@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | function getDolGlobalString($key, $default = '') |
| 169 | 169 | { |
| 170 | 170 | global $conf; |
| 171 | - return (string)(isset($conf->global->$key) ? $conf->global->$key : $default); |
|
| 171 | + return (string) (isset($conf->global->$key) ? $conf->global->$key : $default); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | function getDolGlobalInt($key, $default = 0) |
| 184 | 184 | { |
| 185 | 185 | global $conf; |
| 186 | - return (int)(isset($conf->global->$key) ? $conf->global->$key : $default); |
|
| 186 | + return (int) (isset($conf->global->$key) ? $conf->global->$key : $default); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | $tmpuser = $user; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - return (string)(empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); |
|
| 204 | + return (string) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $tmpuser = $user; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - return (int)(empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); |
|
| 222 | + return (int) (empty($tmpuser->conf->$key) ? $default : $tmpuser->conf->$key); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | |
@@ -236,23 +236,23 @@ discard block |
||
| 236 | 236 | 'MODULE_MAPPING', |
| 237 | 237 | array( |
| 238 | 238 | // Map deprecated names to new names |
| 239 | - 'adherent' => 'member', // Has new directory |
|
| 240 | - 'member_type' => 'adherent_type', // No directory, but file called adherent_type |
|
| 241 | - 'banque' => 'bank', // Has new directory |
|
| 239 | + 'adherent' => 'member', // Has new directory |
|
| 240 | + 'member_type' => 'adherent_type', // No directory, but file called adherent_type |
|
| 241 | + 'banque' => 'bank', // Has new directory |
|
| 242 | 242 | 'contrat' => 'contract', // Has new directory |
| 243 | - 'entrepot' => 'stock', // Has new directory |
|
| 243 | + 'entrepot' => 'stock', // Has new directory |
|
| 244 | 244 | 'projet' => 'project', // Has new directory |
| 245 | 245 | 'categorie' => 'category', // Has old directory |
| 246 | - 'commande' => 'order', // Has old directory |
|
| 246 | + 'commande' => 'order', // Has old directory |
|
| 247 | 247 | 'expedition' => 'shipping', // Has old directory |
| 248 | 248 | 'facture' => 'invoice', // Has old directory |
| 249 | 249 | 'fichinter' => 'intervention', // Has old directory |
| 250 | - 'ficheinter' => 'intervention', // Backup for 'fichinter' |
|
| 250 | + 'ficheinter' => 'intervention', // Backup for 'fichinter' |
|
| 251 | 251 | 'propale' => 'propal', // Has old directory |
| 252 | 252 | 'socpeople' => 'contact', // Has old directory |
| 253 | - 'fournisseur' => 'supplier', // Has old directory |
|
| 253 | + 'fournisseur' => 'supplier', // Has old directory |
|
| 254 | 254 | |
| 255 | - 'actioncomm' => 'agenda', // NO module directory (public dir agenda) |
|
| 255 | + 'actioncomm' => 'agenda', // NO module directory (public dir agenda) |
|
| 256 | 256 | 'product_price' => 'productprice', // NO directory |
| 257 | 257 | 'product_fournisseur_price' => 'productsupplierprice', // NO directory |
| 258 | 258 | ) |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | if (in_array($element, $addzero)) { |
| 391 | 391 | $out .= '0,'; |
| 392 | 392 | } |
| 393 | - $out .= ((int)$conf->entity); |
|
| 393 | + $out .= ((int) $conf->entity); |
|
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | // Manipulate entities to query on the fly |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | $os = 'unknown'; |
| 484 | 484 | $phone = ''; |
| 485 | 485 | |
| 486 | - $user_agent = substr($user_agent, 0, 512); // Avoid to process too large user agent |
|
| 486 | + $user_agent = substr($user_agent, 0, 512); // Avoid to process too large user agent |
|
| 487 | 487 | |
| 488 | 488 | $detectmobile = new Mobile_Detect(null, $user_agent); |
| 489 | 489 | $tablet = $detectmobile->isTablet(); |
@@ -572,8 +572,8 @@ discard block |
||
| 572 | 572 | 'browserversion' => $version, |
| 573 | 573 | 'browseros' => $os, |
| 574 | 574 | 'browserua' => $user_agent, |
| 575 | - 'layout' => $layout, // tablet, phone, classic |
|
| 576 | - 'phone' => $phone, // deprecated |
|
| 575 | + 'layout' => $layout, // tablet, phone, classic |
|
| 576 | + 'phone' => $phone, // deprecated |
|
| 577 | 577 | 'tablet' => $tablet // deprecated |
| 578 | 578 | ); |
| 579 | 579 | } |
@@ -989,13 +989,13 @@ discard block |
||
| 989 | 989 | // Sanitizing for special parameters. |
| 990 | 990 | // Note: There is no reason to allow the backtopage, backtolist or backtourl parameter to contains an external URL. Only relative URLs are allowed. |
| 991 | 991 | if ($paramname == 'backtopage' || $paramname == 'backtolist' || $paramname == 'backtourl') { |
| 992 | - $out = str_replace('\\', '/', $out); // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements. |
|
| 993 | - $out = str_replace(array(':', ';', '@', "\t", ' '), '', $out); // Can be before the loop because only 1 char is replaced. No risk to retrieve it after other replacements. |
|
| 992 | + $out = str_replace('\\', '/', $out); // Can be before the loop because only 1 char is replaced. No risk to get it after other replacements. |
|
| 993 | + $out = str_replace(array(':', ';', '@', "\t", ' '), '', $out); // Can be before the loop because only 1 char is replaced. No risk to retrieve it after other replacements. |
|
| 994 | 994 | do { |
| 995 | 995 | $oldstringtoclean = $out; |
| 996 | 996 | $out = str_ireplace(array('javascript', 'vbscript', '&colon', '&#'), '', $out); |
| 997 | - $out = preg_replace(array('/^[^\?]*%/'), '', $out); // We remove any % chars before the ?. Example in url: '/product/stock/card.php?action=create&backtopage=%2Fdolibarr_dev%2Fhtdocs%2Fpro%25duct%2Fcard.php%3Fid%3Dabc' |
|
| 998 | - $out = preg_replace(array('/^[a-z]*\/\s*\/+/i'), '', $out); // We remove schema*// to remove external URL |
|
| 997 | + $out = preg_replace(array('/^[^\?]*%/'), '', $out); // We remove any % chars before the ?. Example in url: '/product/stock/card.php?action=create&backtopage=%2Fdolibarr_dev%2Fhtdocs%2Fpro%25duct%2Fcard.php%3Fid%3Dabc' |
|
| 998 | + $out = preg_replace(array('/^[a-z]*\/\s*\/+/i'), '', $out); // We remove schema*// to remove external URL |
|
| 999 | 999 | } while ($oldstringtoclean != $out); |
| 1000 | 1000 | } |
| 1001 | 1001 | |
@@ -1029,7 +1029,7 @@ discard block |
||
| 1029 | 1029 | */ |
| 1030 | 1030 | function GETPOSTINT($paramname, $method = 0) |
| 1031 | 1031 | { |
| 1032 | - return (int)GETPOST($paramname, 'int', $method, null, null, 0); |
|
| 1032 | + return (int) GETPOST($paramname, 'int', $method, null, null, 0); |
|
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | |
@@ -1044,7 +1044,7 @@ discard block |
||
| 1044 | 1044 | function GETPOSTFLOAT($paramname, $rounding = '') |
| 1045 | 1045 | { |
| 1046 | 1046 | // price2num() is used to sanitize any valid user input (such as "1 234.5", "1 234,5", "1'234,5", "1·234,5", "1,234.5", etc.) |
| 1047 | - return (float)price2num(GETPOST($paramname), $rounding, 2); |
|
| 1047 | + return (float) price2num(GETPOST($paramname), $rounding, 2); |
|
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | 1050 | |
@@ -1235,7 +1235,7 @@ discard block |
||
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | 1237 | // If prefix is for session (no need to have $conf loaded) |
| 1238 | - global $dolibarr_main_instance_unique_id, $dolibarr_main_cookie_cryptkey; // This is loaded by filefunc.inc.php |
|
| 1238 | + global $dolibarr_main_instance_unique_id, $dolibarr_main_cookie_cryptkey; // This is loaded by filefunc.inc.php |
|
| 1239 | 1239 | $tmp_instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id; // Unique id of instance |
| 1240 | 1240 | |
| 1241 | 1241 | // The recommended value (may be not defined for old versions) |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | $tmpsavdb = null; |
| 1438 | 1438 | if (isset($object->db) && isset($object->db->db) && is_object($object->db->db) && get_class($object->db->db) == 'PgSql\Connection') { |
| 1439 | 1439 | $tmpsavdb = $object->db; |
| 1440 | - unset($object->db); // Such property can not be serialized with pgsl (when object->db->db = 'PgSql\Connection') |
|
| 1440 | + unset($object->db); // Such property can not be serialized with pgsl (when object->db->db = 'PgSql\Connection') |
|
| 1441 | 1441 | } |
| 1442 | 1442 | |
| 1443 | 1443 | $myclone = unserialize(serialize($object)); // serialize then unserialize is a hack to be sure to have a new object for all fields |
@@ -1448,7 +1448,7 @@ discard block |
||
| 1448 | 1448 | } elseif ($native == 2) { |
| 1449 | 1449 | // recommended method to have a full isolated cloned object |
| 1450 | 1450 | $myclone = new stdClass(); |
| 1451 | - $tmparray = get_object_vars($object); // return only public properties |
|
| 1451 | + $tmparray = get_object_vars($object); // return only public properties |
|
| 1452 | 1452 | |
| 1453 | 1453 | if (is_array($tmparray)) { |
| 1454 | 1454 | foreach ($tmparray as $propertykey => $propertyval) { |
@@ -1893,9 +1893,9 @@ discard block |
||
| 1893 | 1893 | |
| 1894 | 1894 | // escape quotes and backslashes, newlines, etc. |
| 1895 | 1895 | if ($escapeonlyhtmltags) { |
| 1896 | - $tmp = htmlspecialchars_decode((string)$stringtoescape, ENT_COMPAT); |
|
| 1896 | + $tmp = htmlspecialchars_decode((string) $stringtoescape, ENT_COMPAT); |
|
| 1897 | 1897 | } else { |
| 1898 | - $tmp = html_entity_decode((string)$stringtoescape, ENT_COMPAT, 'UTF-8'); |
|
| 1898 | + $tmp = html_entity_decode((string) $stringtoescape, ENT_COMPAT, 'UTF-8'); |
|
| 1899 | 1899 | } |
| 1900 | 1900 | if (!$keepb) { |
| 1901 | 1901 | $tmp = strtr($tmp, array("<b>" => '', '</b>' => '', '<strong>' => '', '</strong>' => '')); |
@@ -1925,7 +1925,7 @@ discard block |
||
| 1925 | 1925 | // For case of tag with attribute |
| 1926 | 1926 | $reg = array(); |
| 1927 | 1927 | if (preg_match('/<' . preg_quote($tagtoreplace, '/') . '\s+([^>]+)>/', $tmp, $reg)) { |
| 1928 | - $tmpattributes = str_ireplace(array('[', ']'), '_', $reg[1]); // We must never have [ ] inside the attribute string |
|
| 1928 | + $tmpattributes = str_ireplace(array('[', ']'), '_', $reg[1]); // We must never have [ ] inside the attribute string |
|
| 1929 | 1929 | $tmpattributes = str_ireplace('href="http:', '__HREFHTTPA', $tmpattributes); |
| 1930 | 1930 | $tmpattributes = str_ireplace('href="https:', '__HREFHTTPSA', $tmpattributes); |
| 1931 | 1931 | $tmpattributes = str_ireplace('src="http:', '__SRCHTTPIMG', $tmpattributes); |
@@ -1935,7 +1935,7 @@ discard block |
||
| 1935 | 1935 | $tmp = preg_replace('/<' . preg_quote($tagtoreplace, '/') . '\s+([^>]+)>/', '__BEGINTAGTOREPLACE' . $tagtoreplace . '[' . $tmpattributes . ']__', $tmp); |
| 1936 | 1936 | } |
| 1937 | 1937 | if (preg_match('/<' . preg_quote($tagtoreplace, '/') . '\s+([^>]+)> \/>/', $tmp, $reg)) { |
| 1938 | - $tmpattributes = str_ireplace(array('[', ']'), '_', $reg[1]); // We must not have [ ] inside the attribute string |
|
| 1938 | + $tmpattributes = str_ireplace(array('[', ']'), '_', $reg[1]); // We must not have [ ] inside the attribute string |
|
| 1939 | 1939 | $tmpattributes = str_ireplace('"', '__DOUBLEQUOTE', $tmpattributes); |
| 1940 | 1940 | $tmpattributes = preg_replace('/[^a-z0-9_\/\?\;\s=&]/i', '', $tmpattributes); |
| 1941 | 1941 | $tmp = preg_replace('/<' . preg_quote($tagtoreplace, '/') . '\s+([^>]+) \/>/', '__BEGINENDTAGTOREPLACE' . $tagtoreplace . '[' . $tmpattributes . ']__', $tmp); |
@@ -2378,7 +2378,7 @@ discard block |
||
| 2378 | 2378 | $to_gmt = false; |
| 2379 | 2379 | $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion' |
| 2380 | 2380 | // @phan-suppress-next-line PhanPluginRedundantAssignment |
| 2381 | - $offsettz = 0; // Timezone offset with server timezone (because to_gmt is false), so 0 |
|
| 2381 | + $offsettz = 0; // Timezone offset with server timezone (because to_gmt is false), so 0 |
|
| 2382 | 2382 | // @phan-suppress-next-line PhanPluginRedundantAssignment |
| 2383 | 2383 | $offsetdst = 0; // Dst offset with server timezone (because to_gmt is false), so 0 |
| 2384 | 2384 | } elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') { |
@@ -2389,8 +2389,8 @@ discard block |
||
| 2389 | 2389 | $user_date_tz = new DateTimeZone($offsettzstring); |
| 2390 | 2390 | $user_dt = new DateTime(); |
| 2391 | 2391 | $user_dt->setTimezone($user_date_tz); |
| 2392 | - $user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : (int)$time); |
|
| 2393 | - $offsettz = $user_dt->getOffset(); // should include dst ? |
|
| 2392 | + $user_dt->setTimestamp($tzoutput == 'tzuser' ? dol_now() : (int) $time); |
|
| 2393 | + $offsettz = $user_dt->getOffset(); // should include dst ? |
|
| 2394 | 2394 | } else { // with old method (The 'tzuser' was processed like the 'tzuserrel') |
| 2395 | 2395 | $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore |
| 2396 | 2396 | $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; // Will not be used anymore |
@@ -2407,7 +2407,7 @@ discard block |
||
| 2407 | 2407 | |
| 2408 | 2408 | // Do we have to reduce the length of date (year on 2 chars) to save space. |
| 2409 | 2409 | // Note: dayinputnoreduce is same than day but no reduction of year length will be done |
| 2410 | - $reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour', 'dayhoursec'))) ? 1 : 0; // Test on original $format param. |
|
| 2410 | + $reduceformat = (!empty($conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour', 'dayhoursec'))) ? 1 : 0; // Test on original $format param. |
|
| 2411 | 2411 | $format = preg_replace('/inputnoreduce/', '', $format); // so format 'dayinputnoreduce' is processed like day |
| 2412 | 2412 | $formatwithoutreduce = preg_replace('/reduceformat/', '', $format); |
| 2413 | 2413 | if ($formatwithoutreduce != $format) { |
@@ -2474,10 +2474,10 @@ discard block |
||
| 2474 | 2474 | |
| 2475 | 2475 | // Analyze date |
| 2476 | 2476 | $reg = array(); |
| 2477 | - if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', (string)$time, $reg)) { // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000 |
|
| 2477 | + if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', (string) $time, $reg)) { // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000 |
|
| 2478 | 2478 | dol_print_error(null, "Functions.lib::dol_print_date function called with a bad value from page " . (empty($_SERVER["PHP_SELF"]) ? 'unknown' : $_SERVER["PHP_SELF"])); |
| 2479 | 2479 | return ''; |
| 2480 | - } elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', (string)$time, $reg)) { // Still available to solve problems in extrafields of type date |
|
| 2480 | + } elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', (string) $time, $reg)) { // Still available to solve problems in extrafields of type date |
|
| 2481 | 2481 | // This part of code should not be used anymore. |
| 2482 | 2482 | dol_syslog("Functions.lib::dol_print_date function called with a bad value from page " . (empty($_SERVER["PHP_SELF"]) ? 'unknown' : $_SERVER["PHP_SELF"]), LOG_WARNING); |
| 2483 | 2483 | //if (function_exists('debug_print_backtrace')) debug_print_backtrace(); |
@@ -2494,7 +2494,7 @@ discard block |
||
| 2494 | 2494 | if ($to_gmt) { |
| 2495 | 2495 | $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC |
| 2496 | 2496 | } else { |
| 2497 | - $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server |
|
| 2497 | + $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server |
|
| 2498 | 2498 | } |
| 2499 | 2499 | $dtts = new DateTime(); |
| 2500 | 2500 | $dtts->setTimestamp($time); |
@@ -2518,7 +2518,7 @@ discard block |
||
| 2518 | 2518 | if ($to_gmt) { |
| 2519 | 2519 | $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC |
| 2520 | 2520 | } else { |
| 2521 | - $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server |
|
| 2521 | + $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server |
|
| 2522 | 2522 | } |
| 2523 | 2523 | $dtts = new DateTime(); |
| 2524 | 2524 | $dtts->setTimestamp($timetouse); |
@@ -2546,12 +2546,12 @@ discard block |
||
| 2546 | 2546 | if ($to_gmt) { |
| 2547 | 2547 | $tzo = new DateTimeZone('UTC'); // when to_gmt is true, base for offsettz and offsetdst (so timetouse) is UTC |
| 2548 | 2548 | } else { |
| 2549 | - $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server |
|
| 2549 | + $tzo = new DateTimeZone(date_default_timezone_get()); // when to_gmt is false, base for offsettz and offsetdst (so timetouse) is PHP server |
|
| 2550 | 2550 | } |
| 2551 | 2551 | $dtts = new DateTime(); |
| 2552 | 2552 | $dtts->setTimestamp($timetouse); |
| 2553 | 2553 | $dtts->setTimezone($tzo); |
| 2554 | - $month = (int)$dtts->format("m"); |
|
| 2554 | + $month = (int) $dtts->format("m"); |
|
| 2555 | 2555 | $month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'. |
| 2556 | 2556 | if ($encodetooutput) { |
| 2557 | 2557 | $monthtext = $outputlangs->transnoentities('Month' . $month); |
@@ -2621,14 +2621,14 @@ discard block |
||
| 2621 | 2621 | $datetimeobj->setTimezone(new DateTimeZone($forcetimezone == 'gmt' ? 'UTC' : $forcetimezone)); // (add timezone relative to the date entered) |
| 2622 | 2622 | } |
| 2623 | 2623 | $arrayinfo = array( |
| 2624 | - 'year' => ((int)date_format($datetimeobj, 'Y')), |
|
| 2625 | - 'mon' => ((int)date_format($datetimeobj, 'm')), |
|
| 2626 | - 'mday' => ((int)date_format($datetimeobj, 'd')), |
|
| 2627 | - 'wday' => ((int)date_format($datetimeobj, 'w')), |
|
| 2628 | - 'yday' => ((int)date_format($datetimeobj, 'z')), |
|
| 2629 | - 'hours' => ((int)date_format($datetimeobj, 'H')), |
|
| 2630 | - 'minutes' => ((int)date_format($datetimeobj, 'i')), |
|
| 2631 | - 'seconds' => ((int)date_format($datetimeobj, 's')), |
|
| 2624 | + 'year' => ((int) date_format($datetimeobj, 'Y')), |
|
| 2625 | + 'mon' => ((int) date_format($datetimeobj, 'm')), |
|
| 2626 | + 'mday' => ((int) date_format($datetimeobj, 'd')), |
|
| 2627 | + 'wday' => ((int) date_format($datetimeobj, 'w')), |
|
| 2628 | + 'yday' => ((int) date_format($datetimeobj, 'z')), |
|
| 2629 | + 'hours' => ((int) date_format($datetimeobj, 'H')), |
|
| 2630 | + 'minutes' => ((int) date_format($datetimeobj, 'i')), |
|
| 2631 | + 'seconds' => ((int) date_format($datetimeobj, 's')), |
|
| 2632 | 2632 | '0' => $timestamp |
| 2633 | 2633 | ); |
| 2634 | 2634 | |
@@ -2726,8 +2726,8 @@ discard block |
||
| 2726 | 2726 | //var_dump($localtz); |
| 2727 | 2727 | //var_dump($year.'-'.$month.'-'.$day.'-'.$hour.'-'.$minute); |
| 2728 | 2728 | $dt = new DateTime('now', $localtz); |
| 2729 | - $dt->setDate((int)$year, (int)$month, (int)$day); |
|
| 2730 | - $dt->setTime((int)$hour, (int)$minute, (int)$second); |
|
| 2729 | + $dt->setDate((int) $year, (int) $month, (int) $day); |
|
| 2730 | + $dt->setTime((int) $hour, (int) $minute, (int) $second); |
|
| 2731 | 2731 | $date = $dt->getTimestamp(); // should include daylight saving time |
| 2732 | 2732 | //var_dump($date); |
| 2733 | 2733 | return $date; |
@@ -2757,7 +2757,7 @@ discard block |
||
| 2757 | 2757 | } elseif ($mode == 'tzserver') { // Time for now with PHP server timezone added |
| 2758 | 2758 | require_once constant('DOL_DOCUMENT_ROOT') . '/core/lib/date.lib.php'; |
| 2759 | 2759 | $tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time |
| 2760 | - $ret = (int)(dol_now('gmt') + ($tzsecond * 3600)); |
|
| 2760 | + $ret = (int) (dol_now('gmt') + ($tzsecond * 3600)); |
|
| 2761 | 2761 | //} elseif ($mode == 'tzref') {// Time for now with parent company timezone is added |
| 2762 | 2762 | // require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; |
| 2763 | 2763 | // $tzsecond=getParentCompanyTimeZoneInt(); // Contains tz+dayling saving time |
@@ -2768,7 +2768,7 @@ discard block |
||
| 2768 | 2768 | //print 'time: '.time(); |
| 2769 | 2769 | $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; |
| 2770 | 2770 | $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; |
| 2771 | - $ret = (int)(dol_now('gmt') + ($offsettz + $offsetdst)); |
|
| 2771 | + $ret = (int) (dol_now('gmt') + ($offsettz + $offsetdst)); |
|
| 2772 | 2772 | } |
| 2773 | 2773 | |
| 2774 | 2774 | return $ret; |
@@ -2945,9 +2945,9 @@ discard block |
||
| 2945 | 2945 | if (empty($_SERVER['HTTP_X_FORWARDED_FOR']) || preg_match('/[^0-9\.\:,\[\]]/', $_SERVER['HTTP_X_FORWARDED_FOR'])) { |
| 2946 | 2946 | if (empty($_SERVER['HTTP_CLIENT_IP']) || preg_match('/[^0-9\.\:,\[\]]/', $_SERVER['HTTP_CLIENT_IP'])) { |
| 2947 | 2947 | if (empty($_SERVER["HTTP_CF_CONNECTING_IP"])) { |
| 2948 | - $ip = (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']); // value may have been the IP of the proxy and not the client |
|
| 2948 | + $ip = (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR']); // value may have been the IP of the proxy and not the client |
|
| 2949 | 2949 | } else { |
| 2950 | - $ip = $_SERVER["HTTP_CF_CONNECTING_IP"]; // value here may have been forged by client |
|
| 2950 | + $ip = $_SERVER["HTTP_CF_CONNECTING_IP"]; // value here may have been forged by client |
|
| 2951 | 2951 | } |
| 2952 | 2952 | } else { |
| 2953 | 2953 | $ip = $_SERVER['HTTP_CLIENT_IP']; // value is clean here but may have been forged by proxy |
@@ -3147,7 +3147,7 @@ discard block |
||
| 3147 | 3147 | if (count($mxhosts) > 1) { |
| 3148 | 3148 | return 1; |
| 3149 | 3149 | } |
| 3150 | - if (count($mxhosts) == 1 && !in_array((string)$mxhosts[0], array('', '.'))) { |
|
| 3150 | + if (count($mxhosts) == 1 && !in_array((string) $mxhosts[0], array('', '.'))) { |
|
| 3151 | 3151 | return 1; |
| 3152 | 3152 | } |
| 3153 | 3153 | |
@@ -4173,7 +4173,7 @@ discard block |
||
| 4173 | 4173 | } |
| 4174 | 4174 | // Si on depasse max |
| 4175 | 4175 | $max_nbdecimal = getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN'); |
| 4176 | - if ($trunc && $nbdecimal > (int)$max_nbdecimal) { |
|
| 4176 | + if ($trunc && $nbdecimal > (int) $max_nbdecimal) { |
|
| 4177 | 4177 | $nbdecimal = $max_nbdecimal; |
| 4178 | 4178 | if (preg_match('/\.\.\./i', $nbdecimal)) { |
| 4179 | 4179 | // Si un affichage est tronque, on montre des ... |
@@ -4182,7 +4182,7 @@ discard block |
||
| 4182 | 4182 | } |
| 4183 | 4183 | |
| 4184 | 4184 | // If force rounding |
| 4185 | - if ((string)$forcerounding != '-1') { |
|
| 4185 | + if ((string) $forcerounding != '-1') { |
|
| 4186 | 4186 | if ($forcerounding === 'MU') { |
| 4187 | 4187 | $nbdecimal = getDolGlobalString('MAIN_MAX_DECIMALS_UNIT'); |
| 4188 | 4188 | } elseif ($forcerounding === 'MT') { |
@@ -4193,7 +4193,7 @@ discard block |
||
| 4193 | 4193 | } |
| 4194 | 4194 | |
| 4195 | 4195 | // Format number |
| 4196 | - $output = number_format((float)$amount, $nbdecimal, $dec, $thousand); |
|
| 4196 | + $output = number_format((float) $amount, $nbdecimal, $dec, $thousand); |
|
| 4197 | 4197 | if ($form) { |
| 4198 | 4198 | $output = preg_replace('/\s/', ' ', $output); |
| 4199 | 4199 | $output = preg_replace('/\'/', ''', $output); |
@@ -4282,7 +4282,7 @@ discard block |
||
| 4282 | 4282 | $amount = preg_replace('/[a-zA-Z\/\\\*\(\)\<\>\_]/', '', $amount); |
| 4283 | 4283 | } |
| 4284 | 4284 | |
| 4285 | - if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string)$amount)) { // It means the . is used as a thousand separator and string come from input data, so 1.123 is 1123 |
|
| 4285 | + if ($option == 2 && $thousand == '.' && preg_match('/\.(\d\d\d)$/', (string) $amount)) { // It means the . is used as a thousand separator and string come from input data, so 1.123 is 1123 |
|
| 4286 | 4286 | $amount = str_replace($thousand, '', $amount); |
| 4287 | 4287 | } |
| 4288 | 4288 | |
@@ -4307,7 +4307,7 @@ discard block |
||
| 4307 | 4307 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
| 4308 | 4308 | $amount = str_replace($dec, '.', $amount); |
| 4309 | 4309 | |
| 4310 | - $amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example. |
|
| 4310 | + $amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example. |
|
| 4311 | 4311 | } |
| 4312 | 4312 | //print ' XX'.$amount.' '.$rounding; |
| 4313 | 4313 | |
@@ -4323,14 +4323,14 @@ discard block |
||
| 4323 | 4323 | } elseif ($rounding == 'CU') { |
| 4324 | 4324 | $nbofdectoround = max(getDolGlobalString('MAIN_MAX_DECIMALS_UNIT'), 8); // TODO Use param of currency |
| 4325 | 4325 | } elseif ($rounding == 'CT') { |
| 4326 | - $nbofdectoround = max(getDolGlobalString('MAIN_MAX_DECIMALS_TOT'), 8); // TODO Use param of currency |
|
| 4326 | + $nbofdectoround = max(getDolGlobalString('MAIN_MAX_DECIMALS_TOT'), 8); // TODO Use param of currency |
|
| 4327 | 4327 | } elseif (is_numeric($rounding)) { |
| 4328 | - $nbofdectoround = (int)$rounding; |
|
| 4328 | + $nbofdectoround = (int) $rounding; |
|
| 4329 | 4329 | } |
| 4330 | 4330 | |
| 4331 | 4331 | //print " RR".$amount.' - '.$nbofdectoround.'<br>'; |
| 4332 | 4332 | if (dol_strlen($nbofdectoround)) { |
| 4333 | - $amount = round(is_string($amount) ? (float)$amount : $amount, $nbofdectoround); // $nbofdectoround can be 0. |
|
| 4333 | + $amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0. |
|
| 4334 | 4334 | } else { |
| 4335 | 4335 | return 'ErrorBadParameterProvidedToFunction'; |
| 4336 | 4336 | } |
@@ -4357,7 +4357,7 @@ discard block |
||
| 4357 | 4357 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
| 4358 | 4358 | $amount = str_replace($dec, '.', $amount); |
| 4359 | 4359 | |
| 4360 | - $amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example. |
|
| 4360 | + $amount = preg_replace('/[^0-9\-\.]/', '', $amount); // Clean non numeric chars (so it clean some UTF8 spaces for example. |
|
| 4361 | 4361 | } |
| 4362 | 4362 | |
| 4363 | 4363 | return $amount; |
@@ -4437,7 +4437,7 @@ discard block |
||
| 4437 | 4437 | |
| 4438 | 4438 | $vatratecleaned = $vatrate; |
| 4439 | 4439 | $reg = array(); |
| 4440 | - if (preg_match('/^(.*)\s*\((.*)\)$/', (string)$vatrate, $reg)) { // If vat is "xx (yy)" |
|
| 4440 | + if (preg_match('/^(.*)\s*\((.*)\)$/', (string) $vatrate, $reg)) { // If vat is "xx (yy)" |
|
| 4441 | 4441 | $vatratecleaned = trim($reg[1]); |
| 4442 | 4442 | $vatratecode = $reg[2]; |
| 4443 | 4443 | } |
@@ -4450,7 +4450,7 @@ discard block |
||
| 4450 | 4450 | // Some test to guess with no need to make database access |
| 4451 | 4451 | if ($mysoc->country_code == 'ES') { // For spain localtaxes 1 and 2, tax is qualified if buyer use local tax |
| 4452 | 4452 | if ($local == 1) { |
| 4453 | - if (!$mysoc->localtax1_assuj || (string)$vatratecleaned == "0") { |
|
| 4453 | + if (!$mysoc->localtax1_assuj || (string) $vatratecleaned == "0") { |
|
| 4454 | 4454 | return 0; |
| 4455 | 4455 | } |
| 4456 | 4456 | if ($thirdparty_seller->id == $mysoc->id) { |
@@ -4526,7 +4526,7 @@ discard block |
||
| 4526 | 4526 | $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; |
| 4527 | 4527 | $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c"; |
| 4528 | 4528 | $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $db->escape($thirdparty_seller->country_code) . "'"; |
| 4529 | - $sql .= " AND t.taux = " . ((float)$vatratecleaned) . " AND t.active = 1"; |
|
| 4529 | + $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
|
| 4530 | 4530 | $sql .= " AND t.entity IN (" . getEntity('c_tva') . ")"; |
| 4531 | 4531 | if (!empty($vatratecode)) { |
| 4532 | 4532 | $sql .= " AND t.code ='" . $db->escape($vatratecode) . "'"; // If we have the code, we use it in priority |
@@ -4626,7 +4626,7 @@ discard block |
||
| 4626 | 4626 | $sql .= " t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type"; |
| 4627 | 4627 | $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t"; |
| 4628 | 4628 | if ($firstparamisid) { |
| 4629 | - $sql .= " WHERE t.rowid = " . (int)$vatrate; |
|
| 4629 | + $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
| 4630 | 4630 | } else { |
| 4631 | 4631 | $vatratecleaned = $vatrate; |
| 4632 | 4632 | $vatratecode = ''; |
@@ -4640,7 +4640,7 @@ discard block |
||
| 4640 | 4640 | /*if ($mysoc->country_code == 'ES') $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($buyer->country_code)."'"; // vat in spain use the buyer country ?? |
| 4641 | 4641 | else $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$db->escape($seller->country_code)."'";*/ |
| 4642 | 4642 | $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $db->escape($seller->country_code) . "'"; |
| 4643 | - $sql .= " AND t.taux = " . ((float)$vatratecleaned) . " AND t.active = 1"; |
|
| 4643 | + $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
|
| 4644 | 4644 | $sql .= " AND t.entity IN (" . getEntity('c_tva') . ")"; |
| 4645 | 4645 | if ($vatratecode) { |
| 4646 | 4646 | $sql .= " AND t.code = '" . $db->escape($vatratecode) . "'"; |
@@ -4699,7 +4699,7 @@ discard block |
||
| 4699 | 4699 | $sql = "SELECT t.taux as rate, t.code, t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; |
| 4700 | 4700 | $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t"; |
| 4701 | 4701 | if ($firstparamisid) { |
| 4702 | - $sql .= " WHERE t.rowid = " . (int)$vatrate; |
|
| 4702 | + $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
| 4703 | 4703 | } else { |
| 4704 | 4704 | $vatratecleaned = $vatrate; |
| 4705 | 4705 | $vatratecode = ''; |
@@ -4717,7 +4717,7 @@ discard block |
||
| 4717 | 4717 | $countrycodetouse = ((empty($seller) || empty($seller->country_code)) ? $mysoc->country_code : $seller->country_code); |
| 4718 | 4718 | $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $db->escape($countrycodetouse) . "'"; |
| 4719 | 4719 | } |
| 4720 | - $sql .= " AND t.taux = " . ((float)$vatratecleaned) . " AND t.active = 1"; |
|
| 4720 | + $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
|
| 4721 | 4721 | if ($vatratecode) { |
| 4722 | 4722 | $sql .= " AND t.code = '" . $db->escape($vatratecode) . "'"; |
| 4723 | 4723 | } |
@@ -4783,7 +4783,7 @@ discard block |
||
| 4783 | 4783 | } |
| 4784 | 4784 | } |
| 4785 | 4785 | if (!$found) { |
| 4786 | - $ret = $product->tva_tx; // Default sales vat of product |
|
| 4786 | + $ret = $product->tva_tx; // Default sales vat of product |
|
| 4787 | 4787 | if ($product->default_vat_code) { |
| 4788 | 4788 | $ret .= ' (' . $product->default_vat_code . ')'; |
| 4789 | 4789 | } |
@@ -4934,7 +4934,7 @@ discard block |
||
| 4934 | 4934 | $buyer_country_code = $thirdparty_buyer->country_code; |
| 4935 | 4935 | $buyer_in_cee = isInEEC($thirdparty_buyer); |
| 4936 | 4936 | |
| 4937 | - dol_syslog("get_default_tva: seller use vat=" . $seller_use_vat . ", seller country=" . $seller_country_code . ", seller in cee=" . ((string)(int)$seller_in_cee) . ", buyer vat number=" . $thirdparty_buyer->tva_intra . " buyer country=" . $buyer_country_code . ", buyer in cee=" . ((string)(int)$buyer_in_cee) . ", idprod=" . $idprod . ", idprodfournprice=" . $idprodfournprice . ", SERVICE_ARE_ECOMMERCE_200238EC=" . (getDolGlobalString('SERVICES_ARE_ECOMMERCE_200238EC') ? $conf->global->SERVICES_ARE_ECOMMERCE_200238EC : '')); |
|
| 4937 | + dol_syslog("get_default_tva: seller use vat=" . $seller_use_vat . ", seller country=" . $seller_country_code . ", seller in cee=" . ((string) (int) $seller_in_cee) . ", buyer vat number=" . $thirdparty_buyer->tva_intra . " buyer country=" . $buyer_country_code . ", buyer in cee=" . ((string) (int) $buyer_in_cee) . ", idprod=" . $idprod . ", idprodfournprice=" . $idprodfournprice . ", SERVICE_ARE_ECOMMERCE_200238EC=" . (getDolGlobalString('SERVICES_ARE_ECOMMERCE_200238EC') ? $conf->global->SERVICES_ARE_ECOMMERCE_200238EC : '')); |
|
| 4938 | 4938 | |
| 4939 | 4939 | // If services are eServices according to EU Council Directive 2002/38/EC (http://ec.europa.eu/taxation_customs/taxation/vat/traders/e-commerce/article_1610_en.htm) |
| 4940 | 4940 | // we use the buyer VAT. |
@@ -5177,7 +5177,7 @@ discard block |
||
| 5177 | 5177 | // In a future, we may distribute directories on several levels depending on setup and object. |
| 5178 | 5178 | // Here, $object->id, $object->ref and $modulepart are required. |
| 5179 | 5179 | //var_dump($modulepart); |
| 5180 | - $path = dol_sanitizeFileName(empty($object->ref) ? (string)((is_object($object) && property_exists($object, 'id')) ? $object->id : '') : $object->ref); |
|
| 5180 | + $path = dol_sanitizeFileName(empty($object->ref) ? (string) ((is_object($object) && property_exists($object, 'id')) ? $object->id : '') : $object->ref); |
|
| 5181 | 5181 | } |
| 5182 | 5182 | |
| 5183 | 5183 | if (empty($withoutslash) && !empty($path)) { |
@@ -5237,7 +5237,7 @@ discard block |
||
| 5237 | 5237 | dol_syslog("functions.lib::dol_mkdir: Directory '" . $ccdir . "' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG); |
| 5238 | 5238 | |
| 5239 | 5239 | umask(0); |
| 5240 | - $dirmaskdec = octdec((string)$newmask); |
|
| 5240 | + $dirmaskdec = octdec((string) $newmask); |
|
| 5241 | 5241 | if (empty($newmask)) { |
| 5242 | 5242 | $dirmaskdec = !getDolGlobalString('MAIN_UMASK') ? octdec('0755') : octdec($conf->global->MAIN_UMASK); |
| 5243 | 5243 | } |
@@ -5456,7 +5456,7 @@ discard block |
||
| 5456 | 5456 | } |
| 5457 | 5457 | $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
| 5458 | 5458 | |
| 5459 | - $nblines = (int)floor((count($a) + 1) / 2); |
|
| 5459 | + $nblines = (int) floor((count($a) + 1) / 2); |
|
| 5460 | 5460 | // count possible auto line breaks |
| 5461 | 5461 | if ($maxlinesize) { |
| 5462 | 5462 | foreach ($a as $line) { |
@@ -5592,26 +5592,26 @@ discard block |
||
| 5592 | 5592 | $emailsendersignature = $user->signature; // dy default, we use the signature of current user. We must complete substitution with signature in c_email_senderprofile of array after calling getCommonSubstitutionArray() |
| 5593 | 5593 | $usersignature = $user->signature; |
| 5594 | 5594 | $substitutionarray = array_merge($substitutionarray, array( |
| 5595 | - '__SENDEREMAIL_SIGNATURE__' => (string)((!getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? ($onlykey == 2 ? dol_trunc('SignatureFromTheSelectedSenderProfile', 30) : $emailsendersignature) : ''), |
|
| 5596 | - '__USER_SIGNATURE__' => (string)(($usersignature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($usersignature), 30) : $usersignature) : '') |
|
| 5595 | + '__SENDEREMAIL_SIGNATURE__' => (string) ((!getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? ($onlykey == 2 ? dol_trunc('SignatureFromTheSelectedSenderProfile', 30) : $emailsendersignature) : ''), |
|
| 5596 | + '__USER_SIGNATURE__' => (string) (($usersignature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? ($onlykey == 2 ? dol_trunc(dol_string_nohtmltag($usersignature), 30) : $usersignature) : '') |
|
| 5597 | 5597 | )); |
| 5598 | 5598 | |
| 5599 | 5599 | if (is_object($user) && ($user instanceof User)) { |
| 5600 | 5600 | $substitutionarray = array_merge($substitutionarray, array( |
| 5601 | - '__USER_ID__' => (string)$user->id, |
|
| 5602 | - '__USER_LOGIN__' => (string)$user->login, |
|
| 5603 | - '__USER_EMAIL__' => (string)$user->email, |
|
| 5604 | - '__USER_PHONE__' => (string)dol_print_phone($user->office_phone, '', 0, 0, '', " ", '', '', -1), |
|
| 5605 | - '__USER_PHONEPRO__' => (string)dol_print_phone($user->user_mobile, '', 0, 0, '', " ", '', '', -1), |
|
| 5606 | - '__USER_PHONEMOBILE__' => (string)dol_print_phone($user->personal_mobile, '', 0, 0, '', " ", '', '', -1), |
|
| 5607 | - '__USER_FAX__' => (string)$user->office_fax, |
|
| 5608 | - '__USER_LASTNAME__' => (string)$user->lastname, |
|
| 5609 | - '__USER_FIRSTNAME__' => (string)$user->firstname, |
|
| 5610 | - '__USER_FULLNAME__' => (string)$user->getFullName($outputlangs), |
|
| 5611 | - '__USER_SUPERVISOR_ID__' => (string)($user->fk_user ? $user->fk_user : '0'), |
|
| 5612 | - '__USER_JOB__' => (string)$user->job, |
|
| 5613 | - '__USER_REMOTE_IP__' => (string)getUserRemoteIP(), |
|
| 5614 | - '__USER_VCARD_URL__' => (string)$user->getOnlineVirtualCardUrl('', 'external') |
|
| 5601 | + '__USER_ID__' => (string) $user->id, |
|
| 5602 | + '__USER_LOGIN__' => (string) $user->login, |
|
| 5603 | + '__USER_EMAIL__' => (string) $user->email, |
|
| 5604 | + '__USER_PHONE__' => (string) dol_print_phone($user->office_phone, '', 0, 0, '', " ", '', '', -1), |
|
| 5605 | + '__USER_PHONEPRO__' => (string) dol_print_phone($user->user_mobile, '', 0, 0, '', " ", '', '', -1), |
|
| 5606 | + '__USER_PHONEMOBILE__' => (string) dol_print_phone($user->personal_mobile, '', 0, 0, '', " ", '', '', -1), |
|
| 5607 | + '__USER_FAX__' => (string) $user->office_fax, |
|
| 5608 | + '__USER_LASTNAME__' => (string) $user->lastname, |
|
| 5609 | + '__USER_FIRSTNAME__' => (string) $user->firstname, |
|
| 5610 | + '__USER_FULLNAME__' => (string) $user->getFullName($outputlangs), |
|
| 5611 | + '__USER_SUPERVISOR_ID__' => (string) ($user->fk_user ? $user->fk_user : '0'), |
|
| 5612 | + '__USER_JOB__' => (string) $user->job, |
|
| 5613 | + '__USER_REMOTE_IP__' => (string) getUserRemoteIP(), |
|
| 5614 | + '__USER_VCARD_URL__' => (string) $user->getOnlineVirtualCardUrl('', 'external') |
|
| 5615 | 5615 | )); |
| 5616 | 5616 | } |
| 5617 | 5617 | } |
@@ -5632,7 +5632,7 @@ discard block |
||
| 5632 | 5632 | '__MYCOMPANY_PROFID9__' => $mysoc->idprof9, |
| 5633 | 5633 | '__MYCOMPANY_PROFID10__' => $mysoc->idprof10, |
| 5634 | 5634 | '__MYCOMPANY_CAPITAL__' => $mysoc->capital, |
| 5635 | - '__MYCOMPANY_FULLADDRESS__' => (method_exists($mysoc, 'getFullAddress') ? $mysoc->getFullAddress(1, ', ') : ''), // $mysoc may be stdClass |
|
| 5635 | + '__MYCOMPANY_FULLADDRESS__' => (method_exists($mysoc, 'getFullAddress') ? $mysoc->getFullAddress(1, ', ') : ''), // $mysoc may be stdClass |
|
| 5636 | 5636 | '__MYCOMPANY_ADDRESS__' => $mysoc->address, |
| 5637 | 5637 | '__MYCOMPANY_ZIP__' => $mysoc->zip, |
| 5638 | 5638 | '__MYCOMPANY_TOWN__' => $mysoc->town, |
@@ -6004,7 +6004,7 @@ discard block |
||
| 6004 | 6004 | $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = dol_print_phone($object->array_options['options_' . $key]); |
| 6005 | 6005 | } elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'price') { |
| 6006 | 6006 | $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key]; |
| 6007 | - $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '_FORMATED__'] = price($object->array_options['options_' . $key]); // For compatibility |
|
| 6007 | + $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '_FORMATED__'] = price($object->array_options['options_' . $key]); // For compatibility |
|
| 6008 | 6008 | $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '_FORMATTED__'] = price($object->array_options['options_' . $key]); |
| 6009 | 6009 | } elseif ($extrafields->attributes[$object->table_element]['type'][$key] != 'separator') { |
| 6010 | 6010 | $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = !empty($object->array_options['options_' . $key]) ? $object->array_options['options_' . $key] : ''; |
@@ -6219,26 +6219,26 @@ discard block |
||
| 6219 | 6219 | $daytext = $outputlangs->trans('Day' . $tmp['wday']); |
| 6220 | 6220 | |
| 6221 | 6221 | $substitutionarray = array_merge($substitutionarray, array( |
| 6222 | - '__NOW_TMS__' => (string)$now, // Must be the string that represent the int |
|
| 6222 | + '__NOW_TMS__' => (string) $now, // Must be the string that represent the int |
|
| 6223 | 6223 | '__NOW_TMS_YMD__' => dol_print_date($now, 'day', 'auto', $outputlangs), |
| 6224 | - '__DAY__' => (string)$tmp['mday'], |
|
| 6224 | + '__DAY__' => (string) $tmp['mday'], |
|
| 6225 | 6225 | '__DAY_TEXT__' => $daytext, // Monday |
| 6226 | 6226 | '__DAY_TEXT_SHORT__' => dol_trunc($daytext, 3, 'right', 'UTF-8', 1), // Mon |
| 6227 | 6227 | '__DAY_TEXT_MIN__' => dol_trunc($daytext, 1, 'right', 'UTF-8', 1), // M |
| 6228 | - '__MONTH__' => (string)$tmp['mon'], |
|
| 6228 | + '__MONTH__' => (string) $tmp['mon'], |
|
| 6229 | 6229 | '__MONTH_TEXT__' => $outputlangs->trans('Month' . sprintf("%02d", $tmp['mon'])), |
| 6230 | 6230 | '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort' . sprintf("%02d", $tmp['mon'])), |
| 6231 | 6231 | '__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort' . sprintf("%02d", $tmp['mon'])), |
| 6232 | - '__YEAR__' => (string)$tmp['year'], |
|
| 6233 | - '__PREVIOUS_DAY__' => (string)$tmp2['day'], |
|
| 6234 | - '__PREVIOUS_MONTH__' => (string)$tmp3['month'], |
|
| 6235 | - '__PREVIOUS_YEAR__' => (string)($tmp['year'] - 1), |
|
| 6236 | - '__NEXT_DAY__' => (string)$tmp4['day'], |
|
| 6237 | - '__NEXT_MONTH__' => (string)$tmp5['month'], |
|
| 6232 | + '__YEAR__' => (string) $tmp['year'], |
|
| 6233 | + '__PREVIOUS_DAY__' => (string) $tmp2['day'], |
|
| 6234 | + '__PREVIOUS_MONTH__' => (string) $tmp3['month'], |
|
| 6235 | + '__PREVIOUS_YEAR__' => (string) ($tmp['year'] - 1), |
|
| 6236 | + '__NEXT_DAY__' => (string) $tmp4['day'], |
|
| 6237 | + '__NEXT_MONTH__' => (string) $tmp5['month'], |
|
| 6238 | 6238 | '__NEXT_MONTH_TEXT__' => $outputlangs->trans('Month' . sprintf("%02d", $tmp5['month'])), |
| 6239 | 6239 | '__NEXT_MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort' . sprintf("%02d", $tmp5['month'])), |
| 6240 | 6240 | '__NEXT_MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort' . sprintf("%02d", $tmp5['month'])), |
| 6241 | - '__NEXT_YEAR__' => (string)($tmp['year'] + 1), |
|
| 6241 | + '__NEXT_YEAR__' => (string) ($tmp['year'] + 1), |
|
| 6242 | 6242 | )); |
| 6243 | 6243 | } |
| 6244 | 6244 | |
@@ -6406,7 +6406,7 @@ discard block |
||
| 6406 | 6406 | $path = $param_arr[0]; |
| 6407 | 6407 | $class = $param_arr[1]; |
| 6408 | 6408 | $method = $param_arr[2]; |
| 6409 | - $id = (int)$param_arr[3]; |
|
| 6409 | + $id = (int) $param_arr[3]; |
|
| 6410 | 6410 | |
| 6411 | 6411 | // load class file and init object list in memory |
| 6412 | 6412 | if (!isset($memory_object_list[$class])) { |
@@ -6468,7 +6468,7 @@ discard block |
||
| 6468 | 6468 | // Note: substitution key for each extrafields, using key __EXTRA_XXX__ is already available into the getCommonSubstitutionArray used to build the substitution array. |
| 6469 | 6469 | |
| 6470 | 6470 | // Check if there is external substitution to do, requested by plugins |
| 6471 | - $dirsubstitutions = array_merge(array(), (array)$conf->modules_parts['substitutions']); |
|
| 6471 | + $dirsubstitutions = array_merge(array(), (array) $conf->modules_parts['substitutions']); |
|
| 6472 | 6472 | |
| 6473 | 6473 | foreach ($dirsubstitutions as $reldir) { |
| 6474 | 6474 | $dir = dol_buildpath($reldir, 0); |
@@ -6611,7 +6611,7 @@ discard block |
||
| 6611 | 6611 | { |
| 6612 | 6612 | //dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function |
| 6613 | 6613 | if (!is_array($mesgs)) { |
| 6614 | - $mesgs = trim((string)$mesgs); |
|
| 6614 | + $mesgs = trim((string) $mesgs); |
|
| 6615 | 6615 | // If mesgs is a not an empty string |
| 6616 | 6616 | if ($mesgs) { |
| 6617 | 6617 | if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesgs, $_SESSION['dol_events'][$style])) { |
@@ -6622,7 +6622,7 @@ discard block |
||
| 6622 | 6622 | } else { |
| 6623 | 6623 | // If mesgs is an array |
| 6624 | 6624 | foreach ($mesgs as $mesg) { |
| 6625 | - $mesg = trim((string)$mesg); |
|
| 6625 | + $mesg = trim((string) $mesg); |
|
| 6626 | 6626 | if ($mesg) { |
| 6627 | 6627 | if (!empty($noduplicate) && isset($_SESSION['dol_events'][$style]) && in_array($mesg, $_SESSION['dol_events'][$style])) { |
| 6628 | 6628 | return; |
@@ -6656,7 +6656,7 @@ discard block |
||
| 6656 | 6656 | $mesg .= ''; |
| 6657 | 6657 | } |
| 6658 | 6658 | if (empty($messagekey) || empty($_COOKIE["DOLHIDEMESSAGE" . $messagekey])) { |
| 6659 | - if (!in_array((string)$style, array('mesgs', 'warnings', 'errors'))) { |
|
| 6659 | + if (!in_array((string) $style, array('mesgs', 'warnings', 'errors'))) { |
|
| 6660 | 6660 | dol_print_error(null, 'Bad parameter style=' . $style . ' for setEventMessages'); |
| 6661 | 6661 | } |
| 6662 | 6662 | if (empty($mesgs)) { |
@@ -6701,7 +6701,7 @@ discard block |
||
| 6701 | 6701 | $temp[$key] = empty($array[$key][$index]) ? 0 : $array[$key][$index]; |
| 6702 | 6702 | } |
| 6703 | 6703 | if ($natsort == -1) { |
| 6704 | - $temp[$key] = '___' . $temp[$key]; // We add a string at begin of value to force an alpha order when using asort. |
|
| 6704 | + $temp[$key] = '___' . $temp[$key]; // We add a string at begin of value to force an alpha order when using asort. |
|
| 6705 | 6705 | } |
| 6706 | 6706 | } |
| 6707 | 6707 | |
@@ -6744,7 +6744,7 @@ discard block |
||
| 6744 | 6744 | */ |
| 6745 | 6745 | function utf8_check($str) |
| 6746 | 6746 | { |
| 6747 | - $str = (string)$str; // Sometimes string is an int. |
|
| 6747 | + $str = (string) $str; // Sometimes string is an int. |
|
| 6748 | 6748 | |
| 6749 | 6749 | // We must use here a binary strlen function (so not dol_strlen) |
| 6750 | 6750 | $strLength = strlen($str); |
@@ -6939,7 +6939,7 @@ discard block |
||
| 6939 | 6939 | if (isset($strToEvaluate) && $strToEvaluate !== '') { |
| 6940 | 6940 | //var_dump($strToEvaluate); |
| 6941 | 6941 | //$rep = dol_eval($strToEvaluate, 1, 0, '1'); // to show the error |
| 6942 | - $rep = (int)dol_eval($strToEvaluate, 1, 1, $onlysimplestring); // The dol_eval() must contains all the "global $xxx;" for all variables $xxx found into the string condition |
|
| 6942 | + $rep = (int) dol_eval($strToEvaluate, 1, 1, $onlysimplestring); // The dol_eval() must contains all the "global $xxx;" for all variables $xxx found into the string condition |
|
| 6943 | 6943 | $rights = $rep && (!is_string($rep) || strpos($rep, 'Bad string syntax to evaluate') === false); |
| 6944 | 6944 | //var_dump($rights); |
| 6945 | 6945 | } |
@@ -6963,17 +6963,17 @@ discard block |
||
| 6963 | 6963 | function dol_eval($s, $returnvalue = 1, $hideerrors = 1, $onlysimplestring = '1') |
| 6964 | 6964 | { |
| 6965 | 6965 | // Only this global variables can be read by eval function and returned to caller |
| 6966 | - global $conf; // Read of const is done with getDolGlobalString() but we need $conf->currency for example |
|
| 6966 | + global $conf; // Read of const is done with getDolGlobalString() but we need $conf->currency for example |
|
| 6967 | 6967 | global $db, $langs, $user, $website, $websitepage; |
| 6968 | 6968 | global $action, $mainmenu, $leftmenu; |
| 6969 | 6969 | global $mysoc; |
| 6970 | - global $objectoffield; // To allow the use of $objectoffield in computed fields |
|
| 6970 | + global $objectoffield; // To allow the use of $objectoffield in computed fields |
|
| 6971 | 6971 | |
| 6972 | 6972 | // Old variables used |
| 6973 | 6973 | global $object; |
| 6974 | 6974 | global $obj; // To get $obj used into list when dol_eval() is used for computed fields and $obj is not yet $object |
| 6975 | 6975 | |
| 6976 | - $isObBufferActive = false; // When true, the ObBuffer must be cleaned in the exception handler |
|
| 6976 | + $isObBufferActive = false; // When true, the ObBuffer must be cleaned in the exception handler |
|
| 6977 | 6977 | if (!in_array($onlysimplestring, array('0', '1', '2'))) { |
| 6978 | 6978 | return "Bad call of dol_eval. Parameter onlysimplestring must be '0' (deprecated), '1' or '2'"; |
| 6979 | 6979 | } |
@@ -7004,11 +7004,11 @@ discard block |
||
| 7004 | 7004 | while ($scheck && $savescheck != $scheck) { |
| 7005 | 7005 | $savescheck = $scheck; |
| 7006 | 7006 | $scheck = preg_replace('/->[a-zA-Z0-9_]+\(/', '->__METHOD__', $scheck); // accept parenthesis in '...->method(...' |
| 7007 | - $scheck = preg_replace('/^\(/', '__PARENTHESIS__ ', $scheck); // accept parenthesis in '(...'. Must replace with __PARENTHESIS__ with a space after to allow following substitutions |
|
| 7008 | - $scheck = preg_replace('/\s\(/', '__PARENTHESIS__ ', $scheck); // accept parenthesis in '... ('. Must replace with __PARENTHESIS__ with a space after to allow following substitutions |
|
| 7007 | + $scheck = preg_replace('/^\(/', '__PARENTHESIS__ ', $scheck); // accept parenthesis in '(...'. Must replace with __PARENTHESIS__ with a space after to allow following substitutions |
|
| 7008 | + $scheck = preg_replace('/\s\(/', '__PARENTHESIS__ ', $scheck); // accept parenthesis in '... ('. Must replace with __PARENTHESIS__ with a space after to allow following substitutions |
|
| 7009 | 7009 | $scheck = preg_replace('/^!?[a-zA-Z0-9_]+\(/', '__FUNCTION__', $scheck); // accept parenthesis in 'function(' and '!function(' |
| 7010 | 7010 | $scheck = preg_replace('/\s!?[a-zA-Z0-9_]+\(/', '__FUNCTION__', $scheck); // accept parenthesis in '... function(' and '... !function(' |
| 7011 | - $scheck = preg_replace('/(\^|\')\(/', '__REGEXSTART__', $scheck); // To allow preg_match('/^(aaa|bbb)/'... or isStringVarMatching('leftmenu', '(aaa|bbb)') |
|
| 7011 | + $scheck = preg_replace('/(\^|\')\(/', '__REGEXSTART__', $scheck); // To allow preg_match('/^(aaa|bbb)/'... or isStringVarMatching('leftmenu', '(aaa|bbb)') |
|
| 7012 | 7012 | } |
| 7013 | 7013 | //print 'scheck='.$scheck." : ".strpos($scheck, '(')."<br>\n"; |
| 7014 | 7014 | if (strpos($scheck, '(') !== false) { |
@@ -7065,7 +7065,7 @@ discard block |
||
| 7065 | 7065 | $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities |
| 7066 | 7066 | $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_compress_dir", "dol_decode", "dol_delete_file", "dol_delete_dir", "dol_delete_dir_recursive", "dol_copy", "archiveOrBackupFile")); // more dolibarr functions |
| 7067 | 7067 | |
| 7068 | - $forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function |
|
| 7068 | + $forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function |
|
| 7069 | 7069 | |
| 7070 | 7070 | $forbiddenphpregex = 'global\s+\$|\b(' . implode('|', $forbiddenphpfunctions) . ')\b'; |
| 7071 | 7071 | |
@@ -7283,8 +7283,8 @@ discard block |
||
| 7283 | 7283 | 'en-GB', |
| 7284 | 7284 | 'en-IE', |
| 7285 | 7285 | 'en-IN', |
| 7286 | - 'as-IN', // as-IN must be after en-IN (en in priority if country is IN) |
|
| 7287 | - 'bn-IN', // bn-IN must be after en-IN (en in priority if country is IN) |
|
| 7286 | + 'as-IN', // as-IN must be after en-IN (en in priority if country is IN) |
|
| 7287 | + 'bn-IN', // bn-IN must be after en-IN (en in priority if country is IN) |
|
| 7288 | 7288 | 'en-JM', |
| 7289 | 7289 | 'en-MY', |
| 7290 | 7290 | 'en-NZ', |
@@ -7486,7 +7486,7 @@ discard block |
||
| 7486 | 7486 | if (!function_exists('getmypid')) { |
| 7487 | 7487 | return mt_rand(99900000, 99965535); |
| 7488 | 7488 | } else { |
| 7489 | - return getmypid(); // May be a number on 64 bits (depending on OS) |
|
| 7489 | + return getmypid(); // May be a number on 64 bits (depending on OS) |
|
| 7490 | 7490 | } |
| 7491 | 7491 | } |
| 7492 | 7492 | |
@@ -7533,15 +7533,15 @@ discard block |
||
| 7533 | 7533 | $fields = array($fields); |
| 7534 | 7534 | } |
| 7535 | 7535 | |
| 7536 | - $i1 = 0; // count the nb of and criteria added (all fields / criteria) |
|
| 7536 | + $i1 = 0; // count the nb of and criteria added (all fields / criteria) |
|
| 7537 | 7537 | foreach ($crits as $crit) { // Loop on each AND criteria |
| 7538 | 7538 | $crit = trim($crit); |
| 7539 | - $i2 = 0; // count the nb of valid criteria added for this this first criteria |
|
| 7539 | + $i2 = 0; // count the nb of valid criteria added for this this first criteria |
|
| 7540 | 7540 | $newres = ''; |
| 7541 | 7541 | foreach ($fields as $field) { |
| 7542 | 7542 | if ($mode == 1) { |
| 7543 | 7543 | $tmpcrits = explode('|', $crit); |
| 7544 | - $i3 = 0; // count the nb of valid criteria added for this current field |
|
| 7544 | + $i3 = 0; // count the nb of valid criteria added for this current field |
|
| 7545 | 7545 | foreach ($tmpcrits as $tmpcrit) { |
| 7546 | 7546 | if ($tmpcrit !== '0' && empty($tmpcrit)) { |
| 7547 | 7547 | continue; |
@@ -7561,7 +7561,7 @@ discard block |
||
| 7561 | 7561 | if ($newcrit != '') { |
| 7562 | 7562 | $numnewcrit = price2num($newcrit); |
| 7563 | 7563 | if (is_numeric($numnewcrit)) { |
| 7564 | - $newres .= $field . ' ' . $operator . ' ' . ((float)$numnewcrit); // should be a numeric |
|
| 7564 | + $newres .= $field . ' ' . $operator . ' ' . ((float) $numnewcrit); // should be a numeric |
|
| 7565 | 7565 | } else { |
| 7566 | 7566 | $newres .= '1 = 2'; // force false, we received a corrupted data |
| 7567 | 7567 | } |
@@ -7612,7 +7612,7 @@ discard block |
||
| 7612 | 7612 | } |
| 7613 | 7613 | } else { // $mode=0 |
| 7614 | 7614 | $tmpcrits = explode('|', $crit); |
| 7615 | - $i3 = 0; // count the nb of valid criteria added for the current couple criteria/field |
|
| 7615 | + $i3 = 0; // count the nb of valid criteria added for the current couple criteria/field |
|
| 7616 | 7616 | foreach ($tmpcrits as $tmpcrit) { // loop on each OR criteria |
| 7617 | 7617 | if ($tmpcrit !== '0' && empty($tmpcrit)) { |
| 7618 | 7618 | continue; |
@@ -7626,7 +7626,7 @@ discard block |
||
| 7626 | 7626 | } |
| 7627 | 7627 | |
| 7628 | 7628 | if (preg_match('/\.(id|rowid)$/', $field)) { // Special case for rowid that is sometimes a ref so used as a search field |
| 7629 | - $newres .= $field . " = " . (is_numeric($tmpcrit) ? ((float)$tmpcrit) : '0'); |
|
| 7629 | + $newres .= $field . " = " . (is_numeric($tmpcrit) ? ((float) $tmpcrit) : '0'); |
|
| 7630 | 7630 | } else { |
| 7631 | 7631 | $tmpcrit2 = $tmpcrit; |
| 7632 | 7632 | $tmpbefore = '%'; |
@@ -8131,7 +8131,7 @@ discard block |
||
| 8131 | 8131 | } |
| 8132 | 8132 | |
| 8133 | 8133 | // Return mimetype string |
| 8134 | - switch ((int)$mode) { |
|
| 8134 | + switch ((int) $mode) { |
|
| 8135 | 8135 | case 1: |
| 8136 | 8136 | $tmp = explode('/', $mime); |
| 8137 | 8137 | return (!empty($tmp[1]) ? $tmp[1] : $tmp[0]); |
@@ -8160,7 +8160,7 @@ discard block |
||
| 8160 | 8160 | { |
| 8161 | 8161 | global $conf, $db; |
| 8162 | 8162 | |
| 8163 | - $tablename = preg_replace('/^' . preg_quote(MAIN_DB_PREFIX, '/') . '/', '', $tablename); // Clean name of table for backward compatibility. |
|
| 8163 | + $tablename = preg_replace('/^' . preg_quote(MAIN_DB_PREFIX, '/') . '/', '', $tablename); // Clean name of table for backward compatibility. |
|
| 8164 | 8164 | |
| 8165 | 8165 | $dictvalues = (isset($conf->cache['dictvalues_' . $tablename]) ? $conf->cache['dictvalues_' . $tablename] : null); |
| 8166 | 8166 | |
@@ -8175,7 +8175,7 @@ discard block |
||
| 8175 | 8175 | $resql = $db->query($sql); |
| 8176 | 8176 | if ($resql) { |
| 8177 | 8177 | while ($obj = $db->fetch_object($resql)) { |
| 8178 | - $dictvalues[$obj->$rowidfield] = $obj; // $obj is stdClass |
|
| 8178 | + $dictvalues[$obj->$rowidfield] = $obj; // $obj is stdClass |
|
| 8179 | 8179 | } |
| 8180 | 8180 | } else { |
| 8181 | 8181 | dol_print_error($db); |
@@ -8279,7 +8279,7 @@ discard block |
||
| 8279 | 8279 | function roundUpToNextMultiple($n, $x = 5) |
| 8280 | 8280 | { |
| 8281 | 8281 | $result = (ceil($n) % $x === 0) ? ceil($n) : (round(($n + $x / 2) / $x) * $x); |
| 8282 | - return (int)$result; |
|
| 8282 | + return (int) $result; |
|
| 8283 | 8283 | } |
| 8284 | 8284 | |
| 8285 | 8285 | /** |
@@ -8356,7 +8356,7 @@ discard block |
||
| 8356 | 8356 | return $objecttmp; |
| 8357 | 8357 | } |
| 8358 | 8358 | } else { |
| 8359 | - return $objecttmp; // returned an object without fetch |
|
| 8359 | + return $objecttmp; // returned an object without fetch |
|
| 8360 | 8360 | } |
| 8361 | 8361 | } else { |
| 8362 | 8362 | return -1; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $sql = 'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id, ecm.filepath, ecm.filename'; |
| 61 | 61 | $sql .= ' FROM ' . MAIN_DB_PREFIX . 'ecm_files ecm'; |
| 62 | - $sql .= " WHERE ecm.filepath = 'agenda/" . ((int)$object->id) . "'"; |
|
| 62 | + $sql .= " WHERE ecm.filepath = 'agenda/" . ((int) $object->id) . "'"; |
|
| 63 | 63 | //$sql.= " ecm.src_object_type = '".$db->escape($object->element)."' AND ecm.src_object_id = ".((int) $object->id); // Old version didn't add object_type during upload |
| 64 | 64 | $sql .= ' ORDER BY ecm.position ASC'; |
| 65 | 65 | |
@@ -211,9 +211,9 @@ discard block |
||
| 211 | 211 | if (strtoupper($tmpescaped) == 'NULL') { |
| 212 | 212 | $tmpescaped = 'NULL'; |
| 213 | 213 | } elseif (is_int($tmpescaped)) { |
| 214 | - $tmpescaped = (int)$tmpescaped; |
|
| 214 | + $tmpescaped = (int) $tmpescaped; |
|
| 215 | 215 | } else { |
| 216 | - $tmpescaped = (float)$tmpescaped; |
|
| 216 | + $tmpescaped = (float) $tmpescaped; |
|
| 217 | 217 | } |
| 218 | 218 | } |
| 219 | 219 | |
@@ -248,20 +248,20 @@ discard block |
||
| 248 | 248 | $filter = '(' . $filter . ')'; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - $regexstring = '\(([a-zA-Z0-9_\.]+:[<>!=insotlke]+:[^\(\)]+)\)'; // Must be (aaa:bbb:...) with aaa is a field name (with alias or not) and bbb is one of this operator '=', '<', '>', '<=', '>=', '!=', 'in', 'notin', 'like', 'notlike', 'is', 'isnot' |
|
| 251 | + $regexstring = '\(([a-zA-Z0-9_\.]+:[<>!=insotlke]+:[^\(\)]+)\)'; // Must be (aaa:bbb:...) with aaa is a field name (with alias or not) and bbb is one of this operator '=', '<', '>', '<=', '>=', '!=', 'in', 'notin', 'like', 'notlike', 'is', 'isnot' |
|
| 252 | 252 | $firstandlastparenthesis = 0; |
| 253 | 253 | |
| 254 | 254 | if (!dolCheckFilters($filter, $errorstr, $firstandlastparenthesis)) { |
| 255 | 255 | if ($noerror) { |
| 256 | 256 | return '1 = 2'; |
| 257 | 257 | } else { |
| 258 | - return 'Filter syntax error - ' . $errorstr; // Bad balance of parenthesis, we return an error message or force a SQL not found |
|
| 258 | + return 'Filter syntax error - ' . $errorstr; // Bad balance of parenthesis, we return an error message or force a SQL not found |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | // Test the filter syntax |
| 263 | 263 | $t = preg_replace_callback('/' . $regexstring . '/i', 'dolForgeDummyCriteriaCallback', $filter); |
| 264 | - $t = str_replace(array('and', 'or', 'AND', 'OR', ' '), '', $t); // Remove the only strings allowed between each () criteria |
|
| 264 | + $t = str_replace(array('and', 'or', 'AND', 'OR', ' '), '', $t); // Remove the only strings allowed between each () criteria |
|
| 265 | 265 | // If the string result contains something else than '()', the syntax was wrong |
| 266 | 266 | |
| 267 | 267 | if (preg_match('/[^\(\)]/', $t)) { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | if ($noerror) { |
| 271 | 271 | return '1 = 2'; |
| 272 | 272 | } else { |
| 273 | - return 'Filter error - ' . $tmperrorstr; // Bad syntax of the search string, we return an error message or force a SQL not found |
|
| 273 | + return 'Filter error - ' . $tmperrorstr; // Bad syntax of the search string, we return an error message or force a SQL not found |
|
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $ret = str_replace('__NOW__', $db->idate(dol_now()), $ret); |
| 281 | 281 | } |
| 282 | 282 | if (is_object($user)) { |
| 283 | - $ret = str_replace('__USER_ID__', (string)$user->id, $ret); |
|
| 283 | + $ret = str_replace('__USER_ID__', (string) $user->id, $ret); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | return $ret; |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | return ''; |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - return '()'; // An empty criteria |
|
| 434 | + return '()'; // An empty criteria |
|
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | /** |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | $form = new Form($db); |
| 64 | 64 | |
| 65 | - $templatenameforexport = $website->name_template; // Example 'website_template-corporate' |
|
| 65 | + $templatenameforexport = $website->name_template; // Example 'website_template-corporate' |
|
| 66 | 66 | if (empty($templatenameforexport)) { |
| 67 | 67 | $templatenameforexport = 'website_' . $website->ref; |
| 68 | 68 | } |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | } else { |
| 659 | 659 | $width = 14; |
| 660 | 660 | $cssclass = 'photorefcenter'; |
| 661 | - $picto = $object->picto; // @phan-suppress-current-line PhanUndeclaredProperty |
|
| 661 | + $picto = $object->picto; // @phan-suppress-current-line PhanUndeclaredProperty |
|
| 662 | 662 | $prefix = 'object_'; |
| 663 | 663 | if ($object->element == 'project' && !$object->public) { // @phan-suppress-current-line PhanUndeclaredProperty |
| 664 | 664 | $picto = 'project'; // instead of projectpub |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | } |
| 769 | 769 | // Show address and email |
| 770 | 770 | if (method_exists($object, 'getBannerAddress') && !in_array($object->element, array('product', 'bookmark', 'ecm_directories', 'ecm_files'))) { |
| 771 | - $moreaddress = $object->getBannerAddress('refaddress', $object); // address, email, url, social networks |
|
| 771 | + $moreaddress = $object->getBannerAddress('refaddress', $object); // address, email, url, social networks |
|
| 772 | 772 | if ($moreaddress) { |
| 773 | 773 | $morehtmlref .= '<div class="refidno refaddress">'; |
| 774 | 774 | $morehtmlref .= $moreaddress; |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | 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)) { |
| 779 | 779 | $morehtmlref .= '<div style="clear: both;"></div>'; |
| 780 | 780 | $morehtmlref .= '<div class="refidno opacitymedium">'; |
| 781 | - $morehtmlref .= $langs->trans("TechnicalID") . ': ' . ((int)$object->id); |
|
| 781 | + $morehtmlref .= $langs->trans("TechnicalID") . ': ' . ((int) $object->id); |
|
| 782 | 782 | $morehtmlref .= '</div>'; |
| 783 | 783 | } |
| 784 | 784 | |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | $type = 'AC_EMAIL'; |
| 937 | 937 | $linktoaddaction = ''; |
| 938 | 938 | if (getDolGlobalString('AGENDA_ADDACTIONFOREMAIL')) { |
| 939 | - $linktoaddaction = '<a href="' . constant('BASE_URL') . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . urlencode($type) . '&contactid=' . ((int)$cid) . '&socid=' . ((int)$socid) . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
| 939 | + $linktoaddaction = '<a href="' . constant('BASE_URL') . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . urlencode($type) . '&contactid=' . ((int) $cid) . '&socid=' . ((int) $socid) . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
| 940 | 940 | } |
| 941 | 941 | if ($linktoaddaction) { |
| 942 | 942 | $newemail = '<div>' . $newemail . ' ' . $linktoaddaction . '</div>'; |
@@ -1316,7 +1316,7 @@ discard block |
||
| 1316 | 1316 | $url = make_substitutions($url, $substitarray); |
| 1317 | 1317 | if (!getDolGlobalString('CLICKTODIAL_DO_NOT_USE_AJAX_CALL')) { |
| 1318 | 1318 | // Default and recommended: New method using ajax without submitting a page making a javascript history.go(-1) back |
| 1319 | - $newphoneastart = '<a href="' . $url . '" class="cssforclicktodial">'; // Call of ajax is handled by the lib_foot.js.php on class 'cssforclicktodial' |
|
| 1319 | + $newphoneastart = '<a href="' . $url . '" class="cssforclicktodial">'; // Call of ajax is handled by the lib_foot.js.php on class 'cssforclicktodial' |
|
| 1320 | 1320 | $newphoneaend = '</a>'; |
| 1321 | 1321 | } else { |
| 1322 | 1322 | // Old method |
@@ -1347,7 +1347,7 @@ discard block |
||
| 1347 | 1347 | |
| 1348 | 1348 | if (getDolGlobalString('CONTACT_PHONEMOBILE_SHOW_LINK_TO_WHATSAPP') && $withpicto == 'mobile') { |
| 1349 | 1349 | // Link to Whatsapp |
| 1350 | - $newphone .= ' <a href="https://wa.me/' . $newphonewa . '" target="_blank"';// Use api to whatasapp contacts |
|
| 1350 | + $newphone .= ' <a href="https://wa.me/' . $newphonewa . '" target="_blank"'; // Use api to whatasapp contacts |
|
| 1351 | 1351 | $newphone .= '><span class="paddingright fab fa-whatsapp" style="color:#25D366;" title="WhatsApp"></span></a>'; |
| 1352 | 1352 | } |
| 1353 | 1353 | |
@@ -1846,7 +1846,7 @@ discard block |
||
| 1846 | 1846 | top_httphead(); |
| 1847 | 1847 | } |
| 1848 | 1848 | //http_response_code(500); // If we use 500, message is not output with some command line tools |
| 1849 | - 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 |
|
| 1849 | + 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 |
|
| 1850 | 1850 | } |
| 1851 | 1851 | |
| 1852 | 1852 | if (empty($dolibarr_main_prod)) { |
@@ -2116,7 +2116,7 @@ discard block |
||
| 2116 | 2116 | } |
| 2117 | 2117 | $return .= '<td class="nobordernopadding valignmiddle col-title">'; |
| 2118 | 2118 | $return .= '<div class="titre inline-block">'; |
| 2119 | - $return .= $title; // $title is already HTML sanitized content |
|
| 2119 | + $return .= $title; // $title is already HTML sanitized content |
|
| 2120 | 2120 | $return .= '</div>'; |
| 2121 | 2121 | $return .= '</td>'; |
| 2122 | 2122 | if (dol_strlen($morehtmlcenter)) { |
@@ -2163,7 +2163,7 @@ discard block |
||
| 2163 | 2163 | $totalnboflines = abs($totalnboflines); |
| 2164 | 2164 | } |
| 2165 | 2165 | |
| 2166 | - $page = (int)$page; |
|
| 2166 | + $page = (int) $page; |
|
| 2167 | 2167 | |
| 2168 | 2168 | if ($picto == 'setup') { |
| 2169 | 2169 | $picto = 'title_setup.png'; |
@@ -2194,8 +2194,8 @@ discard block |
||
| 2194 | 2194 | |
| 2195 | 2195 | print '<td class="nobordernopadding valignmiddle col-title">'; |
| 2196 | 2196 | print '<div class="titre inline-block">'; |
| 2197 | - print $title; // $title may contains HTML |
|
| 2198 | - if (!empty($title) && $savtotalnboflines >= 0 && (string)$savtotalnboflines != '') { |
|
| 2197 | + print $title; // $title may contains HTML |
|
| 2198 | + if (!empty($title) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') { |
|
| 2199 | 2199 | print '<span class="opacitymedium colorblack paddingleft">(' . $totalnboflines . ')</span>'; |
| 2200 | 2200 | } |
| 2201 | 2201 | print '</div></td>'; |
@@ -2207,7 +2207,7 @@ discard block |
||
| 2207 | 2207 | |
| 2208 | 2208 | // Right |
| 2209 | 2209 | print '<td class="nobordernopadding valignmiddle right col-right">'; |
| 2210 | - print '<input type="hidden" name="pageplusoneold" value="' . ((int)$page + 1) . '">'; |
|
| 2210 | + print '<input type="hidden" name="pageplusoneold" value="' . ((int) $page + 1) . '">'; |
|
| 2211 | 2211 | if ($sortfield) { |
| 2212 | 2212 | $options .= "&sortfield=" . urlencode($sortfield); |
| 2213 | 2213 | } |
@@ -2326,7 +2326,7 @@ discard block |
||
| 2326 | 2326 | } |
| 2327 | 2327 | |
| 2328 | 2328 | if (empty($hidenavigation)) { |
| 2329 | - if ((int)$limit > 0 && empty($hideselectlimit)) { |
|
| 2329 | + if ((int) $limit > 0 && empty($hideselectlimit)) { |
|
| 2330 | 2330 | $pagesizechoices = '10:10,15:15,20:20,25:25,50:50,100:100,250:250,500:500,1000:1000'; |
| 2331 | 2331 | $pagesizechoices .= ',5000:5000,10000:10000,20000:20000'; |
| 2332 | 2332 | //$pagesizechoices.=',0:'.$langs->trans("All"); // Not yet supported |
@@ -2359,7 +2359,7 @@ discard block |
||
| 2359 | 2359 | $key = $tmp[0]; |
| 2360 | 2360 | $val = $tmp[1]; |
| 2361 | 2361 | if ($key != '' && $val != '') { |
| 2362 | - if ((int)$key == (int)$limit) { |
|
| 2362 | + if ((int) $key == (int) $limit) { |
|
| 2363 | 2363 | $selected = ' selected="selected"'; |
| 2364 | 2364 | } |
| 2365 | 2365 | print '<option name="' . $key . '"' . $selected . '>' . dol_escape_htmltag($val) . '</option>' . "\n"; |
@@ -2561,7 +2561,7 @@ discard block |
||
| 2561 | 2561 | if (is_object($objcon) && $objcon->id > 0) { |
| 2562 | 2562 | $force_filter_contact = true; |
| 2563 | 2563 | $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "actioncomm_resources as r ON a.id = r.fk_actioncomm"; |
| 2564 | - $sql .= " AND r.element_type = '" . $db->escape($objcon->table_element) . "' AND r.fk_element = " . ((int)$objcon->id); |
|
| 2564 | + $sql .= " AND r.element_type = '" . $db->escape($objcon->table_element) . "' AND r.fk_element = " . ((int) $objcon->id); |
|
| 2565 | 2565 | } |
| 2566 | 2566 | |
| 2567 | 2567 | if (is_object($filterobj) && get_class($filterobj) == 'Societe') { |
@@ -2570,7 +2570,7 @@ discard block |
||
| 2570 | 2570 | $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "element_resources as er"; |
| 2571 | 2571 | $sql .= " ON er.resource_type = 'dolresource'"; |
| 2572 | 2572 | $sql .= " AND er.element_id = a.id"; |
| 2573 | - $sql .= " AND er.resource_id = " . ((int)$filterobj->id); |
|
| 2573 | + $sql .= " AND er.resource_id = " . ((int) $filterobj->id); |
|
| 2574 | 2574 | } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { |
| 2575 | 2575 | $sql .= ", " . MAIN_DB_PREFIX . "adherent as m"; |
| 2576 | 2576 | } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') { |
@@ -2588,42 +2588,42 @@ discard block |
||
| 2588 | 2588 | $sql .= " WHERE a.entity IN (" . getEntity('agenda') . ")"; |
| 2589 | 2589 | if (!$force_filter_contact) { |
| 2590 | 2590 | if (is_object($filterobj) && in_array(get_class($filterobj), array('Societe', 'Client', 'Fournisseur')) && $filterobj->id) { |
| 2591 | - $sql .= " AND a.fk_soc = " . ((int)$filterobj->id); |
|
| 2591 | + $sql .= " AND a.fk_soc = " . ((int) $filterobj->id); |
|
| 2592 | 2592 | } elseif (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) { |
| 2593 | - $sql .= " AND a.fk_project = " . ((int)$filterobj->id); |
|
| 2593 | + $sql .= " AND a.fk_project = " . ((int) $filterobj->id); |
|
| 2594 | 2594 | } elseif (is_object($filterobj) && get_class($filterobj) == 'Adherent') { |
| 2595 | 2595 | $sql .= " AND a.fk_element = m.rowid AND a.elementtype = 'member'"; |
| 2596 | 2596 | if ($filterobj->id) { |
| 2597 | - $sql .= " AND a.fk_element = " . ((int)$filterobj->id); |
|
| 2597 | + $sql .= " AND a.fk_element = " . ((int) $filterobj->id); |
|
| 2598 | 2598 | } |
| 2599 | 2599 | } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') { |
| 2600 | 2600 | $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; |
| 2601 | 2601 | if ($filterobj->id) { |
| 2602 | - $sql .= " AND a.fk_element = " . ((int)$filterobj->id); |
|
| 2602 | + $sql .= " AND a.fk_element = " . ((int) $filterobj->id); |
|
| 2603 | 2603 | } |
| 2604 | 2604 | } elseif (is_object($filterobj) && get_class($filterobj) == 'Product') { |
| 2605 | 2605 | $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; |
| 2606 | 2606 | if ($filterobj->id) { |
| 2607 | - $sql .= " AND a.fk_element = " . ((int)$filterobj->id); |
|
| 2607 | + $sql .= " AND a.fk_element = " . ((int) $filterobj->id); |
|
| 2608 | 2608 | } |
| 2609 | 2609 | } elseif (is_object($filterobj) && get_class($filterobj) == 'Ticket') { |
| 2610 | 2610 | $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'ticket'"; |
| 2611 | 2611 | if ($filterobj->id) { |
| 2612 | - $sql .= " AND a.fk_element = " . ((int)$filterobj->id); |
|
| 2612 | + $sql .= " AND a.fk_element = " . ((int) $filterobj->id); |
|
| 2613 | 2613 | } |
| 2614 | 2614 | } elseif (is_object($filterobj) && get_class($filterobj) == 'BOM') { |
| 2615 | 2615 | $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'bom'"; |
| 2616 | 2616 | if ($filterobj->id) { |
| 2617 | - $sql .= " AND a.fk_element = " . ((int)$filterobj->id); |
|
| 2617 | + $sql .= " AND a.fk_element = " . ((int) $filterobj->id); |
|
| 2618 | 2618 | } |
| 2619 | 2619 | } elseif (is_object($filterobj) && get_class($filterobj) == 'Contrat') { |
| 2620 | 2620 | $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'contract'"; |
| 2621 | 2621 | if ($filterobj->id) { |
| 2622 | - $sql .= " AND a.fk_element = " . ((int)$filterobj->id); |
|
| 2622 | + $sql .= " AND a.fk_element = " . ((int) $filterobj->id); |
|
| 2623 | 2623 | } |
| 2624 | 2624 | } |
| 2625 | 2625 | } else { |
| 2626 | - $sql .= " AND u.rowid = " . ((int)$filterobj->id); |
|
| 2626 | + $sql .= " AND u.rowid = " . ((int) $filterobj->id); |
|
| 2627 | 2627 | } |
| 2628 | 2628 | |
| 2629 | 2629 | // Condition on actioncode |
@@ -3311,7 +3311,7 @@ discard block |
||
| 3311 | 3311 | $showonlyonhover = 0; |
| 3312 | 3312 | }*/ |
| 3313 | 3313 | |
| 3314 | - $tag = 'span'; // Using div (like any style of type 'block') does not work when using the js copy code. |
|
| 3314 | + $tag = 'span'; // Using div (like any style of type 'block') does not work when using the js copy code. |
|
| 3315 | 3315 | if ($texttoshow === 'none') { |
| 3316 | 3316 | $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>'; |
| 3317 | 3317 | } elseif ($texttoshow) { |
@@ -3652,7 +3652,7 @@ discard block |
||
| 3652 | 3652 | $table_element = 'adherent_type'; |
| 3653 | 3653 | } elseif ($elementType == 'bank_account') { |
| 3654 | 3654 | $classpath = 'compta/bank/class'; |
| 3655 | - $module = 'bank'; // We need $conf->bank->dir_output and not $conf->banque->dir_output |
|
| 3655 | + $module = 'bank'; // We need $conf->bank->dir_output and not $conf->banque->dir_output |
|
| 3656 | 3656 | $classfile = 'account'; |
| 3657 | 3657 | $classname = 'Account'; |
| 3658 | 3658 | } elseif ($elementType == 'category') { |
@@ -4305,8 +4305,8 @@ discard block |
||
| 4305 | 4305 | |
| 4306 | 4306 | |
| 4307 | 4307 | $parameters = array( |
| 4308 | - 'TCompiledAttr' => $TCompiledAttr, // array |
|
| 4309 | - 'compiledAttributes' => $compiledAttributes, // string |
|
| 4308 | + 'TCompiledAttr' => $TCompiledAttr, // array |
|
| 4309 | + 'compiledAttributes' => $compiledAttributes, // string |
|
| 4310 | 4310 | 'attr' => $attr, |
| 4311 | 4311 | 'tag' => $tag, |
| 4312 | 4312 | 'label' => $label, |
@@ -4422,7 +4422,7 @@ discard block |
||
| 4422 | 4422 | if ($posstart > 0) { |
| 4423 | 4423 | $res1 = substr($str, $posstart + 1, $posend - $posstart - 1); |
| 4424 | 4424 | if (is_numeric($res1)) { |
| 4425 | - $postab = (int)$res1; |
|
| 4425 | + $postab = (int) $res1; |
|
| 4426 | 4426 | $values[1] = '+' . substr($str, $posend + 1); |
| 4427 | 4427 | } |
| 4428 | 4428 | } |
@@ -4998,7 +4998,7 @@ discard block |
||
| 4998 | 4998 | |
| 4999 | 4999 | if (!empty($out) && getDolGlobalString('MAIN_RESTRICTHTML_ONLY_VALID_HTML') && $check != 'restricthtmlallowunvalid') { |
| 5000 | 5000 | try { |
| 5001 | - libxml_use_internal_errors(false); // Avoid to fill memory with xml errors |
|
| 5001 | + libxml_use_internal_errors(false); // Avoid to fill memory with xml errors |
|
| 5002 | 5002 | if (LIBXML_VERSION < 20900) { |
| 5003 | 5003 | // Avoid load of external entities (security problem). |
| 5004 | 5004 | // Required only if LIBXML_VERSION < 20900 |
@@ -5039,7 +5039,7 @@ discard block |
||
| 5039 | 5039 | // See options at https://tidy.sourceforge.net/docs/quickref.html |
| 5040 | 5040 | $config = array( |
| 5041 | 5041 | 'clean' => false, |
| 5042 | - 'quote-marks' => false, // do not replace " that are used for real text content (not a string symbol for html attribute) into " |
|
| 5042 | + 'quote-marks' => false, // do not replace " that are used for real text content (not a string symbol for html attribute) into " |
|
| 5043 | 5043 | 'doctype' => 'strict', |
| 5044 | 5044 | 'show-body-only' => true, |
| 5045 | 5045 | "indent-attributes" => false, |
@@ -5082,7 +5082,7 @@ discard block |
||
| 5082 | 5082 | * @param string[] $m |
| 5083 | 5083 | * @return string |
| 5084 | 5084 | */ |
| 5085 | - static function ($m) { |
|
| 5085 | + static function($m) { |
|
| 5086 | 5086 | return realCharForNumericEntities($m); |
| 5087 | 5087 | }, |
| 5088 | 5088 | $out |
@@ -5215,7 +5215,7 @@ discard block |
||
| 5215 | 5215 | */ |
| 5216 | 5216 | function dol_htmlcleanlastbr($stringtodecode) |
| 5217 | 5217 | { |
| 5218 | - $ret = preg_replace('/ $/i', "", $stringtodecode); // Because wysiwyg editor may add a at end of last line |
|
| 5218 | + $ret = preg_replace('/ $/i', "", $stringtodecode); // Because wysiwyg editor may add a at end of last line |
|
| 5219 | 5219 | $ret = preg_replace('/(<br>|<br(\s[\sa-zA-Z_="]*)?\/?>|' . "\n" . '|' . "\r" . ')+$/i', "", $ret); |
| 5220 | 5220 | return $ret; |
| 5221 | 5221 | } |
@@ -5235,7 +5235,7 @@ discard block |
||
| 5235 | 5235 | if ($keepsomeentities) { |
| 5236 | 5236 | $newstring = strtr($newstring, array('&' => '__andamp__', '<' => '__andlt__', '>' => '__andgt__', '"' => '__dquot__')); |
| 5237 | 5237 | } |
| 5238 | - $newstring = html_entity_decode((string)$newstring, (int)$b, (string)$c); |
|
| 5238 | + $newstring = html_entity_decode((string) $newstring, (int) $b, (string) $c); |
|
| 5239 | 5239 | if ($keepsomeentities) { |
| 5240 | 5240 | $newstring = strtr($newstring, array('__andamp__' => '&', '__andlt__' => '<', '__andgt__' => '>', '__dquot__' => '"')); |
| 5241 | 5241 | } |
@@ -5311,7 +5311,7 @@ discard block |
||
| 5311 | 5311 | if (isset($valuetoclean)) { |
| 5312 | 5312 | do { |
| 5313 | 5313 | $oldvaluetoclean = $valuetoclean; |
| 5314 | - $valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments |
|
| 5314 | + $valuetoclean = preg_replace('/\/\*.*\*\//m', '', $valuetoclean); // clean css comments |
|
| 5315 | 5315 | $valuetoclean = preg_replace('/position\s*:\s*[a-z]+/mi', '', $valuetoclean); |
| 5316 | 5316 | if ($els->item($i)->tagName == 'a') { // more paranoiac cleaning for clickable tags. |
| 5317 | 5317 | $valuetoclean = preg_replace('/display\s*:/mi', '', $valuetoclean); |
@@ -5399,7 +5399,7 @@ discard block |
||
| 5399 | 5399 | $tempbis = $temp; |
| 5400 | 5400 | do { |
| 5401 | 5401 | $temp = $tempbis; |
| 5402 | - $tempbis = str_replace('<>', '', $temp); // No reason to have this into a text, except if value is to try bypass the next html cleaning |
|
| 5402 | + $tempbis = str_replace('<>', '', $temp); // No reason to have this into a text, except if value is to try bypass the next html cleaning |
|
| 5403 | 5403 | $tempbis = preg_replace($pattern, '', $tempbis); |
| 5404 | 5404 | //$idowhile++; print $temp.'-'.$tempbis."\n"; if ($idowhile > 100) break; |
| 5405 | 5405 | } while ($tempbis != $temp); |
@@ -5454,7 +5454,7 @@ discard block |
||
| 5454 | 5454 | "header", "footer", "nav", "section", "menu", "menuitem" // html5 tags |
| 5455 | 5455 | ); |
| 5456 | 5456 | } |
| 5457 | - $allowed_tags[] = "comment"; // this tags is added to manage comment <!--...--> that are replaced into <comment>...</comment> |
|
| 5457 | + $allowed_tags[] = "comment"; // this tags is added to manage comment <!--...--> that are replaced into <comment>...</comment> |
|
| 5458 | 5458 | if ($allowiframe) { |
| 5459 | 5459 | if (!in_array('iframe', $allowed_tags)) { |
| 5460 | 5460 | $allowed_tags[] = "iframe"; |
@@ -5469,7 +5469,7 @@ discard block |
||
| 5469 | 5469 | $allowed_tags_string = implode("><", $allowed_tags); |
| 5470 | 5470 | $allowed_tags_string = '<' . $allowed_tags_string . '>'; |
| 5471 | 5471 | |
| 5472 | - $stringtoclean = str_replace('<!DOCTYPE html>', '__!DOCTYPE_HTML__', $stringtoclean); // Replace DOCTYPE to avoid to have it removed by the strip_tags |
|
| 5472 | + $stringtoclean = str_replace('<!DOCTYPE html>', '__!DOCTYPE_HTML__', $stringtoclean); // Replace DOCTYPE to avoid to have it removed by the strip_tags |
|
| 5473 | 5473 | |
| 5474 | 5474 | $stringtoclean = dol_string_nounprintableascii($stringtoclean, 0); |
| 5475 | 5475 | |
@@ -5479,7 +5479,7 @@ discard block |
||
| 5479 | 5479 | $stringtoclean = preg_replace('/:/i', ':', $stringtoclean); |
| 5480 | 5480 | $stringtoclean = preg_replace('/:|�+58|:/i', '', $stringtoclean); // refused string ':' encoded (no reason to have a : encoded like this) to disable 'javascript:...' |
| 5481 | 5481 | |
| 5482 | - $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 |
|
| 5482 | + $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 |
|
| 5483 | 5483 | |
| 5484 | 5484 | if ($cleanalsosomestyles) { // Clean for remaining html tags |
| 5485 | 5485 | $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 |
@@ -5496,7 +5496,7 @@ discard block |
||
| 5496 | 5496 | |
| 5497 | 5497 | $temp = str_replace('__!DOCTYPE_HTML__', '<!DOCTYPE html>', $temp); // Restore the DOCTYPE |
| 5498 | 5498 | |
| 5499 | - $temp = preg_replace('/<comment>([^>]*)<\/comment>/', '<!--\1-->', $temp); // Restore html comments |
|
| 5499 | + $temp = preg_replace('/<comment>([^>]*)<\/comment>/', '<!--\1-->', $temp); // Restore html comments |
|
| 5500 | 5500 | |
| 5501 | 5501 | |
| 5502 | 5502 | return $temp; |