Passed
Push — REFACTOR_MAIN_INC_241020 ( 0ab19e )
by Rafael
50:33
created
Dolibarr/Lib/Filters.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -66,15 +66,15 @@  discard block
 block discarded – undo
66 66
     private static function getEmojis()
67 67
     {
68 68
         $arrayofcommonemoji = array(
69
-            'misc' => array('2600', '26FF'),        // Miscellaneous Symbols
70
-            'ding' => array('2700', '27BF'),        // Dingbats
71
-            '????' => array('9989', '9989'),        // Variation Selectors
72
-            'vars' => array('FE00', 'FE0F'),        // Variation Selectors
73
-            'pict' => array('1F300', '1F5FF'),      // Miscellaneous Symbols and Pictographs
74
-            'emot' => array('1F600', '1F64F'),      // Emoticons
75
-            'tran' => array('1F680', '1F6FF'),      // Transport and Map Symbols
76
-            'flag' => array('1F1E0', '1F1FF'),      // Flags (note: may be 1F1E6 instead of 1F1E0)
77
-            'supp' => array('1F900', '1F9FF'),      // Supplemental Symbols and Pictographs
69
+            'misc' => array('2600', '26FF'), // Miscellaneous Symbols
70
+            'ding' => array('2700', '27BF'), // Dingbats
71
+            '????' => array('9989', '9989'), // Variation Selectors
72
+            'vars' => array('FE00', 'FE0F'), // Variation Selectors
73
+            'pict' => array('1F300', '1F5FF'), // Miscellaneous Symbols and Pictographs
74
+            'emot' => array('1F600', '1F64F'), // Emoticons
75
+            'tran' => array('1F680', '1F6FF'), // Transport and Map Symbols
76
+            'flag' => array('1F1E0', '1F1FF'), // Flags (note: may be 1F1E6 instead of 1F1E0)
77
+            'supp' => array('1F900', '1F9FF'), // Supplemental Symbols and Pictographs
78 78
         );
79 79
 
80 80
         return $arrayofcommonemoji;
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
                 $ip = (empty($_SERVER['REMOTE_ADDR']) ? 'unknown' : $_SERVER['REMOTE_ADDR']);
110 110
 
111 111
                 if ($stopcode) {
112
-                    $errormessage = 'Access refused to ' . htmlentities($ip, ENT_COMPAT, 'UTF-8') . ' by SQL or Script injection protection in main.inc.php:analyseVarsForSqlAndScriptsInjection type=' . htmlentities((string)$type, ENT_COMPAT, 'UTF-8');
112
+                    $errormessage = 'Access refused to ' . htmlentities($ip, ENT_COMPAT, 'UTF-8') . ' by SQL or Script injection protection in main.inc.php:analyseVarsForSqlAndScriptsInjection type=' . htmlentities((string) $type, ENT_COMPAT, 'UTF-8');
113 113
                     //$errormessage .= ' paramkey='.htmlentities($key, ENT_COMPAT, 'UTF-8');    // Disabled to avoid text injection
114 114
 
115 115
                     $errormessage2 = 'page=' . htmlentities((empty($_SERVER["REQUEST_URI"]) ? '' : $_SERVER["REQUEST_URI"]), ENT_COMPAT, 'UTF-8');
116
-                    $errormessage2 .= ' paramtype=' . htmlentities((string)$type, ENT_COMPAT, 'UTF-8');
116
+                    $errormessage2 .= ' paramtype=' . htmlentities((string) $type, ENT_COMPAT, 'UTF-8');
117 117
                     $errormessage2 .= ' paramkey=' . htmlentities($key, ENT_COMPAT, 'UTF-8');
118 118
                     $errormessage2 .= ' paramvalue=' . htmlentities($value, ENT_COMPAT, 'UTF-8');
119 119
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         //print "before decoding $val\n";
169 169
         do {
170 170
             $oldval = $val;
171
-            $val = html_entity_decode($val, ENT_QUOTES | ENT_HTML5);    // Decode ':', ''', '	', '&NewLine', ...
171
+            $val = html_entity_decode($val, ENT_QUOTES | ENT_HTML5); // Decode ':', ''', '	', '&NewLine', ...
172 172
             // Sometimes we have entities without the ; at end so html_entity_decode does not work but entities is still interpreted by browser.
173 173
             $val = preg_replace_callback(
174 174
                 '/&#(x?[0-9][0-9a-f]+;?)/i',
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                  * @param string[] $m
177 177
                  * @return string
178 178
                  */
179
-                static function ($m) {
179
+                static function($m) {
180 180
                     // Decode 'n', ...
181 181
                     return Filters::realCharForNumericEntities($m);
182 182
                 },
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
             $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() or mysql_user() that return current database login
218 218
             $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database
219 219
             $inj += preg_match('/<svg/i', $val); // <svg can be allowed in POST
220
-            $inj += preg_match('/update[^&=\w].*set.+=/i', $val);   // the [^&=\w] test is to avoid error when request is like action=update&...set... or &updatemodule=...set...
220
+            $inj += preg_match('/update[^&=\w].*set.+=/i', $val); // the [^&=\w] test is to avoid error when request is like action=update&...set... or &updatemodule=...set...
221 221
             $inj += preg_match('/union.+select/i', $val);
222 222
         }
223 223
         if ($type == 3) {
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
         if (preg_match('/^x/i', $newstringnumentity)) {     // if numeric is hexadecimal
302 302
             $newstringnumentity = hexdec(preg_replace('/^x/i', '', $newstringnumentity));
303 303
         } else {
304
-            $newstringnumentity = (int)$newstringnumentity;
304
+            $newstringnumentity = (int) $newstringnumentity;
305 305
         }
306 306
 
307 307
         // The numeric values we don't want as entities because they encode ascii char, and why using html entities on ascii except for haking ?
308 308
         if (($newstringnumentity >= 65 && $newstringnumentity <= 90) || ($newstringnumentity >= 97 && $newstringnumentity <= 122)) {
309
-            return chr((int)$newstringnumentity);
309
+            return chr((int) $newstringnumentity);
310 310
         }
311 311
 
312 312
         // The numeric values we want in UTF8 instead of entities because it is emoji
Please login to merge, or discard this patch.
public/htdocs/main.inc.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 $micro_start_time = 0;
55 55
 if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) {
56 56
     list($usec, $sec) = explode(" ", microtime());
57
-    $micro_start_time = ((float)$usec + (float)$sec);
57
+    $micro_start_time = ((float) $usec + (float) $sec);
58 58
     // Add Xdebug code coverage
59 59
     //define('XDEBUGCOVERAGE',1);
60 60
     if (defined('XDEBUGCOVERAGE')) {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
         session_set_cookie_params($sessioncookieparams);
178 178
     }
179 179
     session_name($sessionname);
180
-    dol_session_start();    // This call the open and read of session handler
180
+    dol_session_start(); // This call the open and read of session handler
181 181
     //exit; // this exist generates a call to write and close
182 182
 }
183 183
 
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
             // Note: Using MAIN_SECURITY_CSRF_TOKEN_RENEWAL_ON_EACH_CALL is not recommended: if a user succeed in entering a data from
359 359
             // a public page with a link that make a token regeneration, it can make use of the backoffice no more possible !
360 360
             // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken']
361
-            $token = dol_hash(uniqid((string)mt_rand(), false), 'md5'); // Generates a hash of a random number. We don't need a secured hash, just a changing random value.
361
+            $token = dol_hash(uniqid((string) mt_rand(), false), 'md5'); // Generates a hash of a random number. We don't need a secured hash, just a changing random value.
362 362
             $_SESSION['newtoken'] = $token;
363 363
             dol_syslog("NEW TOKEN generated by : " . $_SERVER['PHP_SELF'], LOG_DEBUG);
364 364
         }
@@ -441,16 +441,16 @@  discard block
 block discarded – undo
441 441
         }
442 442
         $savid = null;
443 443
         if (isset($_POST['id'])) {
444
-            $savid = ((int)$_POST['id']);
444
+            $savid = ((int) $_POST['id']);
445 445
         }
446 446
         unset($_POST);
447 447
         unset($_GET['confirm']);
448 448
         unset($_GET['action']);
449 449
         unset($_GET['confirmmassaction']);
450 450
         unset($_GET['massaction']);
451
-        unset($_GET['token']);          // TODO Make a redirect if we have a token in url to remove it ?
451
+        unset($_GET['token']); // TODO Make a redirect if we have a token in url to remove it ?
452 452
         if (isset($savid)) {
453
-            $_POST['id'] = ((int)$savid);
453
+            $_POST['id'] = ((int) $savid);
454 454
         }
455 455
         // So rest of code can know something was wrong here
456 456
         $_GET['errorcode'] = 'InvalidToken';
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
                 if (!empty($_SERVER["HTTP_USER_AGENT"]) && $_SERVER["HTTP_USER_AGENT"] == 'securitytest') {
759 759
                     http_response_code(401); // It makes easier to understand if session was broken during security tests
760 760
                 }
761
-                dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : ''));   // This include http headers
761
+                dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : '')); // This include http headers
762 762
             }
763 763
             exit;
764 764
         }
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
 } else {
1107 1107
     // We may have NOLOGIN set, but NOREQUIREUSER not
1108 1108
     if (!empty($user) && method_exists($user, 'loadDefaultValues') && !defined('NODEFAULTVALUES')) {
1109
-        $user->loadDefaultValues();     // Load default values for everybody (works even if $user->id = 0
1109
+        $user->loadDefaultValues(); // Load default values for everybody (works even if $user->id = 0
1110 1110
     }
1111 1111
 }
1112 1112
 
@@ -1277,7 +1277,7 @@  discard block
 block discarded – undo
1277 1277
     }
1278 1278
     if (!class_exists('MenuManager')) {
1279 1279
         $menufound = 0;
1280
-        $dirmenus = array_merge(array("/core/menus/"), (array)$conf->modules_parts['menus']);
1280
+        $dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
1281 1281
         foreach ($dirmenus as $dirmenu) {
1282 1282
             $menufound = dol_include_once($dirmenu . "standard/" . $file_menu);
1283 1283
             if (class_exists('MenuManager')) {
@@ -1729,9 +1729,9 @@  discard block
 block discarded – undo
1729 1729
 
1730 1730
         // CSS forced by modules (relative url starting with /)
1731 1731
         if (!empty($conf->modules_parts['css'])) {
1732
-            $arraycss = (array)$conf->modules_parts['css'];
1732
+            $arraycss = (array) $conf->modules_parts['css'];
1733 1733
             foreach ($arraycss as $modcss => $filescss) {
1734
-                $filescss = (array)$filescss; // To be sure filecss is an array
1734
+                $filescss = (array) $filescss; // To be sure filecss is an array
1735 1735
                 foreach ($filescss as $cssfile) {
1736 1736
                     if (empty($cssfile)) {
1737 1737
                         dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING);
@@ -1890,9 +1890,9 @@  discard block
 block discarded – undo
1890 1890
 
1891 1891
             // JS forced by modules (relative url starting with /)
1892 1892
             if (!empty($conf->modules_parts['js'])) {       // $conf->modules_parts['js'] is array('module'=>array('file1','file2'))
1893
-                $arrayjs = (array)$conf->modules_parts['js'];
1893
+                $arrayjs = (array) $conf->modules_parts['js'];
1894 1894
                 foreach ($arrayjs as $modjs => $filesjs) {
1895
-                    $filesjs = (array)$filesjs; // To be sure filejs is an array
1895
+                    $filesjs = (array) $filesjs; // To be sure filejs is an array
1896 1896
                     foreach ($filesjs as $jsfile) {
1897 1897
                         // jsfile is a relative path
1898 1898
                         $urlforjs = dol_buildpath($jsfile, 3);
@@ -2307,7 +2307,7 @@  discard block
 block discarded – undo
2307 2307
     $langFlag = picto_from_langcode($langs->getDefaultLang());
2308 2308
     $dropdownBody .= '<br><b>' . $langs->trans("CurrentUserLanguage") . ':</b> ' . ($langFlag ? $langFlag . ' ' : '') . $langs->getDefaultLang();
2309 2309
 
2310
-    $tz = (int)$_SESSION['dol_tz'] + (int)$_SESSION['dol_dst'];
2310
+    $tz = (int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
2311 2311
     $dropdownBody .= '<br><b>' . $langs->trans("ClientTZ") . ':</b> ' . ($tz ? ($tz >= 0 ? '+' : '') . $tz : '');
2312 2312
     $dropdownBody .= ' (' . $_SESSION['dol_tz_string'] . ')';
2313 2313
     //$dropdownBody .= ' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': ';
@@ -2353,7 +2353,7 @@  discard block
 block discarded – undo
2353 2353
 
2354 2354
     // Defined the links for bottom of card
2355 2355
     $profilLink = '<a accesskey="u" href="' . BASE_URL . '/user/card.php?id=' . $user->id . '" class="button-top-menu-dropdown" title="' . dol_escape_htmltag($langs->trans("YourUserFile") . ' (' . $stringforfirstkey . ' u)') . '"><i class="fa fa-user"></i>  ' . $langs->trans("Card") . '</a>';
2356
-    $urltovirtualcard = '/user/virtualcard.php?id=' . ((int)$user->id);
2356
+    $urltovirtualcard = '/user/virtualcard.php?id=' . ((int) $user->id);
2357 2357
     $virtuelcardLink = dolButtonToOpenUrlInDialogPopup('publicvirtualcardmenu', $langs->transnoentitiesnoconv("PublicVirtualCardUrl") . (is_object($user) ? ' - ' . $user->getFullName($langs) : '') . ' (' . $stringforfirstkey . ' v)', img_picto($langs->trans("PublicVirtualCardUrl") . ' (' . $stringforfirstkey . ' v)', 'card', ''), $urltovirtualcard, '', 'button-top-menu-dropdown marginleftonly nohover', "closeTopMenuLoginDropdown()", '', 'v');
2358 2358
     $logoutLink = '<a accesskey="l" href="' . $urllogout . '" class="button-top-menu-dropdown" title="' . dol_escape_htmltag($langs->trans("Logout") . ' (' . $stringforfirstkey . ' l)') . '"><i class="fa fa-sign-out-alt padingright"></i><span class="hideonsmartphone">' . $langs->trans("Logout") . '</span></a>';
2359 2359
 
@@ -3597,7 +3597,7 @@  discard block
 block discarded – undo
3597 3597
         $forceping = GETPOST('forceping', 'alpha');
3598 3598
         if (($_SERVER["PHP_SELF"] == constant('BASE_URL') . '/index.php') || $forceping) {
3599 3599
             //print '<!-- instance_unique_id='.$conf->file->instance_unique_id.' MAIN_FIRST_PING_OK_ID='.$conf->global->MAIN_FIRST_PING_OK_ID.' -->';
3600
-            $hash_unique_id = dol_hash('dolibarr' . $conf->file->instance_unique_id, 'sha256');   // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
3600
+            $hash_unique_id = dol_hash('dolibarr' . $conf->file->instance_unique_id, 'sha256'); // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
3601 3601
 
3602 3602
             if (
3603 3603
                 !getDolGlobalString('MAIN_FIRST_PING_OK_DATE')
@@ -3639,8 +3639,8 @@  discard block
 block discarded – undo
3639 3639
                                         hash_algo: 'dol_hash-sha256',
3640 3640
                                         hash_unique_id: '<?php echo dol_escape_js($hash_unique_id); ?>',
3641 3641
                                         action: 'dolibarrping',
3642
-                                        version: '<?php echo (float)DOL_VERSION; ?>',
3643
-                                        entity: '<?php echo (int)$conf->entity; ?>',
3642
+                                        version: '<?php echo (float) DOL_VERSION; ?>',
3643
+                                        entity: '<?php echo (int) $conf->entity; ?>',
3644 3644
                                         dbtype: '<?php echo dol_escape_js($db->type); ?>',
3645 3645
                                         country_code: '<?php echo $mysoc->country_code ? dol_escape_js($mysoc->country_code) : 'unknown'; ?>',
3646 3646
                                         php_version: '<?php echo dol_escape_js(phpversion()); ?>',
Please login to merge, or discard this patch.
public/htdocs/core/lib/html.lib.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
     $form = new Form($db);
82 82
 
83
-    $templatenameforexport = $website->name_template;   // Example 'website_template-corporate'
83
+    $templatenameforexport = $website->name_template; // Example 'website_template-corporate'
84 84
     if (empty($templatenameforexport)) {
85 85
         $templatenameforexport = 'website_' . $website->ref;
86 86
     }
@@ -676,7 +676,7 @@  discard block
 block discarded – undo
676 676
                 } else {
677 677
                     $width = 14;
678 678
                     $cssclass = 'photorefcenter';
679
-                    $picto = $object->picto;  // @phan-suppress-current-line PhanUndeclaredProperty
679
+                    $picto = $object->picto; // @phan-suppress-current-line PhanUndeclaredProperty
680 680
                     $prefix = 'object_';
681 681
                     if ($object->element == 'project' && !$object->public) {  // @phan-suppress-current-line PhanUndeclaredProperty
682 682
                         $picto = 'project'; // instead of projectpub
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
     }
787 787
     // Show address and email
788 788
     if (method_exists($object, 'getBannerAddress') && !in_array($object->element, array('product', 'bookmark', 'ecm_directories', 'ecm_files'))) {
789
-        $moreaddress = $object->getBannerAddress('refaddress', $object);    // address, email, url, social networks
789
+        $moreaddress = $object->getBannerAddress('refaddress', $object); // address, email, url, social networks
790 790
         if ($moreaddress) {
791 791
             $morehtmlref .= '<div class="refidno refaddress">';
792 792
             $morehtmlref .= $moreaddress;
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
     if (getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && (getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') == '1' || preg_match('/' . preg_quote($object->element, '/') . '/i', $conf->global->MAIN_SHOW_TECHNICAL_ID)) && !empty($object->id)) {
797 797
         $morehtmlref .= '<div style="clear: both;"></div>';
798 798
         $morehtmlref .= '<div class="refidno opacitymedium">';
799
-        $morehtmlref .= $langs->trans("TechnicalID") . ': ' . ((int)$object->id);
799
+        $morehtmlref .= $langs->trans("TechnicalID") . ': ' . ((int) $object->id);
800 800
         $morehtmlref .= '</div>';
801 801
     }
802 802
 
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
             $type = 'AC_EMAIL';
955 955
             $linktoaddaction = '';
956 956
             if (getDolGlobalString('AGENDA_ADDACTIONFOREMAIL')) {
957
-                $linktoaddaction = '<a href="' . constant('BASE_URL') . '/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode=' . urlencode($type) . '&amp;contactid=' . ((int)$cid) . '&amp;socid=' . ((int)$socid) . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>';
957
+                $linktoaddaction = '<a href="' . constant('BASE_URL') . '/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode=' . urlencode($type) . '&amp;contactid=' . ((int) $cid) . '&amp;socid=' . ((int) $socid) . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>';
958 958
             }
959 959
             if ($linktoaddaction) {
960 960
                 $newemail = '<div>' . $newemail . ' ' . $linktoaddaction . '</div>';
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
             $url = make_substitutions($url, $substitarray);
1335 1335
             if (!getDolGlobalString('CLICKTODIAL_DO_NOT_USE_AJAX_CALL')) {
1336 1336
                 // Default and recommended: New method using ajax without submitting a page making a javascript history.go(-1) back
1337
-                $newphoneastart = '<a href="' . $url . '" class="cssforclicktodial">';  // Call of ajax is handled by the lib_foot.js.php on class 'cssforclicktodial'
1337
+                $newphoneastart = '<a href="' . $url . '" class="cssforclicktodial">'; // Call of ajax is handled by the lib_foot.js.php on class 'cssforclicktodial'
1338 1338
                 $newphoneaend = '</a>';
1339 1339
             } else {
1340 1340
                 // Old method
@@ -1365,7 +1365,7 @@  discard block
 block discarded – undo
1365 1365
 
1366 1366
     if (getDolGlobalString('CONTACT_PHONEMOBILE_SHOW_LINK_TO_WHATSAPP') && $withpicto == 'mobile') {
1367 1367
         // Link to Whatsapp
1368
-        $newphone .= ' <a href="https://wa.me/' . $newphonewa . '" target="_blank"';// Use api to whatasapp contacts
1368
+        $newphone .= ' <a href="https://wa.me/' . $newphonewa . '" target="_blank"'; // Use api to whatasapp contacts
1369 1369
         $newphone .= '><span class="paddingright fab fa-whatsapp" style="color:#25D366;" title="WhatsApp"></span></a>';
1370 1370
     }
1371 1371
 
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
             top_httphead();
1865 1865
         }
1866 1866
         //http_response_code(500);      // If we use 500, message is not output with some command line tools
1867
-        http_response_code(202);        // If we use 202, this is not really an error message, but this allow to output message on command line tools
1867
+        http_response_code(202); // If we use 202, this is not really an error message, but this allow to output message on command line tools
1868 1868
     }
1869 1869
 
1870 1870
     if (empty($dolibarr_main_prod)) {
@@ -2134,7 +2134,7 @@  discard block
 block discarded – undo
2134 2134
     }
2135 2135
     $return .= '<td class="nobordernopadding valignmiddle col-title">';
2136 2136
     $return .= '<div class="titre inline-block">';
2137
-    $return .= $title;  // $title is already HTML sanitized content
2137
+    $return .= $title; // $title is already HTML sanitized content
2138 2138
     $return .= '</div>';
2139 2139
     $return .= '</td>';
2140 2140
     if (dol_strlen($morehtmlcenter)) {
@@ -2181,7 +2181,7 @@  discard block
 block discarded – undo
2181 2181
         $totalnboflines = abs($totalnboflines);
2182 2182
     }
2183 2183
 
2184
-    $page = (int)$page;
2184
+    $page = (int) $page;
2185 2185
 
2186 2186
     if ($picto == 'setup') {
2187 2187
         $picto = 'title_setup.png';
@@ -2212,8 +2212,8 @@  discard block
 block discarded – undo
2212 2212
 
2213 2213
     print '<td class="nobordernopadding valignmiddle col-title">';
2214 2214
     print '<div class="titre inline-block">';
2215
-    print $title;   // $title may contains HTML
2216
-    if (!empty($title) && $savtotalnboflines >= 0 && (string)$savtotalnboflines != '') {
2215
+    print $title; // $title may contains HTML
2216
+    if (!empty($title) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') {
2217 2217
         print '<span class="opacitymedium colorblack paddingleft">(' . $totalnboflines . ')</span>';
2218 2218
     }
2219 2219
     print '</div></td>';
@@ -2225,7 +2225,7 @@  discard block
 block discarded – undo
2225 2225
 
2226 2226
     // Right
2227 2227
     print '<td class="nobordernopadding valignmiddle right col-right">';
2228
-    print '<input type="hidden" name="pageplusoneold" value="' . ((int)$page + 1) . '">';
2228
+    print '<input type="hidden" name="pageplusoneold" value="' . ((int) $page + 1) . '">';
2229 2229
     if ($sortfield) {
2230 2230
         $options .= "&sortfield=" . urlencode($sortfield);
2231 2231
     }
@@ -2344,7 +2344,7 @@  discard block
 block discarded – undo
2344 2344
     }
2345 2345
 
2346 2346
     if (empty($hidenavigation)) {
2347
-        if ((int)$limit > 0 && empty($hideselectlimit)) {
2347
+        if ((int) $limit > 0 && empty($hideselectlimit)) {
2348 2348
             $pagesizechoices = '10:10,15:15,20:20,25:25,50:50,100:100,250:250,500:500,1000:1000';
2349 2349
             $pagesizechoices .= ',5000:5000,10000:10000,20000:20000';
2350 2350
             //$pagesizechoices.=',0:'.$langs->trans("All");     // Not yet supported
@@ -2377,7 +2377,7 @@  discard block
 block discarded – undo
2377 2377
                 $key = $tmp[0];
2378 2378
                 $val = $tmp[1];
2379 2379
                 if ($key != '' && $val != '') {
2380
-                    if ((int)$key == (int)$limit) {
2380
+                    if ((int) $key == (int) $limit) {
2381 2381
                         $selected = ' selected="selected"';
2382 2382
                     }
2383 2383
                     print '<option name="' . $key . '"' . $selected . '>' . dol_escape_htmltag($val) . '</option>' . "\n";
@@ -2578,7 +2578,7 @@  discard block
 block discarded – undo
2578 2578
         if (is_object($objcon) && $objcon->id > 0) {
2579 2579
             $force_filter_contact = true;
2580 2580
             $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm_resources as r ON a.id = r.fk_actioncomm";
2581
-            $sql .= " AND r.element_type = '" . $db->escape($objcon->table_element) . "' AND r.fk_element = " . ((int)$objcon->id);
2581
+            $sql .= " AND r.element_type = '" . $db->escape($objcon->table_element) . "' AND r.fk_element = " . ((int) $objcon->id);
2582 2582
         }
2583 2583
 
2584 2584
         if (is_object($filterobj) && get_only_class($filterobj) == 'Societe') {
@@ -2587,7 +2587,7 @@  discard block
 block discarded – undo
2587 2587
             $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "element_resources as er";
2588 2588
             $sql .= " ON er.resource_type = 'dolresource'";
2589 2589
             $sql .= " AND er.element_id = a.id";
2590
-            $sql .= " AND er.resource_id = " . ((int)$filterobj->id);
2590
+            $sql .= " AND er.resource_id = " . ((int) $filterobj->id);
2591 2591
         } elseif (is_object($filterobj) && get_only_class($filterobj) == 'Adherent') {
2592 2592
             $sql .= ", " . MAIN_DB_PREFIX . "adherent as m";
2593 2593
         } elseif (is_object($filterobj) && get_only_class($filterobj) == 'CommandeFournisseur') {
@@ -2605,42 +2605,42 @@  discard block
 block discarded – undo
2605 2605
         $sql .= " WHERE a.entity IN (" . getEntity('agenda') . ")";
2606 2606
         if (!$force_filter_contact) {
2607 2607
             if (is_object($filterobj) && in_array(get_only_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) {
2608
-                $sql .= " AND a.fk_soc = " . ((int)$filterobj->id);
2608
+                $sql .= " AND a.fk_soc = " . ((int) $filterobj->id);
2609 2609
             } elseif (is_object($filterobj) && get_only_class($filterobj) == 'Project' && $filterobj->id) {
2610
-                $sql .= " AND a.fk_project = " . ((int)$filterobj->id);
2610
+                $sql .= " AND a.fk_project = " . ((int) $filterobj->id);
2611 2611
             } elseif (is_object($filterobj) && get_only_class($filterobj) == 'Adherent') {
2612 2612
                 $sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'";
2613 2613
                 if ($filterobj->id) {
2614
-                    $sql .= " AND a.fk_element = " . ((int)$filterobj->id);
2614
+                    $sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2615 2615
                 }
2616 2616
             } elseif (is_object($filterobj) && get_only_class($filterobj) == 'CommandeFournisseur') {
2617 2617
                 $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'";
2618 2618
                 if ($filterobj->id) {
2619
-                    $sql .= " AND a.fk_element = " . ((int)$filterobj->id);
2619
+                    $sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2620 2620
                 }
2621 2621
             } elseif (is_object($filterobj) && get_only_class($filterobj) == 'Product') {
2622 2622
                 $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product'";
2623 2623
                 if ($filterobj->id) {
2624
-                    $sql .= " AND a.fk_element = " . ((int)$filterobj->id);
2624
+                    $sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2625 2625
                 }
2626 2626
             } elseif (is_object($filterobj) && get_only_class($filterobj) == 'Ticket') {
2627 2627
                 $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'";
2628 2628
                 if ($filterobj->id) {
2629
-                    $sql .= " AND a.fk_element = " . ((int)$filterobj->id);
2629
+                    $sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2630 2630
                 }
2631 2631
             } elseif (is_object($filterobj) && get_only_class($filterobj) == 'BOM') {
2632 2632
                 $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'bom'";
2633 2633
                 if ($filterobj->id) {
2634
-                    $sql .= " AND a.fk_element = " . ((int)$filterobj->id);
2634
+                    $sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2635 2635
                 }
2636 2636
             } elseif (is_object($filterobj) && get_only_class($filterobj) == 'Contrat') {
2637 2637
                 $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'contract'";
2638 2638
                 if ($filterobj->id) {
2639
-                    $sql .= " AND a.fk_element = " . ((int)$filterobj->id);
2639
+                    $sql .= " AND a.fk_element = " . ((int) $filterobj->id);
2640 2640
                 }
2641 2641
             }
2642 2642
         } else {
2643
-            $sql .= " AND u.rowid = " . ((int)$filterobj->id);
2643
+            $sql .= " AND u.rowid = " . ((int) $filterobj->id);
2644 2644
         }
2645 2645
 
2646 2646
         // Condition on actioncode
@@ -3328,7 +3328,7 @@  discard block
 block discarded – undo
3328 3328
         $showonlyonhover = 0;
3329 3329
     }*/
3330 3330
 
3331
-    $tag = 'span';  // Using div (like any style of type 'block') does not work when using the js copy code.
3331
+    $tag = 'span'; // Using div (like any style of type 'block') does not work when using the js copy code.
3332 3332
     if ($texttoshow === 'none') {
3333 3333
         $result = '<span class="clipboardCP' . ($showonlyonhover ? ' clipboardCPShowOnHover' : '') . '"><' . $tag . ' class="clipboardCPValue hidewithsize">' . dol_escape_htmltag($valuetocopy, 1, 1) . '</' . $tag . '><span class="clipboardCPValueToPrint"></span><span class="clipboardCPButton far fa-clipboard opacitymedium paddingleft paddingright"></span><span class="clipboardCPText"></span></span>';
3334 3334
     } elseif ($texttoshow) {
@@ -3669,7 +3669,7 @@  discard block
 block discarded – undo
3669 3669
         $table_element = 'adherent_type';
3670 3670
     } elseif ($elementType == 'bank_account') {
3671 3671
         $classpath = 'compta/bank/class';
3672
-        $module = 'bank';   // We need $conf->bank->dir_output and not $conf->banque->dir_output
3672
+        $module = 'bank'; // We need $conf->bank->dir_output and not $conf->banque->dir_output
3673 3673
         $classfile = 'account';
3674 3674
         $classname = 'Account';
3675 3675
     } elseif ($elementType == 'category') {
@@ -4321,8 +4321,8 @@  discard block
 block discarded – undo
4321 4321
 
4322 4322
 
4323 4323
     $parameters = array(
4324
-        'TCompiledAttr' => $TCompiledAttr,              // array
4325
-        'compiledAttributes' => $compiledAttributes,    // string
4324
+        'TCompiledAttr' => $TCompiledAttr, // array
4325
+        'compiledAttributes' => $compiledAttributes, // string
4326 4326
         'attr' => $attr,
4327 4327
         'tag' => $tag,
4328 4328
         'label' => $label,
@@ -4438,7 +4438,7 @@  discard block
 block discarded – undo
4438 4438
                     if ($posstart > 0) {
4439 4439
                         $res1 = substr($str, $posstart + 1, $posend - $posstart - 1);
4440 4440
                         if (is_numeric($res1)) {
4441
-                            $postab = (int)$res1;
4441
+                            $postab = (int) $res1;
4442 4442
                             $values[1] = '+' . substr($str, $posend + 1);
4443 4443
                         }
4444 4444
                     }
@@ -5014,7 +5014,7 @@  discard block
 block discarded – undo
5014 5014
 
5015 5015
             if (!empty($out) && getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML') && $check != 'restricthtmlallowunvalid') {
5016 5016
                 try {
5017
-                    libxml_use_internal_errors(false);  // Avoid to fill memory with xml errors
5017
+                    libxml_use_internal_errors(false); // Avoid to fill memory with xml errors
5018 5018
                     if (LIBXML_VERSION < 20900) {
5019 5019
                         // Avoid load of external entities (security problem).
5020 5020
                         // Required only if LIBXML_VERSION < 20900
@@ -5055,7 +5055,7 @@  discard block
 block discarded – undo
5055 5055
                         // See options at https://tidy.sourceforge.net/docs/quickref.html
5056 5056
                         $config = array(
5057 5057
                             'clean' => false,
5058
-                            'quote-marks' => false,     // do not replace " that are used for real text content (not a string symbol for html attribute) into &quot;
5058
+                            'quote-marks' => false, // do not replace " that are used for real text content (not a string symbol for html attribute) into &quot;
5059 5059
                             'doctype' => 'strict',
5060 5060
                             'show-body-only' => true,
5061 5061
                             "indent-attributes" => false,
@@ -5098,7 +5098,7 @@  discard block
 block discarded – undo
5098 5098
                  * @param string[] $m
5099 5099
                  * @return string
5100 5100
                  */
5101
-                static function ($m) {
5101
+                static function($m) {
5102 5102
                     return Filters::realCharForNumericEntities($m);
5103 5103
                 },
5104 5104
                 $out
@@ -5231,7 +5231,7 @@  discard block
 block discarded – undo
5231 5231
  */
5232 5232
 function dol_htmlcleanlastbr($stringtodecode)
5233 5233
 {
5234
-    $ret = preg_replace('/&nbsp;$/i', "", $stringtodecode);     // Because wysiwyg editor may add a &nbsp; at end of last line
5234
+    $ret = preg_replace('/&nbsp;$/i', "", $stringtodecode); // Because wysiwyg editor may add a &nbsp; at end of last line
5235 5235
     $ret = preg_replace('/(<br>|<br(\s[\sa-zA-Z_="]*)?\/?>|' . "\n" . '|' . "\r" . ')+$/i', "", $ret);
5236 5236
     return $ret;
5237 5237
 }
@@ -5251,7 +5251,7 @@  discard block
 block discarded – undo
5251 5251
     if ($keepsomeentities) {
5252 5252
         $newstring = strtr($newstring, array('&amp;' => '__andamp__', '&lt;' => '__andlt__', '&gt;' => '__andgt__', '"' => '__dquot__'));
5253 5253
     }
5254
-    $newstring = html_entity_decode((string)$newstring, (int)$b, (string)$c);
5254
+    $newstring = html_entity_decode((string) $newstring, (int) $b, (string) $c);
5255 5255
     if ($keepsomeentities) {
5256 5256
         $newstring = strtr($newstring, array('__andamp__' => '&amp;', '__andlt__' => '&lt;', '__andgt__' => '&gt;', '__dquot__' => '"'));
5257 5257
     }
@@ -5327,7 +5327,7 @@  discard block
 block discarded – undo
5327 5327
                             if (isset($valuetoclean)) {
5328 5328
                                 do {
5329 5329
                                     $oldvaluetoclean = $valuetoclean;
5330
-                                    $valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean);   // clean css comments
5330
+                                    $valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments
5331 5331
                                     $valuetoclean = preg_replace('/position\s*:\s*[a-z]+/mi', '', $valuetoclean);
5332 5332
                                     if ($els->item($i)->tagName == 'a') {   // more paranoiac cleaning for clickable tags.
5333 5333
                                         $valuetoclean = preg_replace('/display\s*:/mi', '', $valuetoclean);
@@ -5415,7 +5415,7 @@  discard block
 block discarded – undo
5415 5415
         $tempbis = $temp;
5416 5416
         do {
5417 5417
             $temp = $tempbis;
5418
-            $tempbis = str_replace('<>', '', $temp);    // No reason to have this into a text, except if value is to try bypass the next html cleaning
5418
+            $tempbis = str_replace('<>', '', $temp); // No reason to have this into a text, except if value is to try bypass the next html cleaning
5419 5419
             $tempbis = preg_replace($pattern, '', $tempbis);
5420 5420
             //$idowhile++; print $temp.'-'.$tempbis."\n"; if ($idowhile > 100) break;
5421 5421
         } while ($tempbis != $temp);
@@ -5470,7 +5470,7 @@  discard block
 block discarded – undo
5470 5470
             "header", "footer", "nav", "section", "menu", "menuitem"    // html5 tags
5471 5471
         );
5472 5472
     }
5473
-    $allowed_tags[] = "comment";        // this tags is added to manage comment <!--...--> that are replaced into <comment>...</comment>
5473
+    $allowed_tags[] = "comment"; // this tags is added to manage comment <!--...--> that are replaced into <comment>...</comment>
5474 5474
     if ($allowiframe) {
5475 5475
         if (!in_array('iframe', $allowed_tags)) {
5476 5476
             $allowed_tags[] = "iframe";
@@ -5485,7 +5485,7 @@  discard block
 block discarded – undo
5485 5485
     $allowed_tags_string = implode("><", $allowed_tags);
5486 5486
     $allowed_tags_string = '<' . $allowed_tags_string . '>';
5487 5487
 
5488
-    $stringtoclean = str_replace('<!DOCTYPE html>', '__!DOCTYPE_HTML__', $stringtoclean);   // Replace DOCTYPE to avoid to have it removed by the strip_tags
5488
+    $stringtoclean = str_replace('<!DOCTYPE html>', '__!DOCTYPE_HTML__', $stringtoclean); // Replace DOCTYPE to avoid to have it removed by the strip_tags
5489 5489
 
5490 5490
     $stringtoclean = dol_string_nounprintableascii($stringtoclean, 0);
5491 5491
 
@@ -5495,7 +5495,7 @@  discard block
 block discarded – undo
5495 5495
     $stringtoclean = preg_replace('/&colon;/i', ':', $stringtoclean);
5496 5496
     $stringtoclean = preg_replace('/&#58;|&#0+58|&#x3A/i', '', $stringtoclean); // refused string ':' encoded (no reason to have a : encoded like this) to disable 'javascript:...'
5497 5497
 
5498
-    $temp = strip_tags($stringtoclean, $allowed_tags_string);   // Warning: This remove also undesired </>, so may changes string obfuscated with </> that pass the injection detection into a harmfull string
5498
+    $temp = strip_tags($stringtoclean, $allowed_tags_string); // Warning: This remove also undesired </>, so may changes string obfuscated with </> that pass the injection detection into a harmfull string
5499 5499
 
5500 5500
     if ($cleanalsosomestyles) { // Clean for remaining html tags
5501 5501
         $temp = preg_replace('/position\s*:\s*(absolute|fixed)\s*!\s*important/i', '', $temp); // Note: If hacker try to introduce css comment into string to bypass this regex, the string must also be encoded by the dol_htmlentitiesbr during output so it become harmless
@@ -5512,7 +5512,7 @@  discard block
 block discarded – undo
5512 5512
 
5513 5513
     $temp = str_replace('__!DOCTYPE_HTML__', '<!DOCTYPE html>', $temp); // Restore the DOCTYPE
5514 5514
 
5515
-    $temp = preg_replace('/<comment>([^>]*)<\/comment>/', '<!--\1-->', $temp);  // Restore html comments
5515
+    $temp = preg_replace('/<comment>([^>]*)<\/comment>/', '<!--\1-->', $temp); // Restore html comments
5516 5516
 
5517 5517
 
5518 5518
     return $temp;
Please login to merge, or discard this patch.
public/htdocs/core/lib/functions2.lib.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
     include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
167 167
 
168 168
     $deltadateforserver = getServerTimeZoneInt('now');
169
-    $deltadateforclient = ((int)$_SESSION['dol_tz'] + (int)$_SESSION['dol_dst']);
169
+    $deltadateforclient = ((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']);
170 170
     //$deltadateforcompany=((int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst']);
171 171
     $deltadateforuser = round($deltadateforclient - $deltadateforserver);
172 172
     //print "x".$deltadateforserver." - ".$deltadateforclient." - ".$deltadateforuser;
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
     while (preg_match('/\{([A-Z]+)\-([1-9])\}/', $tmpmask, $regKey)) {
1017 1017
         $maskperso[$regKey[1]] = '{' . $regKey[1] . '-' . $regKey[2] . '}';
1018 1018
         // @phan-suppress-next-line PhanParamSuspiciousOrder
1019
-        $maskpersonew[$regKey[1]] = str_pad('', (int)$regKey[2], '_', STR_PAD_RIGHT);
1019
+        $maskpersonew[$regKey[1]] = str_pad('', (int) $regKey[2], '_', STR_PAD_RIGHT);
1020 1020
         $tmpmask = preg_replace('/\{' . $regKey[1] . '\-' . $regKey[2] . '\}/i', $maskpersonew[$regKey[1]], $tmpmask);
1021 1021
     }
1022 1022
 
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 
1079 1079
     if ($maskraz > 0) {   // A reset is required
1080 1080
         if ($maskraz == 99) {
1081
-            $maskraz = (int)date('m', $date);
1081
+            $maskraz = (int) date('m', $date);
1082 1082
             $resetEveryMonth = true;
1083 1083
         }
1084 1084
         if ($maskraz > 12) {
@@ -1131,7 +1131,7 @@  discard block
 block discarded – undo
1131 1131
         $yearcomp = 0;
1132 1132
 
1133 1133
         if (!empty($yearoffsettype) && !is_numeric($yearoffsettype) && $yearoffsettype != '=') {    // $yearoffsettype is - or +
1134
-            $currentyear = (int)date("Y", $date);
1134
+            $currentyear = (int) date("Y", $date);
1135 1135
             $fiscaldate = dol_mktime('0', '0', '0', $maskraz, '1', $currentyear);
1136 1136
             $newyeardate = dol_mktime('0', '0', '0', '1', '1', $currentyear);
1137 1137
             $nextnewyeardate = dol_mktime('0', '0', '0', '1', '1', $currentyear + 1);
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
                 // If after or equal of current new year date
1148 1148
                 $yearoffset = -1;
1149 1149
             }
1150
-        } elseif ((int)date("m", $date) < $maskraz && empty($resetEveryMonth)) {
1150
+        } elseif ((int) date("m", $date) < $maskraz && empty($resetEveryMonth)) {
1151 1151
             // For backward compatibility
1152 1152
             $yearoffset = -1;
1153 1153
         }   // If current month lower that month of return to zero, year is previous year
@@ -1157,7 +1157,7 @@  discard block
 block discarded – undo
1157 1157
         } elseif ($yearlen == 2) {
1158 1158
             $yearcomp = sprintf("%02d", idate("y", $date) + $yearoffset);
1159 1159
         } elseif ($yearlen == 1) {
1160
-            $yearcomp = (int)substr(date('y', $date), 1, 1) + $yearoffset;
1160
+            $yearcomp = (int) substr(date('y', $date), 1, 1) + $yearoffset;
1161 1161
         }
1162 1162
         if ($monthcomp > 1 && empty($resetEveryMonth)) {    // Test with month is useless if monthcomp = 0 or 1 (0 is same as 1) (regis: $monthcomp can't equal 0)
1163 1163
             if ($yearlen == 4) {
@@ -1391,9 +1391,9 @@  discard block
 block discarded – undo
1391 1391
 
1392 1392
         // We replace special codes except refclient
1393 1393
         if (!empty($yearoffsettype) && !is_numeric($yearoffsettype) && $yearoffsettype != '=') {    // yearoffsettype is - or +, so we don't want current year
1394
-            $numFinal = preg_replace('/\{yyyy\}/i', (string)((int)date("Y", $date) + $yearoffset), $numFinal);
1395
-            $numFinal = preg_replace('/\{yy\}/i', (string)((int)date("y", $date) + $yearoffset), $numFinal);
1396
-            $numFinal = preg_replace('/\{y\}/i', (string)((int)substr((string)date("y", $date), 1, 1) + $yearoffset), $numFinal);
1394
+            $numFinal = preg_replace('/\{yyyy\}/i', (string) ((int) date("Y", $date) + $yearoffset), $numFinal);
1395
+            $numFinal = preg_replace('/\{yy\}/i', (string) ((int) date("y", $date) + $yearoffset), $numFinal);
1396
+            $numFinal = preg_replace('/\{y\}/i', (string) ((int) substr((string) date("y", $date), 1, 1) + $yearoffset), $numFinal);
1397 1397
         } else { // we want yyyy to be current year
1398 1398
             $numFinal = preg_replace('/\{yyyy\}/i', date("Y", $date), $numFinal);
1399 1399
             $numFinal = preg_replace('/\{yy\}/i', date("y", $date), $numFinal);
@@ -1549,7 +1549,7 @@  discard block
 block discarded – undo
1549 1549
     }
1550 1550
     if ($maskraz >= 0) {
1551 1551
         if ($maskraz == 99) {
1552
-            $maskraz = (int)date('m');
1552
+            $maskraz = (int) date('m');
1553 1553
             $resetEveryMonth = true;
1554 1554
         }
1555 1555
         if ($maskraz > 12) {
@@ -1644,9 +1644,9 @@  discard block
 block discarded – undo
1644 1644
 
1645 1645
     if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+)\s?([0-9]+)?:?([0-9]+)?/i', $stime, $reg)) {
1646 1646
         // Date est au format 'YYYY-MM-DD' ou 'YYYY-MM-DD HH:MM:SS'
1647
-        $annee = (int)$reg[1];
1648
-        $mois = (int)$reg[2];
1649
-        $jour = (int)$reg[3];
1647
+        $annee = (int) $reg[1];
1648
+        $mois = (int) $reg[2];
1649
+        $jour = (int) $reg[3];
1650 1650
     }
1651 1651
 
1652 1652
     /*
@@ -1657,33 +1657,33 @@  discard block
 block discarded – undo
1657 1657
      */
1658 1658
 
1659 1659
     // Definition du Jeudi de la semaine
1660
-    if ((int)date("w", mktime(12, 0, 0, $mois, $jour, $annee)) == 0) { // Dimanche
1660
+    if ((int) date("w", mktime(12, 0, 0, $mois, $jour, $annee)) == 0) { // Dimanche
1661 1661
         $jeudiSemaine = mktime(12, 0, 0, $mois, $jour, $annee) - 3 * 24 * 60 * 60;
1662 1662
     } elseif (date("w", mktime(12, 0, 0, $mois, $jour, $annee)) < 4) { // du Lundi au Mercredi
1663
-        $jeudiSemaine = mktime(12, 0, 0, $mois, $jour, $annee) + (4 - (int)date("w", mktime(12, 0, 0, $mois, $jour, $annee))) * 24 * 60 * 60;
1664
-    } elseif ((int)date("w", mktime(12, 0, 0, $mois, $jour, $annee)) > 4) { // du Vendredi au Samedi
1665
-        $jeudiSemaine = mktime(12, 0, 0, $mois, $jour, $annee) - ((int)date("w", mktime(12, 0, 0, $mois, $jour, $annee)) - 4) * 24 * 60 * 60;
1663
+        $jeudiSemaine = mktime(12, 0, 0, $mois, $jour, $annee) + (4 - (int) date("w", mktime(12, 0, 0, $mois, $jour, $annee))) * 24 * 60 * 60;
1664
+    } elseif ((int) date("w", mktime(12, 0, 0, $mois, $jour, $annee)) > 4) { // du Vendredi au Samedi
1665
+        $jeudiSemaine = mktime(12, 0, 0, $mois, $jour, $annee) - ((int) date("w", mktime(12, 0, 0, $mois, $jour, $annee)) - 4) * 24 * 60 * 60;
1666 1666
     } else { // Jeudi
1667 1667
         $jeudiSemaine = mktime(12, 0, 0, $mois, $jour, $annee);
1668 1668
     }
1669 1669
 
1670 1670
     // Definition du premier Jeudi de l'annee
1671
-    if ((int)date("w", mktime(12, 0, 0, 1, 1, (int)date("Y", $jeudiSemaine))) == 0) { // Dimanche
1672
-        $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, (int)date("Y", $jeudiSemaine)) + 4 * 24 * 60 * 60;
1673
-    } elseif ((int)date("w", mktime(12, 0, 0, 1, 1, (int)date("Y", $jeudiSemaine))) < 4) { // du Lundi au Mercredi
1674
-        $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, (int)date("Y", $jeudiSemaine)) + (4 - (int)date("w", mktime(12, 0, 0, 1, 1, (int)date("Y", $jeudiSemaine)))) * 24 * 60 * 60;
1675
-    } elseif ((int)date("w", mktime(12, 0, 0, 1, 1, (int)date("Y", $jeudiSemaine))) > 4) { // du Vendredi au Samedi
1676
-        $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, (int)date("Y", $jeudiSemaine)) + (7 - ((int)date("w", mktime(12, 0, 0, 1, 1, (int)date("Y", $jeudiSemaine))) - 4)) * 24 * 60 * 60;
1671
+    if ((int) date("w", mktime(12, 0, 0, 1, 1, (int) date("Y", $jeudiSemaine))) == 0) { // Dimanche
1672
+        $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, (int) date("Y", $jeudiSemaine)) + 4 * 24 * 60 * 60;
1673
+    } elseif ((int) date("w", mktime(12, 0, 0, 1, 1, (int) date("Y", $jeudiSemaine))) < 4) { // du Lundi au Mercredi
1674
+        $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, (int) date("Y", $jeudiSemaine)) + (4 - (int) date("w", mktime(12, 0, 0, 1, 1, (int) date("Y", $jeudiSemaine)))) * 24 * 60 * 60;
1675
+    } elseif ((int) date("w", mktime(12, 0, 0, 1, 1, (int) date("Y", $jeudiSemaine))) > 4) { // du Vendredi au Samedi
1676
+        $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, (int) date("Y", $jeudiSemaine)) + (7 - ((int) date("w", mktime(12, 0, 0, 1, 1, (int) date("Y", $jeudiSemaine))) - 4)) * 24 * 60 * 60;
1677 1677
     } else { // Jeudi
1678
-        $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, (int)date("Y", $jeudiSemaine));
1678
+        $premierJeudiAnnee = mktime(12, 0, 0, 1, 1, (int) date("Y", $jeudiSemaine));
1679 1679
     }
1680 1680
 
1681 1681
     // Definition du numero de semaine: nb de jours entre "premier Jeudi de l'annee" et "Jeudi de la semaine";
1682 1682
     $numeroSemaine = (
1683 1683
             (
1684
-                (int)date("z", mktime(12, 0, 0, (int)date("m", $jeudiSemaine), (int)date("d", $jeudiSemaine), (int)date("Y", $jeudiSemaine)))
1684
+                (int) date("z", mktime(12, 0, 0, (int) date("m", $jeudiSemaine), (int) date("d", $jeudiSemaine), (int) date("Y", $jeudiSemaine)))
1685 1685
                 -
1686
-                (int)date("z", mktime(12, 0, 0, (int)date("m", $premierJeudiAnnee), (int)date("d", $premierJeudiAnnee), (int)date("Y", $premierJeudiAnnee)))
1686
+                (int) date("z", mktime(12, 0, 0, (int) date("m", $premierJeudiAnnee), (int) date("d", $premierJeudiAnnee), (int) date("Y", $premierJeudiAnnee)))
1687 1687
             ) / 7
1688 1688
         ) + 1;
1689 1689
 
@@ -1691,10 +1691,10 @@  discard block
 block discarded – undo
1691 1691
     if ($numeroSemaine == 53) {
1692 1692
         // Les annees qui commencent un Jeudi et les annees bissextiles commencant un Mercredi en possedent 53
1693 1693
         if (
1694
-            ((int)date("w", mktime(12, 0, 0, 1, 1, (int)date("Y", $jeudiSemaine))) == 4)
1694
+            ((int) date("w", mktime(12, 0, 0, 1, 1, (int) date("Y", $jeudiSemaine))) == 4)
1695 1695
             || (
1696
-                ((int)date("w", mktime(12, 0, 0, 1, 1, (int)date("Y", $jeudiSemaine))) == 3)
1697
-                && ((int)date("z", mktime(12, 0, 0, 12, 31, (int)date("Y", $jeudiSemaine))) == 365)
1696
+                ((int) date("w", mktime(12, 0, 0, 1, 1, (int) date("Y", $jeudiSemaine))) == 3)
1697
+                && ((int) date("z", mktime(12, 0, 0, 12, 31, (int) date("Y", $jeudiSemaine))) == 365)
1698 1698
             )
1699 1699
         ) {
1700 1700
             $numeroSemaine = 53;
@@ -1762,8 +1762,8 @@  discard block
 block discarded – undo
1762 1762
 
1763 1763
     // We remove old parameters for all keys in $tab
1764 1764
     $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_param";
1765
-    $sql .= " WHERE fk_user = " . ((int)$user->id);
1766
-    $sql .= " AND entity = " . ((int)$conf->entity);
1765
+    $sql .= " WHERE fk_user = " . ((int) $user->id);
1766
+    $sql .= " AND entity = " . ((int) $conf->entity);
1767 1767
     $sql .= " AND param in (";
1768 1768
     $i = 0;
1769 1769
     foreach ($tab as $key => $value) {
@@ -1787,7 +1787,7 @@  discard block
 block discarded – undo
1787 1787
         // Set new parameters
1788 1788
         if ($value) {
1789 1789
             $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_param(fk_user,entity,param,value)";
1790
-            $sql .= " VALUES (" . ((int)$user->id) . "," . ((int)$conf->entity) . ",";
1790
+            $sql .= " VALUES (" . ((int) $user->id) . "," . ((int) $conf->entity) . ",";
1791 1791
             $sql .= " '" . $db->escape($key) . "','" . $db->escape($value) . "')";
1792 1792
 
1793 1793
             dol_syslog("functions2.lib::dol_set_user_param", LOG_DEBUG);
@@ -2549,7 +2549,7 @@  discard block
 block discarded – undo
2549 2549
     $rgb['g'] = hexdec($length == 6 ? substr($hex, 2, 2) : ($length == 3 ? str_repeat(substr($hex, 1, 1), 2) : 0));
2550 2550
     $rgb['b'] = hexdec($length == 6 ? substr($hex, 4, 2) : ($length == 3 ? str_repeat(substr($hex, 2, 1), 2) : 0));
2551 2551
     if ($alpha !== false) {
2552
-        $rgb['a'] = (float)$alpha;
2552
+        $rgb['a'] = (float) $alpha;
2553 2553
         $string = 'rgba(' . implode(',', array_map('strval', $rgb)) . ')';
2554 2554
     } else {
2555 2555
         $string = 'rgb(' . implode(',', array_map('strval', $rgb)) . ')';
@@ -2882,7 +2882,7 @@  discard block
 block discarded – undo
2882 2882
         $code = ob_get_clean();
2883 2883
         $code = strip_tags($code);
2884 2884
         if (preg_match("'syntax error, (.+) in .+ on line (\d+)$'s", $code, $code)) {
2885
-            $code[2] = (int)$code[2];
2885
+            $code[2] = (int) $code[2];
2886 2886
             $code = $code[2] <= $braces
2887 2887
                 ? array($code[1], $code[2])
2888 2888
                 : array('unexpected $end' . substr($code[1], 14), $braces);
Please login to merge, or discard this patch.