@@ -215,7 +215,7 @@ |
||
215 | 215 | if (!empty($_SESSION['pageforbacktolist']) && !empty($_SESSION['pageforbacktolist']['project'])) { |
216 | 216 | $tmpurl = $_SESSION['pageforbacktolist']['project']; |
217 | 217 | $tmpurl = preg_replace('/__SOCID__/', $object->socid, $tmpurl); |
218 | - $linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?'). 'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
218 | + $linkback = '<a href="'.$tmpurl.(preg_match('/\?/', $tmpurl) ? '&' : '?').'restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
|
219 | 219 | } else { |
220 | 220 | $linkback = '<a href="'.DOL_URL_ROOT.'/projet/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>'; |
221 | 221 | } |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | $modulename = dol_sanitizeFileName(GETPOST('modulename', 'alpha')); |
75 | 75 | $objectname = dol_sanitizeFileName(GETPOST('objectname', 'alpha')); |
76 | 76 | $dicname = dol_sanitizeFileName(GETPOST('dicname', 'alpha')); |
77 | -$editorname= GETPOST('editorname', 'alpha'); |
|
78 | -$editorurl= GETPOST('editorurl', 'alpha'); |
|
79 | -$version= GETPOST('version', 'alpha'); |
|
80 | -$family= GETPOST('family', 'alpha'); |
|
81 | -$picto= GETPOST('idpicto', 'alpha'); |
|
82 | -$idmodule= GETPOST('idmodule', 'alpha'); |
|
77 | +$editorname = GETPOST('editorname', 'alpha'); |
|
78 | +$editorurl = GETPOST('editorurl', 'alpha'); |
|
79 | +$version = GETPOST('version', 'alpha'); |
|
80 | +$family = GETPOST('family', 'alpha'); |
|
81 | +$picto = GETPOST('idpicto', 'alpha'); |
|
82 | +$idmodule = GETPOST('idmodule', 'alpha'); |
|
83 | 83 | |
84 | 84 | // Security check |
85 | 85 | if (!isModEnabled('modulebuilder')) { |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | |
250 | 250 | // Copy last html.formsetup.class.php' to backport folder |
251 | 251 | $tryToCopyFromSetupClass = true; |
252 | - $backportDest = $destdir .'/backport/v16/core/class'; |
|
252 | + $backportDest = $destdir.'/backport/v16/core/class'; |
|
253 | 253 | $backportFileSrc = DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php'; |
254 | 254 | $backportFileDest = $backportDest.'/html.formsetup.class.php'; |
255 | 255 | $result = dol_mkdir($backportDest); |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | |
388 | 388 | clearstatcache(true); |
389 | 389 | if (function_exists('opcache_invalidate')) { |
390 | - opcache_reset(); // remove the include cache hell ! |
|
390 | + opcache_reset(); // remove the include cache hell ! |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | header("Location: ".$_SERVER["PHP_SELF"].'?module='.$modulename); |
@@ -1290,7 +1290,7 @@ discard block |
||
1290 | 1290 | } |
1291 | 1291 | $rights = $moduleobj->rights; |
1292 | 1292 | $moduledescriptorfile = $destdir.'/core/modules/mod'.$module.'.class.php'; |
1293 | - $checkComment=checkExistComment($moduledescriptorfile, 1); |
|
1293 | + $checkComment = checkExistComment($moduledescriptorfile, 1); |
|
1294 | 1294 | if ($checkComment < 0) { |
1295 | 1295 | setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings'); |
1296 | 1296 | } else { |
@@ -1456,7 +1456,7 @@ discard block |
||
1456 | 1456 | } |
1457 | 1457 | } |
1458 | 1458 | $menus = $moduleobj->menu; |
1459 | - $counter = 0 ; |
|
1459 | + $counter = 0; |
|
1460 | 1460 | foreach ($menus as $menu) { |
1461 | 1461 | if ($menu['leftmenu'] == strtolower($objectname)) { |
1462 | 1462 | $counter++; |
@@ -1601,7 +1601,7 @@ discard block |
||
1601 | 1601 | } else { |
1602 | 1602 | createNewDictionnary($module, $moduledescriptorfile, $newdicname, $dictionaries); |
1603 | 1603 | if (function_exists('opcache_invalidate')) { |
1604 | - opcache_reset(); // remove the include cache hell ! |
|
1604 | + opcache_reset(); // remove the include cache hell ! |
|
1605 | 1605 | } |
1606 | 1606 | clearstatcache(true); |
1607 | 1607 | header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : '')); |
@@ -1675,7 +1675,7 @@ discard block |
||
1675 | 1675 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors'); |
1676 | 1676 | } |
1677 | 1677 | |
1678 | - if (!$error && !GETPOST('regenerateclasssql')&& !GETPOST('regeneratemissing')) { |
|
1678 | + if (!$error && !GETPOST('regenerateclasssql') && !GETPOST('regeneratemissing')) { |
|
1679 | 1679 | $addfieldentry = array( |
1680 | 1680 | 'name'=>GETPOST('propname', 'aZ09'), |
1681 | 1681 | 'label'=>GETPOST('proplabel', 'alpha'), |
@@ -1690,7 +1690,7 @@ discard block |
||
1690 | 1690 | 'isameasure'=>GETPOST('propisameasure', 'int'), |
1691 | 1691 | 'comment'=>GETPOST('propcomment', 'alpha'), |
1692 | 1692 | 'help'=>GETPOST('prophelp', 'alpha'), |
1693 | - 'css'=>GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example |
|
1693 | + 'css'=>GETPOST('propcss', 'alpha'), // Can be 'maxwidth500 widthcentpercentminusxx' for example |
|
1694 | 1694 | 'cssview'=>GETPOST('propcssview', 'alpha'), |
1695 | 1695 | 'csslist'=>GETPOST('propcsslist', 'alpha'), |
1696 | 1696 | 'default'=>GETPOST('propdefault', 'restricthtml'), |
@@ -1841,7 +1841,7 @@ discard block |
||
1841 | 1841 | |
1842 | 1842 | clearstatcache(true); |
1843 | 1843 | if (function_exists('opcache_invalidate')) { |
1844 | - opcache_reset(); // remove the include cache hell ! |
|
1844 | + opcache_reset(); // remove the include cache hell ! |
|
1845 | 1845 | } |
1846 | 1846 | |
1847 | 1847 | header("Location: ".$_SERVER["PHP_SELF"].'?module=deletemodule'); |
@@ -1933,7 +1933,7 @@ discard block |
||
1933 | 1933 | |
1934 | 1934 | clearstatcache(true); |
1935 | 1935 | if (function_exists('opcache_invalidate')) { |
1936 | - opcache_reset(); // remove the include cache hell ! |
|
1936 | + opcache_reset(); // remove the include cache hell ! |
|
1937 | 1937 | } |
1938 | 1938 | $resultko = 0; |
1939 | 1939 | foreach ($filetodelete as $tmpfiletodelete) { |
@@ -2010,11 +2010,11 @@ discard block |
||
2010 | 2010 | } |
2011 | 2011 | |
2012 | 2012 | if (!empty(GETPOST('dictionnarykey'))) { |
2013 | - $newdicname = $dicts['tabname'][GETPOST('dictionnarykey')-1]; |
|
2013 | + $newdicname = $dicts['tabname'][GETPOST('dictionnarykey') - 1]; |
|
2014 | 2014 | } |
2015 | 2015 | |
2016 | 2016 | //chercher la table dicname |
2017 | - $query = "SHOW TABLES LIKE '" . MAIN_DB_PREFIX.strtolower($newdicname) . "'"; |
|
2017 | + $query = "SHOW TABLES LIKE '".MAIN_DB_PREFIX.strtolower($newdicname)."'"; |
|
2018 | 2018 | $checkTable = $db->query($query); |
2019 | 2019 | if ($checkTable && $db->num_rows($checkTable) <= 0) { |
2020 | 2020 | $error++; |
@@ -2055,7 +2055,7 @@ discard block |
||
2055 | 2055 | setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Dictionaries"), "mod".$module."class.php"), null, 'warnings'); |
2056 | 2056 | } else { |
2057 | 2057 | if (function_exists('opcache_invalidate')) { |
2058 | - opcache_reset(); // remove the include cache hell ! |
|
2058 | + opcache_reset(); // remove the include cache hell ! |
|
2059 | 2059 | } |
2060 | 2060 | clearstatcache(true); |
2061 | 2061 | header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : '')); |
@@ -2064,7 +2064,7 @@ discard block |
||
2064 | 2064 | } |
2065 | 2065 | } |
2066 | 2066 | if ($dirins && $action == 'updatedictionary' && GETPOST('dictionnarykey')) { |
2067 | - $keydict = GETPOST('dictionnarykey') - 1 ; |
|
2067 | + $keydict = GETPOST('dictionnarykey') - 1; |
|
2068 | 2068 | |
2069 | 2069 | $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; |
2070 | 2070 | $destdir = $dirins.'/'.strtolower($module); |
@@ -2098,7 +2098,7 @@ discard block |
||
2098 | 2098 | setEventMessages($langs->trans("DictionaryNameUpdated", ucfirst(GETPOST('tablib'))), null); |
2099 | 2099 | } |
2100 | 2100 | if (function_exists('opcache_invalidate')) { |
2101 | - opcache_reset(); // remove the include cache hell ! |
|
2101 | + opcache_reset(); // remove the include cache hell ! |
|
2102 | 2102 | } |
2103 | 2103 | clearstatcache(true); |
2104 | 2104 | header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : '')); |
@@ -2218,13 +2218,13 @@ discard block |
||
2218 | 2218 | |
2219 | 2219 | //check existing object permission |
2220 | 2220 | $counter = 0; |
2221 | - $permsForObject =array(); |
|
2221 | + $permsForObject = array(); |
|
2222 | 2222 | $permissions = $moduleobj->rights; |
2223 | 2223 | $allObject = array(); |
2224 | 2224 | |
2225 | 2225 | $countPerms = count($permissions); |
2226 | 2226 | |
2227 | - for ($i =0; $i<$countPerms; $i++) { |
|
2227 | + for ($i = 0; $i < $countPerms; $i++) { |
|
2228 | 2228 | if ($permissions[$i][4] == $objectForPerms) { |
2229 | 2229 | $counter++; |
2230 | 2230 | if (count($permsForObject) < 3) { |
@@ -2236,7 +2236,7 @@ discard block |
||
2236 | 2236 | |
2237 | 2237 | // check if label of object already exists |
2238 | 2238 | $countPermsObj = count($permsForObject); |
2239 | - for ($j = 0; $j<$countPermsObj; $j++) { |
|
2239 | + for ($j = 0; $j < $countPermsObj; $j++) { |
|
2240 | 2240 | if (in_array($crud, $permsForObject[$j])) { |
2241 | 2241 | $error++; |
2242 | 2242 | setEventMessages($langs->trans("ErrorExistingPermission", $langs->transnoentities($crud), $langs->transnoentities($objectForPerms)), null, 'errors'); |
@@ -2273,7 +2273,7 @@ discard block |
||
2273 | 2273 | |
2274 | 2274 | clearstatcache(true); |
2275 | 2275 | if (function_exists('opcache_invalidate')) { |
2276 | - opcache_reset(); // remove the include cache hell ! |
|
2276 | + opcache_reset(); // remove the include cache hell ! |
|
2277 | 2277 | } |
2278 | 2278 | header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); |
2279 | 2279 | exit; |
@@ -2282,7 +2282,7 @@ discard block |
||
2282 | 2282 | |
2283 | 2283 | |
2284 | 2284 | // Update permission |
2285 | -if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& empty($cancel)) { |
|
2285 | +if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright') && empty($cancel)) { |
|
2286 | 2286 | $error = 0; |
2287 | 2287 | // load class and check if right exist |
2288 | 2288 | $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; |
@@ -2325,21 +2325,21 @@ discard block |
||
2325 | 2325 | } |
2326 | 2326 | |
2327 | 2327 | $permissions = $moduleobj->rights; |
2328 | - $key =(int) GETPOST('counter')-1; |
|
2328 | + $key = (int) GETPOST('counter') - 1; |
|
2329 | 2329 | //get permission want to delete from permissions array |
2330 | 2330 | $x1 = $permissions[$key][1]; |
2331 | 2331 | $x2 = $permissions[$key][4]; |
2332 | 2332 | $x3 = $permissions[$key][5]; |
2333 | 2333 | //check existing object permission |
2334 | 2334 | $counter = 0; |
2335 | - $permsForObject =array(); |
|
2335 | + $permsForObject = array(); |
|
2336 | 2336 | $permissions = $moduleobj->rights; |
2337 | 2337 | $firstRight = 0; |
2338 | 2338 | $existRight = 0; |
2339 | 2339 | $allObject = array(); |
2340 | 2340 | |
2341 | 2341 | $countPerms = count($permissions); |
2342 | - for ($i =0; $i<$countPerms; $i++) { |
|
2342 | + for ($i = 0; $i < $countPerms; $i++) { |
|
2343 | 2343 | if ($permissions[$i][4] == $objectForPerms) { |
2344 | 2344 | $counter++; |
2345 | 2345 | if (count($permsForObject) < 3) { |
@@ -2351,7 +2351,7 @@ discard block |
||
2351 | 2351 | |
2352 | 2352 | if ($label != $x1 && $crud != $x3) { |
2353 | 2353 | $countPermsObj = count($permsForObject); |
2354 | - for ($j = 0; $j<$countPermsObj; $j++) { |
|
2354 | + for ($j = 0; $j < $countPermsObj; $j++) { |
|
2355 | 2355 | if (in_array($label, $permsForObject[$j])) { |
2356 | 2356 | $error++; |
2357 | 2357 | setEventMessages($langs->trans("ErrorExistingPermission", $langs->transnoentities($label), $langs->transnoentities($objectForPerms)), null, 'errors'); |
@@ -2379,7 +2379,7 @@ discard block |
||
2379 | 2379 | setEventMessages($langs->trans('PermissionUpdatedSuccesfuly'), null); |
2380 | 2380 | clearstatcache(true); |
2381 | 2381 | if (function_exists('opcache_invalidate')) { |
2382 | - opcache_reset(); // remove the include cache hell ! |
|
2382 | + opcache_reset(); // remove the include cache hell ! |
|
2383 | 2383 | } |
2384 | 2384 | header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); |
2385 | 2385 | exit; |
@@ -2403,7 +2403,7 @@ discard block |
||
2403 | 2403 | } |
2404 | 2404 | |
2405 | 2405 | $permissions = $moduleobj->rights; |
2406 | - $key = (int) GETPOST('permskey', 'int')-1; |
|
2406 | + $key = (int) GETPOST('permskey', 'int') - 1; |
|
2407 | 2407 | |
2408 | 2408 | if (!$error) { |
2409 | 2409 | // check if module is enabled |
@@ -2429,7 +2429,7 @@ discard block |
||
2429 | 2429 | |
2430 | 2430 | clearstatcache(true); |
2431 | 2431 | if (function_exists('opcache_invalidate')) { |
2432 | - opcache_reset(); // remove the include cache hell ! |
|
2432 | + opcache_reset(); // remove the include cache hell ! |
|
2433 | 2433 | } |
2434 | 2434 | |
2435 | 2435 | header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=permissions&module='.$module); |
@@ -2598,7 +2598,7 @@ discard block |
||
2598 | 2598 | |
2599 | 2599 | clearstatcache(true); |
2600 | 2600 | if (function_exists('opcache_invalidate')) { |
2601 | - opcache_reset(); // remove the include cache hell ! |
|
2601 | + opcache_reset(); // remove the include cache hell ! |
|
2602 | 2602 | } |
2603 | 2603 | |
2604 | 2604 | setEventMessages($langs->trans('MenuDeletedSuccessfuly'), null); |
@@ -2654,7 +2654,7 @@ discard block |
||
2654 | 2654 | setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Url")), null, 'errors'); |
2655 | 2655 | } |
2656 | 2656 | if (!empty(GETPOST('target'))) { |
2657 | - $targets = array('_blank','_self','_parent','_top',''); |
|
2657 | + $targets = array('_blank', '_self', '_parent', '_top', ''); |
|
2658 | 2658 | if (!in_array(GETPOST('target'), $targets)) { |
2659 | 2659 | $error++; |
2660 | 2660 | setEventMessages($langs->trans("ErrorFieldValue", $langs->transnoentities("target")), null, 'errors'); |
@@ -2688,7 +2688,7 @@ discard block |
||
2688 | 2688 | $objects = dolGetListOfObjectClasses($destdir); |
2689 | 2689 | |
2690 | 2690 | if (GETPOST('type', 'alpha') == 'left') { |
2691 | - if (empty(GETPOST('leftmenu')) && count($objects) >0) { |
|
2691 | + if (empty(GETPOST('leftmenu')) && count($objects) > 0) { |
|
2692 | 2692 | $error++; |
2693 | 2693 | setEventMessages($langs->trans("ErrorCoherenceMenu", $langs->transnoentities("leftmenu"), $langs->transnoentities("type")), null, 'errors'); |
2694 | 2694 | } |
@@ -2751,7 +2751,7 @@ discard block |
||
2751 | 2751 | |
2752 | 2752 | // modify a menu |
2753 | 2753 | if ($dirins && $action == "modify_menu" && GETPOST('menukey', 'int') && GETPOST('tabobj')) { |
2754 | - $objectname = GETPOST('tabobj'); |
|
2754 | + $objectname = GETPOST('tabobj'); |
|
2755 | 2755 | $dirins = $listofmodules[strtolower($module)]['moduledescriptorrootpath']; |
2756 | 2756 | $destdir = $dirins.'/'.strtolower($module); |
2757 | 2757 | $objects = dolGetListOfObjectClasses($destdir); |
@@ -2836,7 +2836,7 @@ discard block |
||
2836 | 2836 | } |
2837 | 2837 | if ($result < 0) { |
2838 | 2838 | setEventMessages($langs->trans('ErrorMenuExistValue'), null, 'errors'); |
2839 | - header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key+1)); |
|
2839 | + header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key + 1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key + 1)); |
|
2840 | 2840 | exit; |
2841 | 2841 | } |
2842 | 2842 | setEventMessages($langs->trans('MenuUpdatedSuccessfuly'), null); |
@@ -3865,16 +3865,16 @@ discard block |
||
3865 | 3865 | // Define path for sql file |
3866 | 3866 | $pathtosql = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'-'.strtolower($module).'.sql'; |
3867 | 3867 | $result = dol_buildpath($pathtosql); |
3868 | - if (! dol_is_file($result)) { |
|
3868 | + if (!dol_is_file($result)) { |
|
3869 | 3869 | $pathtosql = strtolower($module).'/sql/llx_'.strtolower($module).'_'.strtolower($tabobj).'.sql'; |
3870 | 3870 | $result = dol_buildpath($pathtosql); |
3871 | - if (! dol_is_file($result)) { |
|
3871 | + if (!dol_is_file($result)) { |
|
3872 | 3872 | $pathtosql = 'install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($tabobj).'-'.strtolower($module).'.sql'; |
3873 | 3873 | $result = dol_buildpath($pathtosql); |
3874 | - if (! dol_is_file($result)) { |
|
3874 | + if (!dol_is_file($result)) { |
|
3875 | 3875 | $pathtosql = 'install/mysql/tables/llx_'.strtolower($module).'-'.strtolower($module).'.sql'; |
3876 | 3876 | $result = dol_buildpath($pathtosql); |
3877 | - if (! dol_is_file($result)) { |
|
3877 | + if (!dol_is_file($result)) { |
|
3878 | 3878 | $pathtosql = 'install/mysql/tables/llx_'.strtolower($module).'.sql'; |
3879 | 3879 | $pathtosqlextra = 'install/mysql/tables/llx_'.strtolower($module).'_extrafields.sql'; |
3880 | 3880 | $result = dol_buildpath($pathtosql); |
@@ -3893,7 +3893,7 @@ discard block |
||
3893 | 3893 | $pathtosqlroot = preg_replace('/\/llx_.*$/', '', $pathtosql); |
3894 | 3894 | |
3895 | 3895 | $pathtosqlkey = preg_replace('/\.sql$/', '.key.sql', $pathtosql); |
3896 | - $pathtosqlextrakey = preg_replace('/\.sql$/', '.key.sql', $pathtosqlextra); |
|
3896 | + $pathtosqlextrakey = preg_replace('/\.sql$/', '.key.sql', $pathtosqlextra); |
|
3897 | 3897 | |
3898 | 3898 | $pathtolib = strtolower($module).'/lib/'.strtolower($module).'.lib.php'; |
3899 | 3899 | $pathtoobjlib = strtolower($module).'/lib/'.strtolower($module).'_'.strtolower($tabobj).'.lib.php'; |
@@ -3952,7 +3952,7 @@ discard block |
||
3952 | 3952 | |
3953 | 3953 | // API file |
3954 | 3954 | print '<br>'; |
3955 | - print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtoapi) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi)?'':'</span></strike>').'</strong>'; |
|
3955 | + print '<span class="fa fa-file-o"></span> '.$langs->trans("ApiClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtoapi) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi) ? '' : '</span></strike>').'</strong>'; |
|
3956 | 3956 | if (dol_is_file($realpathtoapi)) { |
3957 | 3957 | $file = file_get_contents($realpathtoapi); |
3958 | 3958 | if (preg_match('/var '.$tabobj.'\s+([^\s]*)\s/ims', $file, $objs)) { |
@@ -3973,7 +3973,7 @@ discard block |
||
3973 | 3973 | } |
3974 | 3974 | // PHPUnit |
3975 | 3975 | print '<br>'; |
3976 | - print '<span class="fa fa-file-o"></span> '.$langs->trans("TestClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtophpunit) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).(dol_is_file($realpathtophpunit)?'':'</span></strike>').'</strong>'; |
|
3976 | + print '<span class="fa fa-file-o"></span> '.$langs->trans("TestClassFile").' : <strong class="wordbreak">'.(dol_is_file($realpathtophpunit) ? '' : '<strike><span class="opacitymedium">').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).(dol_is_file($realpathtophpunit) ? '' : '</span></strike>').'</strong>'; |
|
3977 | 3977 | if (dol_is_file($realpathtophpunit)) { |
3978 | 3978 | print ' <a class="editfielda" href="'.$_SERVER['PHP_SELF'].'?tab='.urlencode($tab).'&tabobj='.$tabobj.'&module='.$module.($forceddirread ? '@'.$dirread : '').'&action=editfile&token='.newToken().'&format=php&file='.urlencode($pathtophpunit).'">'.img_picto($langs->trans("Edit"), 'edit').'</a>'; |
3979 | 3979 | print ' '; |
@@ -4189,26 +4189,26 @@ discard block |
||
4189 | 4189 | $propname = $propkey; |
4190 | 4190 | $proplabel = $propval['label']; |
4191 | 4191 | $proptype = $propval['type']; |
4192 | - $proparrayofkeyval = !empty($propval['arrayofkeyval'])?$propval['arrayofkeyval']:''; |
|
4192 | + $proparrayofkeyval = !empty($propval['arrayofkeyval']) ? $propval['arrayofkeyval'] : ''; |
|
4193 | 4193 | $propnotnull = !empty($propval['notnull']) ? $propval['notnull'] : '0'; |
4194 | - $propdefault = !empty($propval['default'])?$propval['default']:''; |
|
4195 | - $propindex = !empty($propval['index'])?$propval['index']:''; |
|
4196 | - $propforeignkey = !empty($propval['foreignkey'])?$propval['foreignkey']:''; |
|
4194 | + $propdefault = !empty($propval['default']) ? $propval['default'] : ''; |
|
4195 | + $propindex = !empty($propval['index']) ? $propval['index'] : ''; |
|
4196 | + $propforeignkey = !empty($propval['foreignkey']) ? $propval['foreignkey'] : ''; |
|
4197 | 4197 | $propposition = $propval['position']; |
4198 | 4198 | $propenabled = $propval['enabled']; |
4199 | 4199 | $propvisible = $propval['visible']; |
4200 | - $propnoteditable = !empty($propval['noteditable'])?$propval['noteditable']:0; |
|
4201 | - $propalwayseditable = !empty($propval['alwayseditable'])?$propval['alwayseditable']:0; |
|
4202 | - $propsearchall = !empty($propval['searchall'])?$propval['searchall']:0; |
|
4203 | - $propisameasure = !empty($propval['isameasure'])?$propval['isameasure']:0; |
|
4204 | - $propcss = !empty($propval['css'])?$propval['css']:''; |
|
4205 | - $propcssview = !empty($propval['cssview'])?$propval['cssview']:''; |
|
4206 | - $propcsslist = !empty($propval['csslist'])?$propval['csslist']:''; |
|
4207 | - $prophelp = !empty($propval['help'])?$propval['help']:''; |
|
4208 | - $propshowoncombobox = !empty($propval['showoncombobox'])?$propval['showoncombobox']:0; |
|
4200 | + $propnoteditable = !empty($propval['noteditable']) ? $propval['noteditable'] : 0; |
|
4201 | + $propalwayseditable = !empty($propval['alwayseditable']) ? $propval['alwayseditable'] : 0; |
|
4202 | + $propsearchall = !empty($propval['searchall']) ? $propval['searchall'] : 0; |
|
4203 | + $propisameasure = !empty($propval['isameasure']) ? $propval['isameasure'] : 0; |
|
4204 | + $propcss = !empty($propval['css']) ? $propval['css'] : ''; |
|
4205 | + $propcssview = !empty($propval['cssview']) ? $propval['cssview'] : ''; |
|
4206 | + $propcsslist = !empty($propval['csslist']) ? $propval['csslist'] : ''; |
|
4207 | + $prophelp = !empty($propval['help']) ? $propval['help'] : ''; |
|
4208 | + $propshowoncombobox = !empty($propval['showoncombobox']) ? $propval['showoncombobox'] : 0; |
|
4209 | 4209 | //$propdisabled=$propval['disabled']; |
4210 | - $propvalidate = !empty($propval['validate'])?$propval['validate']:0; |
|
4211 | - $propcomment = !empty($propval['comment'])?$propval['comment']:''; |
|
4210 | + $propvalidate = !empty($propval['validate']) ? $propval['validate'] : 0; |
|
4211 | + $propcomment = !empty($propval['comment']) ? $propval['comment'] : ''; |
|
4212 | 4212 | |
4213 | 4213 | print '<tr class="oddeven">'; |
4214 | 4214 | |
@@ -4583,14 +4583,14 @@ discard block |
||
4583 | 4583 | $i = 0; |
4584 | 4584 | $maxi = count($dicts['tabname']); |
4585 | 4585 | while ($i < $maxi) { |
4586 | - if ($action == 'editdict' && $i == (int) GETPOST('dictionnarykey', 'int')-1) { |
|
4586 | + if ($action == 'editdict' && $i == (int) GETPOST('dictionnarykey', 'int') - 1) { |
|
4587 | 4587 | print '<tr class="oddeven">'; |
4588 | 4588 | print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; |
4589 | 4589 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
4590 | 4590 | print '<input type="hidden" name="tab" value="dictionaries">'; |
4591 | 4591 | print '<input type="hidden" name="module" value="'.dol_escape_htmltag($module).'">'; |
4592 | 4592 | print '<input type="hidden" name="action" value="updatedictionary">'; |
4593 | - print '<input type="hidden" name="dictionnarykey" value="'.($i+1).'">'; |
|
4593 | + print '<input type="hidden" name="dictionnarykey" value="'.($i + 1).'">'; |
|
4594 | 4594 | |
4595 | 4595 | print '<td class="tdsticky tdstickygray">'; |
4596 | 4596 | print ($i + 1); |
@@ -4686,8 +4686,8 @@ discard block |
||
4686 | 4686 | print '</td>'; |
4687 | 4687 | |
4688 | 4688 | print '<td class="center tdstickyright tdstickyghostwhite">'; |
4689 | - print '<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=editdict&token='.newToken().'&dictionnarykey='.urlencode($i+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'">'.img_edit().'</a>'; |
|
4690 | - print '<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=deletedict&token='.newToken().'&dictionnarykey='.urlencode($i+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'">'.img_delete().'</a>'; |
|
4689 | + print '<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=editdict&token='.newToken().'&dictionnarykey='.urlencode($i + 1).'&tab='.urlencode($tab).'&module='.urlencode($module).'">'.img_edit().'</a>'; |
|
4690 | + print '<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=deletedict&token='.newToken().'&dictionnarykey='.urlencode($i + 1).'&tab='.urlencode($tab).'&module='.urlencode($module).'">'.img_delete().'</a>'; |
|
4691 | 4691 | print '</td>'; |
4692 | 4692 | |
4693 | 4693 | print '</tr>'; |
@@ -4856,7 +4856,7 @@ discard block |
||
4856 | 4856 | print_liste_field_titre("", $_SERVER["PHP_SELF"], '', "", $param, '', $sortfield, $sortorder, 'center ', $langs->trans('')); |
4857 | 4857 | |
4858 | 4858 | print "</tr>\n"; |
4859 | - $r = count($menus)+1; |
|
4859 | + $r = count($menus) + 1; |
|
4860 | 4860 | // for adding menu on module |
4861 | 4861 | print '<tr>'; |
4862 | 4862 | print '<td class="center"><input type="hidden" readonly class="center maxwidth50" name="propenabled" value="#"></td>'; |
@@ -4879,7 +4879,7 @@ discard block |
||
4879 | 4879 | print '<td class="center"><input id="leftmenu" type="text" class="left maxwidth" name="leftmenu" value="'.dol_escape_htmltag(GETPOST('leftmenu', 'alpha')).'"></td>'; |
4880 | 4880 | print '<td class="left"><input id="url" type="text" class="left maxwidth" name="url" value="'.dol_escape_htmltag(GETPOST('url', 'alpha')).'"></td>'; |
4881 | 4881 | print '<td class="left"><input type="text" class="left maxwidth" name="langs" value="'.strtolower($module).'@'.strtolower($module).'" readonly></td>'; |
4882 | - print '<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.(1000+$r).'" readonly></td>'; |
|
4882 | + print '<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.(1000 + $r).'" readonly></td>'; |
|
4883 | 4883 | print '<td class="center">'; |
4884 | 4884 | print '<select class="center maxwidth" name="enabled">'; |
4885 | 4885 | print '<option value="1" selected>'.$langs->trans("Show").'</option>'; |
@@ -4917,7 +4917,7 @@ discard block |
||
4917 | 4917 | $propMainmenu = !empty($menu['mainmenu']) ? $menu['mainmenu'] : GETPOST('mainmenu'); |
4918 | 4918 | $propLeftmenu = !empty($menu['leftmenu']) ? $menu['leftmenu'] : GETPOST('leftmenu'); |
4919 | 4919 | $propUrl = !empty($menu['url']) ? $menu['url'] : GETPOST('url', 'alpha'); |
4920 | - $propPerms = !empty($menu['perms']) ? $menu['perms'] : GETPOST('perms'); |
|
4920 | + $propPerms = !empty($menu['perms']) ? $menu['perms'] : GETPOST('perms'); |
|
4921 | 4921 | $propUser = !empty($menu['user']) ? $menu['user'] : GETPOST('user'); |
4922 | 4922 | $propTarget = !empty($menu['target']) ? $menu['target'] : GETPOST('target'); |
4923 | 4923 | $propEnabled = !empty($menu['enabled']) ? $menu['enabled'] : GETPOST('enabled'); |
@@ -4967,7 +4967,7 @@ discard block |
||
4967 | 4967 | print '<td class="left"><input type="text" class="left maxwidth" name="leftmenu" value="'.dol_escape_htmltag($propLeftmenu).'" readonly></td>'; |
4968 | 4968 | print '<td class="left"><input type="text" class="left maxwidth" name="url" value="'.dol_escape_htmltag($propUrl).'"></td>'; |
4969 | 4969 | print '<td class="left"><input type="text" class="left maxwidth" name="langs" value="'.strtolower($module).'@'.strtolower($module).'" readonly></td>'; |
4970 | - print '<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.(1000+$r-1).'" readonly></td>'; |
|
4970 | + print '<td class="center"><input type="text" class="center maxwidth50 tdstickygray" name="position" value="'.(1000 + $r - 1).'" readonly></td>'; |
|
4971 | 4971 | print '<td class="left">'; |
4972 | 4972 | print '<select class="center maxwidth" name="enabled">'; |
4973 | 4973 | print '<option selected value="'.dol_escape_htmltag($propEnabled).'">'.(dol_escape_htmltag($propEnabled) == '' ? $langs->trans('Hide') : $langs->trans('Show')).'</option>'; |
@@ -5058,7 +5058,7 @@ discard block |
||
5058 | 5058 | if (strpos($menu['perms'], "\$user->hasRight") !== 0) { |
5059 | 5059 | print ''; |
5060 | 5060 | } else { |
5061 | - print (dol_escape_htmltag($langs->trans($crud[$valPerms])) ); |
|
5061 | + print (dol_escape_htmltag($langs->trans($crud[$valPerms]))); |
|
5062 | 5062 | } |
5063 | 5063 | print '</td>'; |
5064 | 5064 | |
@@ -5080,7 +5080,7 @@ discard block |
||
5080 | 5080 | print '<td class="center tdstickyright tdstickyghostwhite">'; |
5081 | 5081 | if ($menu['titre'] != 'Module'.$module.'Name') { |
5082 | 5082 | print '<a class="editfielda reposition marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($i).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_edit().'</a>'; |
5083 | - print '<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=deletemenu&token='.newToken().'&menukey='.urlencode($i-1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>'; |
|
5083 | + print '<a class="marginleftonly marginrighttonly paddingright paddingleft" href="'.$_SERVER["PHP_SELF"].'?action=deletemenu&token='.newToken().'&menukey='.urlencode($i - 1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.urlencode($tabobj).'">'.img_delete().'</a>'; |
|
5084 | 5084 | } |
5085 | 5085 | print '</td>'; |
5086 | 5086 | } |
@@ -5106,7 +5106,7 @@ discard block |
||
5106 | 5106 | } |
5107 | 5107 | }); |
5108 | 5108 | |
5109 | - var groupedRights = ' . $groupedRights_json . '; |
|
5109 | + var groupedRights = ' . $groupedRights_json.'; |
|
5110 | 5110 | var objectsSelect = $("select[id=\'objects\']"); |
5111 | 5111 | var permsSelect = $("select[id=\'perms\']"); |
5112 | 5112 | |
@@ -5177,7 +5177,7 @@ discard block |
||
5177 | 5177 | $dir = $dirread.'/'.$modulelowercase.'/class'; |
5178 | 5178 | $listofobject = dol_dir_list($dir, 'files', 0, '\.class\.php$'); |
5179 | 5179 | $objects = array('myobject'); |
5180 | - $reg =array(); |
|
5180 | + $reg = array(); |
|
5181 | 5181 | foreach ($listofobject as $fileobj) { |
5182 | 5182 | $tmpcontent = file_get_contents($fileobj['fullname']); |
5183 | 5183 | if (preg_match('/class\s+([^\s]*)\s+extends\s+CommonObject/ims', $tmpcontent, $reg)) { |
@@ -5328,7 +5328,7 @@ discard block |
||
5328 | 5328 | if (in_array($perm[5], array('lire', 'read', 'creer', 'write', 'effacer', 'delete'))) { |
5329 | 5329 | print dol_escape_htmltag(ucfirst($perm[4])); |
5330 | 5330 | } else { |
5331 | - print ''; // No particular object |
|
5331 | + print ''; // No particular object |
|
5332 | 5332 | } |
5333 | 5333 | print '</td>'; |
5334 | 5334 | |
@@ -6165,9 +6165,9 @@ discard block |
||
6165 | 6165 | |
6166 | 6166 | print '<td>'; |
6167 | 6167 | if ($tabName[0] === "+") { |
6168 | - print '<span class="badge badge-status4 badge-status">' . dol_escape_htmltag($tabName) . '</span>'; |
|
6168 | + print '<span class="badge badge-status4 badge-status">'.dol_escape_htmltag($tabName).'</span>'; |
|
6169 | 6169 | } else { |
6170 | - print '<span class="badge badge-status8 badge-status">' . dol_escape_htmltag($tabName) . '</span>'; |
|
6170 | + print '<span class="badge badge-status8 badge-status">'.dol_escape_htmltag($tabName).'</span>'; |
|
6171 | 6171 | } |
6172 | 6172 | print '</td>'; |
6173 | 6173 |
@@ -270,22 +270,22 @@ discard block |
||
270 | 270 | // Edit .sql file |
271 | 271 | if ($moduletype == 'internal') { |
272 | 272 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; |
273 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
273 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
274 | 274 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'_'.strtolower($objectname).'-'.strtolower($module).'.sql'; |
275 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
275 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
276 | 276 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'-'.strtolower($module).'.sql'; |
277 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
277 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
278 | 278 | $pathoffiletoeditsrc = '/../install/mysql/tables/llx_'.strtolower($module).'.sql'; |
279 | 279 | } |
280 | 280 | } |
281 | 281 | } |
282 | 282 | } else { |
283 | 283 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'.sql'; |
284 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
284 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
285 | 285 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'_'.strtolower($objectname).'-'.strtolower($module).'.sql'; |
286 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
286 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
287 | 287 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'-'.strtolower($module).'.sql'; |
288 | - if (! dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
288 | + if (!dol_is_file($readdir.$pathoffiletoeditsrc)) { |
|
289 | 289 | $pathoffiletoeditsrc = '/sql/llx_'.strtolower($module).'.sql'; |
290 | 290 | } |
291 | 291 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | $objects[$fileobj['fullname']] = $objectnameloop; |
443 | 443 | } |
444 | 444 | } |
445 | - if (count($objects)>0) { |
|
445 | + if (count($objects) > 0) { |
|
446 | 446 | return $objects; |
447 | 447 | } |
448 | 448 | |
@@ -552,12 +552,12 @@ discard block |
||
552 | 552 | } |
553 | 553 | } |
554 | 554 | } elseif ($action == -2 && !empty($objectname) && !empty($module)) { |
555 | - $key= null; |
|
555 | + $key = null; |
|
556 | 556 | $right = null; |
557 | 557 | $objectOfRights = array(); |
558 | 558 | //check if object already declared in rights file |
559 | 559 | foreach ($permissions as $right) { |
560 | - $objectOfRights[]= $right[4]; |
|
560 | + $objectOfRights[] = $right[4]; |
|
561 | 561 | } |
562 | 562 | if (in_array(strtolower($objectname), $objectOfRights)) { |
563 | 563 | $error++; |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | if (!$error) { |
585 | 585 | // prepare permissions array |
586 | 586 | $count_perms = count($permissions); |
587 | - for ($i = 0;$i<$count_perms;$i++) { |
|
587 | + for ($i = 0; $i < $count_perms; $i++) { |
|
588 | 588 | $permissions[$i][0] = "\$this->rights[\$r][0] = \$this->numero . sprintf('%02d', \$r + 1)"; |
589 | 589 | $permissions[$i][1] = "\$this->rights[\$r][1] = '".$permissions[$i][1]."'"; |
590 | 590 | $permissions[$i][4] = "\$this->rights[\$r][4] = '".$permissions[$i][4]."'"; |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | |
605 | 605 | |
606 | 606 | // parcourir les objets |
607 | - $o=0; |
|
607 | + $o = 0; |
|
608 | 608 | foreach ($permissions as &$object) { |
609 | 609 | // récupérer la permission de l'objet |
610 | 610 | $p = 1; |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | { |
700 | 700 | |
701 | 701 | // stock all properties in array |
702 | - $attributesUnique = array ('type','label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default' , 'foreignkey', 'arrayofkeyval', 'alwayseditable','validate', 'searchall','comment', 'isameasure', 'css', 'cssview','csslist', 'help', 'showoncombobox','picto' ); |
|
702 | + $attributesUnique = array('type', 'label', 'enabled', 'position', 'notnull', 'visible', 'noteditable', 'index', 'default', 'foreignkey', 'arrayofkeyval', 'alwayseditable', 'validate', 'searchall', 'comment', 'isameasure', 'css', 'cssview', 'csslist', 'help', 'showoncombobox', 'picto'); |
|
703 | 703 | |
704 | 704 | $start = "public \$fields=array("; |
705 | 705 | $end = ");"; |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | foreach ($attributesUnique as $attUnique) { |
730 | 730 | $table .= "|".$attUnique; |
731 | 731 | } |
732 | - $table .="\n"; |
|
732 | + $table .= "\n"; |
|
733 | 733 | $valuesModif = array(); |
734 | 734 | foreach ($keys as $string) { |
735 | 735 | $string = trim($string, "'"); |
@@ -769,8 +769,8 @@ discard block |
||
769 | 769 | $valuesModif[$attUnique] = $values[$attUnique]; |
770 | 770 | } |
771 | 771 | } |
772 | - $table .= "|*" . $field[0] . "*|"; |
|
773 | - $table .= implode("|", $valuesModif) . "\n"; |
|
772 | + $table .= "|*".$field[0]."*|"; |
|
773 | + $table .= implode("|", $valuesModif)."\n"; |
|
774 | 774 | } |
775 | 775 | |
776 | 776 | // end table |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | |
780 | 780 | //write in file |
781 | 781 | $writeInFile = dolReplaceInFile($destfile, array('== DATA SPECIFICATIONS' => $table)); |
782 | - if ($writeInFile<0) { |
|
782 | + if ($writeInFile < 0) { |
|
783 | 783 | return -1; |
784 | 784 | } |
785 | 785 | return 1; |
@@ -798,13 +798,13 @@ discard block |
||
798 | 798 | $start = "== Table of fields and their properties for object *".ucfirst($objectname)."* : "; |
799 | 799 | $end = "__ end table for object ".ucfirst($objectname); |
800 | 800 | $str = file_get_contents($file); |
801 | - $search = '/' . preg_quote($start, '/') . '(.*?)' . preg_quote($end, '/') . '/s'; |
|
801 | + $search = '/'.preg_quote($start, '/').'(.*?)'.preg_quote($end, '/').'/s'; |
|
802 | 802 | $new_contents = preg_replace($search, '', $str); |
803 | 803 | file_put_contents($file, $new_contents); |
804 | 804 | |
805 | 805 | //perms If Exist |
806 | 806 | $perms = "|*".strtolower($objectname)."*|"; |
807 | - $search_pattern_perms = '/' . preg_quote($perms, '/') . '.*?\n/'; |
|
807 | + $search_pattern_perms = '/'.preg_quote($perms, '/').'.*?\n/'; |
|
808 | 808 | $new_contents = preg_replace($search_pattern_perms, '', $new_contents); |
809 | 809 | file_put_contents($file, $new_contents); |
810 | 810 | } |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | $string = "[options='header',grid=rows,width=60%,caption=Organisation]\n"; |
861 | 861 | $string .= "|===\n"; |
862 | 862 | // header for table |
863 | - $header = array($langs->trans('Objects'),$langs->trans('Permission')); |
|
863 | + $header = array($langs->trans('Objects'), $langs->trans('Permission')); |
|
864 | 864 | foreach ($header as $h) { |
865 | 865 | $string .= "|".$h; |
866 | 866 | } |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | foreach ($permissions as $key => $element) { |
888 | 888 | $element = str_replace(" '", '', $element); |
889 | 889 | $element = trim($element, "'"); |
890 | - $permsN[] = substr($element, strpos($element, "=")+1); |
|
890 | + $permsN[] = substr($element, strpos($element, "=") + 1); |
|
891 | 891 | } |
892 | 892 | array_pop($permsN); |
893 | 893 | |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | // end table |
918 | 918 | $string .= "\n|===\n"; |
919 | 919 | $write = dolReplaceInFile($destfile, array('__DATA_PERMISSIONS__'=> $string)); |
920 | - if ($write<0) { |
|
920 | + if ($write < 0) { |
|
921 | 921 | return -1; |
922 | 922 | } |
923 | 923 | return 1; |
@@ -946,26 +946,26 @@ discard block |
||
946 | 946 | if (strpos($lineContent, $varcomented) !== false) { |
947 | 947 | $lineContent = ''; |
948 | 948 | foreach ($objects as $object) { |
949 | - $lineContent .= "\t * @var ".$object." \$".strtolower($object)." {@type ".$object."}". PHP_EOL; |
|
949 | + $lineContent .= "\t * @var ".$object." \$".strtolower($object)." {@type ".$object."}".PHP_EOL; |
|
950 | 950 | } |
951 | 951 | //var_dump($lineContent);exit; |
952 | 952 | } |
953 | 953 | if (strpos($lineContent, $props) !== false) { |
954 | 954 | $lineContent = ''; |
955 | 955 | foreach ($objects as $object) { |
956 | - $lineContent .= "\tpublic \$".strtolower($object).";". PHP_EOL; |
|
956 | + $lineContent .= "\tpublic \$".strtolower($object).";".PHP_EOL; |
|
957 | 957 | } |
958 | 958 | } |
959 | 959 | if (strpos($lineContent, $constructObj) !== false) { |
960 | 960 | $lineContent = ''; |
961 | 961 | foreach ($objects as $object) { |
962 | - $lineContent .= "\t\t\$this->".strtolower($object)." = new ".$object."(\$this->db);". PHP_EOL; |
|
962 | + $lineContent .= "\t\t\$this->".strtolower($object)." = new ".$object."(\$this->db);".PHP_EOL; |
|
963 | 963 | } |
964 | 964 | } |
965 | 965 | if (strpos($lineContent, $includeClass) !== false) { |
966 | 966 | $lineContent = ''; |
967 | 967 | foreach ($objects as $object) { |
968 | - $lineContent .= "dol_include_once('/".strtolower($modulename)."/class/".strtolower($object).".class.php');". PHP_EOL; |
|
968 | + $lineContent .= "dol_include_once('/".strtolower($modulename)."/class/".strtolower($object).".class.php');".PHP_EOL; |
|
969 | 969 | } |
970 | 970 | } |
971 | 971 | } |
@@ -975,10 +975,10 @@ discard block |
||
975 | 975 | //add methods for each object |
976 | 976 | $allContent = getFromFile($file, '/*begin methods CRUD*/', '/*end methods CRUD*/'); |
977 | 977 | foreach ($objects as $object) { |
978 | - $contentReplaced =str_replace(["myobject","MyObject"], [strtolower($object),$object], $allContent); |
|
978 | + $contentReplaced = str_replace(["myobject", "MyObject"], [strtolower($object), $object], $allContent); |
|
979 | 979 | dolReplaceInFile($file, array('/*end methods CRUD*/' => '/*CRUD FOR '.strtoupper($object).'*/'."\n".$contentReplaced."\n\t".'/*END CRUD FOR '.strtoupper($object).'*/'."\n\t".'/*end methods CRUD*/')); |
980 | 980 | } |
981 | - dolReplaceInFile($file, array($allContent => '','MyModule' => ucfirst($modulename))); |
|
981 | + dolReplaceInFile($file, array($allContent => '', 'MyModule' => ucfirst($modulename))); |
|
982 | 982 | return 1; |
983 | 983 | } |
984 | 984 | |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | */ |
1040 | 1040 | function reWriteAllMenus($file, $menus, $menuWantTo, $key, $action) |
1041 | 1041 | { |
1042 | - $errors =0; |
|
1042 | + $errors = 0; |
|
1043 | 1043 | $counter = 0; |
1044 | 1044 | if (!file_exists($file)) { |
1045 | 1045 | return -1; |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | array_push($menus, $menuWantTo); |
1053 | 1053 | } elseif ($action == 2 && !empty($key) && !empty($menuWantTo)) { |
1054 | 1054 | // update right from permissions array |
1055 | - $urlCounter=0; |
|
1055 | + $urlCounter = 0; |
|
1056 | 1056 | // check if the values already exists |
1057 | 1057 | foreach ($menus as $index => $menu) { |
1058 | 1058 | if ($index !== $key) { |
@@ -1098,20 +1098,20 @@ discard block |
||
1098 | 1098 | $val_actuel = $menu; |
1099 | 1099 | $next_val = $menus[$index + 1]; |
1100 | 1100 | $str_menu .= $start."\n"; |
1101 | - $str_menu.= "\t\t\$this->menu[\$r++]=array(\n"; |
|
1102 | - $str_menu.= "\t\t\t 'fk_menu' =>'".$menu['fk_menu']."',\n"; |
|
1103 | - $str_menu.= "\t\t\t 'type' =>'".$menu['type']."',\n"; |
|
1104 | - $str_menu.= "\t\t\t 'titre' =>'".$menu['titre']."',\n"; |
|
1105 | - $str_menu.= "\t\t\t 'mainmenu' =>'".$menu['mainmenu']."',\n"; |
|
1106 | - $str_menu.= "\t\t\t 'leftmenu' =>'".$menu['leftmenu']."',\n"; |
|
1107 | - $str_menu.= "\t\t\t 'url' =>'".$menu['url']."',\n"; |
|
1108 | - $str_menu.= "\t\t\t 'langs' =>'".$menu['langs']."',\n"; |
|
1109 | - $str_menu.= "\t\t\t 'position' =>".$menu['position'].",\n"; |
|
1110 | - $str_menu.= "\t\t\t 'enabled' =>'".$menu['enabled']."',\n"; |
|
1111 | - $str_menu.= "\t\t\t 'perms' =>'".$menu['perms']."',\n"; |
|
1112 | - $str_menu.= "\t\t\t 'target' =>'".$menu['target']."',\n"; |
|
1113 | - $str_menu.= "\t\t\t 'user' =>".$menu['user'].",\n"; |
|
1114 | - $str_menu.= "\t\t);\n"; |
|
1101 | + $str_menu .= "\t\t\$this->menu[\$r++]=array(\n"; |
|
1102 | + $str_menu .= "\t\t\t 'fk_menu' =>'".$menu['fk_menu']."',\n"; |
|
1103 | + $str_menu .= "\t\t\t 'type' =>'".$menu['type']."',\n"; |
|
1104 | + $str_menu .= "\t\t\t 'titre' =>'".$menu['titre']."',\n"; |
|
1105 | + $str_menu .= "\t\t\t 'mainmenu' =>'".$menu['mainmenu']."',\n"; |
|
1106 | + $str_menu .= "\t\t\t 'leftmenu' =>'".$menu['leftmenu']."',\n"; |
|
1107 | + $str_menu .= "\t\t\t 'url' =>'".$menu['url']."',\n"; |
|
1108 | + $str_menu .= "\t\t\t 'langs' =>'".$menu['langs']."',\n"; |
|
1109 | + $str_menu .= "\t\t\t 'position' =>".$menu['position'].",\n"; |
|
1110 | + $str_menu .= "\t\t\t 'enabled' =>'".$menu['enabled']."',\n"; |
|
1111 | + $str_menu .= "\t\t\t 'perms' =>'".$menu['perms']."',\n"; |
|
1112 | + $str_menu .= "\t\t\t 'target' =>'".$menu['target']."',\n"; |
|
1113 | + $str_menu .= "\t\t\t 'user' =>".$menu['user'].",\n"; |
|
1114 | + $str_menu .= "\t\t);\n"; |
|
1115 | 1115 | |
1116 | 1116 | if ($val_actuel['leftmenu'] !== $next_val['leftmenu']) { |
1117 | 1117 | $str_menu .= $end."\n"; |
@@ -1148,21 +1148,21 @@ discard block |
||
1148 | 1148 | $dicData .= "\t\t\t'$key'=>"; |
1149 | 1149 | |
1150 | 1150 | if ($key === 'tabcond') { |
1151 | - $conditions = array_map(function ($val) use ($module) { |
|
1151 | + $conditions = array_map(function($val) use ($module) { |
|
1152 | 1152 | return ($val === true || $val === false) ? "isModEnabled('$module')" : $val; |
1153 | 1153 | }, $value); |
1154 | - $dicData .= "array(" . implode(",", $conditions) . ")"; |
|
1154 | + $dicData .= "array(".implode(",", $conditions).")"; |
|
1155 | 1155 | } elseif ($key === 'tabhelp') { |
1156 | 1156 | $helpItems = array(); |
1157 | 1157 | foreach ($value as $key => $helpValue) { |
1158 | 1158 | $helpItems[] = "array('code'=>\$langs->trans('".$helpValue['code']."'), 'field2' => 'field2tooltip')"; |
1159 | 1159 | } |
1160 | - $dicData .= "array(" . implode(",", $helpItems) . ")"; |
|
1160 | + $dicData .= "array(".implode(",", $helpItems).")"; |
|
1161 | 1161 | } else { |
1162 | 1162 | if (is_array($value)) { |
1163 | - $dicData .= "array(" . implode(",", array_map(function ($val) { |
|
1163 | + $dicData .= "array(".implode(",", array_map(function($val) { |
|
1164 | 1164 | return "'$val'"; |
1165 | - }, $value)) . ")"; |
|
1165 | + }, $value)).")"; |
|
1166 | 1166 | } else { |
1167 | 1167 | $dicData .= "'$value'"; |
1168 | 1168 | } |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | } |
1229 | 1229 | } |
1230 | 1230 | // check if tablename exist in Database and create it if not |
1231 | - $query = "SHOW TABLES LIKE '" . MAIN_DB_PREFIX.strtolower($namedic) . "'"; |
|
1231 | + $query = "SHOW TABLES LIKE '".MAIN_DB_PREFIX.strtolower($namedic)."'"; |
|
1232 | 1232 | $checkTable = $db->query($query); |
1233 | 1233 | if ($checkTable && $db->num_rows($checkTable) > 0) { |
1234 | 1234 | setEventMessages($langs->trans("ErrorTableExist", $namedic), null, 'errors'); |
@@ -1336,9 +1336,9 @@ discard block |
||
1336 | 1336 | |
1337 | 1337 | foreach ($allFilesAndDirs as $item) { |
1338 | 1338 | if ($item != '.' && $item != '..') { |
1339 | - if ($type == 1 && is_file($path . DIRECTORY_SEPARATOR . $item) && strpos($item, '.back') === false) { |
|
1339 | + if ($type == 1 && is_file($path.DIRECTORY_SEPARATOR.$item) && strpos($item, '.back') === false) { |
|
1340 | 1340 | $count++; |
1341 | - } elseif ($type == 2 && is_dir($path . DIRECTORY_SEPARATOR . $item)) { |
|
1341 | + } elseif ($type == 2 && is_dir($path.DIRECTORY_SEPARATOR.$item)) { |
|
1342 | 1342 | $count++; |
1343 | 1343 | } |
1344 | 1344 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | { |
78 | 78 | $str = str_replace('<?=', '<?php', $str); |
79 | 79 | $str = str_replace('<?php', '__LTINTPHP__', $str); |
80 | - $str = str_replace('<?', '<?php', $str); // replace the short_open_tag. It is recommended to set this is Off in php.ini |
|
80 | + $str = str_replace('<?', '<?php', $str); // replace the short_open_tag. It is recommended to set this is Off in php.ini |
|
81 | 81 | $str = str_replace('__LTINTPHP__', '<?php', $str); |
82 | 82 | |
83 | 83 | $newstr = ''; |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $sql .= " lastaccess = '".$db->idate(dol_now('gmt'), 'gmt')."'"; |
459 | 459 | $sql .= " WHERE rowid = ".((int) $websiteid); |
460 | 460 | $resql = $db->query($sql); |
461 | - if (! $resql) { |
|
461 | + if (!$resql) { |
|
462 | 462 | return -1; |
463 | 463 | } |
464 | 464 | } |
@@ -871,7 +871,7 @@ discard block |
||
871 | 871 | $hashtags = trim(join(' #', array_map('trim', explode(',', $websitepage->keywords)))); |
872 | 872 | |
873 | 873 | // Open Graph |
874 | - $out .= '<meta name="og:type" content="website">'."\n"; // TODO If blogpost, use type article |
|
874 | + $out .= '<meta name="og:type" content="website">'."\n"; // TODO If blogpost, use type article |
|
875 | 875 | $out .= '<meta name="og:title" content="'.$websitepage->title.'">'."\n"; |
876 | 876 | if ($websitepage->image) { |
877 | 877 | $out .= '<meta name="og:image" content="'.$website->virtualhost.$image.'">'."\n"; |