@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | * @param int $entitytotest Number of instance (always 1 if module multicompany not enabled) |
35 | 35 | * @return string Login if OK, '' if KO |
36 | 36 | */ |
37 | -function check_user_password_openid($usertotest,$passwordtotest,$entitytotest) |
|
37 | +function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) |
|
38 | 38 | { |
39 | - global $_POST,$db,$conf,$langs; |
|
39 | + global $_POST, $db, $conf, $langs; |
|
40 | 40 | |
41 | 41 | dol_syslog("functions_openid::check_user_password_openid usertotest=".$usertotest); |
42 | 42 | |
43 | - $login=''; |
|
43 | + $login = ''; |
|
44 | 44 | |
45 | 45 | // Get identity from user and redirect browser to OpenID Server |
46 | 46 | if (isset($_POST['username'])) |
@@ -48,14 +48,14 @@ discard block |
||
48 | 48 | $openid = new SimpleOpenID(); |
49 | 49 | $openid->SetIdentity($_POST['username']); |
50 | 50 | $protocol = ($conf->file->main_force_https ? 'https://' : 'http://'); |
51 | - $openid->SetTrustRoot($protocol . $_SERVER["HTTP_HOST"]); |
|
52 | - $openid->SetRequiredFields(array('email','fullname')); |
|
51 | + $openid->SetTrustRoot($protocol.$_SERVER["HTTP_HOST"]); |
|
52 | + $openid->SetRequiredFields(array('email', 'fullname')); |
|
53 | 53 | $_SESSION['dol_entity'] = $_POST["entity"]; |
54 | 54 | //$openid->SetOptionalFields(array('dob','gender','postcode','country','language','timezone')); |
55 | 55 | if ($openid->sendDiscoveryRequestToGetXRDS()) |
56 | 56 | { |
57 | - $openid->SetApprovedURL($protocol . $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script |
|
58 | - $openid->Redirect(); // This will redirect user to OpenID Server |
|
57 | + $openid->SetApprovedURL($protocol.$_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script |
|
58 | + $openid->Redirect(); // This will redirect user to OpenID Server |
|
59 | 59 | } |
60 | 60 | else |
61 | 61 | { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | return false; |
66 | 66 | } |
67 | 67 | // Perform HTTP Request to OpenID server to validate key |
68 | - elseif($_GET['openid_mode'] == 'id_res') |
|
68 | + elseif ($_GET['openid_mode'] == 'id_res') |
|
69 | 69 | { |
70 | 70 | $openid = new SimpleOpenID(); |
71 | 71 | $openid->SetIdentity($_GET['openid_identity']); |
@@ -74,23 +74,23 @@ discard block |
||
74 | 74 | { |
75 | 75 | // OK HERE KEY IS VALID |
76 | 76 | |
77 | - $sql ="SELECT login"; |
|
78 | - $sql.=" FROM ".MAIN_DB_PREFIX."user"; |
|
79 | - $sql.=" WHERE openid = '".$db->escape($_GET['openid_identity'])."'"; |
|
80 | - $sql.=" AND entity IN (0," . ($_SESSION["dol_entity"] ? $_SESSION["dol_entity"] : 1) . ")"; |
|
77 | + $sql = "SELECT login"; |
|
78 | + $sql .= " FROM ".MAIN_DB_PREFIX."user"; |
|
79 | + $sql .= " WHERE openid = '".$db->escape($_GET['openid_identity'])."'"; |
|
80 | + $sql .= " AND entity IN (0,".($_SESSION["dol_entity"] ? $_SESSION["dol_entity"] : 1).")"; |
|
81 | 81 | |
82 | 82 | dol_syslog("functions_openid::check_user_password_openid", LOG_DEBUG); |
83 | - $resql=$db->query($sql); |
|
83 | + $resql = $db->query($sql); |
|
84 | 84 | if ($resql) |
85 | 85 | { |
86 | - $obj=$db->fetch_object($resql); |
|
86 | + $obj = $db->fetch_object($resql); |
|
87 | 87 | if ($obj) |
88 | 88 | { |
89 | - $login=$obj->login; |
|
89 | + $login = $obj->login; |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | } |
93 | - else if($openid->IsError() === true) |
|
93 | + else if ($openid->IsError() === true) |
|
94 | 94 | { |
95 | 95 | // ON THE WAY, WE GOT SOME ERROR |
96 | 96 | $error = $openid->GetError(); |
@@ -31,14 +31,14 @@ |
||
31 | 31 | * @param int $entitytotest Number of instance (always 1 if module multicompany not enabled) |
32 | 32 | * @return string Login if OK, '' if KO |
33 | 33 | */ |
34 | -function check_user_password_empty($usertotest,$passwordtotest,$entitytotest) |
|
34 | +function check_user_password_empty($usertotest, $passwordtotest, $entitytotest) |
|
35 | 35 | { |
36 | 36 | global $langs; |
37 | 37 | |
38 | 38 | dol_syslog("functions_empty::check_user_password_empty usertotest=".$usertotest); |
39 | 39 | |
40 | - $login=''; |
|
41 | - $_SESSION["dol_loginmesg"]=$langs->trans("FailedToLogin"); |
|
40 | + $login = ''; |
|
41 | + $_SESSION["dol_loginmesg"] = $langs->trans("FailedToLogin"); |
|
42 | 42 | |
43 | 43 | return $login; |
44 | 44 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | public function __construct() |
14 | 14 | { |
15 | - $this->searchDir[] = BASE_PATH . '/plugins'; |
|
15 | + $this->searchDir[] = BASE_PATH.'/plugins'; |
|
16 | 16 | $this->nameSpaces[] = 'Alixar'; |
17 | 17 | |
18 | 18 | parent::__construct(); |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | define('SITE_URL', APP_PROTOCOL . '://' . SERVER_NAME); |
42 | 42 | define('BASE_URI', SITE_URL . APP_URI); |
43 | 43 | */ |
44 | - define('DOL_BASE_PATH', BASE_PATH . '/dolibarr/htdocs'); |
|
45 | - define('DOL_BASE_URI', BASE_URI . '/dolibarr/htdocs'); |
|
44 | + define('DOL_BASE_PATH', BASE_PATH.'/dolibarr/htdocs'); |
|
45 | + define('DOL_BASE_URI', BASE_URI.'/dolibarr/htdocs'); |
|
46 | 46 | define('DOL_DOCUMENT_ROOT', DOL_BASE_PATH); |
47 | 47 | |
48 | 48 | define('CORE_FOLDER', '/core'); |
@@ -56,15 +56,15 @@ discard block |
||
56 | 56 | define('CACHE_FOLDER', '/../cache'); |
57 | 57 | //define('VENDOR_FOLDER', BASE_URI . '/vendor'); |
58 | 58 | |
59 | - define('CORE_PATH', BASE_PATH . CORE_FOLDER); |
|
60 | - define('CONFIG_PATH', BASE_PATH . CONFIG_FOLDER); |
|
61 | - define('CONTROLLERS_PATH', BASE_PATH . CONTROLLERS_FOLDER); |
|
62 | - define('HELPERS_PATH', BASE_PATH . HELPERS_FOLDER); |
|
63 | - define('MODELS_PATH', BASE_PATH . MODELS_FOLDER); |
|
64 | - define('SKINS_PATH', BASE_PATH . SKINS_FOLDER); |
|
65 | - define('TEMPLATES_PATH', BASE_PATH . TEMPLATES_FOLDER); |
|
66 | - define('PLUGINS_PATH', BASE_PATH . PLUGINS_FOLDER); |
|
67 | - define('CACHE_PATH', BASE_PATH . CACHE_FOLDER); |
|
59 | + define('CORE_PATH', BASE_PATH.CORE_FOLDER); |
|
60 | + define('CONFIG_PATH', BASE_PATH.CONFIG_FOLDER); |
|
61 | + define('CONTROLLERS_PATH', BASE_PATH.CONTROLLERS_FOLDER); |
|
62 | + define('HELPERS_PATH', BASE_PATH.HELPERS_FOLDER); |
|
63 | + define('MODELS_PATH', BASE_PATH.MODELS_FOLDER); |
|
64 | + define('SKINS_PATH', BASE_PATH.SKINS_FOLDER); |
|
65 | + define('TEMPLATES_PATH', BASE_PATH.TEMPLATES_FOLDER); |
|
66 | + define('PLUGINS_PATH', BASE_PATH.PLUGINS_FOLDER); |
|
67 | + define('CACHE_PATH', BASE_PATH.CACHE_FOLDER); |
|
68 | 68 | //define('VENDOR_PATH', BASE_PATH . VENDOR_FOLDER); |
69 | 69 | |
70 | 70 | /** |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | static function getStaticMember($class, $member) |
54 | 54 | { |
55 | - dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); |
|
55 | + dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING); |
|
56 | 56 | |
57 | 57 | // This part is deprecated. Uncomment if for php 5.2.*, and comment next isset class::member |
58 | 58 | /* if (version_compare(phpversion(), '5.3.0', '<')) |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | if (isset($class::$member)) |
79 | 79 | return $class::$member; |
80 | - dol_print_error('', 'Try to get a static member "' . $member . '" in class "' . $class . '" that does not exists or is not static.'); |
|
80 | + dol_print_error('', 'Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.'); |
|
81 | 81 | return null; |
82 | 82 | } |
83 | 83 | |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | */ |
95 | 95 | static function getDoliDBInstance($type, $host, $user, $pass, $name, $port) |
96 | 96 | { |
97 | - require_once DOL_BASE_PATH . "/core/db/" . $type . '.class.php'; |
|
97 | + require_once DOL_BASE_PATH."/core/db/".$type.'.class.php'; |
|
98 | 98 | |
99 | - $class = 'DoliDB' . ucfirst($type); |
|
99 | + $class = 'DoliDB'.ucfirst($type); |
|
100 | 100 | $dolidb = new $class($type, $host, $user, $pass, $name, $port); |
101 | 101 | return $dolidb; |
102 | 102 | } |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $depth = $db->transaction_opened; |
266 | 266 | $disconnectdone = $db->close(); |
267 | 267 | } |
268 | - dol_syslog("--- End access to " . $_SERVER["PHP_SELF"] . (($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was ' . $depth . ')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO)); |
|
268 | + dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO)); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if (empty($paramname)) |
311 | 311 | return 'BadFirstParameterForDolUtils::GETPOST'; |
312 | 312 | if (empty($check)) { |
313 | - dol_syslog("Deprecated use of DolUtils::GETPOST, called with 1st param = " . $paramname . " and 2nd param is '', when calling page " . $_SERVER["PHP_SELF"], LOG_WARNING); |
|
313 | + dol_syslog("Deprecated use of DolUtils::GETPOST, called with 1st param = ".$paramname." and 2nd param is '', when calling page ".$_SERVER["PHP_SELF"], LOG_WARNING); |
|
314 | 314 | // Enable this line to know who call the DolUtils::GETPOST with '' $check parameter. |
315 | 315 | //var_dump(debug_backtrace()[0]); |
316 | 316 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $relativepathstring = $_SERVER["PHP_SELF"]; |
333 | 333 | // Clean $relativepathstring |
334 | 334 | if (constant('DOL_BASE_URI')) |
335 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
335 | + $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring); |
|
336 | 336 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
337 | 337 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
338 | 338 | //var_dump($relativepathstring); |
@@ -340,8 +340,8 @@ discard block |
||
340 | 340 | // Code for search criteria persistence. |
341 | 341 | // Retrieve values if restore_lastsearch_values |
342 | 342 | if (!empty($_GET['restore_lastsearch_values'])) { // Use $_GET here and not DolUtils::GETPOST |
343 | - if (!empty($_SESSION['lastsearch_values_' . $relativepathstring])) { // If there is saved values |
|
344 | - $tmp = json_decode($_SESSION['lastsearch_values_' . $relativepathstring], true); |
|
343 | + if (!empty($_SESSION['lastsearch_values_'.$relativepathstring])) { // If there is saved values |
|
344 | + $tmp = json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true); |
|
345 | 345 | if (is_array($tmp)) { |
346 | 346 | foreach ($tmp as $key => $val) { |
347 | 347 | if ($key == $paramname) { // We are on the requested parameter |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | } |
353 | 353 | } |
354 | 354 | // If there is saved contextpage, page or limit |
355 | - if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_' . $relativepathstring])) { |
|
356 | - $out = $_SESSION['lastsearch_contextpage_' . $relativepathstring]; |
|
357 | - } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_' . $relativepathstring])) { |
|
358 | - $out = $_SESSION['lastsearch_page_' . $relativepathstring]; |
|
359 | - } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_' . $relativepathstring])) { |
|
360 | - $out = $_SESSION['lastsearch_limit_' . $relativepathstring]; |
|
355 | + if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) { |
|
356 | + $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring]; |
|
357 | + } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_'.$relativepathstring])) { |
|
358 | + $out = $_SESSION['lastsearch_page_'.$relativepathstring]; |
|
359 | + } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring])) { |
|
360 | + $out = $_SESSION['lastsearch_limit_'.$relativepathstring]; |
|
361 | 361 | } |
362 | 362 | } |
363 | 363 | // Else, retreive default values if we are not doing a sort |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | $qualified = 1; |
426 | 426 | |
427 | 427 | if ($qualified) { |
428 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
428 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
429 | 429 | foreach ($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val) { |
430 | 430 | if ($out) |
431 | 431 | $out .= ', '; |
@@ -461,11 +461,11 @@ discard block |
||
461 | 461 | if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all'])) { |
462 | 462 | // We made a search from quick search menu, do we still use default filter ? |
463 | 463 | if (empty(Globals::$conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH)) { |
464 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
464 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
465 | 465 | $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace); |
466 | 466 | } |
467 | 467 | } else { |
468 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
468 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and , |
|
469 | 469 | $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace); |
470 | 470 | } |
471 | 471 | break; |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | // We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text. |
484 | 484 | if (!is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) { |
485 | 485 | $maxloop = 20; |
486 | - $loopnb = 0; // Protection against infinite loop |
|
486 | + $loopnb = 0; // Protection against infinite loop |
|
487 | 487 | while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) { // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side. |
488 | 488 | $loopnb++; |
489 | 489 | $newout = ''; |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | } elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID') { |
529 | 529 | $newout = Globals::$conf->entity; |
530 | 530 | } else |
531 | - $newout = ''; // Key not found, we replace with empty string |
|
531 | + $newout = ''; // Key not found, we replace with empty string |
|
532 | 532 | |
533 | 533 | |
534 | 534 | |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | |
564 | 564 | |
565 | 565 | //var_dump('__'.$reg[1].'__ -> '.$newout); |
566 | - $out = preg_replace('/__' . preg_quote($reg[1], '/') . '__/', $newout, $out); |
|
566 | + $out = preg_replace('/__'.preg_quote($reg[1], '/').'__/', $newout, $out); |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | // If prefix is for email |
674 | 674 | if ($mode == 'email') { |
675 | 675 | if (empty(Globals::$conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) { |
676 | - return Security::dol_hash(DOL_DOCUMENT_ROOT . DOL_BASE_URI); |
|
676 | + return Security::dol_hash(DOL_DOCUMENT_ROOT.DOL_BASE_URI); |
|
677 | 677 | } |
678 | 678 | // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended) |
679 | 679 | if (Globals::$conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') { |
@@ -683,16 +683,16 @@ discard block |
||
683 | 683 | return $_SERVER["SERVER_NAME"]; |
684 | 684 | } |
685 | 685 | |
686 | - return Security::dol_hash(DOL_DOCUMENT_ROOT . DOL_BASE_URI); |
|
686 | + return Security::dol_hash(DOL_DOCUMENT_ROOT.DOL_BASE_URI); |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) { |
690 | - return Security::dol_hash($_SERVER["SERVER_NAME"] . $_SERVER["DOCUMENT_ROOT"] . DOL_DOCUMENT_ROOT . DOL_BASE_URI); |
|
690 | + return Security::dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_BASE_URI); |
|
691 | 691 | |
692 | 692 | // Use this for a "readable" cookie name |
693 | 693 | //return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_BASE_URI); |
694 | 694 | } |
695 | - return Security::dol_hash(DOL_DOCUMENT_ROOT . DOL_BASE_URI); |
|
695 | + return Security::dol_hash(DOL_DOCUMENT_ROOT.DOL_BASE_URI); |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | /** |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | $fullpath = dol_buildpath($relpath); |
713 | 713 | |
714 | 714 | if (!file_exists($fullpath)) { |
715 | - dol_syslog('functions::dol_include_once Tried to load unexisting file: ' . $relpath, LOG_ERR); |
|
715 | + dol_syslog('functions::dol_include_once Tried to load unexisting file: '.$relpath, LOG_ERR); |
|
716 | 716 | return false; |
717 | 717 | } |
718 | 718 | |
@@ -741,14 +741,14 @@ discard block |
||
741 | 741 | |
742 | 742 | if ($type == 0 /* empty($type) */) { // For a filesystem path |
743 | 743 | //$res = DOL_BASE_PATH . '' . $path; // Standard default path |
744 | - $res = DOL_BASE_PATH . '/' . $path; // Standard default path |
|
744 | + $res = DOL_BASE_PATH.'/'.$path; // Standard default path |
|
745 | 745 | if (isset(Globals::$conf->file->dol_document_root)) { |
746 | 746 | foreach (Globals::$conf->file->dol_document_root as $key => $dirroot) { // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...) |
747 | 747 | if ($key == 'main') { |
748 | 748 | continue; |
749 | 749 | } |
750 | - if (file_exists($dirroot . '/' . $path)) { |
|
751 | - $res = $dirroot . '/' . $path; |
|
750 | + if (file_exists($dirroot.'/'.$path)) { |
|
751 | + $res = $dirroot.'/'.$path; |
|
752 | 752 | return $res; |
753 | 753 | } |
754 | 754 | } |
@@ -765,13 +765,13 @@ discard block |
||
765 | 765 | // using proxy, rewriting, virtual path, etc... |
766 | 766 | $res = ''; |
767 | 767 | if ($type == 1) { |
768 | - $res = /* DOL_BASE_URI */ DOL_BASE_URI . '/' . $path; // Standard value |
|
768 | + $res = /* DOL_BASE_URI */ DOL_BASE_URI.'/'.$path; // Standard value |
|
769 | 769 | } |
770 | 770 | if ($type == 2) { |
771 | - $res = /* DOL_MAIN_URL_ROOT */ DOL_BASE_PATH . '/' . $path; // Standard value |
|
771 | + $res = /* DOL_MAIN_URL_ROOT */ DOL_BASE_PATH.'/'.$path; // Standard value |
|
772 | 772 | } |
773 | 773 | if ($type == 3) { |
774 | - $res = DOL_BASE_URI . '/' . $path; |
|
774 | + $res = DOL_BASE_URI.'/'.$path; |
|
775 | 775 | } |
776 | 776 | |
777 | 777 | foreach (Globals::$conf->file->dol_document_root as $key => $dirroot) { // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...) |
@@ -781,33 +781,33 @@ discard block |
||
781 | 781 | // Define $urlwithroot |
782 | 782 | |
783 | 783 | // $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_BASE_URI, '/') . '$/i', '', trim($dolibarr_main_url_root)); |
784 | - $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_BASE_URI, '/') . '$/i', '', trim(DOL_BASE_URI)); |
|
784 | + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_BASE_URI, '/').'$/i', '', trim(DOL_BASE_URI)); |
|
785 | 785 | |
786 | - $urlwithroot = $urlwithouturlroot . DOL_BASE_URI; // This is to use external domain name found into config file |
|
786 | + $urlwithroot = $urlwithouturlroot.DOL_BASE_URI; // This is to use external domain name found into config file |
|
787 | 787 | //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current |
788 | 788 | |
789 | - $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : $urlwithroot) . '/' . $path; // Test on start with http is for old conf syntax |
|
789 | + $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : $urlwithroot).'/'.$path; // Test on start with http is for old conf syntax |
|
790 | 790 | } |
791 | 791 | continue; |
792 | 792 | } |
793 | - preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i', $path, $regs); // Take part before '?' |
|
793 | + preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i', $path, $regs); // Take part before '?' |
|
794 | 794 | if (!empty($regs[1])) { |
795 | 795 | //print $key.'-'.$dirroot.'/'.$path.'-'.$conf->file->dol_url_root[$type].'<br>'."\n"; |
796 | - if (file_exists($dirroot . '/' . $regs[1])) { |
|
796 | + if (file_exists($dirroot.'/'.$regs[1])) { |
|
797 | 797 | if ($type == 1) { |
798 | - $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : DOL_BASE_URI) . Globals::$conf->file->dol_url_root[$key] . '/' . $path; |
|
798 | + $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : DOL_BASE_URI).Globals::$conf->file->dol_url_root[$key].'/'.$path; |
|
799 | 799 | } |
800 | 800 | if ($type == 2) { |
801 | - $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : DOL_MAIN_URL_ROOT) . Globals::$conf->file->dol_url_root[$key] . '/' . $path; |
|
801 | + $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : DOL_MAIN_URL_ROOT).Globals::$conf->file->dol_url_root[$key].'/'.$path; |
|
802 | 802 | } |
803 | 803 | if ($type == 3) { |
804 | 804 | // global $dolibarr_main_url_root; |
805 | 805 | // Define $urlwithroot |
806 | - $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_BASE_URI, '/') . '$/i', '', trim($dolibarr_main_url_root)); |
|
807 | - $urlwithroot = $urlwithouturlroot . DOL_BASE_URI; // This is to use external domain name found into config file |
|
806 | + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_BASE_URI, '/').'$/i', '', trim($dolibarr_main_url_root)); |
|
807 | + $urlwithroot = $urlwithouturlroot.DOL_BASE_URI; // This is to use external domain name found into config file |
|
808 | 808 | //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current |
809 | 809 | |
810 | - $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : $urlwithroot) . Globals::$conf->file->dol_url_root[$key] . '/' . $path; // Test on start with http is for old conf syntax |
|
810 | + $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : $urlwithroot).Globals::$conf->file->dol_url_root[$key].'/'.$path; // Test on start with http is for old conf syntax |
|
811 | 811 | } |
812 | 812 | break; |
813 | 813 | } |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | if (empty($native)) { |
836 | 836 | $myclone = unserialize(serialize($object)); |
837 | 837 | } else { |
838 | - $myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep references (refer to the same target/variable) |
|
838 | + $myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep references (refer to the same target/variable) |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | return $myclone; |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | */ |
957 | 957 | static function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '') |
958 | 958 | { |
959 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName |
|
959 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName |
|
960 | 960 | $forbidden_chars_to_remove = array(); |
961 | 961 | if (is_array($badcharstoreplace)) |
962 | 962 | $forbidden_chars_to_replace = $badcharstoreplace; |
@@ -1019,12 +1019,12 @@ discard block |
||
1019 | 1019 | static function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0) |
1020 | 1020 | { |
1021 | 1021 | // escape quotes and backslashes, newlines, etc. |
1022 | - $tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags |
|
1022 | + $tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags |
|
1023 | 1023 | if (!$keepb) |
1024 | 1024 | $tmp = strtr($tmp, array("<b>" => '', '</b>' => '')); |
1025 | 1025 | if (!$keepn) |
1026 | 1026 | $tmp = strtr($tmp, array("\r" => '\\r', "\n" => '\\n')); |
1027 | - return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html tags |
|
1027 | + return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html tags |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | /** |
@@ -1094,14 +1094,14 @@ discard block |
||
1094 | 1094 | $message = preg_replace('/password=\'[^\']*\'/', 'password=\'hidden\'', $message); // protection to avoid to have value of password in log |
1095 | 1095 | // If adding log inside HTML page is required |
1096 | 1096 | if (!empty($_REQUEST['logtohtml']) && (!empty(Globals::$conf->global->MAIN_ENABLE_LOG_TO_HTML) || !empty(Globals::$conf->global->MAIN_LOGTOHTML))) { // MAIN_LOGTOHTML kept for backward compatibility |
1097 | - Globals::$conf->logbuffer[] = dol_print_date(time(), "%Y-%m-%d %H:%M:%S") . " " . $message; |
|
1097 | + Globals::$conf->logbuffer[] = dol_print_date(time(), "%Y-%m-%d %H:%M:%S")." ".$message; |
|
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | //TODO: Remove this. MAIN_ENABLE_LOG_INLINE_HTML should be deprecated and use a log handler dedicated to HTML output |
1101 | 1101 | // If html log tag enabled and url parameter log defined, we show output log on HTML comments |
1102 | 1102 | if (!empty(Globals::$conf->global->MAIN_ENABLE_LOG_INLINE_HTML) && !empty($_GET["log"])) { |
1103 | 1103 | print "\n\n<!-- Log start\n"; |
1104 | - print $message . "\n"; |
|
1104 | + print $message."\n"; |
|
1105 | 1105 | print "Log end -->\n"; |
1106 | 1106 | } |
1107 | 1107 | |
@@ -1115,7 +1115,7 @@ discard block |
||
1115 | 1115 | |
1116 | 1116 | // This is when server run behind a reverse proxy |
1117 | 1117 | if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) |
1118 | - $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'] . (empty($_SERVER["REMOTE_ADDR"]) ? '' : '->' . $_SERVER['REMOTE_ADDR']); |
|
1118 | + $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'].(empty($_SERVER["REMOTE_ADDR"]) ? '' : '->'.$_SERVER['REMOTE_ADDR']); |
|
1119 | 1119 | // This is when server run normally on a server |
1120 | 1120 | else if (!empty($_SERVER["REMOTE_ADDR"])) |
1121 | 1121 | $data['ip'] = $_SERVER['REMOTE_ADDR']; |
@@ -1124,10 +1124,10 @@ discard block |
||
1124 | 1124 | $data['ip'] = $_SERVER['SERVER_ADDR']; |
1125 | 1125 | // This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it). |
1126 | 1126 | else if (!empty($_SERVER['COMPUTERNAME'])) |
1127 | - $data['ip'] = $_SERVER['COMPUTERNAME'] . (empty($_SERVER['USERNAME']) ? '' : '@' . $_SERVER['USERNAME']); |
|
1127 | + $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME']) ? '' : '@'.$_SERVER['USERNAME']); |
|
1128 | 1128 | // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). |
1129 | 1129 | else if (!empty($_SERVER['LOGNAME'])) |
1130 | - $data['ip'] = '???@' . $_SERVER['LOGNAME']; |
|
1130 | + $data['ip'] = '???@'.$_SERVER['LOGNAME']; |
|
1131 | 1131 | // Loop on each log handler and send output |
1132 | 1132 | foreach (Globals::$conf->loghandlers as $loghandlerinstance) { |
1133 | 1133 | if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) |
@@ -1179,10 +1179,10 @@ discard block |
||
1179 | 1179 | { |
1180 | 1180 | // global Globals::$conf, $langs, $hookmanager; |
1181 | 1181 | |
1182 | - $out = "\n" . '<div class="tabs" data-role="controlgroup" data-type="horizontal">' . "\n"; |
|
1182 | + $out = "\n".'<div class="tabs" data-role="controlgroup" data-type="horizontal">'."\n"; |
|
1183 | 1183 | |
1184 | 1184 | if ($morehtmlright) { |
1185 | - $out .= '<div class="inline-block floatright tabsElem">' . $morehtmlright . '</div>'; // Output right area first so when space is missing, text is in front of tabs and not under. |
|
1185 | + $out .= '<div class="inline-block floatright tabsElem">'.$morehtmlright.'</div>'; // Output right area first so when space is missing, text is in front of tabs and not under. |
|
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | // Show title |
@@ -1193,8 +1193,8 @@ discard block |
||
1193 | 1193 | $limittitle = 30; |
1194 | 1194 | $out .= '<a class="tabTitle">'; |
1195 | 1195 | if ($picto) |
1196 | - $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_') . $picto, '', $pictoisfullpath) . ' '; |
|
1197 | - $out .= '<span class="tabTitleText">' . dol_trunc($title, $limittitle) . '</span>'; |
|
1196 | + $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath).' '; |
|
1197 | + $out .= '<span class="tabTitleText">'.dol_trunc($title, $limittitle).'</span>'; |
|
1198 | 1198 | $out .= '</a>'; |
1199 | 1199 | } |
1200 | 1200 | |
@@ -1234,23 +1234,23 @@ discard block |
||
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | if ($i < $limittoshow || $isactive) { |
1237 | - $out .= '<div class="inline-block tabsElem' . ($isactive ? ' tabsElemActive' : '') . ((!$isactive && !empty(Globals::$conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT)) ? ' hideonprint' : '') . '"><!-- id tab = ' . (empty($links[$i][2]) ? '' : $links[$i][2]) . ' -->'; |
|
1237 | + $out .= '<div class="inline-block tabsElem'.($isactive ? ' tabsElemActive' : '').((!$isactive && !empty(Globals::$conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT)) ? ' hideonprint' : '').'"><!-- id tab = '.(empty($links[$i][2]) ? '' : $links[$i][2]).' -->'; |
|
1238 | 1238 | if (isset($links[$i][2]) && $links[$i][2] == 'image') { |
1239 | 1239 | if (!empty($links[$i][0])) { |
1240 | - $out .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n"; |
|
1240 | + $out .= '<a class="tabimage'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; |
|
1241 | 1241 | } else { |
1242 | - $out .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n"; |
|
1242 | + $out .= '<span class="tabspan">'.$links[$i][1].'</span>'."\n"; |
|
1243 | 1243 | } |
1244 | 1244 | } else if (!empty($links[$i][1])) { |
1245 | 1245 | //print "x $i $active ".$links[$i][2]." z"; |
1246 | 1246 | if ($isactive) { |
1247 | - $out .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="tabactive tab inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">'; |
|
1247 | + $out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tabactive tab inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'; |
|
1248 | 1248 | $out .= $links[$i][1]; |
1249 | - $out .= '</a>' . "\n"; |
|
1249 | + $out .= '</a>'."\n"; |
|
1250 | 1250 | } else { |
1251 | - $out .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="tabunactive tab inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">'; |
|
1251 | + $out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tabunactive tab inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'; |
|
1252 | 1252 | $out .= $links[$i][1]; |
1253 | - $out .= '</a>' . "\n"; |
|
1253 | + $out .= '</a>'."\n"; |
|
1254 | 1254 | } |
1255 | 1255 | } |
1256 | 1256 | $out .= '</div>'; |
@@ -1263,14 +1263,14 @@ discard block |
||
1263 | 1263 | $outmore .= '<div class="popuptab wordwrap" style="display:inherit;">'; |
1264 | 1264 | if (isset($links[$i][2]) && $links[$i][2] == 'image') { |
1265 | 1265 | if (!empty($links[$i][0])) |
1266 | - $outmore .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n"; |
|
1266 | + $outmore .= '<a class="tabimage'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; |
|
1267 | 1267 | else |
1268 | - $outmore .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n"; |
|
1268 | + $outmore .= '<span class="tabspan">'.$links[$i][1].'</span>'."\n"; |
|
1269 | 1269 | } |
1270 | 1270 | else if (!empty($links[$i][1])) { |
1271 | - $outmore .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="wordwrap inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">'; |
|
1271 | + $outmore .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="wordwrap inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'; |
|
1272 | 1272 | $outmore .= preg_replace('/([a-z])\/([a-z])/i', '\\1 / \\2', $links[$i][1]); // Replace x/y with x / y to allow wrap on long composed texts. |
1273 | - $outmore .= '</a>' . "\n"; |
|
1273 | + $outmore .= '</a>'."\n"; |
|
1274 | 1274 | } |
1275 | 1275 | $outmore .= '</div>'; |
1276 | 1276 | |
@@ -1286,24 +1286,24 @@ discard block |
||
1286 | 1286 | $right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right'); |
1287 | 1287 | |
1288 | 1288 | $tabsname = str_replace("@", "", $picto); |
1289 | - $out .= '<div id="moretabs' . $tabsname . '" class="inline-block tabsElem">'; |
|
1290 | - $out .= '<a href="#" class="tab moretab inline-block tabunactive reposition">' . $langs->trans("More") . '... (' . $nbintab . ')</a>'; |
|
1291 | - $out .= '<div id="moretabsList' . $tabsname . '" style="position: absolute; ' . $left . ': -999em; text-align: ' . $left . '; margin:0px; padding:2px">'; |
|
1289 | + $out .= '<div id="moretabs'.$tabsname.'" class="inline-block tabsElem">'; |
|
1290 | + $out .= '<a href="#" class="tab moretab inline-block tabunactive reposition">'.$langs->trans("More").'... ('.$nbintab.')</a>'; |
|
1291 | + $out .= '<div id="moretabsList'.$tabsname.'" style="position: absolute; '.$left.': -999em; text-align: '.$left.'; margin:0px; padding:2px">'; |
|
1292 | 1292 | $out .= $outmore; |
1293 | 1293 | $out .= '</div>'; |
1294 | 1294 | $out .= '<div></div>'; |
1295 | 1295 | $out .= "</div>\n"; |
1296 | 1296 | |
1297 | 1297 | $out .= "<script>"; |
1298 | - $out .= "$('#moretabs" . $tabsname . "').mouseenter( function() { console.log('mouseenter " . $left . "'); $('#moretabsList" . $tabsname . "').css('" . $left . "','auto');});"; |
|
1299 | - $out .= "$('#moretabs" . $tabsname . "').mouseleave( function() { console.log('mouseleave " . $left . "'); $('#moretabsList" . $tabsname . "').css('" . $left . "','-999em');});"; |
|
1298 | + $out .= "$('#moretabs".$tabsname."').mouseenter( function() { console.log('mouseenter ".$left."'); $('#moretabsList".$tabsname."').css('".$left."','auto');});"; |
|
1299 | + $out .= "$('#moretabs".$tabsname."').mouseleave( function() { console.log('mouseleave ".$left."'); $('#moretabsList".$tabsname."').css('".$left."','-999em');});"; |
|
1300 | 1300 | $out .= "</script>"; |
1301 | 1301 | } |
1302 | 1302 | |
1303 | 1303 | $out .= "</div>\n"; |
1304 | 1304 | |
1305 | 1305 | if (!$notab || $notab == -1) |
1306 | - $out .= "\n" . '<div class="tabBar' . ($notab == -1 ? '' : ' tabBarWithBottom') . '">' . "\n"; |
|
1306 | + $out .= "\n".'<div class="tabBar'.($notab == -1 ? '' : ' tabBarWithBottom').'">'."\n"; |
|
1307 | 1307 | |
1308 | 1308 | $parameters = array('tabname' => $active, 'out' => $out); |
1309 | 1309 | $reshook = $hookmanager->executeHooks('printTabsHead', $parameters); // This hook usage is called just before output the head of tabs. Take also a look at "completeTabsHead" |
@@ -1412,7 +1412,7 @@ discard block |
||
1412 | 1412 | if (Globals::$conf->browser->layout == 'phone') |
1413 | 1413 | $maxvisiblephotos = 1; |
1414 | 1414 | if ($showimage) |
1415 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('product', Globals::$conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>'; |
|
1415 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', Globals::$conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>'; |
|
1416 | 1416 | else { |
1417 | 1417 | if (!empty(Globals::$conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) { |
1418 | 1418 | $nophoto = ''; |
@@ -1421,18 +1421,18 @@ discard block |
||
1421 | 1421 | //elseif (Globals::$conf->browser->layout != 'phone') { // Show no photo link |
1422 | 1422 | $nophoto = '/public/theme/common/nophoto.png'; |
1423 | 1423 | // $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '"></div>'; |
1424 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '"></div>'; |
|
1424 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" border="0"'.($width ? ' width="'.$width.'"' : '').' src="'.DOL_BASE_URI.$nophoto.'"></div>'; |
|
1425 | 1425 | //} |
1426 | 1426 | } |
1427 | 1427 | } elseif ($object->element == 'ticket') { |
1428 | 1428 | $width = 80; |
1429 | 1429 | $cssclass = 'photoref'; |
1430 | - $showimage = $object->is_photo_available(Globals::$conf->ticket->multidir_output[$entity] . '/' . $object->track_id); |
|
1430 | + $showimage = $object->is_photo_available(Globals::$conf->ticket->multidir_output[$entity].'/'.$object->track_id); |
|
1431 | 1431 | $maxvisiblephotos = (isset(Globals::$conf->global->TICKETSUP_MAX_VISIBLE_PHOTO) ? Globals::$conf->global->TICKETSUP_MAX_VISIBLE_PHOTO : 2); |
1432 | 1432 | if (Globals::$conf->browser->layout == 'phone') |
1433 | 1433 | $maxvisiblephotos = 1; |
1434 | 1434 | if ($showimage) |
1435 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('ticket', Globals::$conf->ticket->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>'; |
|
1435 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('ticket', Globals::$conf->ticket->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>'; |
|
1436 | 1436 | else { |
1437 | 1437 | if (!empty(Globals::$conf->global->TICKETSUP_NODISPLAYIFNOPHOTO)) { |
1438 | 1438 | $nophoto = ''; |
@@ -1441,7 +1441,7 @@ discard block |
||
1441 | 1441 | //elseif (Globals::$conf->browser->layout != 'phone') { // Show no photo link |
1442 | 1442 | $nophoto = '/public/theme/common/nophoto.png'; |
1443 | 1443 | //$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '"></div>'; |
1444 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '"></div>'; |
|
1444 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" border="0"'.($width ? ' width="'.$width.'"' : '').' src="'.DOL_BASE_URI.$nophoto.'"></div>'; |
|
1445 | 1445 | //} |
1446 | 1446 | } |
1447 | 1447 | } else { |
@@ -1451,25 +1451,25 @@ discard block |
||
1451 | 1451 | // Check if a preview file is available |
1452 | 1452 | if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice', 'expensereport')) && class_exists("Imagick")) { |
1453 | 1453 | $objectref = dol_sanitizeFileName($object->ref); |
1454 | - $dir_output = (empty(Globals::$conf->$modulepart->multidir_output[$entity]) ? Globals::$conf->$modulepart->dir_output : Globals::$conf->$modulepart->multidir_output[$entity]) . "/"; |
|
1454 | + $dir_output = (empty(Globals::$conf->$modulepart->multidir_output[$entity]) ? Globals::$conf->$modulepart->dir_output : Globals::$conf->$modulepart->multidir_output[$entity])."/"; |
|
1455 | 1455 | if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice'))) { |
1456 | 1456 | $subdir = get_exdir($object->id, 2, 0, 1, $object, $modulepart); |
1457 | - $subdir .= ((!empty($subdir) && !preg_match('/\/$/', $subdir)) ? '/' : '') . $objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it at end |
|
1457 | + $subdir .= ((!empty($subdir) && !preg_match('/\/$/', $subdir)) ? '/' : '').$objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it at end |
|
1458 | 1458 | } else { |
1459 | 1459 | $subdir = get_exdir($object->id, 0, 0, 1, $object, $modulepart); |
1460 | 1460 | } |
1461 | 1461 | if (empty($subdir)) |
1462 | 1462 | $subdir = 'errorgettingsubdirofobject'; // Protection to avoid to return empty path |
1463 | 1463 | |
1464 | - $filepath = $dir_output . $subdir . "/"; |
|
1464 | + $filepath = $dir_output.$subdir."/"; |
|
1465 | 1465 | |
1466 | - $file = $filepath . $objectref . ".pdf"; |
|
1467 | - $relativepath = $subdir . '/' . $objectref . '.pdf'; |
|
1466 | + $file = $filepath.$objectref.".pdf"; |
|
1467 | + $relativepath = $subdir.'/'.$objectref.'.pdf'; |
|
1468 | 1468 | |
1469 | 1469 | // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") |
1470 | - $fileimage = $file . '_preview.png'; // If PDF has 1 page |
|
1471 | - $fileimagebis = $file . '_preview-0.png'; // If PDF has more than one page |
|
1472 | - $relativepathimage = $relativepath . '_preview.png'; |
|
1470 | + $fileimage = $file.'_preview.png'; // If PDF has 1 page |
|
1471 | + $fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page |
|
1472 | + $relativepathimage = $relativepath.'_preview.png'; |
|
1473 | 1473 | |
1474 | 1474 | // Si fichier PDF existe |
1475 | 1475 | if (file_exists($file)) { |
@@ -1478,7 +1478,7 @@ discard block |
||
1478 | 1478 | if ((!file_exists($fileimage) || (filemtime($fileimage) < filemtime($file))) && (!file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file))) |
1479 | 1479 | ) { |
1480 | 1480 | if (empty(Globals::$conf->global->MAIN_DISABLE_PDF_THUMBS)) { // If you experienc trouble with pdf thumb generation and imagick, you can disable here. |
1481 | - include_once DOL_BASE_PATH . '/core/lib/files.lib.php'; |
|
1481 | + include_once DOL_BASE_PATH.'/core/lib/files.lib.php'; |
|
1482 | 1482 | $ret = dol_convert_file($file, 'png', $fileimage); |
1483 | 1483 | if ($ret < 0) |
1484 | 1484 | $error++; |
@@ -1491,14 +1491,14 @@ discard block |
||
1491 | 1491 | // Si fichier png PDF d'1 page trouve |
1492 | 1492 | if (file_exists($fileimage)) { |
1493 | 1493 | $phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">'; |
1494 | - $phototoshow .= '<img height="' . $heightforphotref . '" class="photo photowithmargin photowithborder" src="' . DOL_BASE_URI . '/viewimage.php?modulepart=apercu' . $modulepart . '&file=' . urlencode($relativepathimage) . '">'; |
|
1494 | + $phototoshow .= '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_BASE_URI.'/viewimage.php?modulepart=apercu'.$modulepart.'&file='.urlencode($relativepathimage).'">'; |
|
1495 | 1495 | $phototoshow .= '</div></div>'; |
1496 | 1496 | } |
1497 | 1497 | // Si fichier png PDF de plus d'1 page trouve |
1498 | 1498 | elseif (file_exists($fileimagebis)) { |
1499 | - $preview = preg_replace('/\.png/', '', $relativepathimage) . "-0.png"; |
|
1499 | + $preview = preg_replace('/\.png/', '', $relativepathimage)."-0.png"; |
|
1500 | 1500 | $phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">'; |
1501 | - $phototoshow .= '<img height="' . $heightforphotref . '" class="photo photowithmargin photowithborder" src="' . DOL_BASE_URI . '/viewimage.php?modulepart=apercu' . $modulepart . '&file=' . urlencode($preview) . '"><p>'; |
|
1501 | + $phototoshow .= '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_BASE_URI.'/viewimage.php?modulepart=apercu'.$modulepart.'&file='.urlencode($preview).'"><p>'; |
|
1502 | 1502 | $phototoshow .= '</div></div>'; |
1503 | 1503 | } |
1504 | 1504 | } |
@@ -1525,10 +1525,10 @@ discard block |
||
1525 | 1525 | $picto = $object->picto; |
1526 | 1526 | if ($object->element == 'project' && !$object->public) |
1527 | 1527 | $picto = 'project'; // instead of projectpub |
1528 | - $nophoto = img_picto('', 'object_' . $picto, '', false, 1); |
|
1528 | + $nophoto = img_picto('', 'object_'.$picto, '', false, 1); |
|
1529 | 1529 | } |
1530 | 1530 | $morehtmlleft .= '<!-- No photo to show -->'; |
1531 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . $nophoto . '"></div></div>'; |
|
1531 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" border="0"'.($width ? ' width="'.$width.'"' : '').' src="'.$nophoto.'"></div></div>'; |
|
1532 | 1532 | |
1533 | 1533 | $morehtmlleft .= '</div>'; |
1534 | 1534 | } |
@@ -1536,7 +1536,7 @@ discard block |
||
1536 | 1536 | } |
1537 | 1537 | |
1538 | 1538 | if ($showbarcode) |
1539 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $form->showbarcode($object) . '</div>'; |
|
1539 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>'; |
|
1540 | 1540 | |
1541 | 1541 | if ($object->element == 'societe') { |
1542 | 1542 | if (!empty(Globals::$conf->use_javascript_ajax) && $user->rights->societe->creer && !empty(Globals::$conf->global->MAIN_DIRECT_STATUS_UPDATE)) { |
@@ -1549,14 +1549,14 @@ discard block |
||
1549 | 1549 | if (!empty(Globals::$conf->use_javascript_ajax) && $user->rights->produit->creer && !empty(Globals::$conf->global->MAIN_DIRECT_STATUS_UPDATE)) { |
1550 | 1550 | $morehtmlstatus .= ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); |
1551 | 1551 | } else { |
1552 | - $morehtmlstatus .= '<span class="statusrefsell">' . $object->getLibStatut(5, 0) . '</span>'; |
|
1552 | + $morehtmlstatus .= '<span class="statusrefsell">'.$object->getLibStatut(5, 0).'</span>'; |
|
1553 | 1553 | } |
1554 | 1554 | $morehtmlstatus .= ' '; |
1555 | 1555 | //$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Buy").') '; |
1556 | 1556 | if (!empty(Globals::$conf->use_javascript_ajax) && $user->rights->produit->creer && !empty(Globals::$conf->global->MAIN_DIRECT_STATUS_UPDATE)) { |
1557 | 1557 | $morehtmlstatus .= ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); |
1558 | 1558 | } else { |
1559 | - $morehtmlstatus .= '<span class="statusrefbuy">' . $object->getLibStatut(5, 1) . '</span>'; |
|
1559 | + $morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(5, 1).'</span>'; |
|
1560 | 1560 | } |
1561 | 1561 | } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan'))) { |
1562 | 1562 | $tmptxt = $object->getLibStatut(6, $object->totalpaye); |
@@ -1583,7 +1583,7 @@ discard block |
||
1583 | 1583 | if ($object->progress >= 100) |
1584 | 1584 | $object->fk_statut = 3; |
1585 | 1585 | $tmptxt = $object->getLibStatut(5); |
1586 | - $morehtmlstatus .= $tmptxt; // No status on task |
|
1586 | + $morehtmlstatus .= $tmptxt; // No status on task |
|
1587 | 1587 | } |
1588 | 1588 | else { // Generic case |
1589 | 1589 | $tmptxt = $object->getLibStatut(6); |
@@ -1597,18 +1597,18 @@ discard block |
||
1597 | 1597 | if (method_exists($object, 'getVentilExportCompta')) { |
1598 | 1598 | $accounted = $object->getVentilExportCompta(); |
1599 | 1599 | $langs->load("accountancy"); |
1600 | - $morehtmlstatus .= '</div><div class="statusref statusrefbis">' . ($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted")); |
|
1600 | + $morehtmlstatus .= '</div><div class="statusref statusrefbis">'.($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted")); |
|
1601 | 1601 | } |
1602 | 1602 | } |
1603 | 1603 | |
1604 | 1604 | // Add alias for thirdparty |
1605 | 1605 | if (!empty($object->name_alias)) |
1606 | - $morehtmlref .= '<div class="refidno">' . $object->name_alias . '</div>'; |
|
1606 | + $morehtmlref .= '<div class="refidno">'.$object->name_alias.'</div>'; |
|
1607 | 1607 | |
1608 | 1608 | // Add label |
1609 | 1609 | if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task') { |
1610 | 1610 | if (!empty($object->label)) |
1611 | - $morehtmlref .= '<div class="refidno">' . $object->label . '</div>'; |
|
1611 | + $morehtmlref .= '<div class="refidno">'.$object->label.'</div>'; |
|
1612 | 1612 | } |
1613 | 1613 | |
1614 | 1614 | if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files') { |
@@ -1618,11 +1618,11 @@ discard block |
||
1618 | 1618 | } |
1619 | 1619 | if (!empty(Globals::$conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product'))) { |
1620 | 1620 | $morehtmlref .= '<div style="clear: both;"></div><div class="refidno">'; |
1621 | - $morehtmlref .= $langs->trans("TechnicalID") . ': ' . $object->id; |
|
1621 | + $morehtmlref .= $langs->trans("TechnicalID").': '.$object->id; |
|
1622 | 1622 | $morehtmlref .= '</div>'; |
1623 | 1623 | } |
1624 | 1624 | |
1625 | - print '<div class="' . ($onlybanner ? 'arearefnobottom ' : 'arearef ') . 'heightref valignmiddle" width="100%">'; |
|
1625 | + print '<div class="'.($onlybanner ? 'arearefnobottom ' : 'arearef ').'heightref valignmiddle" width="100%">'; |
|
1626 | 1626 | print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright); |
1627 | 1627 | print '</div>'; |
1628 | 1628 | print '<div class="underrefbanner clearboth"></div>'; |
@@ -1644,7 +1644,7 @@ discard block |
||
1644 | 1644 | if ($fieldrequired) |
1645 | 1645 | $ret .= '<span class="fieldrequired">'; |
1646 | 1646 | if ((Globals::$conf->dol_use_jmobile != 4)) |
1647 | - $ret .= '<label for="' . $fieldkey . '">'; |
|
1647 | + $ret .= '<label for="'.$fieldkey.'">'; |
|
1648 | 1648 | $ret .= $langs->trans($langkey); |
1649 | 1649 | if ((Globals::$conf->dol_use_jmobile != 4)) |
1650 | 1650 | $ret .= '</label>'; |
@@ -1663,9 +1663,9 @@ discard block |
||
1663 | 1663 | static function dol_bc($var, $moreclass = '') |
1664 | 1664 | { |
1665 | 1665 | // global $bc; |
1666 | - $ret = ' ' . $bc[$var]; |
|
1666 | + $ret = ' '.$bc[$var]; |
|
1667 | 1667 | if ($moreclass) |
1668 | - $ret = preg_replace('/class=\"/', 'class="' . $moreclass . ' ', $ret); |
|
1668 | + $ret = preg_replace('/class=\"/', 'class="'.$moreclass.' ', $ret); |
|
1669 | 1669 | return $ret; |
1670 | 1670 | } |
1671 | 1671 | |
@@ -1685,50 +1685,50 @@ discard block |
||
1685 | 1685 | // global Globals::$conf, $langs; |
1686 | 1686 | |
1687 | 1687 | $ret = ''; |
1688 | - $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS |
|
1688 | + $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS |
|
1689 | 1689 | // Address |
1690 | 1690 | if (empty($mode)) { |
1691 | 1691 | $ret .= $object->address; |
1692 | 1692 | } |
1693 | 1693 | // Zip/Town/State |
1694 | 1694 | if (in_array($object->country_code, array('AU', 'CA', 'US')) || !empty(Globals::$conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) { // US: title firstname name \n address lines \n town, state, zip \n country |
1695 | - $ret .= ($ret ? $sep : '' ) . $object->town; |
|
1695 | + $ret .= ($ret ? $sep : '').$object->town; |
|
1696 | 1696 | if ($object->state) { |
1697 | - $ret .= ($ret ? ", " : '') . $object->state; |
|
1697 | + $ret .= ($ret ? ", " : '').$object->state; |
|
1698 | 1698 | } |
1699 | 1699 | if ($object->zip) |
1700 | - $ret .= ($ret ? ", " : '') . $object->zip; |
|
1700 | + $ret .= ($ret ? ", " : '').$object->zip; |
|
1701 | 1701 | } |
1702 | 1702 | else if (in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country |
1703 | - $ret .= ($ret ? $sep : '' ) . $object->town; |
|
1703 | + $ret .= ($ret ? $sep : '').$object->town; |
|
1704 | 1704 | if ($object->state) { |
1705 | - $ret .= ($ret ? ", " : '') . $object->state; |
|
1705 | + $ret .= ($ret ? ", " : '').$object->state; |
|
1706 | 1706 | } |
1707 | 1707 | if ($object->zip) |
1708 | - $ret .= ($ret ? $sep : '' ) . $object->zip; |
|
1708 | + $ret .= ($ret ? $sep : '').$object->zip; |
|
1709 | 1709 | } |
1710 | 1710 | else if (in_array($object->country_code, array('ES', 'TR'))) { // ES: title firstname name \n address lines \n zip town \n state \n country |
1711 | - $ret .= ($ret ? $sep : '' ) . $object->zip; |
|
1712 | - $ret .= ($object->town ? (($object->zip ? ' ' : '') . $object->town) : ''); |
|
1711 | + $ret .= ($ret ? $sep : '').$object->zip; |
|
1712 | + $ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : ''); |
|
1713 | 1713 | if ($object->state) { |
1714 | - $ret .= "\n" . $object->state; |
|
1714 | + $ret .= "\n".$object->state; |
|
1715 | 1715 | } |
1716 | 1716 | } else if (in_array($object->country_code, array('IT'))) { // IT: tile firstname name\n address lines \n zip (Code Departement) \n country |
1717 | - $ret .= ($ret ? $sep : '' ) . $object->zip; |
|
1718 | - $ret .= ($object->town ? (($object->zip ? ' ' : '') . $object->town) : ''); |
|
1719 | - $ret .= ($object->departement_id ? (' (' . ($object->departement_id) . ')') : ''); |
|
1717 | + $ret .= ($ret ? $sep : '').$object->zip; |
|
1718 | + $ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : ''); |
|
1719 | + $ret .= ($object->departement_id ? (' ('.($object->departement_id).')') : ''); |
|
1720 | 1720 | } else { // Other: title firstname name \n address lines \n zip town \n country |
1721 | - $ret .= $object->zip ? (($ret ? $sep : '' ) . $object->zip) : ''; |
|
1722 | - $ret .= ($object->town ? (($object->zip ? ' ' : ($ret ? $sep : '' )) . $object->town) : ''); |
|
1721 | + $ret .= $object->zip ? (($ret ? $sep : '').$object->zip) : ''; |
|
1722 | + $ret .= ($object->town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$object->town) : ''); |
|
1723 | 1723 | if ($object->state && in_array($object->country_code, $countriesusingstate)) { |
1724 | - $ret .= ($ret ? ", " : '') . $object->state; |
|
1724 | + $ret .= ($ret ? ", " : '').$object->state; |
|
1725 | 1725 | } |
1726 | 1726 | } |
1727 | 1727 | if (!is_object($outputlangs)) |
1728 | 1728 | $outputlangs = $langs; |
1729 | 1729 | if ($withcountry) { |
1730 | 1730 | $langs->load("dict"); |
1731 | - $ret .= ($object->country_code ? ($ret ? $sep : '') . $outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country" . $object->country_code)) : ''); |
|
1731 | + $ret .= ($object->country_code ? ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)) : ''); |
|
1732 | 1732 | } |
1733 | 1733 | |
1734 | 1734 | return $ret; |
@@ -1782,13 +1782,13 @@ discard block |
||
1782 | 1782 | if (is_string($tzoutput)) { |
1783 | 1783 | if ($tzoutput == 'tzserver') { |
1784 | 1784 | $to_gmt = false; |
1785 | - $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion' |
|
1785 | + $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion' |
|
1786 | 1786 | $offsettz = 0; |
1787 | 1787 | $offsetdst = 0; |
1788 | 1788 | } elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') { |
1789 | 1789 | $to_gmt = true; |
1790 | 1790 | $offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion' |
1791 | - $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore |
|
1791 | + $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore |
|
1792 | 1792 | $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; // Will not be used anymore |
1793 | 1793 | } |
1794 | 1794 | } |
@@ -1834,9 +1834,9 @@ discard block |
||
1834 | 1834 | else if ($format == 'dayxcard') |
1835 | 1835 | $format = '%Y%m%d'; |
1836 | 1836 | else if ($format == 'dayrfc') |
1837 | - $format = '%Y-%m-%d'; // DATE_RFC3339 |
|
1837 | + $format = '%Y-%m-%d'; // DATE_RFC3339 |
|
1838 | 1838 | else if ($format == 'dayhourrfc') |
1839 | - $format = '%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339 |
|
1839 | + $format = '%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339 |
|
1840 | 1840 | else if ($format == 'standard') |
1841 | 1841 | $format = '%Y-%m-%d %H:%M:%S'; |
1842 | 1842 | |
@@ -1847,7 +1847,7 @@ discard block |
||
1847 | 1847 | |
1848 | 1848 | // If date undefined or "", we return "" |
1849 | 1849 | if (dol_strlen($time) == 0) |
1850 | - return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) |
|
1850 | + return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) |
|
1851 | 1851 | |
1852 | 1852 | |
1853 | 1853 | |
@@ -1898,7 +1898,7 @@ discard block |
||
1898 | 1898 | if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg) || 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', $time, $reg)) { // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000 |
1899 | 1899 | // TODO Remove this. |
1900 | 1900 | // This part of code should not be used. |
1901 | - dol_syslog("Functions.lib::dol_print_date static function call with deprecated value of time in page " . $_SERVER["PHP_SELF"], LOG_ERR); |
|
1901 | + dol_syslog("Functions.lib::dol_print_date static function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_ERR); |
|
1902 | 1902 | // Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS' |
1903 | 1903 | $syear = (!empty($reg[1]) ? $reg[1] : ''); |
1904 | 1904 | $smonth = (!empty($reg[2]) ? $reg[2] : ''); |
@@ -1916,7 +1916,7 @@ discard block |
||
1916 | 1916 | |
1917 | 1917 | $ret = adodb_strftime($format, $timetouse, $to_gmt); |
1918 | 1918 | } else |
1919 | - $ret = 'Bad value ' . $time . ' for date'; |
|
1919 | + $ret = 'Bad value '.$time.' for date'; |
|
1920 | 1920 | } |
1921 | 1921 | |
1922 | 1922 | if (preg_match('/__b__/i', $format)) { |
@@ -1925,11 +1925,11 @@ discard block |
||
1925 | 1925 | $month = adodb_strftime('%m', $timetouse); |
1926 | 1926 | $month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'. |
1927 | 1927 | if ($encodetooutput) { |
1928 | - $monthtext = $outputlangs->transnoentities('Month' . $month); |
|
1929 | - $monthtextshort = $outputlangs->transnoentities('MonthShort' . $month); |
|
1928 | + $monthtext = $outputlangs->transnoentities('Month'.$month); |
|
1929 | + $monthtextshort = $outputlangs->transnoentities('MonthShort'.$month); |
|
1930 | 1930 | } else { |
1931 | - $monthtext = $outputlangs->transnoentitiesnoconv('Month' . $month); |
|
1932 | - $monthtextshort = $outputlangs->transnoentitiesnoconv('MonthShort' . $month); |
|
1931 | + $monthtext = $outputlangs->transnoentitiesnoconv('Month'.$month); |
|
1932 | + $monthtextshort = $outputlangs->transnoentitiesnoconv('MonthShort'.$month); |
|
1933 | 1933 | } |
1934 | 1934 | //print 'monthtext='.$monthtext.' monthtextshort='.$monthtextshort; |
1935 | 1935 | $ret = str_replace('__b__', $monthtextshort, $ret); |
@@ -1940,8 +1940,8 @@ discard block |
||
1940 | 1940 | if (preg_match('/__a__/i', $format)) { |
1941 | 1941 | $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with static function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. |
1942 | 1942 | |
1943 | - $w = adodb_strftime('%w', $timetouse); // TODO Replace this with static function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. |
|
1944 | - $dayweek = $outputlangs->transnoentitiesnoconv('Day' . $w); |
|
1943 | + $w = adodb_strftime('%w', $timetouse); // TODO Replace this with static function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. |
|
1944 | + $dayweek = $outputlangs->transnoentitiesnoconv('Day'.$w); |
|
1945 | 1945 | $ret = str_replace('__A__', $dayweek, $ret); |
1946 | 1946 | $ret = str_replace('__a__', dol_substr($dayweek, 0, 3), $ret); |
1947 | 1947 | } |
@@ -1988,9 +1988,9 @@ discard block |
||
1988 | 1988 | |
1989 | 1989 | $usealternatemethod = false; |
1990 | 1990 | if ($timestamp <= 0) |
1991 | - $usealternatemethod = true; // <= 1970 |
|
1991 | + $usealternatemethod = true; // <= 1970 |
|
1992 | 1992 | if ($timestamp >= 2145913200) |
1993 | - $usealternatemethod = true; // >= 2038 |
|
1993 | + $usealternatemethod = true; // >= 2038 |
|
1994 | 1994 | |
1995 | 1995 | if ($usealternatemethod) { |
1996 | 1996 | $arrayinfo = adodb_getdate($timestamp, $fast); |
@@ -2050,23 +2050,23 @@ discard block |
||
2050 | 2050 | |
2051 | 2051 | if (method_exists('DateTime', 'getTimestamp')) { |
2052 | 2052 | if (empty($gm) || $gm === 'server') { |
2053 | - $default_timezone = @date_default_timezone_get(); // Example 'Europe/Berlin' |
|
2053 | + $default_timezone = @date_default_timezone_get(); // Example 'Europe/Berlin' |
|
2054 | 2054 | $localtz = new DateTimeZone($default_timezone); |
2055 | 2055 | } else if ($gm === 'user') { |
2056 | 2056 | // We use dol_tz_string first because it is more reliable. |
2057 | - $default_timezone = (empty($_SESSION["dol_tz_string"]) ? @date_default_timezone_get() : $_SESSION["dol_tz_string"]); // Example 'Europe/Berlin' |
|
2057 | + $default_timezone = (empty($_SESSION["dol_tz_string"]) ? @date_default_timezone_get() : $_SESSION["dol_tz_string"]); // Example 'Europe/Berlin' |
|
2058 | 2058 | try { |
2059 | 2059 | $localtz = new DateTimeZone($default_timezone); |
2060 | 2060 | } catch (Exception $e) { |
2061 | - dol_syslog("Warning dol_tz_string contains an invalid value " . $_SESSION["dol_tz_string"], LOG_WARNING); |
|
2061 | + dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING); |
|
2062 | 2062 | $default_timezone = @date_default_timezone_get(); |
2063 | 2063 | } |
2064 | 2064 | } else if (strrpos($gm, "tz,") !== false) { |
2065 | - $timezone = str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin' |
|
2065 | + $timezone = str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin' |
|
2066 | 2066 | try { |
2067 | 2067 | $localtz = new DateTimeZone($timezone); |
2068 | 2068 | } catch (Exception $e) { |
2069 | - dol_syslog("Warning passed timezone contains an invalid value " . $timezone, LOG_WARNING); |
|
2069 | + dol_syslog("Warning passed timezone contains an invalid value ".$timezone, LOG_WARNING); |
|
2070 | 2070 | } |
2071 | 2071 | } |
2072 | 2072 | |
@@ -2105,8 +2105,8 @@ discard block |
||
2105 | 2105 | if ($mode == 'gmt') |
2106 | 2106 | $ret = time(); // Time for now at greenwich. |
2107 | 2107 | else if ($mode == 'tzserver') { // Time for now with PHP server timezone added |
2108 | - require_once DOL_BASE_PATH . '/core/lib/date.lib.php'; |
|
2109 | - $tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time |
|
2108 | + require_once DOL_BASE_PATH.'/core/lib/date.lib.php'; |
|
2109 | + $tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time |
|
2110 | 2110 | $ret = (int) (dol_now('gmt') + ($tzsecond * 3600)); |
2111 | 2111 | } |
2112 | 2112 | /* else if ($mode == 'tzref') // Time for now with parent company timezone is added |
@@ -2152,9 +2152,9 @@ discard block |
||
2152 | 2152 | } |
2153 | 2153 | // Use long or short text unit |
2154 | 2154 | if (empty($shortunit)) { |
2155 | - $ret .= ' ' . $textunitlong; |
|
2155 | + $ret .= ' '.$textunitlong; |
|
2156 | 2156 | } else { |
2157 | - $ret .= ' ' . $textunitshort; |
|
2157 | + $ret .= ' '.$textunitshort; |
|
2158 | 2158 | } |
2159 | 2159 | |
2160 | 2160 | return $ret; |
@@ -2182,13 +2182,13 @@ discard block |
||
2182 | 2182 | $link .= $url; |
2183 | 2183 | $link .= '"'; |
2184 | 2184 | if ($target) |
2185 | - $link .= ' target="' . $target . '"'; |
|
2185 | + $link .= ' target="'.$target.'"'; |
|
2186 | 2186 | $link .= '>'; |
2187 | 2187 | if (!preg_match('/^http/i', $url)) |
2188 | 2188 | $link .= 'http://'; |
2189 | 2189 | $link .= dol_trunc($url, $max); |
2190 | 2190 | $link .= '</a>'; |
2191 | - return '<div class="nospan float" style="margin-right: 10px">' . ($withpicto ? img_picto($langs->trans("Url"), 'object_globe.png') . ' ' : '') . $link . '</div>'; |
|
2191 | + return '<div class="nospan float" style="margin-right: 10px">'.($withpicto ? img_picto($langs->trans("Url"), 'object_globe.png').' ' : '').$link.'</div>'; |
|
2192 | 2192 | } |
2193 | 2193 | |
2194 | 2194 | /** |
@@ -2229,9 +2229,9 @@ discard block |
||
2229 | 2229 | $type = 'AC_EMAIL'; |
2230 | 2230 | $link = ''; |
2231 | 2231 | if (!empty(Globals::$conf->global->AGENDA_ADDACTIONFOREMAIL)) |
2232 | - $link = '<a href="' . DOL_BASE_URI . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
2232 | + $link = '<a href="'.DOL_BASE_URI.'/comm/action/card.php?action=create&backtopage=1&actioncode='.$type.'&contactid='.$cid.'&socid='.$socid.'">'.img_object($langs->trans("AddAction"), "calendar").'</a>'; |
|
2233 | 2233 | if ($link) |
2234 | - $newemail = '<div>' . $newemail . ' ' . $link . '</div>'; |
|
2234 | + $newemail = '<div>'.$newemail.' '.$link.'</div>'; |
|
2235 | 2235 | } |
2236 | 2236 | } |
2237 | 2237 | else { |
@@ -2241,7 +2241,7 @@ discard block |
||
2241 | 2241 | } |
2242 | 2242 | } |
2243 | 2243 | |
2244 | - $rep = '<div class="nospan float" style="margin-right: 10px">' . ($withpicto ? img_picto($langs->trans("EMail"), 'object_email.png') . ' ' : '') . $newemail . '</div>'; |
|
2244 | + $rep = '<div class="nospan float" style="margin-right: 10px">'.($withpicto ? img_picto($langs->trans("EMail"), 'object_email.png').' ' : '').$newemail.'</div>'; |
|
2245 | 2245 | if ($hookmanager) { |
2246 | 2246 | $parameters = array('cid' => $cid, 'socid' => $socid, 'addlink' => $addlink, 'picto' => $withpicto); |
2247 | 2247 | $reshook = $hookmanager->executeHooks('printEmail', $parameters, $email); |
@@ -2271,26 +2271,26 @@ discard block |
||
2271 | 2271 | |
2272 | 2272 | if (!empty($type)) { |
2273 | 2273 | $newskype = '<div class="divsocialnetwork inline-block valignmiddle">'; |
2274 | - $newskype .= img_picto($langs->trans(strtoupper($type)), $type . '.png', '', false, 0, 0, '', 'paddingright'); |
|
2274 | + $newskype .= img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright'); |
|
2275 | 2275 | $newskype .= $value; |
2276 | 2276 | if ($type == 'skype') { |
2277 | 2277 | $newskype .= ' '; |
2278 | 2278 | $newskype .= '<a href="skype:'; |
2279 | 2279 | $newskype .= $value; |
2280 | - $newskype .= '?call" alt="' . $langs->trans("Call") . ' ' . $value . '" title="' . $langs->trans("Call") . ' ' . $value . '">'; |
|
2281 | - $newskype .= '<img src="' . DOL_BASE_URI . '/theme/common/skype_callbutton.png" border="0">'; |
|
2280 | + $newskype .= '?call" alt="'.$langs->trans("Call").' '.$value.'" title="'.$langs->trans("Call").' '.$value.'">'; |
|
2281 | + $newskype .= '<img src="'.DOL_BASE_URI.'/theme/common/skype_callbutton.png" border="0">'; |
|
2282 | 2282 | $newskype .= '</a><a href="skype:'; |
2283 | 2283 | $newskype .= $value; |
2284 | - $newskype .= '?chat" alt="' . $langs->trans("Chat") . ' ' . $value . '" title="' . $langs->trans("Chat") . ' ' . $value . '">'; |
|
2285 | - $newskype .= '<img class="paddingleft" src="' . DOL_BASE_URI . '/theme/common/skype_chatbutton.png" border="0">'; |
|
2284 | + $newskype .= '?chat" alt="'.$langs->trans("Chat").' '.$value.'" title="'.$langs->trans("Chat").' '.$value.'">'; |
|
2285 | + $newskype .= '<img class="paddingleft" src="'.DOL_BASE_URI.'/theme/common/skype_chatbutton.png" border="0">'; |
|
2286 | 2286 | $newskype .= '</a>'; |
2287 | 2287 | } |
2288 | 2288 | if (($cid || $socid) && !empty(Globals::$conf->agenda->enabled) && $user->rights->agenda->myactions->create && $type == 'skype') { |
2289 | 2289 | $addlink = 'AC_SKYPE'; |
2290 | 2290 | $link = ''; |
2291 | 2291 | if (!empty(Globals::$conf->global->AGENDA_ADDACTIONFORSKYPE)) |
2292 | - $link = '<a href="' . DOL_BASE_URI . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $addlink . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
2293 | - $newskype .= ($link ? ' ' . $link : ''); |
|
2292 | + $link = '<a href="'.DOL_BASE_URI.'/comm/action/card.php?action=create&backtopage=1&actioncode='.$addlink.'&contactid='.$cid.'&socid='.$socid.'">'.img_object($langs->trans("AddAction"), "calendar").'</a>'; |
|
2293 | + $newskype .= ($link ? ' '.$link : ''); |
|
2294 | 2294 | } |
2295 | 2295 | $newskype .= '</div>'; |
2296 | 2296 | } |
@@ -2334,165 +2334,165 @@ discard block |
||
2334 | 2334 | if (strtoupper($countrycode) == "FR") { |
2335 | 2335 | // France |
2336 | 2336 | if (dol_strlen($phone) == 10) { |
2337 | - $newphone = substr($newphone, 0, 2) . $separ . substr($newphone, 2, 2) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2); |
|
2337 | + $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 2).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2); |
|
2338 | 2338 | } elseif (dol_strlen($phone) == 7) { |
2339 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 2); |
|
2339 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2); |
|
2340 | 2340 | } elseif (dol_strlen($phone) == 9) { |
2341 | - $newphone = substr($newphone, 0, 2) . $separ . substr($newphone, 2, 3) . $separ . substr($newphone, 5, 2) . $separ . substr($newphone, 7, 2); |
|
2341 | + $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 3).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2); |
|
2342 | 2342 | } elseif (dol_strlen($phone) == 11) { |
2343 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 2) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2); |
|
2343 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2); |
|
2344 | 2344 | } elseif (dol_strlen($phone) == 12) { |
2345 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2345 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2346 | 2346 | } |
2347 | 2347 | } elseif (strtoupper($countrycode) == "CA") { |
2348 | 2348 | if (dol_strlen($phone) == 10) { |
2349 | - $newphone = ($separ != '' ? '(' : '') . substr($newphone, 0, 3) . ($separ != '' ? ')' : '') . $separ . substr($newphone, 3, 3) . ($separ != '' ? '-' : '') . substr($newphone, 6, 4); |
|
2349 | + $newphone = ($separ != '' ? '(' : '').substr($newphone, 0, 3).($separ != '' ? ')' : '').$separ.substr($newphone, 3, 3).($separ != '' ? '-' : '').substr($newphone, 6, 4); |
|
2350 | 2350 | } |
2351 | 2351 | } elseif (strtoupper($countrycode) == "PT") {//Portugal |
2352 | 2352 | if (dol_strlen($phone) == 13) {//ex: +351_ABC_DEF_GHI |
2353 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3); |
|
2353 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3); |
|
2354 | 2354 | } |
2355 | 2355 | } elseif (strtoupper($countrycode) == "SR") {//Suriname |
2356 | 2356 | if (dol_strlen($phone) == 10) {//ex: +597_ABC_DEF |
2357 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3); |
|
2357 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3); |
|
2358 | 2358 | } elseif (dol_strlen($phone) == 11) {//ex: +597_ABC_DEFG |
2359 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 4); |
|
2359 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 4); |
|
2360 | 2360 | } |
2361 | 2361 | } elseif (strtoupper($countrycode) == "DE") {//Allemagne |
2362 | 2362 | if (dol_strlen($phone) == 14) {//ex: +49_ABCD_EFGH_IJK |
2363 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 4) . $separ . substr($newphone, 7, 4) . $separ . substr($newphone, 11, 3); |
|
2363 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 4).$separ.substr($newphone, 11, 3); |
|
2364 | 2364 | } elseif (dol_strlen($phone) == 13) {//ex: +49_ABC_DEFG_HIJ |
2365 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 4) . $separ . substr($newphone, 10, 3); |
|
2365 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 4).$separ.substr($newphone, 10, 3); |
|
2366 | 2366 | } |
2367 | 2367 | } elseif (strtoupper($countrycode) == "ES") {//Espagne |
2368 | 2368 | if (dol_strlen($phone) == 12) {//ex: +34_ABC_DEF_GHI |
2369 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3); |
|
2369 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3); |
|
2370 | 2370 | } |
2371 | 2371 | } elseif (strtoupper($countrycode) == "BF") {// Burkina Faso |
2372 | 2372 | if (dol_strlen($phone) == 12) {//ex : +22 A BC_DE_FG_HI |
2373 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 1) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2373 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2374 | 2374 | } |
2375 | 2375 | } elseif (strtoupper($countrycode) == "RO") {// Roumanie |
2376 | 2376 | if (dol_strlen($phone) == 12) {//ex : +40 AB_CDE_FG_HI |
2377 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2377 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2378 | 2378 | } |
2379 | 2379 | } elseif (strtoupper($countrycode) == "TR") {//Turquie |
2380 | 2380 | if (dol_strlen($phone) == 13) {//ex : +90 ABC_DEF_GHIJ |
2381 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 4); |
|
2381 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 4); |
|
2382 | 2382 | } |
2383 | 2383 | } elseif (strtoupper($countrycode) == "US") {//Etat-Unis |
2384 | 2384 | if (dol_strlen($phone) == 12) {//ex: +1 ABC_DEF_GHIJ |
2385 | - $newphone = substr($newphone, 0, 2) . $separ . substr($newphone, 2, 3) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 4); |
|
2385 | + $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 3).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 4); |
|
2386 | 2386 | } |
2387 | 2387 | } elseif (strtoupper($countrycode) == "MX") {//Mexique |
2388 | 2388 | if (dol_strlen($phone) == 12) {//ex: +52 ABCD_EFG_HI |
2389 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 4) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 2); |
|
2389 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 2); |
|
2390 | 2390 | } elseif (dol_strlen($phone) == 11) {//ex: +52 AB_CD_EF_GH |
2391 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 2) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2); |
|
2391 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2); |
|
2392 | 2392 | } elseif (dol_strlen($phone) == 13) {//ex: +52 ABC_DEF_GHIJ |
2393 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 4); |
|
2393 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 4); |
|
2394 | 2394 | } |
2395 | 2395 | } elseif (strtoupper($countrycode) == "ML") {//Mali |
2396 | 2396 | if (dol_strlen($phone) == 12) {//ex: +223 AB_CD_EF_GH |
2397 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2397 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2398 | 2398 | } |
2399 | 2399 | } elseif (strtoupper($countrycode) == "TH") {//Thaïlande |
2400 | 2400 | if (dol_strlen($phone) == 11) {//ex: +66_ABC_DE_FGH |
2401 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 3); |
|
2401 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3); |
|
2402 | 2402 | } elseif (dol_strlen($phone) == 12) {//ex: +66_A_BCD_EF_GHI |
2403 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 1) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 3); |
|
2403 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 3); |
|
2404 | 2404 | } |
2405 | 2405 | } elseif (strtoupper($countrycode) == "MU") {//Maurice |
2406 | 2406 | if (dol_strlen($phone) == 11) {//ex: +230_ABC_DE_FG |
2407 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2); |
|
2407 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2); |
|
2408 | 2408 | } elseif (dol_strlen($phone) == 12) {//ex: +230_ABCD_EF_GH |
2409 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 4) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2409 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2410 | 2410 | } |
2411 | 2411 | } elseif (strtoupper($countrycode) == "ZA") {//Afrique du sud |
2412 | 2412 | if (dol_strlen($phone) == 12) {//ex: +27_AB_CDE_FG_HI |
2413 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2413 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2414 | 2414 | } |
2415 | 2415 | } elseif (strtoupper($countrycode) == "SY") {//Syrie |
2416 | 2416 | if (dol_strlen($phone) == 12) {//ex: +963_AB_CD_EF_GH |
2417 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2417 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2418 | 2418 | } elseif (dol_strlen($phone) == 13) {//ex: +963_AB_CD_EF_GHI |
2419 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 3); |
|
2419 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 3); |
|
2420 | 2420 | } |
2421 | 2421 | } elseif (strtoupper($countrycode) == "AE") {//Emirats Arabes Unis |
2422 | 2422 | if (dol_strlen($phone) == 12) {//ex: +971_ABC_DEF_GH |
2423 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 2); |
|
2423 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 2); |
|
2424 | 2424 | } elseif (dol_strlen($phone) == 13) {//ex: +971_ABC_DEF_GHI |
2425 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3); |
|
2425 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3); |
|
2426 | 2426 | } elseif (dol_strlen($phone) == 14) {//ex: +971_ABC_DEF_GHIK |
2427 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 4); |
|
2427 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 4); |
|
2428 | 2428 | } |
2429 | 2429 | } elseif (strtoupper($countrycode) == "DZ") {//Algérie |
2430 | 2430 | if (dol_strlen($phone) == 13) {//ex: +213_ABC_DEF_GHI |
2431 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3); |
|
2431 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3); |
|
2432 | 2432 | } |
2433 | 2433 | } elseif (strtoupper($countrycode) == "BE") {//Belgique |
2434 | 2434 | if (dol_strlen($phone) == 11) {//ex: +32_ABC_DE_FGH |
2435 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 3); |
|
2435 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3); |
|
2436 | 2436 | } elseif (dol_strlen($phone) == 12) {//ex: +32_ABC_DEF_GHI |
2437 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3); |
|
2437 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3); |
|
2438 | 2438 | } |
2439 | 2439 | } elseif (strtoupper($countrycode) == "PF") {//Polynésie française |
2440 | 2440 | if (dol_strlen($phone) == 12) {//ex: +689_AB_CD_EF_GH |
2441 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2441 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2442 | 2442 | } |
2443 | 2443 | } elseif (strtoupper($countrycode) == "CO") {//Colombie |
2444 | 2444 | if (dol_strlen($phone) == 13) {//ex: +57_ABC_DEF_GH_IJ |
2445 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
2445 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
2446 | 2446 | } |
2447 | 2447 | } elseif (strtoupper($countrycode) == "JO") {//Jordanie |
2448 | 2448 | if (dol_strlen($phone) == 12) {//ex: +962_A_BCD_EF_GH |
2449 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 1) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2); |
|
2449 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 1).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2); |
|
2450 | 2450 | } |
2451 | 2451 | } elseif (strtoupper($countrycode) == "MG") {//Madagascar |
2452 | 2452 | if (dol_strlen($phone) == 13) {//ex: +261_AB_CD_EF_GHI |
2453 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 3); |
|
2453 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 3); |
|
2454 | 2454 | } |
2455 | 2455 | } elseif (strtoupper($countrycode) == "GB") {//Royaume uni |
2456 | 2456 | if (dol_strlen($phone) == 13) {//ex: +44_ABCD_EFG_HIJ |
2457 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 4) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3); |
|
2457 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3); |
|
2458 | 2458 | } |
2459 | 2459 | } elseif (strtoupper($countrycode) == "CH") {//Suisse |
2460 | 2460 | if (dol_strlen($phone) == 12) {//ex: +41_AB_CDE_FG_HI |
2461 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
2461 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
2462 | 2462 | } elseif (dol_strlen($phone) == 15) {// +41_AB_CDE_FGH_IJKL |
2463 | - $newphone = $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 3) . $separ . substr($newphone, 11, 4); |
|
2463 | + $newphone = $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 3).$separ.substr($newphone, 11, 4); |
|
2464 | 2464 | } |
2465 | 2465 | } elseif (strtoupper($countrycode) == "TN") {//Tunisie |
2466 | 2466 | if (dol_strlen($phone) == 12) {//ex: +216_AB_CDE_FGH |
2467 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3); |
|
2467 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3); |
|
2468 | 2468 | } |
2469 | 2469 | } elseif (strtoupper($countrycode) == "GF") {//Guyane francaise |
2470 | 2470 | if (dol_strlen($phone) == 13) {//ex: +594_ABC_DE_FG_HI (ABC=594 de nouveau) |
2471 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
2471 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
2472 | 2472 | } |
2473 | 2473 | } elseif (strtoupper($countrycode) == "GP") {//Guadeloupe |
2474 | 2474 | if (dol_strlen($phone) == 13) {//ex: +590_ABC_DE_FG_HI (ABC=590 de nouveau) |
2475 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
2475 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
2476 | 2476 | } |
2477 | 2477 | } elseif (strtoupper($countrycode) == "MQ") {//Martinique |
2478 | 2478 | if (dol_strlen($phone) == 13) {//ex: +596_ABC_DE_FG_HI (ABC=596 de nouveau) |
2479 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
2479 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
2480 | 2480 | } |
2481 | 2481 | } elseif (strtoupper($countrycode) == "IT") {//Italie |
2482 | 2482 | if (dol_strlen($phone) == 12) {//ex: +39_ABC_DEF_GHI |
2483 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3); |
|
2483 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3); |
|
2484 | 2484 | } elseif (dol_strlen($phone) == 13) {//ex: +39_ABC_DEF_GH_IJ |
2485 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
2485 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
2486 | 2486 | } |
2487 | 2487 | } elseif (strtoupper($countrycode) == "AU") {//Australie |
2488 | 2488 | if (dol_strlen($phone) == 12) {//ex: +61_A_BCDE_FGHI |
2489 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 1) . $separ . substr($newphone, 4, 4) . $separ . substr($newphone, 8, 4); |
|
2489 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 4); |
|
2490 | 2490 | } |
2491 | 2491 | } |
2492 | 2492 | if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set) |
2493 | 2493 | if (Globals::$conf->browser->layout == 'phone' || (!empty(Globals::$conf->clicktodial->enabled) && !empty(Globals::$conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone |
2494 | - $newphone = '<a href="tel:' . $phone . '"'; |
|
2495 | - $newphone .= '>' . $phone . '</a>'; |
|
2494 | + $newphone = '<a href="tel:'.$phone.'"'; |
|
2495 | + $newphone .= '>'.$phone.'</a>'; |
|
2496 | 2496 | } else if (!empty(Globals::$conf->clicktodial->enabled) && $addlink == 'AC_TEL') { // If click to dial, we use click to dial url |
2497 | 2497 | if (empty($user->clicktodial_loaded)) |
2498 | 2498 | $user->fetch_clicktodial(); |
@@ -2516,10 +2516,10 @@ discard block |
||
2516 | 2516 | '__PASS__' => $clicktodial_password); |
2517 | 2517 | $url = make_substitutions($url, $substitarray); |
2518 | 2518 | $newphonesav = $newphone; |
2519 | - $newphone = '<a href="' . $url . '"'; |
|
2519 | + $newphone = '<a href="'.$url.'"'; |
|
2520 | 2520 | if (!empty(Globals::$conf->global->CLICKTODIAL_FORCENEWTARGET)) |
2521 | 2521 | $newphone .= ' target="_blank"'; |
2522 | - $newphone .= '>' . $newphonesav . '</a>'; |
|
2522 | + $newphone .= '>'.$newphonesav.'</a>'; |
|
2523 | 2523 | } |
2524 | 2524 | |
2525 | 2525 | //if (($cid || $socid) && ! empty(Globals::$conf->agenda->enabled) && $user->rights->agenda->myactions->create) |
@@ -2529,9 +2529,9 @@ discard block |
||
2529 | 2529 | if ($addlink == 'AC_FAX') |
2530 | 2530 | $type = 'AC_FAX'; |
2531 | 2531 | if (!empty(Globals::$conf->global->AGENDA_ADDACTIONFORPHONE)) |
2532 | - $link = '<a href="' . DOL_BASE_URI . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . ($cid ? '&contactid=' . $cid : '') . ($socid ? '&socid=' . $socid : '') . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>'; |
|
2532 | + $link = '<a href="'.DOL_BASE_URI.'/comm/action/card.php?action=create&backtopage=1&actioncode='.$type.($cid ? '&contactid='.$cid : '').($socid ? '&socid='.$socid : '').'">'.img_object($langs->trans("AddAction"), "calendar").'</a>'; |
|
2533 | 2533 | if ($link) |
2534 | - $newphone = '<div>' . $newphone . ' ' . $link . '</div>'; |
|
2534 | + $newphone = '<div>'.$newphone.' '.$link.'</div>'; |
|
2535 | 2535 | } |
2536 | 2536 | } |
2537 | 2537 | |
@@ -2562,7 +2562,7 @@ discard block |
||
2562 | 2562 | $rep .= '<div class="nospan float" style="margin-right: 10px">'; |
2563 | 2563 | else |
2564 | 2564 | $rep .= '<span style="margin-right: 10px;">'; |
2565 | - $rep .= ($withpicto ? img_picto($titlealt, 'object_' . $picto . '.png') . ' ' : '') . $newphone; |
|
2565 | + $rep .= ($withpicto ? img_picto($titlealt, 'object_'.$picto.'.png').' ' : '').$newphone; |
|
2566 | 2566 | if ($adddivfloat) |
2567 | 2567 | $rep .= '</div>'; |
2568 | 2568 | else |
@@ -2589,15 +2589,15 @@ discard block |
||
2589 | 2589 | $ret .= $ip; |
2590 | 2590 | } |
2591 | 2591 | |
2592 | - echo ('<p>DOL_BASE_PATH: ' . DOL_BASE_PATH . '/DOL_BASE_URI: ' . DOL_BASE_URI . '</p>'); |
|
2592 | + echo ('<p>DOL_BASE_PATH: '.DOL_BASE_PATH.'/DOL_BASE_URI: '.DOL_BASE_URI.'</p>'); |
|
2593 | 2593 | |
2594 | 2594 | if ($mode != 2) { |
2595 | 2595 | $countrycode = dolGetCountryCodeFromIp($ip); |
2596 | 2596 | if ($countrycode) { // If success, countrycode is us, fr, ... |
2597 | - if (file_exists(DOL_BASE_PATH . '/theme/common/flags/' . $countrycode . '.png')) { |
|
2598 | - $ret .= ' ' . img_picto($countrycode . ' ' . $langs->trans("AccordingToGeoIPDatabase"), DOL_BASE_URI . '/theme/common/flags/' . $countrycode . '.png', '', 1); |
|
2597 | + if (file_exists(DOL_BASE_PATH.'/theme/common/flags/'.$countrycode.'.png')) { |
|
2598 | + $ret .= ' '.img_picto($countrycode.' '.$langs->trans("AccordingToGeoIPDatabase"), DOL_BASE_URI.'/theme/common/flags/'.$countrycode.'.png', '', 1); |
|
2599 | 2599 | } else |
2600 | - $ret .= ' (' . $countrycode . ')'; |
|
2600 | + $ret .= ' ('.$countrycode.')'; |
|
2601 | 2601 | } |
2602 | 2602 | } |
2603 | 2603 | |
@@ -2635,7 +2635,7 @@ discard block |
||
2635 | 2635 | //$ip='24.24.24.24'; |
2636 | 2636 | //$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat'; Note that this must be downloaded datafile (not same than datafile provided with ubuntu packages) |
2637 | 2637 | |
2638 | - include_once DOL_BASE_PATH . '/core/class/dolgeoip.class.php'; |
|
2638 | + include_once DOL_BASE_PATH.'/core/class/dolgeoip.class.php'; |
|
2639 | 2639 | $geoip = new DolGeoIP('country', $datafile); |
2640 | 2640 | //print 'ip='.$ip.' databaseType='.$geoip->gi->databaseType." GEOIP_CITY_EDITION_REV1=".GEOIP_CITY_EDITION_REV1."\n"; |
2641 | 2641 | //print "geoip_country_id_by_addr=".geoip_country_id_by_addr($geoip->gi,$ip)."\n"; |
@@ -2661,7 +2661,7 @@ discard block |
||
2661 | 2661 | $datafile = Globals::$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE; |
2662 | 2662 | //$ip='24.24.24.24'; |
2663 | 2663 | //$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat'; |
2664 | - include_once DOL_BASE_PATH . '/core/class/dolgeoip.class.php'; |
|
2664 | + include_once DOL_BASE_PATH.'/core/class/dolgeoip.class.php'; |
|
2665 | 2665 | $geoip = new DolGeoIP('country', $datafile); |
2666 | 2666 | $countrycode = $geoip->getCountryCodeFromIP($ip); |
2667 | 2667 | $ret = $countrycode; |
@@ -2716,12 +2716,12 @@ discard block |
||
2716 | 2716 | $showomap = 1; |
2717 | 2717 | |
2718 | 2718 | if ($showgmap) { |
2719 | - $url = dol_buildpath('/google/gmaps.php?mode=' . $mode . '&id=' . $id, 1); |
|
2720 | - $out .= ' <a href="' . $url . '" target="_gmaps"><img id="' . $htmlid . '" class="valigntextbottom" src="' . DOL_BASE_URI . '/theme/common/gmap.png"></a>'; |
|
2719 | + $url = dol_buildpath('/google/gmaps.php?mode='.$mode.'&id='.$id, 1); |
|
2720 | + $out .= ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'" class="valigntextbottom" src="'.DOL_BASE_URI.'/theme/common/gmap.png"></a>'; |
|
2721 | 2721 | } |
2722 | 2722 | if ($showomap) { |
2723 | - $url = dol_buildpath('/openstreetmap/maps.php?mode=' . $mode . '&id=' . $id, 1); |
|
2724 | - $out .= ' <a href="' . $url . '" target="_gmaps"><img id="' . $htmlid . '_openstreetmap" class="valigntextbottom" src="' . DOL_BASE_URI . '/theme/common/gmap.png"></a>'; |
|
2723 | + $url = dol_buildpath('/openstreetmap/maps.php?mode='.$mode.'&id='.$id, 1); |
|
2724 | + $out .= ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'_openstreetmap" class="valigntextbottom" src="'.DOL_BASE_URI.'/theme/common/gmap.png"></a>'; |
|
2725 | 2725 | } |
2726 | 2726 | } |
2727 | 2727 | } |
@@ -2867,7 +2867,7 @@ discard block |
||
2867 | 2867 | if ($trunc == 'right') { |
2868 | 2868 | $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
2869 | 2869 | if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
2870 | - return dol_substr($newstring, 0, $size, $stringencoding) . ($nodot ? '' : '...'); |
|
2870 | + return dol_substr($newstring, 0, $size, $stringencoding).($nodot ? '' : '...'); |
|
2871 | 2871 | else |
2872 | 2872 | //return 'u'.$size.'-'.$newstring.'-'.dol_strlen($newstring,$stringencoding).'-'.$string; |
2873 | 2873 | return $string; |
@@ -2877,21 +2877,21 @@ discard block |
||
2877 | 2877 | if (dol_strlen($newstring, $stringencoding) > 2 && dol_strlen($newstring, $stringencoding) > ($size + 1)) { |
2878 | 2878 | $size1 = round($size / 2); |
2879 | 2879 | $size2 = round($size / 2); |
2880 | - return dol_substr($newstring, 0, $size1, $stringencoding) . '...' . dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding); |
|
2880 | + return dol_substr($newstring, 0, $size1, $stringencoding).'...'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding); |
|
2881 | 2881 | } else |
2882 | 2882 | return $string; |
2883 | 2883 | } |
2884 | 2884 | elseif ($trunc == 'left') { |
2885 | 2885 | $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
2886 | 2886 | if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
2887 | - return '...' . dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding); |
|
2887 | + return '...'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding); |
|
2888 | 2888 | else |
2889 | 2889 | return $string; |
2890 | 2890 | } |
2891 | 2891 | elseif ($trunc == 'wrap') { |
2892 | 2892 | $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
2893 | 2893 | if (dol_strlen($newstring, $stringencoding) > ($size + 1)) |
2894 | - return dol_substr($newstring, 0, $size, $stringencoding) . "\n" . dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc); |
|
2894 | + return dol_substr($newstring, 0, $size, $stringencoding)."\n".dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc); |
|
2895 | 2895 | else |
2896 | 2896 | return $string; |
2897 | 2897 | } else |
@@ -2924,7 +2924,7 @@ discard block |
||
2924 | 2924 | $url = DOL_BASE_URI; |
2925 | 2925 | |
2926 | 2926 | $theme = Globals::$conf->theme; |
2927 | - $path = 'theme/' . $theme; |
|
2927 | + $path = 'theme/'.$theme; |
|
2928 | 2928 | |
2929 | 2929 | // Define fullpathpicto to use into src |
2930 | 2930 | if ($pictoisfullpath) { |
@@ -2973,7 +2973,7 @@ discard block |
||
2973 | 2973 | $fakey = 'fa-pencil'; |
2974 | 2974 | $facolor = '#444'; |
2975 | 2975 | } elseif ($pictowithoutext == 'filter') { |
2976 | - $fakey = 'fa-' . $pictowithoutext; |
|
2976 | + $fakey = 'fa-'.$pictowithoutext; |
|
2977 | 2977 | } elseif ($pictowithoutext == 'grip_title' || $pictowithoutext == 'grip') { |
2978 | 2978 | $fakey = 'fa-arrows'; |
2979 | 2979 | } elseif ($pictowithoutext == 'listlight') { |
@@ -3012,15 +3012,15 @@ discard block |
||
3012 | 3012 | } elseif ($pictowithoutext == 'jabber') { |
3013 | 3013 | $fakey = 'fa-comment-o'; |
3014 | 3014 | } else { |
3015 | - $fakey = 'fa-' . $pictowithoutext; |
|
3015 | + $fakey = 'fa-'.$pictowithoutext; |
|
3016 | 3016 | $facolor = '#444'; |
3017 | 3017 | $marginleftonlyshort = 0; |
3018 | 3018 | } |
3019 | 3019 | |
3020 | 3020 | if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) { |
3021 | - $morecss .= ($morecss ? ' ' : '') . $reg[1]; |
|
3021 | + $morecss .= ($morecss ? ' ' : '').$reg[1]; |
|
3022 | 3022 | } |
3023 | - $enabledisablehtml = '<span class="fa ' . $fakey . ' ' . ($marginleftonlyshort ? ($marginleftonlyshort == 1 ? 'marginleftonlyshort' : 'marginleftonly') : '') . ' valignmiddle' . ($morecss ? ' ' . $morecss : '') . '" style="' . ($fasize ? ('font-size: ' . $fasize . ';') : '') . ($facolor ? (' color: ' . $facolor . ';') : '') . '" alt="' . dol_escape_htmltag($titlealt) . '"' . (($notitle || empty($title)) ? '' : ' title="' . dol_escape_htmltag($title) . '"') . ($moreatt ? ' ' . $moreatt : '') . '>'; |
|
3023 | + $enabledisablehtml = '<span class="fa '.$fakey.' '.($marginleftonlyshort ? ($marginleftonlyshort == 1 ? 'marginleftonlyshort' : 'marginleftonly') : '').' valignmiddle'.($morecss ? ' '.$morecss : '').'" style="'.($fasize ? ('font-size: '.$fasize.';') : '').($facolor ? (' color: '.$facolor.';') : '').'" alt="'.dol_escape_htmltag($titlealt).'"'.(($notitle || empty($title)) ? '' : ' title="'.dol_escape_htmltag($title).'"').($moreatt ? ' '.$moreatt : '').'>'; |
|
3024 | 3024 | if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
3025 | 3025 | $enabledisablehtml .= $titlealt; |
3026 | 3026 | } |
@@ -3030,11 +3030,11 @@ discard block |
||
3030 | 3030 | } |
3031 | 3031 | |
3032 | 3032 | if (!empty(Globals::$conf->global->MAIN_OVERWRITE_THEME_PATH)) { |
3033 | - $path = Globals::$conf->global->MAIN_OVERWRITE_THEME_PATH . '/theme/' . $theme; // If the theme does not have the same name as the module |
|
3033 | + $path = Globals::$conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module |
|
3034 | 3034 | } else if (!empty(Globals::$conf->global->MAIN_OVERWRITE_THEME_RES)) { |
3035 | - $path = Globals::$conf->global->MAIN_OVERWRITE_THEME_RES . '/theme/' . Globals::$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme |
|
3035 | + $path = Globals::$conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.Globals::$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme |
|
3036 | 3036 | } else if (!empty(Globals::$conf->modules_parts['theme']) && array_key_exists($theme, Globals::$conf->modules_parts['theme'])) { |
3037 | - $path = $theme . '/theme/' . $theme; // If the theme have the same name as the module |
|
3037 | + $path = $theme.'/theme/'.$theme; // If the theme have the same name as the module |
|
3038 | 3038 | } |
3039 | 3039 | |
3040 | 3040 | // If we ask an image into $url/$mymodule/img (instead of default path) |
@@ -3054,15 +3054,15 @@ discard block |
||
3054 | 3054 | continue; |
3055 | 3055 | } |
3056 | 3056 | // This need a lot of time, that's why enabling alternative dir like "custom" dir is not recommanded |
3057 | - if (file_exists($dirroot . '/' . $path . '/img/' . $picto)) { |
|
3057 | + if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) { |
|
3058 | 3058 | //$url = DOL_BASE_URI . Globals::$conf->file->dol_url_root[$type]; |
3059 | - $url = DOL_BASE_URI . Globals::$conf->file->dol_url_root[$type]; |
|
3059 | + $url = DOL_BASE_URI.Globals::$conf->file->dol_url_root[$type]; |
|
3060 | 3060 | break; |
3061 | 3061 | } |
3062 | 3062 | } |
3063 | 3063 | |
3064 | 3064 | // $url is '' or '/custom', $path is current theme or |
3065 | - $fullpathpicto = $url . '/' . $path . '/img/' . $picto; |
|
3065 | + $fullpathpicto = $url.'/'.$path.'/img/'.$picto; |
|
3066 | 3066 | } |
3067 | 3067 | |
3068 | 3068 | if ($srconly) { |
@@ -3070,7 +3070,7 @@ discard block |
||
3070 | 3070 | } |
3071 | 3071 | |
3072 | 3072 | // tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for bind people |
3073 | - return '<img src="' . $fullpathpicto . '" alt="' . dol_escape_htmltag($alt) . '"' . (($notitle || empty($titlealt)) ? '' : ' title="' . dol_escape_htmltag($titlealt) . '"') . ($moreatt ? ' ' . $moreatt : ' class="inline-block' . ($morecss ? ' ' . $morecss : '') . '"') . '>'; // Alt is used for accessibility, title for popup |
|
3073 | + return '<img src="'.$fullpathpicto.'" alt="'.dol_escape_htmltag($alt).'"'.(($notitle || empty($titlealt)) ? '' : ' title="'.dol_escape_htmltag($titlealt).'"').($moreatt ? ' '.$moreatt : ' class="inline-block'.($morecss ? ' '.$morecss : '').'"').'>'; // Alt is used for accessibility, title for popup |
|
3074 | 3074 | } |
3075 | 3075 | |
3076 | 3076 | /** |
@@ -3088,7 +3088,7 @@ discard block |
||
3088 | 3088 | */ |
3089 | 3089 | static function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0) |
3090 | 3090 | { |
3091 | - return img_picto($titlealt, 'object_' . $picto, $moreatt, $pictoisfullpath, $srconly, $notitle); |
|
3091 | + return img_picto($titlealt, 'object_'.$picto, $moreatt, $pictoisfullpath, $srconly, $notitle); |
|
3092 | 3092 | } |
3093 | 3093 | |
3094 | 3094 | /** |
@@ -3109,7 +3109,7 @@ discard block |
||
3109 | 3109 | $picto .= '.png'; |
3110 | 3110 | |
3111 | 3111 | //$path = DOL_BASE_URI . '/theme/' . Globals::$conf->theme . '/img/weather/' . $picto; |
3112 | - $path = DOL_BASE_URI . '/theme/' . Globals::$conf->theme . '/img/weather/' . $picto; |
|
3112 | + $path = DOL_BASE_URI.'/theme/'.Globals::$conf->theme.'/img/weather/'.$picto; |
|
3113 | 3113 | |
3114 | 3114 | return img_picto($titlealt, $path, $moreatt, 1); |
3115 | 3115 | } |
@@ -3135,10 +3135,10 @@ discard block |
||
3135 | 3135 | $path = $picto; |
3136 | 3136 | else { |
3137 | 3137 | //$path = DOL_BASE_URI . '/theme/common/' . $picto; |
3138 | - $path = DOL_BASE_URI . '/theme/common/' . $picto; |
|
3138 | + $path = DOL_BASE_URI.'/theme/common/'.$picto; |
|
3139 | 3139 | |
3140 | 3140 | if (!empty(Globals::$conf->global->MAIN_MODULE_CAN_OVERWRITE_COMMONICONS)) { |
3141 | - $themepath = DOL_BASE_PATH . 'theme/' . Globals::$conf->theme . '/img/' . $picto; |
|
3141 | + $themepath = DOL_BASE_PATH.'theme/'.Globals::$conf->theme.'/img/'.$picto; |
|
3142 | 3142 | |
3143 | 3143 | if (file_exists($themepath)) |
3144 | 3144 | $path = $themepath; |
@@ -3176,14 +3176,14 @@ discard block |
||
3176 | 3176 | $numaction = 3; |
3177 | 3177 | $titlealt = $langs->transnoentitiesnoconv('ChangeContactDone'); |
3178 | 3178 | } else { |
3179 | - $titlealt = $langs->transnoentitiesnoconv('ChangeStatus ' . $numaction); |
|
3179 | + $titlealt = $langs->transnoentitiesnoconv('ChangeStatus '.$numaction); |
|
3180 | 3180 | $numaction = 0; |
3181 | 3181 | } |
3182 | 3182 | } |
3183 | 3183 | if (!is_numeric($numaction)) |
3184 | 3184 | $numaction = 0; |
3185 | 3185 | |
3186 | - return img_picto($titlealt, 'stcomm' . $numaction . '.png'); |
|
3186 | + return img_picto($titlealt, 'stcomm'.$numaction.'.png'); |
|
3187 | 3187 | } |
3188 | 3188 | |
3189 | 3189 | /** |
@@ -3200,7 +3200,7 @@ discard block |
||
3200 | 3200 | if ($titlealt == 'default') |
3201 | 3201 | $titlealt = $langs->trans('Show'); |
3202 | 3202 | |
3203 | - return img_picto($titlealt, 'pdf' . $size . '.png'); |
|
3203 | + return img_picto($titlealt, 'pdf'.$size.'.png'); |
|
3204 | 3204 | } |
3205 | 3205 | |
3206 | 3206 | /** |
@@ -3252,7 +3252,7 @@ discard block |
||
3252 | 3252 | if ($titlealt == 'default') |
3253 | 3253 | $titlealt = $langs->trans('Modify'); |
3254 | 3254 | |
3255 | - return img_picto($titlealt, 'edit.png', ($float ? 'style="float: ' . ($langs->tab_translate["DIRECTION"] == 'rtl' ? 'left' : 'right') . '"' : "") . ($other ? ' ' . $other : '')); |
|
3255 | + return img_picto($titlealt, 'edit.png', ($float ? 'style="float: '.($langs->tab_translate["DIRECTION"] == 'rtl' ? 'left' : 'right').'"' : "").($other ? ' '.$other : '')); |
|
3256 | 3256 | } |
3257 | 3257 | |
3258 | 3258 | /** |
@@ -3270,7 +3270,7 @@ discard block |
||
3270 | 3270 | if ($titlealt == 'default') |
3271 | 3271 | $titlealt = $langs->trans('View'); |
3272 | 3272 | |
3273 | - $moreatt = ($float ? 'style="float: right" ' : '') . $other; |
|
3273 | + $moreatt = ($float ? 'style="float: right" ' : '').$other; |
|
3274 | 3274 | |
3275 | 3275 | return img_picto($titlealt, 'view.png', $moreatt); |
3276 | 3276 | } |
@@ -3343,7 +3343,7 @@ discard block |
||
3343 | 3343 | $usealttitle = $langs->trans('Info'); |
3344 | 3344 | } |
3345 | 3345 | |
3346 | - return img_picto($usealttitle, 'info.png', 'style="vertical-align: middle;' . ($usehelpcursor == 1 ? ' cursor: help' : ($usehelpcursor == 2 ? ' cursor: pointer' : '')) . '"'); |
|
3346 | + return img_picto($usealttitle, 'info.png', 'style="vertical-align: middle;'.($usehelpcursor == 1 ? ' cursor: help' : ($usehelpcursor == 2 ? ' cursor: pointer' : '')).'"'); |
|
3347 | 3347 | } |
3348 | 3348 | |
3349 | 3349 | /** |
@@ -3377,7 +3377,7 @@ discard block |
||
3377 | 3377 | $titlealt = $langs->trans('Warning'); |
3378 | 3378 | |
3379 | 3379 | //return '<div class="imglatecoin">'.img_picto($titlealt, 'warning_white.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')).'</div>'; |
3380 | - return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"' . ($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' ' . $moreatt) : '')); |
|
3380 | + return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt) : '')); |
|
3381 | 3381 | } |
3382 | 3382 | |
3383 | 3383 | /** |
@@ -3411,7 +3411,7 @@ discard block |
||
3411 | 3411 | $titlealt = $langs->trans('Next'); |
3412 | 3412 | |
3413 | 3413 | //return img_picto($titlealt, 'next.png', $moreatt); |
3414 | - return '<span class="fa fa-chevron-right paddingright paddingleft" title="' . dol_escape_htmltag($titlealt) . '"></span>'; |
|
3414 | + return '<span class="fa fa-chevron-right paddingright paddingleft" title="'.dol_escape_htmltag($titlealt).'"></span>'; |
|
3415 | 3415 | } |
3416 | 3416 | |
3417 | 3417 | /** |
@@ -3429,7 +3429,7 @@ discard block |
||
3429 | 3429 | $titlealt = $langs->trans('Previous'); |
3430 | 3430 | |
3431 | 3431 | //return img_picto($titlealt, 'previous.png', $moreatt); |
3432 | - return '<span class="fa fa-chevron-left paddingright paddingleft" title="' . dol_escape_htmltag($titlealt) . '"></span>'; |
|
3432 | + return '<span class="fa fa-chevron-left paddingright paddingleft" title="'.dol_escape_htmltag($titlealt).'"></span>'; |
|
3433 | 3433 | } |
3434 | 3434 | |
3435 | 3435 | /** |
@@ -3447,7 +3447,7 @@ discard block |
||
3447 | 3447 | if ($titlealt == 'default') |
3448 | 3448 | $titlealt = $langs->trans('Down'); |
3449 | 3449 | |
3450 | - return img_picto($titlealt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown' . ($moreclass ? " " . $moreclass : "") . '"'); |
|
3450 | + return img_picto($titlealt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown'.($moreclass ? " ".$moreclass : "").'"'); |
|
3451 | 3451 | } |
3452 | 3452 | |
3453 | 3453 | /** |
@@ -3465,7 +3465,7 @@ discard block |
||
3465 | 3465 | if ($titlealt == 'default') |
3466 | 3466 | $titlealt = $langs->trans('Up'); |
3467 | 3467 | |
3468 | - return img_picto($titlealt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup' . ($moreclass ? " " . $moreclass : "") . '"'); |
|
3468 | + return img_picto($titlealt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup'.($moreclass ? " ".$moreclass : "").'"'); |
|
3469 | 3469 | } |
3470 | 3470 | |
3471 | 3471 | /** |
@@ -3548,7 +3548,7 @@ discard block |
||
3548 | 3548 | $brand = 'credit-card'; |
3549 | 3549 | } |
3550 | 3550 | |
3551 | - return '<span class="fa fa-' . $brand . ' fa-2x fa-fw"></span>'; |
|
3551 | + return '<span class="fa fa-'.$brand.' fa-2x fa-fw"></span>'; |
|
3552 | 3552 | } |
3553 | 3553 | |
3554 | 3554 | /** |
@@ -3561,17 +3561,17 @@ discard block |
||
3561 | 3561 | */ |
3562 | 3562 | static function img_mime($file, $titlealt = '', $morecss = '') |
3563 | 3563 | { |
3564 | - require_once DOL_BASE_PATH . '/core/lib/files.lib.php'; |
|
3564 | + require_once DOL_BASE_PATH.'/core/lib/files.lib.php'; |
|
3565 | 3565 | |
3566 | 3566 | $mimetype = dol_mimetype($file, '', 1); |
3567 | 3567 | $mimeimg = dol_mimetype($file, '', 2); |
3568 | 3568 | $mimefa = dol_mimetype($file, '', 4); |
3569 | 3569 | |
3570 | 3570 | if (empty($titlealt)) |
3571 | - $titlealt = 'Mime type: ' . $mimetype; |
|
3571 | + $titlealt = 'Mime type: '.$mimetype; |
|
3572 | 3572 | |
3573 | 3573 | //return img_picto_common($titlealt, 'mime/'.$mimeimg, 'class="'.$morecss.'"'); |
3574 | - return '<i class="fa fa-' . $mimefa . ' paddingright"></i>'; |
|
3574 | + return '<i class="fa fa-'.$mimefa.' paddingright"></i>'; |
|
3575 | 3575 | } |
3576 | 3576 | |
3577 | 3577 | /** |
@@ -3586,7 +3586,7 @@ discard block |
||
3586 | 3586 | */ |
3587 | 3587 | static function img_phone($titlealt = 'default', $option = 0) |
3588 | 3588 | { |
3589 | - dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); |
|
3589 | + dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING); |
|
3590 | 3590 | |
3591 | 3591 | // global Globals::$conf, $langs; |
3592 | 3592 | |
@@ -3617,8 +3617,8 @@ discard block |
||
3617 | 3617 | |
3618 | 3618 | $img = img_picto($titlealt, 'search.png', $other, false, 1); |
3619 | 3619 | |
3620 | - $input = '<input type="image" class="liste_titre" name="button_search" src="' . $img . '" '; |
|
3621 | - $input .= 'value="' . dol_escape_htmltag($titlealt) . '" title="' . dol_escape_htmltag($titlealt) . '" >'; |
|
3620 | + $input = '<input type="image" class="liste_titre" name="button_search" src="'.$img.'" '; |
|
3621 | + $input .= 'value="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'" >'; |
|
3622 | 3622 | |
3623 | 3623 | return $input; |
3624 | 3624 | } |
@@ -3639,8 +3639,8 @@ discard block |
||
3639 | 3639 | |
3640 | 3640 | $img = img_picto($titlealt, 'searchclear.png', $other, false, 1); |
3641 | 3641 | |
3642 | - $input = '<input type="image" class="liste_titre" name="button_removefilter" src="' . $img . '" '; |
|
3643 | - $input .= 'value="' . dol_escape_htmltag($titlealt) . '" title="' . dol_escape_htmltag($titlealt) . '" >'; |
|
3642 | + $input = '<input type="image" class="liste_titre" name="button_removefilter" src="'.$img.'" '; |
|
3643 | + $input .= 'value="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'" >'; |
|
3644 | 3644 | |
3645 | 3645 | return $input; |
3646 | 3646 | } |
@@ -3660,10 +3660,10 @@ discard block |
||
3660 | 3660 | // global Globals::$conf, $langs; |
3661 | 3661 | |
3662 | 3662 | if ($infoonimgalt) { |
3663 | - return img_picto($text, 'info', 'class="hideonsmartphone' . ($morecss ? ' ' . $morecss : '') . '"'); |
|
3663 | + return img_picto($text, 'info', 'class="hideonsmartphone'.($morecss ? ' '.$morecss : '').'"'); |
|
3664 | 3664 | } |
3665 | 3665 | |
3666 | - return ($nodiv ? '' : '<div class="' . (empty($admin) ? '' : ($admin == '1' ? 'info' : $admin)) . ' hideonsmartphone' . ($morecss ? ' ' . $morecss : '') . '">') . '<span class="fa fa-info-circle" title="' . dol_escape_htmltag($admin ? $langs->trans('InfoAdmin') : $langs->trans('Note')) . '"></span> ' . $text . ($nodiv ? '' : '</div>'); |
|
3666 | + return ($nodiv ? '' : '<div class="'.(empty($admin) ? '' : ($admin == '1' ? 'info' : $admin)).' hideonsmartphone'.($morecss ? ' '.$morecss : '').'">').'<span class="fa fa-info-circle" title="'.dol_escape_htmltag($admin ? $langs->trans('InfoAdmin') : $langs->trans('Note')).'"></span> '.$text.($nodiv ? '' : '</div>'); |
|
3667 | 3667 | } |
3668 | 3668 | |
3669 | 3669 | /** |
@@ -3688,7 +3688,7 @@ discard block |
||
3688 | 3688 | |
3689 | 3689 | // Si erreur intervenue avant chargement langue |
3690 | 3690 | if (!$langs) { |
3691 | - require_once DOL_BASE_PATH . '/core/class/translate.class.php'; |
|
3691 | + require_once DOL_BASE_PATH.'/core/class/translate.class.php'; |
|
3692 | 3692 | $langs = new Translate('', Globals::$conf); |
3693 | 3693 | $langs->load("main"); |
3694 | 3694 | } |
@@ -3696,51 +3696,51 @@ discard block |
||
3696 | 3696 | $langs->loadLangs(array('main', 'errors')); |
3697 | 3697 | |
3698 | 3698 | if ($_SERVER['DOCUMENT_ROOT']) { // Mode web |
3699 | - $out .= $langs->trans("DolibarrHasDetectedError") . ".<br>\n"; |
|
3699 | + $out .= $langs->trans("DolibarrHasDetectedError").".<br>\n"; |
|
3700 | 3700 | if (!empty(Globals::$conf->global->MAIN_FEATURES_LEVEL)) |
3701 | 3701 | $out .= "You use an experimental or develop level of features, so please do NOT report any bugs, except if problem is confirmed moving option MAIN_FEATURES_LEVEL back to 0.<br>\n"; |
3702 | - $out .= $langs->trans("InformationToHelpDiagnose") . ":<br>\n"; |
|
3702 | + $out .= $langs->trans("InformationToHelpDiagnose").":<br>\n"; |
|
3703 | 3703 | |
3704 | - $out .= "<b>" . $langs->trans("Date") . ":</b> " . dol_print_date(time(), 'dayhourlog') . "<br>\n"; |
|
3705 | - $out .= "<b>" . $langs->trans("Dolibarr") . ":</b> " . DOL_VERSION . "<br>\n"; |
|
3704 | + $out .= "<b>".$langs->trans("Date").":</b> ".dol_print_date(time(), 'dayhourlog')."<br>\n"; |
|
3705 | + $out .= "<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION."<br>\n"; |
|
3706 | 3706 | if (isset(Globals::$conf->global->MAIN_FEATURES_LEVEL)) |
3707 | - $out .= "<b>" . $langs->trans("LevelOfFeature") . ":</b> " . Globals::$conf->global->MAIN_FEATURES_LEVEL . "<br>\n"; |
|
3707 | + $out .= "<b>".$langs->trans("LevelOfFeature").":</b> ".Globals::$conf->global->MAIN_FEATURES_LEVEL."<br>\n"; |
|
3708 | 3708 | if (function_exists("phpversion")) { |
3709 | - $out .= "<b>" . $langs->trans("PHP") . ":</b> " . phpversion() . "<br>\n"; |
|
3709 | + $out .= "<b>".$langs->trans("PHP").":</b> ".phpversion()."<br>\n"; |
|
3710 | 3710 | } |
3711 | - $out .= "<b>" . $langs->trans("Server") . ":</b> " . $_SERVER["SERVER_SOFTWARE"] . "<br>\n"; |
|
3711 | + $out .= "<b>".$langs->trans("Server").":</b> ".$_SERVER["SERVER_SOFTWARE"]."<br>\n"; |
|
3712 | 3712 | if (function_exists("php_uname")) { |
3713 | - $out .= "<b>" . $langs->trans("OS") . ":</b> " . php_uname() . "<br>\n"; |
|
3713 | + $out .= "<b>".$langs->trans("OS").":</b> ".php_uname()."<br>\n"; |
|
3714 | 3714 | } |
3715 | - $out .= "<b>" . $langs->trans("UserAgent") . ":</b> " . $_SERVER["HTTP_USER_AGENT"] . "<br>\n"; |
|
3715 | + $out .= "<b>".$langs->trans("UserAgent").":</b> ".$_SERVER["HTTP_USER_AGENT"]."<br>\n"; |
|
3716 | 3716 | $out .= "<br>\n"; |
3717 | - $out .= "<b>" . $langs->trans("RequestedUrl") . ":</b> " . dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT, 'UTF-8') . "<br>\n"; |
|
3718 | - $out .= "<b>" . $langs->trans("Referer") . ":</b> " . (isset($_SERVER["HTTP_REFERER"]) ? dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT, 'UTF-8') : '') . "<br>\n"; |
|
3719 | - $out .= "<b>" . $langs->trans("MenuManager") . ":</b> " . (isset(Globals::$conf->standard_menu) ? Globals::$conf->standard_menu : '') . "<br>\n"; |
|
3717 | + $out .= "<b>".$langs->trans("RequestedUrl").":</b> ".dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT, 'UTF-8')."<br>\n"; |
|
3718 | + $out .= "<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"]) ? dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT, 'UTF-8') : '')."<br>\n"; |
|
3719 | + $out .= "<b>".$langs->trans("MenuManager").":</b> ".(isset(Globals::$conf->standard_menu) ? Globals::$conf->standard_menu : '')."<br>\n"; |
|
3720 | 3720 | $out .= "<br>\n"; |
3721 | - $syslog .= "url=" . dol_escape_htmltag($_SERVER["REQUEST_URI"]); |
|
3722 | - $syslog .= ", query_string=" . dol_escape_htmltag($_SERVER["QUERY_STRING"]); |
|
3721 | + $syslog .= "url=".dol_escape_htmltag($_SERVER["REQUEST_URI"]); |
|
3722 | + $syslog .= ", query_string=".dol_escape_htmltag($_SERVER["QUERY_STRING"]); |
|
3723 | 3723 | } else { // Mode CLI |
3724 | - $out .= '> ' . $langs->transnoentities("ErrorInternalErrorDetected") . ":\n" . $argv[0] . "\n"; |
|
3725 | - $syslog .= "pid=" . dol_getmypid(); |
|
3724 | + $out .= '> '.$langs->transnoentities("ErrorInternalErrorDetected").":\n".$argv[0]."\n"; |
|
3725 | + $syslog .= "pid=".dol_getmypid(); |
|
3726 | 3726 | } |
3727 | 3727 | |
3728 | 3728 | if (is_object($db)) { |
3729 | 3729 | if ($_SERVER['DOCUMENT_ROOT']) { // Mode web |
3730 | - $out .= "<b>" . $langs->trans("DatabaseTypeManager") . ":</b> " . $db->type . "<br>\n"; |
|
3731 | - $out .= "<b>" . $langs->trans("RequestLastAccessInError") . ":</b> " . ($db->lastqueryerror() ? dol_escape_htmltag($db->lastqueryerror()) : $langs->trans("ErrorNoRequestInError")) . "<br>\n"; |
|
3732 | - $out .= "<b>" . $langs->trans("ReturnCodeLastAccessInError") . ":</b> " . ($db->lasterrno() ? dol_escape_htmltag($db->lasterrno()) : $langs->trans("ErrorNoRequestInError")) . "<br>\n"; |
|
3733 | - $out .= "<b>" . $langs->trans("InformationLastAccessInError") . ":</b> " . ($db->lasterror() ? dol_escape_htmltag($db->lasterror()) : $langs->trans("ErrorNoRequestInError")) . "<br>\n"; |
|
3730 | + $out .= "<b>".$langs->trans("DatabaseTypeManager").":</b> ".$db->type."<br>\n"; |
|
3731 | + $out .= "<b>".$langs->trans("RequestLastAccessInError").":</b> ".($db->lastqueryerror() ? dol_escape_htmltag($db->lastqueryerror()) : $langs->trans("ErrorNoRequestInError"))."<br>\n"; |
|
3732 | + $out .= "<b>".$langs->trans("ReturnCodeLastAccessInError").":</b> ".($db->lasterrno() ? dol_escape_htmltag($db->lasterrno()) : $langs->trans("ErrorNoRequestInError"))."<br>\n"; |
|
3733 | + $out .= "<b>".$langs->trans("InformationLastAccessInError").":</b> ".($db->lasterror() ? dol_escape_htmltag($db->lasterror()) : $langs->trans("ErrorNoRequestInError"))."<br>\n"; |
|
3734 | 3734 | $out .= "<br>\n"; |
3735 | 3735 | } else { // Mode CLI |
3736 | 3736 | // No dol_escape_htmltag for output, we are in CLI mode |
3737 | - $out .= '> ' . $langs->transnoentities("DatabaseTypeManager") . ":\n" . $db->type . "\n"; |
|
3738 | - $out .= '> ' . $langs->transnoentities("RequestLastAccessInError") . ":\n" . ($db->lastqueryerror() ? $db->lastqueryerror() : $langs->transnoentities("ErrorNoRequestInError")) . "\n"; |
|
3739 | - $out .= '> ' . $langs->transnoentities("ReturnCodeLastAccessInError") . ":\n" . ($db->lasterrno() ? $db->lasterrno() : $langs->transnoentities("ErrorNoRequestInError")) . "\n"; |
|
3740 | - $out .= '> ' . $langs->transnoentities("InformationLastAccessInError") . ":\n" . ($db->lasterror() ? $db->lasterror() : $langs->transnoentities("ErrorNoRequestInError")) . "\n"; |
|
3737 | + $out .= '> '.$langs->transnoentities("DatabaseTypeManager").":\n".$db->type."\n"; |
|
3738 | + $out .= '> '.$langs->transnoentities("RequestLastAccessInError").":\n".($db->lastqueryerror() ? $db->lastqueryerror() : $langs->transnoentities("ErrorNoRequestInError"))."\n"; |
|
3739 | + $out .= '> '.$langs->transnoentities("ReturnCodeLastAccessInError").":\n".($db->lasterrno() ? $db->lasterrno() : $langs->transnoentities("ErrorNoRequestInError"))."\n"; |
|
3740 | + $out .= '> '.$langs->transnoentities("InformationLastAccessInError").":\n".($db->lasterror() ? $db->lasterror() : $langs->transnoentities("ErrorNoRequestInError"))."\n"; |
|
3741 | 3741 | } |
3742 | - $syslog .= ", sql=" . $db->lastquery(); |
|
3743 | - $syslog .= ", db_error=" . $db->lasterror(); |
|
3742 | + $syslog .= ", sql=".$db->lastquery(); |
|
3743 | + $syslog .= ", db_error=".$db->lasterror(); |
|
3744 | 3744 | } |
3745 | 3745 | |
3746 | 3746 | if ($error || $errors) { |
@@ -3760,31 +3760,31 @@ discard block |
||
3760 | 3760 | if (empty($msg)) |
3761 | 3761 | continue; |
3762 | 3762 | if ($_SERVER['DOCUMENT_ROOT']) { // Mode web |
3763 | - $out .= "<b>" . $langs->trans("Message") . ":</b> " . dol_escape_htmltag($msg) . "<br>\n"; |
|
3763 | + $out .= "<b>".$langs->trans("Message").":</b> ".dol_escape_htmltag($msg)."<br>\n"; |
|
3764 | 3764 | } else { // Mode CLI |
3765 | - $out .= '> ' . $langs->transnoentities("Message") . ":\n" . $msg . "\n"; |
|
3765 | + $out .= '> '.$langs->transnoentities("Message").":\n".$msg."\n"; |
|
3766 | 3766 | } |
3767 | - $syslog .= ", msg=" . $msg; |
|
3767 | + $syslog .= ", msg=".$msg; |
|
3768 | 3768 | } |
3769 | 3769 | } |
3770 | 3770 | if (empty($dolibarr_main_prod) && $_SERVER['DOCUMENT_ROOT'] && function_exists('xdebug_print_function_stack') && function_exists('xdebug_call_file')) { |
3771 | 3771 | xdebug_print_function_stack(); |
3772 | - $out .= '<b>XDebug informations:</b>' . "<br>\n"; |
|
3773 | - $out .= 'File: ' . xdebug_call_file() . "<br>\n"; |
|
3774 | - $out .= 'Line: ' . xdebug_call_line() . "<br>\n"; |
|
3775 | - $out .= 'Function: ' . xdebug_call_function() . "<br>\n"; |
|
3772 | + $out .= '<b>XDebug informations:</b>'."<br>\n"; |
|
3773 | + $out .= 'File: '.xdebug_call_file()."<br>\n"; |
|
3774 | + $out .= 'Line: '.xdebug_call_line()."<br>\n"; |
|
3775 | + $out .= 'Function: '.xdebug_call_function()."<br>\n"; |
|
3776 | 3776 | $out .= "<br>\n"; |
3777 | 3777 | } |
3778 | 3778 | |
3779 | 3779 | if (empty($dolibarr_main_prod)) |
3780 | 3780 | print $out; |
3781 | 3781 | else { |
3782 | - print $langs->trans("DolibarrHasDetectedError") . '. '; |
|
3782 | + print $langs->trans("DolibarrHasDetectedError").'. '; |
|
3783 | 3783 | print $langs->trans("YouCanSetOptionDolibarrMainProdToZero"); |
3784 | 3784 | define("MAIN_CORE_ERROR", 1); |
3785 | 3785 | } |
3786 | 3786 | //else print 'Sorry, an error occured but the parameter $dolibarr_main_prod is defined in conf file so no message is reported to your browser. Please read the log file for error message.'; |
3787 | - dol_syslog("Error " . $syslog, LOG_ERR); |
|
3787 | + dol_syslog("Error ".$syslog, LOG_ERR); |
|
3788 | 3788 | } |
3789 | 3789 | |
3790 | 3790 | /** |
@@ -3807,13 +3807,13 @@ discard block |
||
3807 | 3807 | $langs->load("errors"); |
3808 | 3808 | $now = dol_now(); |
3809 | 3809 | |
3810 | - print '<br><div class="center login_main_message"><div class="' . $morecss . '">'; |
|
3811 | - print $langs->trans("ErrorContactEMail", $email, $prefixcode . dol_print_date($now, '%Y%m%d')); |
|
3810 | + print '<br><div class="center login_main_message"><div class="'.$morecss.'">'; |
|
3811 | + print $langs->trans("ErrorContactEMail", $email, $prefixcode.dol_print_date($now, '%Y%m%d')); |
|
3812 | 3812 | if ($errormessage) |
3813 | - print '<br><br>' . $errormessage; |
|
3813 | + print '<br><br>'.$errormessage; |
|
3814 | 3814 | if (is_array($errormessages) && count($errormessages)) { |
3815 | 3815 | foreach ($errormessages as $mesgtoshow) { |
3816 | - print '<br><br>' . $mesgtoshow; |
|
3816 | + print '<br><br>'.$mesgtoshow; |
|
3817 | 3817 | } |
3818 | 3818 | } |
3819 | 3819 | print '</div></div>'; |
@@ -3871,16 +3871,16 @@ discard block |
||
3871 | 3871 | } |
3872 | 3872 | |
3873 | 3873 | $tmpsortfield = explode(',', $sortfield); |
3874 | - $sortfield1 = trim($tmpsortfield[0]); // If $sortfield is 'd.datep,d.id', it becomes 'd.datep' |
|
3874 | + $sortfield1 = trim($tmpsortfield[0]); // If $sortfield is 'd.datep,d.id', it becomes 'd.datep' |
|
3875 | 3875 | $tmpfield = explode(',', $field); |
3876 | - $field1 = trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep' |
|
3876 | + $field1 = trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep' |
|
3877 | 3877 | //var_dump('field='.$field.' field1='.$field1.' sortfield='.$sortfield.' sortfield1='.$sortfield1); |
3878 | 3878 | // If field is used as sort criteria we use a specific css class liste_titre_sel |
3879 | 3879 | // Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom") |
3880 | 3880 | if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./", "", $field1))) { |
3881 | - $out .= '<' . $tag . ' class="' . $prefix . 'liste_titre_sel" ' . $moreattrib . '>'; |
|
3881 | + $out .= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '.$moreattrib.'>'; |
|
3882 | 3882 | } else { |
3883 | - $out .= '<' . $tag . ' class="' . $prefix . 'liste_titre" ' . $moreattrib . '>'; |
|
3883 | + $out .= '<'.$tag.' class="'.$prefix.'liste_titre" '.$moreattrib.'>'; |
|
3884 | 3884 | } |
3885 | 3885 | |
3886 | 3886 | if (empty($thead) && $field && empty($disablesortlink)) { // If this is a sort field |
@@ -3888,7 +3888,7 @@ discard block |
||
3888 | 3888 | $options = preg_replace('/sortorder=([a-zA-Z0-9,\s\.]+)/i', '', $options); |
3889 | 3889 | $options = preg_replace('/&+/i', '&', $options); |
3890 | 3890 | if (!preg_match('/^&/', $options)) { |
3891 | - $options = '&' . $options; |
|
3891 | + $options = '&'.$options; |
|
3892 | 3892 | } |
3893 | 3893 | |
3894 | 3894 | $sortordertouseinlink = ''; |
@@ -3906,7 +3906,7 @@ discard block |
||
3906 | 3906 | } |
3907 | 3907 | } |
3908 | 3908 | $sortordertouseinlink = preg_replace('/,$/', '', $sortordertouseinlink); |
3909 | - $out .= '<a class="reposition" href="' . $file . '?sortfield=' . $field . '&sortorder=' . $sortordertouseinlink . '&begin=' . $begin . $options . '">'; |
|
3909 | + $out .= '<a class="reposition" href="'.$file.'?sortfield='.$field.'&sortorder='.$sortordertouseinlink.'&begin='.$begin.$options.'">'; |
|
3910 | 3910 | } |
3911 | 3911 | |
3912 | 3912 | if ($tooltip) { |
@@ -3924,7 +3924,7 @@ discard block |
||
3924 | 3924 | $options = preg_replace('/sortorder=([a-zA-Z0-9,\s\.]+)/i', '', $options); |
3925 | 3925 | $options = preg_replace('/&+/i', '&', $options); |
3926 | 3926 | if (!preg_match('/^&/', $options)) { |
3927 | - $options = '&' . $options; |
|
3927 | + $options = '&'.$options; |
|
3928 | 3928 | } |
3929 | 3929 | |
3930 | 3930 | if (!$sortorder || $field1 != $sortfield1) { |
@@ -3934,19 +3934,19 @@ discard block |
||
3934 | 3934 | if (preg_match('/^DESC/', $sortorder)) { |
3935 | 3935 | //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",0).'</a>'; |
3936 | 3936 | //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'.img_up("Z-A",1).'</a>'; |
3937 | - $sortimg .= '<span class="nowrap">' . img_up("Z-A", 0) . '</span>'; |
|
3937 | + $sortimg .= '<span class="nowrap">'.img_up("Z-A", 0).'</span>'; |
|
3938 | 3938 | } |
3939 | 3939 | if (preg_match('/^ASC/', $sortorder)) { |
3940 | 3940 | //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",1).'</a>'; |
3941 | 3941 | //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'.img_up("Z-A",0).'</a>'; |
3942 | - $sortimg .= '<span class="nowrap">' . img_down("A-Z", 0) . '</span>'; |
|
3942 | + $sortimg .= '<span class="nowrap">'.img_down("A-Z", 0).'</span>'; |
|
3943 | 3943 | } |
3944 | 3944 | } |
3945 | 3945 | } |
3946 | 3946 | |
3947 | 3947 | $out .= $sortimg; |
3948 | 3948 | |
3949 | - $out .= '</' . $tag . '>'; |
|
3949 | + $out .= '</'.$tag.'>'; |
|
3950 | 3950 | |
3951 | 3951 | return $out; |
3952 | 3952 | } |
@@ -3961,9 +3961,9 @@ discard block |
||
3961 | 3961 | */ |
3962 | 3962 | static function print_titre($title) |
3963 | 3963 | { |
3964 | - dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); |
|
3964 | + dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING); |
|
3965 | 3965 | |
3966 | - print '<div class="titre">' . $title . '</div>'; |
|
3966 | + print '<div class="titre">'.$title.'</div>'; |
|
3967 | 3967 | } |
3968 | 3968 | |
3969 | 3969 | /** |
@@ -4006,20 +4006,20 @@ discard block |
||
4006 | 4006 | } |
4007 | 4007 | |
4008 | 4008 | $return .= "\n"; |
4009 | - $return .= '<table ' . ($id ? 'id="' . $id . '" ' : '') . 'summary="" class="centpercent notopnoleftnoright' . ($morecssontable ? ' ' . $morecssontable : '') . '" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into print_barre_list |
|
4009 | + $return .= '<table '.($id ? 'id="'.$id.'" ' : '').'summary="" class="centpercent notopnoleftnoright'.($morecssontable ? ' '.$morecssontable : '').'" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into print_barre_list |
|
4010 | 4010 | if ($picto) { |
4011 | - $return .= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">' . img_picto('', $picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath) . '</td>'; |
|
4011 | + $return .= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">'.img_picto('', $picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).'</td>'; |
|
4012 | 4012 | } |
4013 | 4013 | $return .= '<td class="nobordernopadding valignmiddle">'; |
4014 | - $return .= '<div class="titre inline-block">' . $titre . '</div>'; |
|
4014 | + $return .= '<div class="titre inline-block">'.$titre.'</div>'; |
|
4015 | 4015 | $return .= '</td>'; |
4016 | 4016 | if (dol_strlen($morehtmlcenter)) { |
4017 | - $return .= '<td class="nobordernopadding" align="center" valign="middle">' . $morehtmlcenter . '</td>'; |
|
4017 | + $return .= '<td class="nobordernopadding" align="center" valign="middle">'.$morehtmlcenter.'</td>'; |
|
4018 | 4018 | } |
4019 | 4019 | if (dol_strlen($morehtmlright)) { |
4020 | - $return .= '<td class="nobordernopadding titre_right wordbreak" align="right" valign="middle">' . $morehtmlright . '</td>'; |
|
4020 | + $return .= '<td class="nobordernopadding titre_right wordbreak" align="right" valign="middle">'.$morehtmlright.'</td>'; |
|
4021 | 4021 | } |
4022 | - $return .= '</tr></table>' . "\n"; |
|
4022 | + $return .= '</tr></table>'."\n"; |
|
4023 | 4023 | |
4024 | 4024 | return $return; |
4025 | 4025 | } |
@@ -4067,29 +4067,29 @@ discard block |
||
4067 | 4067 | //print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage; |
4068 | 4068 | |
4069 | 4069 | print "\n"; |
4070 | - print "<!-- Begin title '" . $titre . "' -->\n"; |
|
4071 | - print '<table border="0" class="centpercent notopnoleftnoright' . ($morecss ? ' ' . $morecss : '') . '" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into load_fiche_tire |
|
4070 | + print "<!-- Begin title '".$titre."' -->\n"; |
|
4071 | + print '<table border="0" class="centpercent notopnoleftnoright'.($morecss ? ' '.$morecss : '').'" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into load_fiche_tire |
|
4072 | 4072 | // Left |
4073 | 4073 | //if ($picto && $titre) print '<td class="nobordernopadding hideonsmartphone" width="40" align="left" valign="middle">'.img_picto('', $picto, 'id="pictotitle"', $pictoisfullpath).'</td>'; |
4074 | 4074 | print '<td class="nobordernopadding valignmiddle">'; |
4075 | 4075 | if ($picto && $titre) |
4076 | 4076 | print img_picto('', $picto, 'class="hideonsmartphone valignmiddle opacityhigh pictotitle widthpictotitle"', $pictoisfullpath); |
4077 | - print '<div class="titre inline-block">' . $titre; |
|
4077 | + print '<div class="titre inline-block">'.$titre; |
|
4078 | 4078 | if (!empty($titre) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') |
4079 | - print ' (' . $totalnboflines . ')'; |
|
4079 | + print ' ('.$totalnboflines.')'; |
|
4080 | 4080 | print '</div></td>'; |
4081 | 4081 | |
4082 | 4082 | // Center |
4083 | 4083 | if ($morehtmlcenter) { |
4084 | - print '<td class="nobordernopadding center valignmiddle">' . $morehtmlcenter . '</td>'; |
|
4084 | + print '<td class="nobordernopadding center valignmiddle">'.$morehtmlcenter.'</td>'; |
|
4085 | 4085 | } |
4086 | 4086 | |
4087 | 4087 | // Right |
4088 | 4088 | print '<td class="nobordernopadding valignmiddle" align="right">'; |
4089 | 4089 | if ($sortfield) |
4090 | - $options .= "&sortfield=" . urlencode($sortfield); |
|
4090 | + $options .= "&sortfield=".urlencode($sortfield); |
|
4091 | 4091 | if ($sortorder) |
4092 | - $options .= "&sortorder=" . urlencode($sortorder); |
|
4092 | + $options .= "&sortorder=".urlencode($sortorder); |
|
4093 | 4093 | // Show navigation bar |
4094 | 4094 | $pagelist = ''; |
4095 | 4095 | if ($savlimit != 0 && ($page > 0 || $num > $limit)) { |
@@ -4107,40 +4107,40 @@ discard block |
||
4107 | 4107 | } |
4108 | 4108 | |
4109 | 4109 | if ($cpt >= 1) { |
4110 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=0' . $options . '">1</a></li>'; |
|
4110 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page=0'.$options.'">1</a></li>'; |
|
4111 | 4111 | if ($cpt > 2) |
4112 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . ((Globals::$conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
4112 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.((Globals::$conf->dol_use_jmobile != 4) ? 'class="inactive"' : '').'>...</span></li>'; |
|
4113 | 4113 | else if ($cpt == 2) |
4114 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=1' . $options . '">2</a></li>'; |
|
4114 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page=1'.$options.'">2</a></li>'; |
|
4115 | 4115 | } |
4116 | 4116 | |
4117 | 4117 | do { |
4118 | 4118 | if ($cpt == $page) { |
4119 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . ((Globals::$conf->dol_use_jmobile != 4) ? 'class="active"' : '') . '>' . ($page + 1) . '</span></li>'; |
|
4119 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.((Globals::$conf->dol_use_jmobile != 4) ? 'class="active"' : '').'>'.($page + 1).'</span></li>'; |
|
4120 | 4120 | } else { |
4121 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . $cpt . $options . '">' . ($cpt + 1) . '</a></li>'; |
|
4121 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page='.$cpt.$options.'">'.($cpt + 1).'</a></li>'; |
|
4122 | 4122 | } |
4123 | 4123 | $cpt++; |
4124 | 4124 | } while ($cpt < $nbpages && $cpt <= $page + $maxnbofpage); |
4125 | 4125 | |
4126 | 4126 | if ($cpt < $nbpages) { |
4127 | 4127 | if ($cpt < $nbpages - 2) |
4128 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . ((Globals::$conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
4128 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.((Globals::$conf->dol_use_jmobile != 4) ? 'class="inactive"' : '').'>...</span></li>'; |
|
4129 | 4129 | else if ($cpt == $nbpages - 2) |
4130 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 2) . $options . '">' . ($nbpages - 1) . '</a></li>'; |
|
4131 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 1) . $options . '">' . $nbpages . '</a></li>'; |
|
4130 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page='.($nbpages - 2).$options.'">'.($nbpages - 1).'</a></li>'; |
|
4131 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page='.($nbpages - 1).$options.'">'.$nbpages.'</a></li>'; |
|
4132 | 4132 | } |
4133 | 4133 | } |
4134 | 4134 | else { |
4135 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . ((Globals::$conf->dol_use_jmobile != 4) ? 'class="active"' : '') . '>' . ($page + 1) . "</li>"; |
|
4135 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.((Globals::$conf->dol_use_jmobile != 4) ? 'class="active"' : '').'>'.($page + 1)."</li>"; |
|
4136 | 4136 | } |
4137 | 4137 | } |
4138 | 4138 | |
4139 | - print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist |
|
4139 | + print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist |
|
4140 | 4140 | |
4141 | 4141 | print '</td>'; |
4142 | 4142 | |
4143 | - print '</tr></table>' . "\n"; |
|
4143 | + print '</tr></table>'."\n"; |
|
4144 | 4144 | print "<!-- End title -->\n\n"; |
4145 | 4145 | } |
4146 | 4146 | |
@@ -4171,12 +4171,12 @@ discard block |
||
4171 | 4171 | $pagesizechoices = Globals::$conf->global->MAIN_PAGESIZE_CHOICES; |
4172 | 4172 | |
4173 | 4173 | print '<li class="pagination">'; |
4174 | - print '<select class="flat selectlimit" name="limit" title="' . dol_escape_htmltag($langs->trans("MaxNbOfRecordPerPage")) . '">'; |
|
4174 | + print '<select class="flat selectlimit" name="limit" title="'.dol_escape_htmltag($langs->trans("MaxNbOfRecordPerPage")).'">'; |
|
4175 | 4175 | $tmpchoice = explode(',', $pagesizechoices); |
4176 | - $tmpkey = $limit . ':' . $limit; |
|
4176 | + $tmpkey = $limit.':'.$limit; |
|
4177 | 4177 | if (!in_array($tmpkey, $tmpchoice)) |
4178 | 4178 | $tmpchoice[] = $tmpkey; |
4179 | - $tmpkey = Globals::$conf->liste_limit . ':' . Globals::$conf->liste_limit; |
|
4179 | + $tmpkey = Globals::$conf->liste_limit.':'.Globals::$conf->liste_limit; |
|
4180 | 4180 | if (!in_array($tmpkey, $tmpchoice)) |
4181 | 4181 | $tmpchoice[] = $tmpkey; |
4182 | 4182 | asort($tmpchoice, SORT_NUMERIC); |
@@ -4191,7 +4191,7 @@ discard block |
||
4191 | 4191 | $selected = ' selected="selected"'; |
4192 | 4192 | $found = true; |
4193 | 4193 | } |
4194 | - print '<option name="' . $key . '"' . $selected . '>' . dol_escape_htmltag($val) . '</option>' . "\n"; |
|
4194 | + print '<option name="'.$key.'"'.$selected.'>'.dol_escape_htmltag($val).'</option>'."\n"; |
|
4195 | 4195 | } |
4196 | 4196 | } |
4197 | 4197 | print '</select>'; |
@@ -4210,20 +4210,20 @@ discard block |
||
4210 | 4210 | print '</li>'; |
4211 | 4211 | } |
4212 | 4212 | if ($page > 0) { |
4213 | - print '<li class="pagination"><a class="paginationprevious" href="' . $file . '?page=' . ($page - 1) . $options . '"><i class="fa fa-chevron-left" title="' . dol_escape_htmltag($langs->trans("Previous")) . '"></i></a></li>'; |
|
4213 | + print '<li class="pagination"><a class="paginationprevious" href="'.$file.'?page='.($page - 1).$options.'"><i class="fa fa-chevron-left" title="'.dol_escape_htmltag($langs->trans("Previous")).'"></i></a></li>'; |
|
4214 | 4214 | } |
4215 | 4215 | if ($betweenarrows) { |
4216 | 4216 | print $betweenarrows; |
4217 | 4217 | } |
4218 | 4218 | if ($nextpage > 0) { |
4219 | - print '<li class="pagination"><a class="paginationnext" href="' . $file . '?page=' . ($page + 1) . $options . '"><i class="fa fa-chevron-right" title="' . dol_escape_htmltag($langs->trans("Next")) . '"></i></a></li>'; |
|
4219 | + print '<li class="pagination"><a class="paginationnext" href="'.$file.'?page='.($page + 1).$options.'"><i class="fa fa-chevron-right" title="'.dol_escape_htmltag($langs->trans("Next")).'"></i></a></li>'; |
|
4220 | 4220 | } |
4221 | 4221 | if ($afterarrows) { |
4222 | 4222 | print '<li class="paginationafterarrows">'; |
4223 | 4223 | print $afterarrows; |
4224 | 4224 | print '</li>'; |
4225 | 4225 | } |
4226 | - print '</ul></div>' . "\n"; |
|
4226 | + print '</ul></div>'."\n"; |
|
4227 | 4227 | } |
4228 | 4228 | |
4229 | 4229 | /** |
@@ -4245,8 +4245,8 @@ discard block |
||
4245 | 4245 | $addpercent = true; |
4246 | 4246 | } |
4247 | 4247 | if (preg_match('/\((.*)\)/', $rate, $reg)) { |
4248 | - $morelabel = ' (' . $reg[1] . ')'; |
|
4249 | - $rate = preg_replace('/\s*' . preg_quote($morelabel, '/') . '/', '', $rate); |
|
4248 | + $morelabel = ' ('.$reg[1].')'; |
|
4249 | + $rate = preg_replace('/\s*'.preg_quote($morelabel, '/').'/', '', $rate); |
|
4250 | 4250 | } |
4251 | 4251 | if (preg_match('/\*/', $rate)) { |
4252 | 4252 | $rate = str_replace('*', '', $rate); |
@@ -4255,10 +4255,10 @@ discard block |
||
4255 | 4255 | |
4256 | 4256 | // If rate is '9/9/9' we don't change it. If rate is '9.000' we apply price() |
4257 | 4257 | if (!preg_match('/\//', $rate)) |
4258 | - $ret = price($rate, 0, '', 0, 0) . ($addpercent ? '%' : ''); |
|
4258 | + $ret = price($rate, 0, '', 0, 0).($addpercent ? '%' : ''); |
|
4259 | 4259 | else { |
4260 | 4260 | // TODO Split on / and output with a price2num to have clean numbers without ton of 000. |
4261 | - $ret = $rate . ($addpercent ? '%' : ''); |
|
4261 | + $ret = $rate.($addpercent ? '%' : ''); |
|
4262 | 4262 | } |
4263 | 4263 | if (($info_bits & 1) && $usestarfornpr >= 0) |
4264 | 4264 | $ret .= ' *'; |
@@ -4351,10 +4351,10 @@ discard block |
||
4351 | 4351 | $cursymbolbefore .= $outlangs->getCurrencySymbol($currency_code); |
4352 | 4352 | else { |
4353 | 4353 | $tmpcur = $outlangs->getCurrencySymbol($currency_code); |
4354 | - $cursymbolafter .= ($tmpcur == $currency_code ? ' ' . $tmpcur : $tmpcur); |
|
4354 | + $cursymbolafter .= ($tmpcur == $currency_code ? ' '.$tmpcur : $tmpcur); |
|
4355 | 4355 | } |
4356 | 4356 | } |
4357 | - $output = $cursymbolbefore . $output . $end . ($cursymbolafter ? ' ' : '') . $cursymbolafter; |
|
4357 | + $output = $cursymbolbefore.$output.$end.($cursymbolafter ? ' ' : '').$cursymbolafter; |
|
4358 | 4358 | |
4359 | 4359 | return $output; |
4360 | 4360 | } |
@@ -4407,7 +4407,7 @@ discard block |
||
4407 | 4407 | // Now make replace (the main goal of function) |
4408 | 4408 | if ($thousand != ',' && $thousand != '.') |
4409 | 4409 | $amount = str_replace(',', '.', $amount); // To accept 2 notations for french users |
4410 | - $amount = str_replace(' ', '', $amount); // To avoid spaces |
|
4410 | + $amount = str_replace(' ', '', $amount); // To avoid spaces |
|
4411 | 4411 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
4412 | 4412 | $amount = str_replace($dec, '.', $amount); |
4413 | 4413 | } |
@@ -4436,14 +4436,14 @@ discard block |
||
4436 | 4436 | $temps = sprintf("%0.10F", $amount - intval($amount)); // temps=0.0000000000 or 0.0000200000 or 9999.1000000000 |
4437 | 4437 | $temps = preg_replace('/([\.1-9])0+$/', '\\1', $temps); // temps=0. or 0.00002 or 9999.1 |
4438 | 4438 | $nbofdec = max(0, dol_strlen($temps) - 2); // -2 to remove "0." |
4439 | - $amount = number_format($amount, min($nbofdec, $nbofdectoround), $dec, $thousand); // Convert amount to format with dolibarr dec and thousand |
|
4439 | + $amount = number_format($amount, min($nbofdec, $nbofdectoround), $dec, $thousand); // Convert amount to format with dolibarr dec and thousand |
|
4440 | 4440 | } |
4441 | 4441 | //print "TT".$amount.'<br>'; |
4442 | 4442 | // Always make replace because each math static function (like round) replace |
4443 | 4443 | // with local values and we want a number that has a SQL string format x.y |
4444 | 4444 | if ($thousand != ',' && $thousand != '.') |
4445 | 4445 | $amount = str_replace(',', '.', $amount); // To accept 2 notations for french users |
4446 | - $amount = str_replace(' ', '', $amount); // To avoid spaces |
|
4446 | + $amount = str_replace(' ', '', $amount); // To avoid spaces |
|
4447 | 4447 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
4448 | 4448 | $amount = str_replace($dec, '.', $amount); |
4449 | 4449 | } |
@@ -4464,7 +4464,7 @@ discard block |
||
4464 | 4464 | */ |
4465 | 4465 | static function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round = -1, $forceunitoutput = 'no') |
4466 | 4466 | { |
4467 | - require_once DOL_BASE_PATH . '/core/lib/product.lib.php'; |
|
4467 | + require_once DOL_BASE_PATH.'/core/lib/product.lib.php'; |
|
4468 | 4468 | |
4469 | 4469 | if (($forceunitoutput == 'no' && $dimension < 1 / 10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6)) { |
4470 | 4470 | $dimension = $dimension * 1000000; |
@@ -4480,7 +4480,7 @@ discard block |
||
4480 | 4480 | $unit = $unit + 3; |
4481 | 4481 | } |
4482 | 4482 | |
4483 | - $ret = price($dimension, 0, $outputlangs, 0, 0, $round) . ' ' . measuring_units_string($unit, $type); |
|
4483 | + $ret = price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type); |
|
4484 | 4484 | |
4485 | 4485 | return $ret; |
4486 | 4486 | } |
@@ -4504,7 +4504,7 @@ discard block |
||
4504 | 4504 | if (empty($thirdparty_seller) || !is_object($thirdparty_seller)) |
4505 | 4505 | $thirdparty_seller = $mysoc; |
4506 | 4506 | |
4507 | - dol_syslog("get_localtax tva=" . $vatrate . " local=" . $local . " thirdparty_buyer id=" . (is_object($thirdparty_buyer) ? $thirdparty_buyer->id : '') . "/country_code=" . (is_object($thirdparty_buyer) ? $thirdparty_buyer->country_code : '') . " thirdparty_seller id=" . $thirdparty_seller->id . "/country_code=" . $thirdparty_seller->country_code . " thirdparty_seller localtax1_assuj=" . $thirdparty_seller->localtax1_assuj . " thirdparty_seller localtax2_assuj=" . $thirdparty_seller->localtax2_assuj); |
|
4507 | + dol_syslog("get_localtax tva=".$vatrate." local=".$local." thirdparty_buyer id=".(is_object($thirdparty_buyer) ? $thirdparty_buyer->id : '')."/country_code=".(is_object($thirdparty_buyer) ? $thirdparty_buyer->country_code : '')." thirdparty_seller id=".$thirdparty_seller->id."/country_code=".$thirdparty_seller->country_code." thirdparty_seller localtax1_assuj=".$thirdparty_seller->localtax1_assuj." thirdparty_seller localtax2_assuj=".$thirdparty_seller->localtax2_assuj); |
|
4508 | 4508 | |
4509 | 4509 | $vatratecleaned = $vatrate; |
4510 | 4510 | if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) { // If vat is "xx (yy)" |
@@ -4535,7 +4535,7 @@ discard block |
||
4535 | 4535 | if ($local == 2) { |
4536 | 4536 | //if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0; |
4537 | 4537 | if (!$mysoc->localtax2_assuj) |
4538 | - return 0; // If main vat is 0, IRPF may be different than 0. |
|
4538 | + return 0; // If main vat is 0, IRPF may be different than 0. |
|
4539 | 4539 | if ($thirdparty_seller->id == $mysoc->id) { |
4540 | 4540 | if (!$thirdparty_buyer->localtax2_assuj) |
4541 | 4541 | return 0; |
@@ -4589,13 +4589,13 @@ discard block |
||
4589 | 4589 | |
4590 | 4590 | // By default, search value of local tax on line of common tax |
4591 | 4591 | $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; |
4592 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c"; |
|
4593 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $thirdparty_seller->country_code . "'"; |
|
4594 | - $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
|
4592 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; |
|
4593 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$thirdparty_seller->country_code."'"; |
|
4594 | + $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; |
|
4595 | 4595 | if ($vatratecode) |
4596 | - $sql .= " AND t.code ='" . $vatratecode . "'"; // If we have the code, we use it in priority |
|
4596 | + $sql .= " AND t.code ='".$vatratecode."'"; // If we have the code, we use it in priority |
|
4597 | 4597 | else |
4598 | - $sql .= " AND t.recuperableonly ='" . $vatnpr . "'"; |
|
4598 | + $sql .= " AND t.recuperableonly ='".$vatnpr."'"; |
|
4599 | 4599 | dol_syslog("get_localtax", LOG_DEBUG); |
4600 | 4600 | $resql = $db->query($sql); |
4601 | 4601 | |
@@ -4641,10 +4641,10 @@ discard block |
||
4641 | 4641 | { |
4642 | 4642 | // global $db, $mysoc; |
4643 | 4643 | $sql = "SELECT t.localtax1, t.localtax2 "; |
4644 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t inner join " . MAIN_DB_PREFIX . "c_country as c ON c.rowid=t.fk_pays"; |
|
4645 | - $sql .= " WHERE c.code = '" . $mysoc->country_code . "' AND t.active = 1 AND t.taux=("; |
|
4646 | - $sql .= " SELECT max(tt.taux) FROM " . MAIN_DB_PREFIX . "c_tva as tt inner join " . MAIN_DB_PREFIX . "c_country as c ON c.rowid=tt.fk_pays"; |
|
4647 | - $sql .= " WHERE c.code = '" . $mysoc->country_code . "' AND tt.active = 1"; |
|
4644 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=t.fk_pays"; |
|
4645 | + $sql .= " WHERE c.code = '".$mysoc->country_code."' AND t.active = 1 AND t.taux=("; |
|
4646 | + $sql .= " SELECT max(tt.taux) FROM ".MAIN_DB_PREFIX."c_tva as tt inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=tt.fk_pays"; |
|
4647 | + $sql .= " WHERE c.code = '".$mysoc->country_code."' AND tt.active = 1"; |
|
4648 | 4648 | $sql .= " )"; |
4649 | 4649 | |
4650 | 4650 | $resql = $db->query($sql); |
@@ -4674,13 +4674,13 @@ discard block |
||
4674 | 4674 | { |
4675 | 4675 | // global $db, $mysoc; |
4676 | 4676 | |
4677 | - dol_syslog("getTaxesFromId vat id or rate = " . $vatrate); |
|
4677 | + dol_syslog("getTaxesFromId vat id or rate = ".$vatrate); |
|
4678 | 4678 | |
4679 | 4679 | // Search local taxes |
4680 | 4680 | $sql = "SELECT t.rowid, t.code, t.taux as rate, t.recuperableonly as npr, t.accountancy_code_sell, t.accountancy_code_buy"; |
4681 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t"; |
|
4681 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t"; |
|
4682 | 4682 | if ($firstparamisid) |
4683 | - $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
4683 | + $sql .= " WHERE t.rowid = ".(int) $vatrate; |
|
4684 | 4684 | else { |
4685 | 4685 | $vatratecleaned = $vatrate; |
4686 | 4686 | $vatratecode = ''; |
@@ -4689,13 +4689,13 @@ discard block |
||
4689 | 4689 | $vatratecode = $reg[2]; |
4690 | 4690 | } |
4691 | 4691 | |
4692 | - $sql .= ", " . MAIN_DB_PREFIX . "c_country as c"; |
|
4692 | + $sql .= ", ".MAIN_DB_PREFIX."c_country as c"; |
|
4693 | 4693 | /* if ($mysoc->country_code == 'ES') $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; // vat in spain use the buyer country ?? |
4694 | 4694 | else $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; */ |
4695 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'"; |
|
4696 | - $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
|
4695 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; |
|
4696 | + $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; |
|
4697 | 4697 | if ($vatratecode) |
4698 | - $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
4698 | + $sql .= " AND t.code = '".$vatratecode."'"; |
|
4699 | 4699 | } |
4700 | 4700 | |
4701 | 4701 | $resql = $db->query($sql); |
@@ -4731,13 +4731,13 @@ discard block |
||
4731 | 4731 | { |
4732 | 4732 | // global $db, $mysoc; |
4733 | 4733 | |
4734 | - dol_syslog("getLocalTaxesFromRate vatrate=" . $vatrate . " local=" . $local); |
|
4734 | + dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local); |
|
4735 | 4735 | |
4736 | 4736 | // Search local taxes |
4737 | 4737 | $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; |
4738 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t"; |
|
4738 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t"; |
|
4739 | 4739 | if ($firstparamisid) |
4740 | - $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
4740 | + $sql .= " WHERE t.rowid = ".(int) $vatrate; |
|
4741 | 4741 | else { |
4742 | 4742 | $vatratecleaned = $vatrate; |
4743 | 4743 | $vatratecode = ''; |
@@ -4746,14 +4746,14 @@ discard block |
||
4746 | 4746 | $vatratecode = $reg[2]; |
4747 | 4747 | } |
4748 | 4748 | |
4749 | - $sql .= ", " . MAIN_DB_PREFIX . "c_country as c"; |
|
4749 | + $sql .= ", ".MAIN_DB_PREFIX."c_country as c"; |
|
4750 | 4750 | if ($mysoc->country_code == 'ES') |
4751 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $buyer->country_code . "'"; // local tax in spain use the buyer country ?? |
|
4751 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; // local tax in spain use the buyer country ?? |
|
4752 | 4752 | else |
4753 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'"; |
|
4754 | - $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
|
4753 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; |
|
4754 | + $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; |
|
4755 | 4755 | if ($vatratecode) |
4756 | - $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
4756 | + $sql .= " AND t.code = '".$vatratecode."'"; |
|
4757 | 4757 | } |
4758 | 4758 | |
4759 | 4759 | $resql = $db->query($sql); |
@@ -4785,7 +4785,7 @@ discard block |
||
4785 | 4785 | { |
4786 | 4786 | // global $db, Globals::$conf, $mysoc; |
4787 | 4787 | |
4788 | - require_once DOL_BASE_PATH . '/product/class/product.class.php'; |
|
4788 | + require_once DOL_BASE_PATH.'/product/class/product.class.php'; |
|
4789 | 4789 | |
4790 | 4790 | $ret = 0; |
4791 | 4791 | $found = 0; |
@@ -4800,12 +4800,12 @@ discard block |
||
4800 | 4800 | $product->get_buyprice($idprodfournprice, 0, 0, 0); |
4801 | 4801 | $ret = $product->vatrate_supplier; |
4802 | 4802 | if ($product->default_vat_code) |
4803 | - $ret .= ' (' . $product->default_vat_code . ')'; |
|
4803 | + $ret .= ' ('.$product->default_vat_code.')'; |
|
4804 | 4804 | } |
4805 | 4805 | else { |
4806 | - $ret = $product->tva_tx; // Default vat of product we defined |
|
4806 | + $ret = $product->tva_tx; // Default vat of product we defined |
|
4807 | 4807 | if ($product->default_vat_code) |
4808 | - $ret .= ' (' . $product->default_vat_code . ')'; |
|
4808 | + $ret .= ' ('.$product->default_vat_code.')'; |
|
4809 | 4809 | } |
4810 | 4810 | $found = 1; |
4811 | 4811 | } |
@@ -4819,8 +4819,8 @@ discard block |
||
4819 | 4819 | if (empty(Globals::$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS)) { |
4820 | 4820 | // If vat of product for the country not found or not defined, we return the first higher vat of country. |
4821 | 4821 | $sql = "SELECT t.taux as vat_rate, t.code as default_vat_code"; |
4822 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c"; |
|
4823 | - $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='" . $thirdparty_seller->country_code . "'"; |
|
4822 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; |
|
4823 | + $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'"; |
|
4824 | 4824 | $sql .= " ORDER BY t.taux DESC, t.code ASC, t.recuperableonly ASC"; |
4825 | 4825 | $sql .= $db->plimit(1); |
4826 | 4826 | |
@@ -4830,16 +4830,16 @@ discard block |
||
4830 | 4830 | if ($obj) { |
4831 | 4831 | $ret = $obj->vat_rate; |
4832 | 4832 | if ($obj->default_vat_code) |
4833 | - $ret .= ' (' . $obj->default_vat_code . ')'; |
|
4833 | + $ret .= ' ('.$obj->default_vat_code.')'; |
|
4834 | 4834 | } |
4835 | 4835 | $db->free($sql); |
4836 | 4836 | } else |
4837 | 4837 | dol_print_error($db); |
4838 | 4838 | } else |
4839 | - $ret = Globals::$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; // Forced value if autodetect fails |
|
4839 | + $ret = Globals::$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; // Forced value if autodetect fails |
|
4840 | 4840 | } |
4841 | 4841 | |
4842 | - dol_syslog("get_product_vat_for_country: ret=" . $ret); |
|
4842 | + dol_syslog("get_product_vat_for_country: ret=".$ret); |
|
4843 | 4843 | return $ret; |
4844 | 4844 | } |
4845 | 4845 | |
@@ -4857,7 +4857,7 @@ discard block |
||
4857 | 4857 | // global $db, $mysoc; |
4858 | 4858 | |
4859 | 4859 | if (!class_exists('Product')) { |
4860 | - require_once DOL_BASE_PATH . 'product/class/product.class.php'; |
|
4860 | + require_once DOL_BASE_PATH.'product/class/product.class.php'; |
|
4861 | 4861 | } |
4862 | 4862 | |
4863 | 4863 | $ret = 0; |
@@ -4882,8 +4882,8 @@ discard block |
||
4882 | 4882 | if (!$found) { |
4883 | 4883 | // If vat of product for the country not found or not defined, we return higher vat of country. |
4884 | 4884 | $sql = "SELECT taux as vat_rate, localtax1, localtax2"; |
4885 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c"; |
|
4886 | - $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='" . $thirdparty_seller->country_code . "'"; |
|
4885 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; |
|
4886 | + $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'"; |
|
4887 | 4887 | $sql .= " ORDER BY t.taux DESC, t.recuperableonly ASC"; |
4888 | 4888 | $sql .= $db->plimit(1); |
4889 | 4889 | |
@@ -4900,7 +4900,7 @@ discard block |
||
4900 | 4900 | dol_print_error($db); |
4901 | 4901 | } |
4902 | 4902 | |
4903 | - dol_syslog("get_product_localtax_for_country: ret=" . $ret); |
|
4903 | + dol_syslog("get_product_localtax_for_country: ret=".$ret); |
|
4904 | 4904 | return $ret; |
4905 | 4905 | } |
4906 | 4906 | |
@@ -4924,7 +4924,7 @@ discard block |
||
4924 | 4924 | { |
4925 | 4925 | // global Globals::$conf; |
4926 | 4926 | |
4927 | - require_once DOL_BASE_PATH . '/core/lib/company.lib.php'; |
|
4927 | + require_once DOL_BASE_PATH.'/core/lib/company.lib.php'; |
|
4928 | 4928 | |
4929 | 4929 | // Note: possible values for tva_assuj are 0/1 or franchise/reel |
4930 | 4930 | $seller_use_vat = ((is_numeric($thirdparty_seller->tva_assuj) && !$thirdparty_seller->tva_assuj) || (!is_numeric($thirdparty_seller->tva_assuj) && $thirdparty_seller->tva_assuj == 'franchise')) ? 0 : 1; |
@@ -4935,7 +4935,7 @@ discard block |
||
4935 | 4935 | $buyer_country_code = $thirdparty_buyer->country_code; |
4936 | 4936 | $buyer_in_cee = isInEEC($thirdparty_buyer); |
4937 | 4937 | |
4938 | - dol_syslog("get_default_tva: seller use vat=" . $seller_use_vat . ", seller country=" . $seller_country_code . ", seller in cee=" . $seller_in_cee . ", buyer vat number=" . $thirdparty_buyer->tva_intra . " buyer country=" . $buyer_country_code . ", buyer in cee=" . $buyer_in_cee . ", idprod=" . $idprod . ", idprodfournprice=" . $idprodfournprice . ", SERVICE_ARE_ECOMMERCE_200238EC=" . (!empty(Globals::$conf->global->SERVICES_ARE_ECOMMERCE_200238EC) ? Globals::$conf->global->SERVICES_ARE_ECOMMERCE_200238EC : '')); |
|
4938 | + dol_syslog("get_default_tva: seller use vat=".$seller_use_vat.", seller country=".$seller_country_code.", seller in cee=".$seller_in_cee.", buyer vat number=".$thirdparty_buyer->tva_intra." buyer country=".$buyer_country_code.", buyer in cee=".$buyer_in_cee.", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(!empty(Globals::$conf->global->SERVICES_ARE_ECOMMERCE_200238EC) ? Globals::$conf->global->SERVICES_ARE_ECOMMERCE_200238EC : '')); |
|
4939 | 4939 | |
4940 | 4940 | // 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) |
4941 | 4941 | // we use the buyer VAT. |
@@ -5001,14 +5001,14 @@ discard block |
||
5001 | 5001 | |
5002 | 5002 | if ($idprodfournprice > 0) { |
5003 | 5003 | if (!class_exists('ProductFournisseur')) |
5004 | - require_once DOL_BASE_PATH . '/fourn/class/fournisseur.product.class.php'; |
|
5004 | + require_once DOL_BASE_PATH.'/fourn/class/fournisseur.product.class.php'; |
|
5005 | 5005 | $prodprice = new ProductFournisseur($db); |
5006 | 5006 | $prodprice->fetch_product_fournisseur_price($idprodfournprice); |
5007 | 5007 | return $prodprice->fourn_tva_npr; |
5008 | 5008 | } |
5009 | 5009 | elseif ($idprod > 0) { |
5010 | 5010 | if (!class_exists('Product')) |
5011 | - require_once DOL_BASE_PATH . 'product/class/product.class.php'; |
|
5011 | + require_once DOL_BASE_PATH.'product/class/product.class.php'; |
|
5012 | 5012 | $prod = new Product($db); |
5013 | 5013 | $prod->fetch($idprod); |
5014 | 5014 | return $prod->tva_npr; |
@@ -5087,7 +5087,7 @@ discard block |
||
5087 | 5087 | if ($case == 2) |
5088 | 5088 | $result = '<input type="checkbox" value="1" checked disabled>'; |
5089 | 5089 | if ($case == 3) |
5090 | - $result = '<input type="checkbox" value="1" checked disabled> ' . $result; |
|
5090 | + $result = '<input type="checkbox" value="1" checked disabled> '.$result; |
|
5091 | 5091 | |
5092 | 5092 | $classname = 'ok'; |
5093 | 5093 | } |
@@ -5098,7 +5098,7 @@ discard block |
||
5098 | 5098 | if ($case == 2) |
5099 | 5099 | $result = '<input type="checkbox" value="0" disabled>'; |
5100 | 5100 | if ($case == 3) |
5101 | - $result = '<input type="checkbox" value="0" disabled> ' . $result; |
|
5101 | + $result = '<input type="checkbox" value="0" disabled> '.$result; |
|
5102 | 5102 | |
5103 | 5103 | if ($color == 2) |
5104 | 5104 | $classname = 'ok'; |
@@ -5106,7 +5106,7 @@ discard block |
||
5106 | 5106 | $classname = 'error'; |
5107 | 5107 | } |
5108 | 5108 | if ($color) |
5109 | - return '<font class="' . $classname . '">' . $result . '</font>'; |
|
5109 | + return '<font class="'.$classname.'">'.$result.'</font>'; |
|
5110 | 5110 | return $result; |
5111 | 5111 | } |
5112 | 5112 | |
@@ -5140,13 +5140,13 @@ discard block |
||
5140 | 5140 | $num = preg_replace('/([^0-9])/i', '', $num); |
5141 | 5141 | else |
5142 | 5142 | $num = preg_replace('/^.*\-/i', '', $num); |
5143 | - $num = substr("000" . $num, -$level); |
|
5143 | + $num = substr("000".$num, -$level); |
|
5144 | 5144 | if ($level == 1) |
5145 | 5145 | $path = substr($num, 0, 1); |
5146 | 5146 | if ($level == 2) |
5147 | - $path = substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
5147 | + $path = substr($num, 1, 1).'/'.substr($num, 0, 1); |
|
5148 | 5148 | if ($level == 3) |
5149 | - $path = substr($num, 2, 1) . '/' . substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
5149 | + $path = substr($num, 2, 1).'/'.substr($num, 1, 1).'/'.substr($num, 0, 1); |
|
5150 | 5150 | } |
5151 | 5151 | else { |
5152 | 5152 | // TODO |
@@ -5177,7 +5177,7 @@ discard block |
||
5177 | 5177 | { |
5178 | 5178 | // global Globals::$conf; |
5179 | 5179 | |
5180 | - dol_syslog("functions.lib::dol_mkdir: dir=" . $dir, LOG_INFO); |
|
5180 | + dol_syslog("functions.lib::dol_mkdir: dir=".$dir, LOG_INFO); |
|
5181 | 5181 | |
5182 | 5182 | $dir_osencoded = dol_osencode($dir); |
5183 | 5183 | if (@is_dir($dir_osencoded)) |
@@ -5189,15 +5189,15 @@ discard block |
||
5189 | 5189 | $ccdir = ''; |
5190 | 5190 | if (!empty($dataroot)) { |
5191 | 5191 | // Remove data root from loop |
5192 | - $dir = str_replace($dataroot . '/', '', $dir); |
|
5193 | - $ccdir = $dataroot . '/'; |
|
5192 | + $dir = str_replace($dataroot.'/', '', $dir); |
|
5193 | + $ccdir = $dataroot.'/'; |
|
5194 | 5194 | } |
5195 | 5195 | |
5196 | 5196 | $cdir = explode("/", $dir); |
5197 | 5197 | $num = count($cdir); |
5198 | 5198 | for ($i = 0; $i < $num; $i++) { |
5199 | 5199 | if ($i > 0) |
5200 | - $ccdir .= '/' . $cdir[$i]; |
|
5200 | + $ccdir .= '/'.$cdir[$i]; |
|
5201 | 5201 | else |
5202 | 5202 | $ccdir .= $cdir[$i]; |
5203 | 5203 | if (preg_match("/^.:$/", $ccdir, $regs)) |
@@ -5241,20 +5241,20 @@ discard block |
||
5241 | 5241 | if ($ccdir) { |
5242 | 5242 | $ccdir_osencoded = dol_osencode($ccdir); |
5243 | 5243 | if (!@is_dir($ccdir_osencoded)) { |
5244 | - dol_syslog("functions.lib::dol_mkdir: Directory '" . $ccdir . "' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG); |
|
5244 | + dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG); |
|
5245 | 5245 | |
5246 | 5246 | umask(0); |
5247 | 5247 | $dirmaskdec = octdec($newmask); |
5248 | 5248 | if (empty($newmask)) { |
5249 | 5249 | $dirmaskdec = empty(Globals::$conf->global->MAIN_UMASK) ? octdec('0755') : octdec(Globals::$conf->global->MAIN_UMASK); |
5250 | 5250 | } |
5251 | - $dirmaskdec |= octdec('0111'); // Set x bit required for directories |
|
5251 | + $dirmaskdec |= octdec('0111'); // Set x bit required for directories |
|
5252 | 5252 | if (!@mkdir($ccdir_osencoded, $dirmaskdec)) { |
5253 | 5253 | // Si le is_dir a renvoye une fausse info, alors on passe ici. |
5254 | - dol_syslog("functions.lib::dol_mkdir: Fails to create directory '" . $ccdir . "' or directory already exists.", LOG_WARNING); |
|
5254 | + dol_syslog("functions.lib::dol_mkdir: Fails to create directory '".$ccdir."' or directory already exists.", LOG_WARNING); |
|
5255 | 5255 | $nberr++; |
5256 | 5256 | } else { |
5257 | - dol_syslog("functions.lib::dol_mkdir: Directory '" . $ccdir . "' created", LOG_DEBUG); |
|
5257 | + dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' created", LOG_DEBUG); |
|
5258 | 5258 | $nberr = 0; // On remet a zero car si on arrive ici, cela veut dire que les echecs precedents peuvent etre ignore |
5259 | 5259 | $nbcreated++; |
5260 | 5260 | } |
@@ -5302,9 +5302,9 @@ discard block |
||
5302 | 5302 | } else { |
5303 | 5303 | $pattern = "/<[^<>]+>/"; |
5304 | 5304 | // Exemple of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a> |
5305 | - $temp = preg_replace($pattern, "", $temp); // pass 1 |
|
5305 | + $temp = preg_replace($pattern, "", $temp); // pass 1 |
|
5306 | 5306 | // $temp after pass 1: <a href="/myurl" title="A title">0000-021 |
5307 | - $temp = preg_replace($pattern, "", $temp); // pass 2 |
|
5307 | + $temp = preg_replace($pattern, "", $temp); // pass 2 |
|
5308 | 5308 | // $temp after pass 2: 0000-021 |
5309 | 5309 | } |
5310 | 5310 | |
@@ -5360,8 +5360,8 @@ discard block |
||
5360 | 5360 | { |
5361 | 5361 | $temp = $stringtoclean; |
5362 | 5362 | foreach ($disallowed_tags as $tagtoremove) { |
5363 | - $temp = preg_replace('/<\/?' . $tagtoremove . '>/', '', $temp); |
|
5364 | - $temp = preg_replace('/<\/?' . $tagtoremove . '\s+[^>]*>/', '', $temp); |
|
5363 | + $temp = preg_replace('/<\/?'.$tagtoremove.'>/', '', $temp); |
|
5364 | + $temp = preg_replace('/<\/?'.$tagtoremove.'\s+[^>]*>/', '', $temp); |
|
5365 | 5365 | } |
5366 | 5366 | return $temp; |
5367 | 5367 | } |
@@ -5378,12 +5378,12 @@ discard block |
||
5378 | 5378 | { |
5379 | 5379 | if ($nboflines == 1) { |
5380 | 5380 | if (dol_textishtml($text)) { |
5381 | - $firstline = preg_replace('/<br[^>]*>.*$/s', '', $text); // The s pattern modifier means the . can match newline characters |
|
5381 | + $firstline = preg_replace('/<br[^>]*>.*$/s', '', $text); // The s pattern modifier means the . can match newline characters |
|
5382 | 5382 | $firstline = preg_replace('/<div[^>]*>.*$/s', '', $firstline); // The s pattern modifier means the . can match newline characters |
5383 | 5383 | } else { |
5384 | 5384 | $firstline = preg_replace('/[\n\r].*/', '', $text); |
5385 | 5385 | } |
5386 | - return $firstline . ((strlen($firstline) != strlen($text)) ? '...' : ''); |
|
5386 | + return $firstline.((strlen($firstline) != strlen($text)) ? '...' : ''); |
|
5387 | 5387 | } else { |
5388 | 5388 | $ishtml = 0; |
5389 | 5389 | if (dol_textishtml($text)) { |
@@ -5399,7 +5399,7 @@ discard block |
||
5399 | 5399 | $pattern = '/(<br[^>]*>)/Uu'; |
5400 | 5400 | } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support |
5401 | 5401 | else |
5402 | - $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
5402 | + $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
5403 | 5403 | $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
5404 | 5404 | |
5405 | 5405 | $firstline = ''; |
@@ -5413,7 +5413,7 @@ discard block |
||
5413 | 5413 | $i++; |
5414 | 5414 | } |
5415 | 5415 | unset($a); |
5416 | - return $firstline . (($i < $nba) ? '...' : ''); |
|
5416 | + return $firstline.(($i < $nba) ? '...' : ''); |
|
5417 | 5417 | } |
5418 | 5418 | } |
5419 | 5419 | |
@@ -5484,9 +5484,9 @@ discard block |
||
5484 | 5484 | static function dol_htmlentitiesbr_decode($stringtodecode, $pagecodeto = 'UTF-8') |
5485 | 5485 | { |
5486 | 5486 | $ret = dol_html_entity_decode($stringtodecode, ENT_COMPAT, $pagecodeto); |
5487 | - $ret = preg_replace('/' . "\r\n" . '<br(\s[\sa-zA-Z_="]*)?\/?>/i', "<br>", $ret); |
|
5488 | - $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>' . "\r\n" . '/i', "\r\n", $ret); |
|
5489 | - $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>' . "\n" . '/i', "\n", $ret); |
|
5487 | + $ret = preg_replace('/'."\r\n".'<br(\s[\sa-zA-Z_="]*)?\/?>/i', "<br>", $ret); |
|
5488 | + $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>'."\r\n".'/i', "\r\n", $ret); |
|
5489 | + $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>'."\n".'/i', "\n", $ret); |
|
5490 | 5490 | $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', "\n", $ret); |
5491 | 5491 | return $ret; |
5492 | 5492 | } |
@@ -5499,7 +5499,7 @@ discard block |
||
5499 | 5499 | */ |
5500 | 5500 | static function dol_htmlcleanlastbr($stringtodecode) |
5501 | 5501 | { |
5502 | - $ret = preg_replace('/(<br>|<br(\s[\sa-zA-Z_="]*)?\/?>|' . "\n" . '|' . "\r" . ')+$/i', "", $stringtodecode); |
|
5502 | + $ret = preg_replace('/(<br>|<br(\s[\sa-zA-Z_="]*)?\/?>|'."\n".'|'."\r".')+$/i', "", $stringtodecode); |
|
5503 | 5503 | return $ret; |
5504 | 5504 | } |
5505 | 5505 | |
@@ -5596,7 +5596,7 @@ discard block |
||
5596 | 5596 | $pattern = '/(<br[^>]*>)/Uu'; |
5597 | 5597 | } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support |
5598 | 5598 | else |
5599 | - $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
5599 | + $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
5600 | 5600 | $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
5601 | 5601 | |
5602 | 5602 | $nblines = (int) floor((count($a) + 1) / 2); |
@@ -5627,7 +5627,7 @@ discard block |
||
5627 | 5627 | */ |
5628 | 5628 | static function dol_microtime_float() |
5629 | 5629 | { |
5630 | - dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); |
|
5630 | + dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING); |
|
5631 | 5631 | |
5632 | 5632 | return microtime(true); |
5633 | 5633 | } |
@@ -5673,9 +5673,9 @@ discard block |
||
5673 | 5673 | elseif (preg_match('/<h[0-9]>/i', $msg)) |
5674 | 5674 | return true; |
5675 | 5675 | elseif (preg_match('/&[A-Z0-9]{1,6};/i', $msg)) |
5676 | - return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) |
|
5676 | + return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) |
|
5677 | 5677 | elseif (preg_match('/&#[0-9]{2,3};/i', $msg)) |
5678 | - return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) |
|
5678 | + return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) |
|
5679 | 5679 | |
5680 | 5680 | return false; |
5681 | 5681 | } |
@@ -5900,7 +5900,7 @@ discard block |
||
5900 | 5900 | if ($object->fetch_optionals() > 0) { |
5901 | 5901 | if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { |
5902 | 5902 | foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { |
5903 | - $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key]; |
|
5903 | + $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = $object->array_options['options_'.$key]; |
|
5904 | 5904 | } |
5905 | 5905 | } |
5906 | 5906 | } |
@@ -5912,7 +5912,7 @@ discard block |
||
5912 | 5912 | $paymenturl = ''; |
5913 | 5913 | } else { |
5914 | 5914 | // Set the online payment url link into __ONLINE_PAYMENT_URL__ key |
5915 | - require_once DOL_BASE_PATH . '/core/lib/payments.lib.php'; |
|
5915 | + require_once DOL_BASE_PATH.'/core/lib/payments.lib.php'; |
|
5916 | 5916 | $outputlangs->loadLangs(array('paypal', 'other')); |
5917 | 5917 | $typeforonlinepayment = 'free'; |
5918 | 5918 | if (is_object($object) && $object->element == 'commande') |
@@ -5973,7 +5973,7 @@ discard block |
||
5973 | 5973 | |
5974 | 5974 | //var_dump($substitutionarray['__AMOUNT_FORMATED__']); |
5975 | 5975 | if (empty($exclude) || !in_array('date', $exclude)) { |
5976 | - include_once DOL_BASE_PATH . '/core/lib/date.lib.php'; |
|
5976 | + include_once DOL_BASE_PATH.'/core/lib/date.lib.php'; |
|
5977 | 5977 | |
5978 | 5978 | $tmp = dol_getdate(dol_now(), true); |
5979 | 5979 | $tmp2 = dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']); |
@@ -5983,13 +5983,13 @@ discard block |
||
5983 | 5983 | |
5984 | 5984 | $substitutionarray = array_merge($substitutionarray, array( |
5985 | 5985 | '__DAY__' => (string) $tmp['mday'], |
5986 | - '__DAY_TEXT__' => $outputlangs->trans('Day' . $tmp['wday']), // Monday |
|
5987 | - '__DAY_TEXT_SHORT__' => $outputlangs->trans($tmp['weekday'] . 'Min'), // Mon |
|
5988 | - '__DAY_TEXT_MIN__' => $outputlangs->trans('Short' . $tmp['weekday']), // M |
|
5986 | + '__DAY_TEXT__' => $outputlangs->trans('Day'.$tmp['wday']), // Monday |
|
5987 | + '__DAY_TEXT_SHORT__' => $outputlangs->trans($tmp['weekday'].'Min'), // Mon |
|
5988 | + '__DAY_TEXT_MIN__' => $outputlangs->trans('Short'.$tmp['weekday']), // M |
|
5989 | 5989 | '__MONTH__' => (string) $tmp['mon'], |
5990 | - '__MONTH_TEXT__' => $outputlangs->trans('Month' . sprintf("%02d", $tmp['mon'])), |
|
5991 | - '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort' . sprintf("%02d", $tmp['mon'])), |
|
5992 | - '__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort' . sprintf("%02d", $tmp['mon'])), |
|
5990 | + '__MONTH_TEXT__' => $outputlangs->trans('Month'.sprintf("%02d", $tmp['mon'])), |
|
5991 | + '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort'.sprintf("%02d", $tmp['mon'])), |
|
5992 | + '__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort'.sprintf("%02d", $tmp['mon'])), |
|
5993 | 5993 | '__YEAR__' => (string) $tmp['year'], |
5994 | 5994 | '__PREVIOUS_DAY__' => (string) $tmp2['day'], |
5995 | 5995 | '__PREVIOUS_MONTH__' => (string) $tmp3['month'], |
@@ -6048,7 +6048,7 @@ discard block |
||
6048 | 6048 | if (!empty($tmp[1])) |
6049 | 6049 | $outputlangs->load($tmp[1]); |
6050 | 6050 | |
6051 | - $text = preg_replace('/__\(' . preg_quote($reg[1], '/') . '\)__/', $msgishtml ? dol_htmlentitiesbr($outputlangs->transnoentitiesnoconv($reg[1])) : $outputlangs->transnoentitiesnoconv($reg[1]), $text); |
|
6051 | + $text = preg_replace('/__\('.preg_quote($reg[1], '/').'\)__/', $msgishtml ? dol_htmlentitiesbr($outputlangs->transnoentitiesnoconv($reg[1])) : $outputlangs->transnoentitiesnoconv($reg[1]), $text); |
|
6052 | 6052 | } |
6053 | 6053 | } |
6054 | 6054 | |
@@ -6064,13 +6064,13 @@ discard block |
||
6064 | 6064 | $newval = '*****forbidden*****'; |
6065 | 6065 | else |
6066 | 6066 | $newval = empty(Globals::$conf->global->$keyfound) ? '' : Globals::$conf->global->$keyfound; |
6067 | - $text = preg_replace('/__\[' . preg_quote($keyfound, '/') . '\]__/', $msgishtml ? dol_htmlentitiesbr($newval) : $newval, $text); |
|
6067 | + $text = preg_replace('/__\['.preg_quote($keyfound, '/').'\]__/', $msgishtml ? dol_htmlentitiesbr($newval) : $newval, $text); |
|
6068 | 6068 | } |
6069 | 6069 | |
6070 | 6070 | // Make substitition for array $substitutionarray |
6071 | 6071 | foreach ($substitutionarray as $key => $value) { |
6072 | 6072 | if ($key == '__SIGNATURE__' && (!empty(Globals::$conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) |
6073 | - $value = ''; // Protection |
|
6073 | + $value = ''; // Protection |
|
6074 | 6074 | if ($key == '__USER_SIGNATURE__' && (!empty(Globals::$conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) |
6075 | 6075 | $value = ''; // Protection |
6076 | 6076 | |
@@ -6096,7 +6096,7 @@ discard block |
||
6096 | 6096 | { |
6097 | 6097 | // global Globals::$conf, $user; |
6098 | 6098 | |
6099 | - require_once DOL_BASE_PATH . '/core/lib/files.lib.php'; |
|
6099 | + require_once DOL_BASE_PATH.'/core/lib/files.lib.php'; |
|
6100 | 6100 | |
6101 | 6101 | // Add a substitution key for each extrafields, using key __EXTRA_XXX__ |
6102 | 6102 | // TODO Remove this. Already available into the getCommonSubstitutionArray used to build the substitution array. |
@@ -6126,11 +6126,11 @@ discard block |
||
6126 | 6126 | if (preg_match('/functions_(.*)\.lib\.php/i', $substitfile['name'], $reg)) { |
6127 | 6127 | $module = $reg[1]; |
6128 | 6128 | |
6129 | - dol_syslog("Library " . $substitfile['name'] . " found into " . $dir); |
|
6129 | + dol_syslog("Library ".$substitfile['name']." found into ".$dir); |
|
6130 | 6130 | // Include the user's functions file |
6131 | - require_once $dir . $substitfile['name']; |
|
6131 | + require_once $dir.$substitfile['name']; |
|
6132 | 6132 | // Call the user's function, and only if it is defined |
6133 | - $function_name = $module . "_" . $callfunc; |
|
6133 | + $function_name = $module."_".$callfunc; |
|
6134 | 6134 | if (function_exists($function_name)) |
6135 | 6135 | $function_name($substitutionarray, $outputlangs, $object, $parameters); |
6136 | 6136 | } |
@@ -6172,13 +6172,13 @@ discard block |
||
6172 | 6172 | $outputlangs = $langs; |
6173 | 6173 | |
6174 | 6174 | if ($date_start && $date_end) { |
6175 | - $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateFromTo', dol_print_date($date_start, $format, false, $outputlangs), dol_print_date($date_end, $format, false, $outputlangs)) . ($withparenthesis ? ')' : ''); |
|
6175 | + $out .= ($withparenthesis ? ' (' : '').$outputlangs->transnoentitiesnoconv('DateFromTo', dol_print_date($date_start, $format, false, $outputlangs), dol_print_date($date_end, $format, false, $outputlangs)).($withparenthesis ? ')' : ''); |
|
6176 | 6176 | } |
6177 | 6177 | if ($date_start && !$date_end) { |
6178 | - $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateFrom', dol_print_date($date_start, $format, false, $outputlangs)) . ($withparenthesis ? ')' : ''); |
|
6178 | + $out .= ($withparenthesis ? ' (' : '').$outputlangs->transnoentitiesnoconv('DateFrom', dol_print_date($date_start, $format, false, $outputlangs)).($withparenthesis ? ')' : ''); |
|
6179 | 6179 | } |
6180 | 6180 | if (!$date_start && $date_end) { |
6181 | - $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateUntil', dol_print_date($date_end, $format, false, $outputlangs)) . ($withparenthesis ? ')' : ''); |
|
6181 | + $out .= ($withparenthesis ? ' (' : '').$outputlangs->transnoentitiesnoconv('DateUntil', dol_print_date($date_end, $format, false, $outputlangs)).($withparenthesis ? ')' : ''); |
|
6182 | 6182 | } |
6183 | 6183 | |
6184 | 6184 | return $out; |
@@ -6258,7 +6258,7 @@ discard block |
||
6258 | 6258 | dol_syslog("Try to add a message in stack with empty message", LOG_WARNING); |
6259 | 6259 | } else { |
6260 | 6260 | if (!in_array((string) $style, array('mesgs', 'warnings', 'errors'))) |
6261 | - dol_print_error('', 'Bad parameter style=' . $style . ' for setEventMessages'); |
|
6261 | + dol_print_error('', 'Bad parameter style='.$style.' for setEventMessages'); |
|
6262 | 6262 | if (empty($mesgs)) |
6263 | 6263 | setEventMessage($mesg, $style); |
6264 | 6264 | else { |
@@ -6327,7 +6327,7 @@ discard block |
||
6327 | 6327 | |
6328 | 6328 | // If inline message with no format, we add it. |
6329 | 6329 | if ((empty(Globals::$conf->use_javascript_ajax) || !empty(Globals::$conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) || $keepembedded) && !preg_match('/<div class=".*">/i', $out)) { |
6330 | - $divstart = '<div class="' . $style . ' clearboth">'; |
|
6330 | + $divstart = '<div class="'.$style.' clearboth">'; |
|
6331 | 6331 | $divend = '</div>'; |
6332 | 6332 | } |
6333 | 6333 | |
@@ -6354,14 +6354,14 @@ discard block |
||
6354 | 6354 | if (!empty(Globals::$conf->use_javascript_ajax) && empty(Globals::$conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded)) { |
6355 | 6355 | $return = '<script type="text/javascript"> |
6356 | 6356 | $(document).ready(function() { |
6357 | - var block = ' . (!empty(Globals::$conf->global->MAIN_USE_JQUERY_BLOCKUI) ? "true" : "false") . ' |
|
6357 | + var block = ' . (!empty(Globals::$conf->global->MAIN_USE_JQUERY_BLOCKUI) ? "true" : "false").' |
|
6358 | 6358 | if (block) { |
6359 | - $.dolEventValid("","' . dol_escape_js($out) . '"); |
|
6359 | + $.dolEventValid("","' . dol_escape_js($out).'"); |
|
6360 | 6360 | } else { |
6361 | 6361 | /* jnotify(message, preset of message type, keepmessage) */ |
6362 | - $.jnotify("' . dol_escape_js($out) . '", |
|
6363 | - "' . ($style == "ok" ? 3000 : $style) . '", |
|
6364 | - ' . ($style == "ok" ? "false" : "true") . ', |
|
6362 | + $.jnotify("' . dol_escape_js($out).'", |
|
6363 | + "' . ($style == "ok" ? 3000 : $style).'", |
|
6364 | + ' . ($style == "ok" ? "false" : "true").', |
|
6365 | 6365 | { remove: static function (){} } ); |
6366 | 6366 | } |
6367 | 6367 | }); |
@@ -6556,11 +6556,11 @@ discard block |
||
6556 | 6556 | { |
6557 | 6557 | // global Globals::$conf; |
6558 | 6558 | |
6559 | - $tmp = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 |
|
6559 | + $tmp = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0 |
|
6560 | 6560 | if (empty($tmp) && !empty($_SERVER["WINDIR"])) |
6561 | 6561 | $tmp = 'iso-8859-1'; // By default for windows |
6562 | 6562 | if (empty($tmp)) |
6563 | - $tmp = 'utf-8'; // By default for other |
|
6563 | + $tmp = 'utf-8'; // By default for other |
|
6564 | 6564 | if (!empty(Globals::$conf->global->MAIN_FILESYSTEM_ENCODING)) |
6565 | 6565 | $tmp = Globals::$conf->global->MAIN_FILESYSTEM_ENCODING; |
6566 | 6566 | |
@@ -6591,16 +6591,16 @@ discard block |
||
6591 | 6591 | |
6592 | 6592 | // Check in cache |
6593 | 6593 | if (isset($cache_codes[$tablename][$key][$fieldid])) { // Can be defined to 0 or '' |
6594 | - return $cache_codes[$tablename][$key][$fieldid]; // Found in cache |
|
6594 | + return $cache_codes[$tablename][$key][$fieldid]; // Found in cache |
|
6595 | 6595 | } |
6596 | 6596 | |
6597 | 6597 | dol_syslog('dol_getIdFromCode (value not found into cache)', LOG_DEBUG); |
6598 | 6598 | |
6599 | - $sql = "SELECT " . $fieldid . " as valuetoget"; |
|
6600 | - $sql .= " FROM " . MAIN_DB_PREFIX . $tablename; |
|
6601 | - $sql .= " WHERE " . $fieldkey . " = '" . $db->escape($key) . "'"; |
|
6599 | + $sql = "SELECT ".$fieldid." as valuetoget"; |
|
6600 | + $sql .= " FROM ".MAIN_DB_PREFIX.$tablename; |
|
6601 | + $sql .= " WHERE ".$fieldkey." = '".$db->escape($key)."'"; |
|
6602 | 6602 | if (!empty($entityfilter)) |
6603 | - $sql .= " AND entity IN (" . getEntity($tablename) . ")"; |
|
6603 | + $sql .= " AND entity IN (".getEntity($tablename).")"; |
|
6604 | 6604 | |
6605 | 6605 | $resql = $db->query($sql); |
6606 | 6606 | if ($resql) { |
@@ -6631,8 +6631,8 @@ discard block |
||
6631 | 6631 | //print $strRights."<br>\n"; |
6632 | 6632 | $rights = true; |
6633 | 6633 | if ($strRights != '') { |
6634 | - $str = 'if(!(' . $strRights . ')) { $rights = false; }'; |
|
6635 | - self::dol_eval($str); // The dol_eval must contains all the// global $xxx used into a condition |
|
6634 | + $str = 'if(!('.$strRights.')) { $rights = false; }'; |
|
6635 | + self::dol_eval($str); // The dol_eval must contains all the// global $xxx used into a condition |
|
6636 | 6636 | } |
6637 | 6637 | return $rights; |
6638 | 6638 | } |
@@ -6659,9 +6659,9 @@ discard block |
||
6659 | 6659 | //print $s."<br>\n"; |
6660 | 6660 | if ($returnvalue) { |
6661 | 6661 | if ($hideerrors) |
6662 | - return @eval('return ' . $s . ';'); |
|
6662 | + return @eval('return '.$s.';'); |
|
6663 | 6663 | else |
6664 | - return eval('return ' . $s . ';'); |
|
6664 | + return eval('return '.$s.';'); |
|
6665 | 6665 | } |
6666 | 6666 | else { |
6667 | 6667 | if ($hideerrors) |
@@ -6715,7 +6715,7 @@ discard block |
||
6715 | 6715 | $flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1]; |
6716 | 6716 | } |
6717 | 6717 | |
6718 | - return img_picto_common($codelang, 'flags/' . strtolower($flagImage) . '.png', $moreatt); |
|
6718 | + return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt); |
|
6719 | 6719 | } |
6720 | 6720 | |
6721 | 6721 | /** |
@@ -6913,16 +6913,16 @@ discard block |
||
6913 | 6913 | 'zu-ZA', |
6914 | 6914 | ); |
6915 | 6915 | |
6916 | - $buildprimarykeytotest = strtolower($countrycode) . '-' . strtoupper($countrycode); |
|
6916 | + $buildprimarykeytotest = strtolower($countrycode).'-'.strtoupper($countrycode); |
|
6917 | 6917 | if (in_array($buildprimarykeytotest, $locales)) |
6918 | - return strtolower($countrycode) . '_' . strtoupper($countrycode); |
|
6918 | + return strtolower($countrycode).'_'.strtoupper($countrycode); |
|
6919 | 6919 | |
6920 | 6920 | foreach ($locales as $locale) { |
6921 | 6921 | $locale_language = locale_get_primary_language($locale); |
6922 | 6922 | $locale_region = locale_get_region($locale); |
6923 | 6923 | if (strtoupper($countrycode) == $locale_region) { |
6924 | 6924 | //var_dump($locale.'-'.$locale_language.'-'.$locale_region); |
6925 | - return strtolower($locale_language) . '_' . strtoupper($locale_region); |
|
6925 | + return strtolower($locale_language).'_'.strtoupper($locale_region); |
|
6926 | 6926 | } |
6927 | 6927 | } |
6928 | 6928 | |
@@ -6983,7 +6983,7 @@ discard block |
||
6983 | 6983 | $label = $langs->trans($values[2]); |
6984 | 6984 | |
6985 | 6985 | //$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]), 1); |
6986 | - $head[$h][0] = BASE_URI . preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]); |
|
6986 | + $head[$h][0] = BASE_URI.preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]); |
|
6987 | 6987 | $head[$h][1] = $label; |
6988 | 6988 | $head[$h][2] = str_replace('+', '', $values[1]); |
6989 | 6989 | $h++; |
@@ -7054,43 +7054,43 @@ discard block |
||
7054 | 7054 | // global $micro_start_time; |
7055 | 7055 | |
7056 | 7056 | if ($zone == 'private') |
7057 | - print "\n" . '<!-- Common footer for private page -->' . "\n"; |
|
7057 | + print "\n".'<!-- Common footer for private page -->'."\n"; |
|
7058 | 7058 | else |
7059 | - print "\n" . '<!-- Common footer for public page -->' . "\n"; |
|
7059 | + print "\n".'<!-- Common footer for public page -->'."\n"; |
|
7060 | 7060 | |
7061 | 7061 | // A div to store page_y POST parameter so we can read it using javascript |
7062 | 7062 | print "\n<!-- A div to store page_y POST paramater -->\n"; |
7063 | - print '<div id="page_y" style="display: none;">' . $_POST['page_y'] . '</div>' . "\n"; |
|
7063 | + print '<div id="page_y" style="display: none;">'.$_POST['page_y'].'</div>'."\n"; |
|
7064 | 7064 | |
7065 | 7065 | $parameters = array(); |
7066 | - $reshook = $hookmanager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks |
|
7066 | + $reshook = $hookmanager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks |
|
7067 | 7067 | if (empty($reshook)) { |
7068 | 7068 | if (!empty(Globals::$conf->global->MAIN_HTML_FOOTER)) |
7069 | - print Globals::$conf->global->MAIN_HTML_FOOTER . "\n"; |
|
7069 | + print Globals::$conf->global->MAIN_HTML_FOOTER."\n"; |
|
7070 | 7070 | |
7071 | 7071 | print "\n"; |
7072 | 7072 | if (!empty(Globals::$conf->use_javascript_ajax)) { |
7073 | - print '<script type="text/javascript" language="javascript">' . "\n"; |
|
7074 | - print 'jQuery(document).ready(function() {' . "\n"; |
|
7073 | + print '<script type="text/javascript" language="javascript">'."\n"; |
|
7074 | + print 'jQuery(document).ready(function() {'."\n"; |
|
7075 | 7075 | |
7076 | 7076 | if ($zone == 'private' && empty(Globals::$conf->dol_use_jmobile)) { |
7077 | 7077 | print "\n"; |
7078 | - print '/* JS CODE TO ENABLE to manage handler to switch left menu page (menuhider) */' . "\n"; |
|
7078 | + print '/* JS CODE TO ENABLE to manage handler to switch left menu page (menuhider) */'."\n"; |
|
7079 | 7079 | print 'jQuery(".menuhider").click(function() {'; |
7080 | - print ' console.log("We click on .menuhider");' . "\n"; |
|
7080 | + print ' console.log("We click on .menuhider");'."\n"; |
|
7081 | 7081 | //print " $('.side-nav').animate({width:'toggle'},200);\n"; // OK with eldy theme but not with md |
7082 | 7082 | print " $('.side-nav').toggle()\n"; |
7083 | 7083 | print " $('.login_block').toggle()\n"; |
7084 | - print '});' . "\n"; |
|
7084 | + print '});'."\n"; |
|
7085 | 7085 | } |
7086 | 7086 | |
7087 | 7087 | // Management of focus and mandatory for fields |
7088 | 7088 | if ($action == 'create' || $action == 'edit' || (empty($action) && (preg_match('/new\.php/', $_SERVER["PHP_SELF"])))) { |
7089 | - print '/* JS CODE TO ENABLE to manage focus and mandatory form fields */' . "\n"; |
|
7089 | + print '/* JS CODE TO ENABLE to manage focus and mandatory form fields */'."\n"; |
|
7090 | 7090 | $relativepathstring = $_SERVER["PHP_SELF"]; |
7091 | 7091 | // Clean $relativepathstring |
7092 | 7092 | if (constant('DOL_BASE_URI')) |
7093 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
7093 | + $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring); |
|
7094 | 7094 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
7095 | 7095 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
7096 | 7096 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING'])); |
@@ -7113,9 +7113,9 @@ discard block |
||
7113 | 7113 | if ($qualified) { |
7114 | 7114 | foreach ($defval as $paramkey => $paramval) { |
7115 | 7115 | // Set focus on field |
7116 | - print 'jQuery("input[name=\'' . $paramkey . '\']").focus();' . "\n"; |
|
7117 | - print 'jQuery("textarea[name=\'' . $paramkey . '\']").focus();' . "\n"; |
|
7118 | - print 'jQuery("select[name=\'' . $paramkey . '\']").focus();' . "\n"; // Not really usefull, but we keep it in case of. |
|
7116 | + print 'jQuery("input[name=\''.$paramkey.'\']").focus();'."\n"; |
|
7117 | + print 'jQuery("textarea[name=\''.$paramkey.'\']").focus();'."\n"; |
|
7118 | + print 'jQuery("select[name=\''.$paramkey.'\']").focus();'."\n"; // Not really usefull, but we keep it in case of. |
|
7119 | 7119 | } |
7120 | 7120 | } |
7121 | 7121 | } |
@@ -7139,16 +7139,16 @@ discard block |
||
7139 | 7139 | if ($qualified) { |
7140 | 7140 | foreach ($defval as $paramkey => $paramval) { |
7141 | 7141 | // Add property 'required' on input |
7142 | - print 'jQuery("input[name=\'' . $paramkey . '\']").prop(\'required\',true);' . "\n"; |
|
7143 | - print 'jQuery("textarea[name=\'' . $paramkey . '\']").prop(\'required\',true);' . "\n"; |
|
7144 | - print 'jQuery("select[name=\'' . $paramkey . '\']").prop(\'required\',true);' . "\n"; // required on a select works only if key is "", this does not happen in Dolibarr |
|
7142 | + print 'jQuery("input[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n"; |
|
7143 | + print 'jQuery("textarea[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n"; |
|
7144 | + print 'jQuery("select[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n"; // required on a select works only if key is "", this does not happen in Dolibarr |
|
7145 | 7145 | } |
7146 | 7146 | } |
7147 | 7147 | } |
7148 | 7148 | } |
7149 | 7149 | } |
7150 | 7150 | |
7151 | - print '});' . "\n"; |
|
7151 | + print '});'."\n"; |
|
7152 | 7152 | |
7153 | 7153 | // Google Analytics |
7154 | 7154 | // TODO Add a hook here |
@@ -7156,15 +7156,15 @@ discard block |
||
7156 | 7156 | if ((Globals::$conf->dol_use_jmobile != 4)) { |
7157 | 7157 | print "\n"; |
7158 | 7158 | print "/* JS CODE TO ENABLE for google analtics tag */\n"; |
7159 | - print ' var _gaq = _gaq || [];' . "\n"; |
|
7160 | - print ' _gaq.push([\'_setAccount\', \'' . Globals::$conf->global->MAIN_GOOGLE_AN_ID . '\']);' . "\n"; |
|
7161 | - print ' _gaq.push([\'_trackPageview\']);' . "\n"; |
|
7162 | - print '' . "\n"; |
|
7163 | - print ' (function() {' . "\n"; |
|
7164 | - print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;' . "\n"; |
|
7165 | - print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';' . "\n"; |
|
7166 | - print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);' . "\n"; |
|
7167 | - print ' })();' . "\n"; |
|
7159 | + print ' var _gaq = _gaq || [];'."\n"; |
|
7160 | + print ' _gaq.push([\'_setAccount\', \''.Globals::$conf->global->MAIN_GOOGLE_AN_ID.'\']);'."\n"; |
|
7161 | + print ' _gaq.push([\'_trackPageview\']);'."\n"; |
|
7162 | + print ''."\n"; |
|
7163 | + print ' (function() {'."\n"; |
|
7164 | + print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;'."\n"; |
|
7165 | + print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';'."\n"; |
|
7166 | + print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);'."\n"; |
|
7167 | + print ' })();'."\n"; |
|
7168 | 7168 | } |
7169 | 7169 | } |
7170 | 7170 | |
@@ -7174,27 +7174,27 @@ discard block |
||
7174 | 7174 | print "/* JS CODE TO ENABLE to add memory info */\n"; |
7175 | 7175 | print 'window.console && console.log("'; |
7176 | 7176 | if (!empty(Globals::$conf->global->MEMCACHED_SERVER)) |
7177 | - print 'MEMCACHED_SERVER=' . Globals::$conf->global->MEMCACHED_SERVER . ' - '; |
|
7178 | - print 'MAIN_OPTIMIZE_SPEED=' . (isset(Globals::$conf->global->MAIN_OPTIMIZE_SPEED) ? Globals::$conf->global->MAIN_OPTIMIZE_SPEED : 'off'); |
|
7177 | + print 'MEMCACHED_SERVER='.Globals::$conf->global->MEMCACHED_SERVER.' - '; |
|
7178 | + print 'MAIN_OPTIMIZE_SPEED='.(isset(Globals::$conf->global->MAIN_OPTIMIZE_SPEED) ? Globals::$conf->global->MAIN_OPTIMIZE_SPEED : 'off'); |
|
7179 | 7179 | if (!empty($micro_start_time)) { // Works only if MAIN_SHOW_TUNING_INFO is defined at $_SERVER level. Not in// global variable. |
7180 | 7180 | $micro_end_time = microtime(true); |
7181 | - print ' - Build time: ' . ceil(1000 * ($micro_end_time - $micro_start_time)) . ' ms'; |
|
7181 | + print ' - Build time: '.ceil(1000 * ($micro_end_time - $micro_start_time)).' ms'; |
|
7182 | 7182 | } |
7183 | 7183 | if (function_exists("memory_get_usage")) { |
7184 | - print ' - Mem: ' . memory_get_usage(); |
|
7184 | + print ' - Mem: '.memory_get_usage(); |
|
7185 | 7185 | } |
7186 | 7186 | if (function_exists("xdebug_memory_usage")) { |
7187 | - print ' - XDebug time: ' . ceil(1000 * xdebug_time_index()) . ' ms'; |
|
7188 | - print ' - XDebug mem: ' . xdebug_memory_usage(); |
|
7189 | - print ' - XDebug mem peak: ' . xdebug_peak_memory_usage(); |
|
7187 | + print ' - XDebug time: '.ceil(1000 * xdebug_time_index()).' ms'; |
|
7188 | + print ' - XDebug mem: '.xdebug_memory_usage(); |
|
7189 | + print ' - XDebug mem peak: '.xdebug_peak_memory_usage(); |
|
7190 | 7190 | } |
7191 | 7191 | if (function_exists("zend_loader_file_encoded")) { |
7192 | - print ' - Zend encoded file: ' . (zend_loader_file_encoded() ? 'yes' : 'no'); |
|
7192 | + print ' - Zend encoded file: '.(zend_loader_file_encoded() ? 'yes' : 'no'); |
|
7193 | 7193 | } |
7194 | - print '");' . "\n"; |
|
7194 | + print '");'."\n"; |
|
7195 | 7195 | } |
7196 | 7196 | |
7197 | - print "\n" . '</script>' . "\n"; |
|
7197 | + print "\n".'</script>'."\n"; |
|
7198 | 7198 | } |
7199 | 7199 | |
7200 | 7200 | // Add Xdebug coverage of code |
@@ -7208,7 +7208,7 @@ discard block |
||
7208 | 7208 | print "<!-- Start of log output\n"; |
7209 | 7209 | //print '<div class="hidden">'."\n"; |
7210 | 7210 | foreach (Globals::$conf->logbuffer as $logline) { |
7211 | - print $logline . "<br>\n"; |
|
7211 | + print $logline."<br>\n"; |
|
7212 | 7212 | } |
7213 | 7213 | //print '</div>'."\n"; |
7214 | 7214 | print "End of log output -->\n"; |
@@ -7251,8 +7251,8 @@ discard block |
||
7251 | 7251 | */ |
7252 | 7252 | static function dol_set_focus($selector) |
7253 | 7253 | { |
7254 | - print "\n" . '<!-- Set focus onto a specific field -->' . "\n"; |
|
7255 | - print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("' . dol_escape_js($selector) . '").focus(); });</script>' . "\n"; |
|
7254 | + print "\n".'<!-- Set focus onto a specific field -->'."\n"; |
|
7255 | + print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("'.dol_escape_js($selector).'").focus(); });</script>'."\n"; |
|
7256 | 7256 | } |
7257 | 7257 | |
7258 | 7258 | /** |
@@ -7297,7 +7297,7 @@ discard block |
||
7297 | 7297 | $value = preg_replace('/\*/', '%', $value); // Replace * with % |
7298 | 7298 | } |
7299 | 7299 | if ($mode == 1) { |
7300 | - $value = preg_replace('/([<>=]+)\s+([0-9' . preg_quote($langs->trans("DecimalSeparator"), '/') . '\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do |
|
7300 | + $value = preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do |
|
7301 | 7301 | } |
7302 | 7302 | |
7303 | 7303 | $value = preg_replace('/\s*\|\s*/', '|', $value); |
@@ -7326,14 +7326,14 @@ discard block |
||
7326 | 7326 | if ($newcrit != '') { |
7327 | 7327 | $numnewcrit = price2num($newcrit); |
7328 | 7328 | if (is_numeric($numnewcrit)) { |
7329 | - $newres .= ($i2 > 0 ? ' OR ' : '') . $field . ' ' . $operator . ' ' . $numnewcrit; |
|
7329 | + $newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.$numnewcrit; |
|
7330 | 7330 | } else { |
7331 | - $newres .= ($i2 > 0 ? ' OR ' : '') . '1 = 2'; // force false |
|
7331 | + $newres .= ($i2 > 0 ? ' OR ' : '').'1 = 2'; // force false |
|
7332 | 7332 | } |
7333 | 7333 | $i2++; // a criteria was added to string |
7334 | 7334 | } |
7335 | 7335 | } else if ($mode == 2) { |
7336 | - $newres .= ($i2 > 0 ? ' OR ' : '') . $field . " IN (" . $db->escape(trim($crit)) . ")"; |
|
7336 | + $newres .= ($i2 > 0 ? ' OR ' : '').$field." IN (".$db->escape(trim($crit)).")"; |
|
7337 | 7337 | $i2++; // a criteria was added to string |
7338 | 7338 | } else if ($mode == 3) { |
7339 | 7339 | $tmparray = explode(',', trim($crit)); |
@@ -7342,10 +7342,10 @@ discard block |
||
7342 | 7342 | foreach ($tmparray as $val) { |
7343 | 7343 | if ($val) { |
7344 | 7344 | $listofcodes .= ($listofcodes ? ',' : ''); |
7345 | - $listofcodes .= "'" . $db->escape(trim($val)) . "'"; |
|
7345 | + $listofcodes .= "'".$db->escape(trim($val))."'"; |
|
7346 | 7346 | } |
7347 | 7347 | } |
7348 | - $newres .= ($i2 > 0 ? ' OR ' : '') . $field . " IN (" . $listofcodes . ")"; |
|
7348 | + $newres .= ($i2 > 0 ? ' OR ' : '').$field." IN (".$listofcodes.")"; |
|
7349 | 7349 | $i2++; // a criteria was added to string |
7350 | 7350 | } |
7351 | 7351 | } else if ($mode == 4) { |
@@ -7354,10 +7354,10 @@ discard block |
||
7354 | 7354 | $listofcodes = ''; |
7355 | 7355 | foreach ($tmparray as $val) { |
7356 | 7356 | if ($val) { |
7357 | - $newres .= ($i2 > 0 ? ' OR (' : '(') . $field . ' LIKE \'' . $db->escape(trim($val)) . ',%\''; |
|
7358 | - $newres .= ' OR ' . $field . ' = \'' . $db->escape(trim($val)) . '\''; |
|
7359 | - $newres .= ' OR ' . $field . ' LIKE \'%,' . $db->escape(trim($val)) . '\''; |
|
7360 | - $newres .= ' OR ' . $field . ' LIKE \'%,' . $db->escape(trim($val)) . ',%\''; |
|
7357 | + $newres .= ($i2 > 0 ? ' OR (' : '(').$field.' LIKE \''.$db->escape(trim($val)).',%\''; |
|
7358 | + $newres .= ' OR '.$field.' = \''.$db->escape(trim($val)).'\''; |
|
7359 | + $newres .= ' OR '.$field.' LIKE \'%,'.$db->escape(trim($val)).'\''; |
|
7360 | + $newres .= ' OR '.$field.' LIKE \'%,'.$db->escape(trim($val)).',%\''; |
|
7361 | 7361 | $newres .= ')'; |
7362 | 7362 | $i2++; |
7363 | 7363 | } |
@@ -7374,9 +7374,9 @@ discard block |
||
7374 | 7374 | $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : ''); |
7375 | 7375 | |
7376 | 7376 | if (preg_match('/\.(id|rowid)$/', $field)) { // Special case for rowid that is sometimes a ref so used as a search field |
7377 | - $newres .= $field . " = " . (is_numeric(trim($tmpcrit)) ? trim($tmpcrit) : '0'); |
|
7377 | + $newres .= $field." = ".(is_numeric(trim($tmpcrit)) ? trim($tmpcrit) : '0'); |
|
7378 | 7378 | } else { |
7379 | - $newres .= $field . " LIKE '"; |
|
7379 | + $newres .= $field." LIKE '"; |
|
7380 | 7380 | |
7381 | 7381 | $tmpcrit = trim($tmpcrit); |
7382 | 7382 | $tmpcrit2 = $tmpcrit; |
@@ -7395,7 +7395,7 @@ discard block |
||
7395 | 7395 | $newres .= $tmpafter; |
7396 | 7396 | $newres .= "'"; |
7397 | 7397 | if ($tmpcrit2 == '') { |
7398 | - $newres .= ' OR ' . $field . " IS NULL"; |
|
7398 | + $newres .= ' OR '.$field." IS NULL"; |
|
7399 | 7399 | } |
7400 | 7400 | } |
7401 | 7401 | |
@@ -7406,10 +7406,10 @@ discard block |
||
7406 | 7406 | $i++; |
7407 | 7407 | } |
7408 | 7408 | if ($newres) |
7409 | - $res = $res . ($res ? ' AND ' : '') . ($i2 > 1 ? '(' : '') . $newres . ($i2 > 1 ? ')' : ''); |
|
7409 | + $res = $res.($res ? ' AND ' : '').($i2 > 1 ? '(' : '').$newres.($i2 > 1 ? ')' : ''); |
|
7410 | 7410 | $j++; |
7411 | 7411 | } |
7412 | - $res = ($nofirstand ? "" : " AND ") . "(" . $res . ")"; |
|
7412 | + $res = ($nofirstand ? "" : " AND ")."(".$res.")"; |
|
7413 | 7413 | //print 'xx'.$res.'yy'; |
7414 | 7414 | return $res; |
7415 | 7415 | } |
@@ -7428,8 +7428,8 @@ discard block |
||
7428 | 7428 | $url = $object->getLastMainDocLink($object->element); |
7429 | 7429 | |
7430 | 7430 | if ($url) { |
7431 | - $out .= img_picto('', 'object_globe.png') . ' ' . $langs->trans("DirectDownloadLink") . '<br>'; |
|
7432 | - $out .= '<input type="text" id="directdownloadlink" class="quatrevingtpercent" value="' . $url . '">'; |
|
7431 | + $out .= img_picto('', 'object_globe.png').' '.$langs->trans("DirectDownloadLink").'<br>'; |
|
7432 | + $out .= '<input type="text" id="directdownloadlink" class="quatrevingtpercent" value="'.$url.'">'; |
|
7433 | 7433 | $out .= ajax_autoselect("directdownloadlink", 0); |
7434 | 7434 | } |
7435 | 7435 | return $out; |
@@ -7470,7 +7470,7 @@ discard block |
||
7470 | 7470 | if ($extName) |
7471 | 7471 | $subdir = 'thumbs/'; |
7472 | 7472 | |
7473 | - return ($dirName ? $dirName . '/' : '') . $subdir . $fileName . $extName . $extImgTarget; // New filename for thumb |
|
7473 | + return ($dirName ? $dirName.'/' : '').$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb |
|
7474 | 7474 | } |
7475 | 7475 | |
7476 | 7476 | /** |
@@ -7496,14 +7496,14 @@ discard block |
||
7496 | 7496 | |
7497 | 7497 | if ($alldata == 1) { |
7498 | 7498 | if ($num_mime !== false) |
7499 | - return array('target' => '_blank', 'css' => 'documentpreview', 'url' => DOL_BASE_URI . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : ''), 'mime' => dol_mimetype($relativepath),); |
|
7499 | + return array('target' => '_blank', 'css' => 'documentpreview', 'url' => DOL_BASE_URI.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : ''), 'mime' => dol_mimetype($relativepath),); |
|
7500 | 7500 | else |
7501 | 7501 | return array(); |
7502 | 7502 | } |
7503 | 7503 | |
7504 | 7504 | // old behavior |
7505 | 7505 | if ($num_mime !== false) |
7506 | - return 'javascript:document_preview(\'' . dol_escape_js(DOL_BASE_URI . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : '')) . '\', \'' . dol_mimetype($relativepath) . '\', \'' . dol_escape_js($langs->trans('Preview')) . '\')'; |
|
7506 | + return 'javascript:document_preview(\''.dol_escape_js(DOL_BASE_URI.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : '')).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')'; |
|
7507 | 7507 | else |
7508 | 7508 | return ''; |
7509 | 7509 | } |
@@ -7520,11 +7520,11 @@ discard block |
||
7520 | 7520 | // global $langs; |
7521 | 7521 | $out = '<script type="text/javascript"> |
7522 | 7522 | jQuery(document).ready(static function () { |
7523 | - jQuery("#' . $htmlname . '").click(function() { jQuery(this).select(); } ); |
|
7523 | + jQuery("#' . $htmlname.'").click(function() { jQuery(this).select(); } ); |
|
7524 | 7524 | }); |
7525 | 7525 | </script>'; |
7526 | 7526 | if ($addlink) |
7527 | - $out .= ' <a href="' . $addlink . '" target="_blank">' . $langs->trans("Link") . '</a>'; |
|
7527 | + $out .= ' <a href="'.$addlink.'" target="_blank">'.$langs->trans("Link").'</a>'; |
|
7528 | 7528 | return $out; |
7529 | 7529 | } |
7530 | 7530 | |
@@ -7905,9 +7905,9 @@ discard block |
||
7905 | 7905 | |
7906 | 7906 | if (!isset($dictvalues[$tablename])) { |
7907 | 7907 | $dictvalues[$tablename] = array(); |
7908 | - $sql = 'SELECT * FROM ' . $tablename . ' WHERE 1'; |
|
7908 | + $sql = 'SELECT * FROM '.$tablename.' WHERE 1'; |
|
7909 | 7909 | if ($checkentity) |
7910 | - $sql .= ' AND entity IN (0,' . getEntity($tablename) . ')'; |
|
7910 | + $sql .= ' AND entity IN (0,'.getEntity($tablename).')'; |
|
7911 | 7911 | |
7912 | 7912 | $resql = $db->query($sql); |
7913 | 7913 | if ($resql) { |
@@ -7945,14 +7945,14 @@ discard block |
||
7945 | 7945 | $g = $tmp[1]; |
7946 | 7946 | $b = $tmp[2]; |
7947 | 7947 | } else { |
7948 | - $hexr = $stringcolor[0] . $stringcolor[1]; |
|
7949 | - $hexg = $stringcolor[2] . $stringcolor[3]; |
|
7950 | - $hexb = $stringcolor[4] . $stringcolor[5]; |
|
7948 | + $hexr = $stringcolor[0].$stringcolor[1]; |
|
7949 | + $hexg = $stringcolor[2].$stringcolor[3]; |
|
7950 | + $hexb = $stringcolor[4].$stringcolor[5]; |
|
7951 | 7951 | $r = hexdec($hexr); |
7952 | 7952 | $g = hexdec($hexg); |
7953 | 7953 | $b = hexdec($hexb); |
7954 | 7954 | } |
7955 | - $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm |
|
7955 | + $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm |
|
7956 | 7956 | if ($bright > 0.6) |
7957 | 7957 | $res = 1; |
7958 | 7958 | } |
@@ -7987,11 +7987,11 @@ discard block |
||
7987 | 7987 | return 0; // Entry is for menus all excluded to external users |
7988 | 7988 | } |
7989 | 7989 | if (!$menuentry['perms'] && $type_user) |
7990 | - return 0; // No permissions and user is external |
|
7990 | + return 0; // No permissions and user is external |
|
7991 | 7991 | if (!$menuentry['perms'] && !empty(Globals::$conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) |
7992 | 7992 | return 0; // No permissions and option to hide when not allowed, even for internal user, is on |
7993 | 7993 | if (!$menuentry['perms']) |
7994 | - return 2; // No permissions and user is external |
|
7994 | + return 2; // No permissions and user is external |
|
7995 | 7995 | return 1; |
7996 | 7996 | } |
7997 | 7997 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | if (!defined('DOL_VERSION')) { |
56 | - define('DOL_VERSION', '10.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c |
|
56 | + define('DOL_VERSION', '10.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | if (!defined('EURO')) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | { |
71 | 71 | self::$conf = new Conf(); |
72 | 72 | |
73 | - include DOL_BASE_PATH . '/conf/conf.php'; |
|
73 | + include DOL_BASE_PATH.'/conf/conf.php'; |
|
74 | 74 | |
75 | 75 | // Set properties specific to database |
76 | 76 | Globals::$conf->db->host = $dolibarr_main_db_host; |
@@ -98,17 +98,17 @@ discard block |
||
98 | 98 | Globals::$conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb ?? 0; |
99 | 99 | Globals::$conf->file->mailing_limit_sendbycli = $dolibarr_mailing_limit_sendbycli ?? 0; |
100 | 100 | Globals::$conf->file->main_authentication = empty($dolibarr_main_authentication) ? '' : $dolibarr_main_authentication; // Identification mode |
101 | - Globals::$conf->file->main_force_https = empty($dolibarr_main_force_https) ? '' : $dolibarr_main_force_https; // Force https |
|
102 | - Globals::$conf->file->strict_mode = empty($dolibarr_strict_mode) ? '' : $dolibarr_strict_mode; // Force php strict mode (for debug) |
|
101 | + Globals::$conf->file->main_force_https = empty($dolibarr_main_force_https) ? '' : $dolibarr_main_force_https; // Force https |
|
102 | + Globals::$conf->file->strict_mode = empty($dolibarr_strict_mode) ? '' : $dolibarr_strict_mode; // Force php strict mode (for debug) |
|
103 | 103 | Globals::$conf->file->cookie_cryptkey = empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey; // Cookie cryptkey |
104 | - Globals::$conf->file->dol_document_root = array('main' => (string) DOL_DOCUMENT_ROOT); // Define array of document root directories ('/home/htdocs') |
|
105 | - Globals::$conf->file->dol_url_root = array('main' => (string) DOL_BASE_URI); // Define array of url root path ('' or '/dolibarr') |
|
104 | + Globals::$conf->file->dol_document_root = array('main' => (string) DOL_DOCUMENT_ROOT); // Define array of document root directories ('/home/htdocs') |
|
105 | + Globals::$conf->file->dol_url_root = array('main' => (string) DOL_BASE_URI); // Define array of url root path ('' or '/dolibarr') |
|
106 | 106 | if (!empty($dolibarr_main_document_root_alt)) { |
107 | 107 | // dolibarr_main_document_root_alt can contains several directories |
108 | 108 | $values = preg_split('/[;,]/', $dolibarr_main_document_root_alt); |
109 | 109 | $i = 0; |
110 | 110 | foreach ($values as $value) { |
111 | - Globals::$conf->file->dol_document_root['alt' . ($i++)] = (string) $value; |
|
111 | + Globals::$conf->file->dol_document_root['alt'.($i++)] = (string) $value; |
|
112 | 112 | } |
113 | 113 | $values = preg_split('/[;,]/', $dolibarr_main_url_root_alt); |
114 | 114 | $i = 0; |
@@ -116,11 +116,11 @@ discard block |
||
116 | 116 | if (preg_match('/^http(s)?:/', $value)) { |
117 | 117 | // Show error message |
118 | 118 | $correct_value = str_replace($dolibarr_main_url_root, '', $value); |
119 | - print '<b>Error:</b><br>' . "\n"; |
|
120 | - print 'Wrong <b>$dolibarr_main_url_root_alt</b> value in <b>conf.php</b> file.<br>' . "\n"; |
|
121 | - print 'We now use a relative path to $dolibarr_main_url_root to build alternate URLs.<br>' . "\n"; |
|
122 | - print 'Value found: ' . $value . '<br>' . "\n"; |
|
123 | - print 'Should be replaced by: ' . $correct_value . '<br>' . "\n"; |
|
119 | + print '<b>Error:</b><br>'."\n"; |
|
120 | + print 'Wrong <b>$dolibarr_main_url_root_alt</b> value in <b>conf.php</b> file.<br>'."\n"; |
|
121 | + print 'We now use a relative path to $dolibarr_main_url_root to build alternate URLs.<br>'."\n"; |
|
122 | + print 'Value found: '.$value.'<br>'."\n"; |
|
123 | + print 'Should be replaced by: '.$correct_value.'<br>'."\n"; |
|
124 | 124 | print "Or something like following examples:<br>\n"; |
125 | 125 | print "\"/extensions\"<br>\n"; |
126 | 126 | print "\"/extensions1,/extensions2,...\"<br>\n"; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | print "\"/custom\"<br>\n"; |
129 | 129 | exit; |
130 | 130 | } |
131 | - Globals::$conf->file->dol_url_root['alt' . ($i++)] = (string) $value; |
|
131 | + Globals::$conf->file->dol_url_root['alt'.($i++)] = (string) $value; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | if (isset(self::$configFilename)) { |
163 | 163 | return self::$configFilename; |
164 | 164 | } |
165 | - $filename = CONFIGURATION_PATH . '/config.yaml'; |
|
165 | + $filename = CONFIGURATION_PATH.'/config.yaml'; |
|
166 | 166 | if (file_exists($filename) || is_dir(CONFIGURATION_PATH) || mkdir(CONFIGURATION_PATH, 0777, true)) { |
167 | 167 | self::$configFilename = $filename; |
168 | 168 | } |
@@ -227,8 +227,8 @@ discard block |
||
227 | 227 | { |
228 | 228 | self::$global = self::loadConfigurationFile(); |
229 | 229 | if (isset(self::$global['skin'])) { |
230 | - $templatesFolder = BASE_PATH . Skin::SKINS_FOLDER; |
|
231 | - $skinFolder = $templatesFolder . '/' . self::$global['skin']; |
|
230 | + $templatesFolder = BASE_PATH.Skin::SKINS_FOLDER; |
|
231 | + $skinFolder = $templatesFolder.'/'.self::$global['skin']; |
|
232 | 232 | if (is_dir($templatesFolder) && !is_dir($skinFolder)) { |
233 | 233 | Config::setError("Skin folder '$skinFolder' does not exists!"); |
234 | 234 | //(new EditConfig())->run(); |
@@ -325,13 +325,13 @@ discard block |
||
325 | 325 | { |
326 | 326 | if (self::$dbEngine == null) { |
327 | 327 | $dbEngineName = self::$global['dbEngineName'] ?? 'PdoMySql'; |
328 | - $helperName = 'Sql' . substr($dbEngineName, 3); |
|
328 | + $helperName = 'Sql'.substr($dbEngineName, 3); |
|
329 | 329 | |
330 | 330 | Debug::addMessage('SQL', "Using '$dbEngineName' engine."); |
331 | 331 | Debug::addMessage('SQL', "Using '$helperName' SQL helper engine."); |
332 | 332 | |
333 | - $sqlEngine = '\\Alxarafe\\Database\\SqlHelpers\\' . $helperName; |
|
334 | - $engine = '\\Alxarafe\\Database\\Engines\\' . $dbEngineName; |
|
333 | + $sqlEngine = '\\Alxarafe\\Database\\SqlHelpers\\'.$helperName; |
|
334 | + $engine = '\\Alxarafe\\Database\\Engines\\'.$dbEngineName; |
|
335 | 335 | try { |
336 | 336 | Config::$sqlHelper = new $sqlEngine(); |
337 | 337 | Config::$dbEngine = new $engine([ |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | { |
41 | 41 | $t = '?'; |
42 | 42 | if ($mode == 'user') |
43 | - $t = getenv('APACHE_RUN_USER'); // $_ENV['APACHE_RUN_USER'] is empty |
|
43 | + $t = getenv('APACHE_RUN_USER'); // $_ENV['APACHE_RUN_USER'] is empty |
|
44 | 44 | if ($mode == 'group') |
45 | 45 | $t = getenv('APACHE_RUN_GROUP'); |
46 | 46 | return $t; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $entitytotest = 1; |
65 | 65 | } |
66 | 66 | |
67 | - DolUtils::dol_syslog("checkLoginPassEntity usertotest=" . $usertotest . " entitytotest=" . $entitytotest . " authmode=" . join(',', $authmode)); |
|
67 | + DolUtils::dol_syslog("checkLoginPassEntity usertotest=".$usertotest." entitytotest=".$entitytotest." authmode=".join(',', $authmode)); |
|
68 | 68 | $login = ''; |
69 | 69 | |
70 | 70 | // Validation of login/pass/entity with standard modules |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | if ($test && $mode && !$login) { |
75 | 75 | // Validation of login/pass/entity for mode $mode |
76 | 76 | $mode = trim($mode); |
77 | - $authfile = 'functions_' . $mode . '.php'; |
|
77 | + $authfile = 'functions_'.$mode.'.php'; |
|
78 | 78 | $fullauthfile = ''; |
79 | 79 | |
80 | 80 | /* |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $dirlogin = array_merge(array("/Helpers/login"), (array) Globals::$conf->modules_parts['login']); |
94 | 94 | foreach ($dirlogin as $reldir) { |
95 | 95 | // Check if file found (do not use dol_is_file to avoid loading files.lib.php) |
96 | - $tmpnewauthfile = BASE_PATH . $reldir . '/' . $authfile; |
|
96 | + $tmpnewauthfile = BASE_PATH.$reldir.'/'.$authfile; |
|
97 | 97 | if (is_file($tmpnewauthfile)) { |
98 | 98 | $fullauthfile = $tmpnewauthfile; |
99 | 99 | } |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | } |
106 | 106 | if ($fullauthfile && $result) { |
107 | 107 | // Call function to check user/password |
108 | - $function = 'check_user_password_' . $mode; |
|
108 | + $function = 'check_user_password_'.$mode; |
|
109 | 109 | $login = \call_user_func($function, $usertotest, $passwordtotest, $entitytotest); |
110 | 110 | if ($login) { // Login is successfull |
111 | - $test = false; // To stop once at first login success |
|
111 | + $test = false; // To stop once at first login success |
|
112 | 112 | Globals::$conf->authmode = $mode; // This properties is defined only when logged to say what mode was successfully used |
113 | 113 | $dol_tz = DolUtils::GETPOST('tz'); |
114 | 114 | $dol_dst = DolUtils::GETPOST('dst'); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $dol_screenheight = DolUtils::GETPOST('screenheight'); |
117 | 117 | } |
118 | 118 | } else { |
119 | - DolUtils::dol_syslog("Authentification ko - failed to load file '" . $authfile . "'", LOG_ERR); |
|
119 | + DolUtils::dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR); |
|
120 | 120 | sleep(1); |
121 | 121 | // Load translation files required by the page |
122 | 122 | Globals::$langs->loadLangs(array('other', 'main', 'errors')); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | // Title |
158 | 158 | $appli = constant('DOL_APPLICATION_TITLE'); |
159 | - $title = $appli . ' ' . constant('DOL_VERSION'); |
|
159 | + $title = $appli.' '.constant('DOL_VERSION'); |
|
160 | 160 | if (!empty(Globals::$conf->global->MAIN_APPLICATION_TITLE)) { |
161 | 161 | $title = Globals::$conf->global->MAIN_APPLICATION_TITLE; |
162 | 162 | } |
@@ -183,19 +183,19 @@ discard block |
||
183 | 183 | if (!empty(Globals::$conf->modules_parts['tpl'])) { // Using this feature slow down application |
184 | 184 | $dirtpls = array_merge(Globals::$conf->modules_parts['tpl'], array('/core/tpl/')); |
185 | 185 | foreach ($dirtpls as $reldir) { |
186 | - $tmp = DolUtils::dol_buildpath($reldir . 'login.tpl.php'); |
|
186 | + $tmp = DolUtils::dol_buildpath($reldir.'login.tpl.php'); |
|
187 | 187 | if (file_exists($tmp)) { |
188 | 188 | $template_dir = preg_replace('/login\.tpl\.php$/', '', $tmp); |
189 | 189 | break; |
190 | 190 | } |
191 | 191 | } |
192 | 192 | } else { |
193 | - $template_dir = DOL_DOCUMENT_ROOT . "/core/tpl/"; |
|
193 | + $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/"; |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | // Set cookie for timeout management |
197 | 197 | $prefix = DolUtils::dol_getprefix(''); |
198 | - $sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix; |
|
198 | + $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; |
|
199 | 199 | if (!empty(Globals::$conf->global->MAIN_SESSION_TIMEOUT)) { |
200 | 200 | setcookie($sessiontimeout, Globals::$conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true); |
201 | 201 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | |
223 | 223 | // Execute hook getLoginPageOptions (for table) |
224 | 224 | $parameters = array('entity' => DolUtils::GETPOST('entity', 'int')); |
225 | - $reshook = Globals::$hookManager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks. |
|
225 | + $reshook = Globals::$hookManager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks. |
|
226 | 226 | if (is_array(Globals::$hookManager->resArray) && !empty(Globals::$hookManager->resArray)) { |
227 | 227 | $morelogincontent = Globals::$hookManager->resArray; // (deprecated) For compatibility |
228 | 228 | } else { |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | |
232 | 232 | // Execute hook getLoginPageExtraOptions (eg for js) |
233 | 233 | $parameters = array('entity' => DolUtils::GETPOST('entity', 'int')); |
234 | - $reshook = Globals::$hookManager->executeHooks('getLoginPageExtraOptions', $parameters); // Note that $action and $object may have been modified by some hooks. |
|
234 | + $reshook = Globals::$hookManager->executeHooks('getLoginPageExtraOptions', $parameters); // Note that $action and $object may have been modified by some hooks. |
|
235 | 235 | $moreloginextracontent = Globals::$hookManager->resPrint; |
236 | 236 | |
237 | 237 | // Login |
@@ -240,17 +240,17 @@ discard block |
||
240 | 240 | |
241 | 241 | // Show logo (search in order: small company logo, large company logo, theme logo, common logo) |
242 | 242 | $width = 0; |
243 | - $urllogo = DOL_BASE_URI . '/theme/login_logo.png'; |
|
243 | + $urllogo = DOL_BASE_URI.'/theme/login_logo.png'; |
|
244 | 244 | |
245 | - if (!empty($mysoc->logo_small) && is_readable(Globals::$conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) { |
|
246 | - $urllogo = DOL_BASE_URI . '/viewimage.php?cache=1&modulepart=mycompany&file=' . urlencode('logos/thumbs/' . $mysoc->logo_small); |
|
247 | - } elseif (!empty($mysoc->logo) && is_readable(Globals::$conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) { |
|
248 | - $urllogo = DOL_BASE_URI . '/viewimage.php?cache=1&modulepart=mycompany&file=' . urlencode('logos/' . $mysoc->logo); |
|
245 | + if (!empty($mysoc->logo_small) && is_readable(Globals::$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { |
|
246 | + $urllogo = DOL_BASE_URI.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); |
|
247 | + } elseif (!empty($mysoc->logo) && is_readable(Globals::$conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { |
|
248 | + $urllogo = DOL_BASE_URI.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); |
|
249 | 249 | $width = 128; |
250 | - } elseif (is_readable(DOL_BASE_URI . '/theme/' . Globals::$conf->theme . '/img/dolibarr_logo.png')) { |
|
251 | - $urllogo = DOL_BASE_URI . '/theme/' . Globals::$conf->theme . '/img/dolibarr_logo.png'; |
|
252 | - } elseif (is_readable(DOL_BASE_URI . '/theme/dolibarr_logo.png')) { |
|
253 | - $urllogo = DOL_BASE_URI . '/theme/dolibarr_logo.png'; |
|
250 | + } elseif (is_readable(DOL_BASE_URI.'/theme/'.Globals::$conf->theme.'/img/dolibarr_logo.png')) { |
|
251 | + $urllogo = DOL_BASE_URI.'/theme/'.Globals::$conf->theme.'/img/dolibarr_logo.png'; |
|
252 | + } elseif (is_readable(DOL_BASE_URI.'/theme/dolibarr_logo.png')) { |
|
253 | + $urllogo = DOL_BASE_URI.'/theme/dolibarr_logo.png'; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | // Security graphical code |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | // Set jquery theme |
291 | 291 | $dol_loginmesg = (!empty($_SESSION["dol_loginmesg"]) ? $_SESSION["dol_loginmesg"] : ''); |
292 | - $favicon = DolUtils::dol_buildpath('/theme/' . Globals::$conf->theme . '/img/favicon.ico', 1); |
|
292 | + $favicon = DolUtils::dol_buildpath('/theme/'.Globals::$conf->theme.'/img/favicon.ico', 1); |
|
293 | 293 | if (!empty(Globals::$conf->global->MAIN_FAVICON_URL)) { |
294 | 294 | $favicon = Globals::$conf->global->MAIN_FAVICON_URL; |
295 | 295 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | function makesalt($type = CRYPT_SALT_LENGTH) |
324 | 324 | { |
325 | - DolUtils::dol_syslog("makesalt type=" . $type); |
|
325 | + DolUtils::dol_syslog("makesalt type=".$type); |
|
326 | 326 | switch ($type) { |
327 | 327 | case 12: // 8 + 4 |
328 | 328 | $saltlen = 8; |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | while (dol_strlen($salt) < $saltlen) |
346 | 346 | $salt .= chr(mt_rand(64, 126)); |
347 | 347 | |
348 | - $result = $saltprefix . $salt . $saltsuffix; |
|
349 | - DolUtils::dol_syslog("makesalt return=" . $result); |
|
348 | + $result = $saltprefix.$salt.$saltsuffix; |
|
349 | + DolUtils::dol_syslog("makesalt return=".$result); |
|
350 | 350 | return $result; |
351 | 351 | } |
352 | 352 | |
@@ -358,12 +358,12 @@ discard block |
||
358 | 358 | */ |
359 | 359 | function encodedecode_dbpassconf($level = 0) |
360 | 360 | { |
361 | - DolUtils::dol_syslog("encodedecode_dbpassconf level=" . $level, LOG_DEBUG); |
|
361 | + DolUtils::dol_syslog("encodedecode_dbpassconf level=".$level, LOG_DEBUG); |
|
362 | 362 | Globals::$config = ''; |
363 | 363 | $passwd = ''; |
364 | 364 | $passwd_crypted = ''; |
365 | 365 | |
366 | - if ($fp = fopen(DOL_DOCUMENT_ROOT . '/conf/conf.php', 'r')) { |
|
366 | + if ($fp = fopen(DOL_DOCUMENT_ROOT.'/conf/conf.php', 'r')) { |
|
367 | 367 | while (!feof($fp)) { |
368 | 368 | $buffer = fgets($fp, 4096); |
369 | 369 | |
@@ -400,10 +400,10 @@ discard block |
||
400 | 400 | if ($lineofpass) { |
401 | 401 | // Add value at end of file |
402 | 402 | if ($level == 0) { |
403 | - Globals::$config .= '$dolibarr_main_db_pass=\'' . $passwd . '\';' . "\n"; |
|
403 | + Globals::$config .= '$dolibarr_main_db_pass=\''.$passwd.'\';'."\n"; |
|
404 | 404 | } |
405 | 405 | if ($level == 1) { |
406 | - Globals::$config .= '$dolibarr_main_db_pass=\'crypted:' . $passwd_crypted . '\';' . "\n"; |
|
406 | + Globals::$config .= '$dolibarr_main_db_pass=\'crypted:'.$passwd_crypted.'\';'."\n"; |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | //print 'passwd = '.$passwd.' - passwd_crypted = '.$passwd_crypted; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | fclose($fp); |
416 | 416 | |
417 | 417 | // Write new conf file |
418 | - $file = DOL_DOCUMENT_ROOT . '/conf/conf.php'; |
|
418 | + $file = DOL_DOCUMENT_ROOT.'/conf/conf.php'; |
|
419 | 419 | if ($fp = @fopen($file, 'w')) { |
420 | 420 | fputs($fp, Globals::$config); |
421 | 421 | fflush($fp); |
@@ -491,10 +491,10 @@ discard block |
||
491 | 491 | $generated_password = str_shuffle($randomCode); |
492 | 492 | } |
493 | 493 | } else if (!empty(Globals::$conf->global->USER_PASSWORD_GENERATED)) { |
494 | - $nomclass = "modGeneratePass" . ucfirst(Globals::$conf->global->USER_PASSWORD_GENERATED); |
|
495 | - $nomfichier = $nomclass . ".class.php"; |
|
494 | + $nomclass = "modGeneratePass".ucfirst(Globals::$conf->global->USER_PASSWORD_GENERATED); |
|
495 | + $nomfichier = $nomclass.".class.php"; |
|
496 | 496 | //print DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomclass; |
497 | - require_once DOL_DOCUMENT_ROOT . "/core/modules/security/generate/" . $nomfichier; |
|
497 | + require_once DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomfichier; |
|
498 | 498 | $genhandler = new $nomclass($db, Globals::$conf, Globals::$langs, $user); |
499 | 499 | $generated_password = $genhandler->getNewGeneratedPassword(); |
500 | 500 | unset($genhandler); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | } |
111 | 111 | // Salt value |
112 | 112 | if (!empty(Globals::$conf->global->MAIN_SECURITY_SALT)) { |
113 | - $chain = Globals::$conf->global->MAIN_SECURITY_SALT . $chain; |
|
113 | + $chain = Globals::$conf->global->MAIN_SECURITY_SALT.$chain; |
|
114 | 114 | } |
115 | 115 | if ($type == '1' || $type == 'sha1') { |
116 | 116 | return sha1($chain); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | return md5($chain); |
123 | 123 | } |
124 | 124 | if ($type == '4' || $type == 'md5openldap') { |
125 | - return '{md5}' . base64_encode(mhash(MHASH_MD5, $chain)); // For OpenLdap with md5 (based on an unencrypted password in base) |
|
125 | + return '{md5}'.base64_encode(mhash(MHASH_MD5, $chain)); // For OpenLdap with md5 (based on an unencrypted password in base) |
|
126 | 126 | } |
127 | 127 | if ($type == '5') { |
128 | 128 | return hash('sha256', $chain); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | return false; |
203 | 203 | |
204 | 204 | if ($dbt_select != 'rowid' && $dbt_select != 'id') |
205 | - $objectid = "'" . $objectid . "'"; |
|
205 | + $objectid = "'".$objectid."'"; |
|
206 | 206 | |
207 | 207 | // Features/modules to check |
208 | 208 | $featuresarray = array($features); |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | else if ($feature == 'ftp') { |
403 | 403 | if (!$user->rights->ftp->write) |
404 | 404 | $deleteok = 0; |
405 | - }else if ($feature == 'salaries') { |
|
405 | + } else if ($feature == 'salaries') { |
|
406 | 406 | if (!$user->rights->salaries->delete) |
407 | 407 | $deleteok = 0; |
408 | 408 | } |
@@ -480,8 +480,8 @@ discard block |
||
480 | 480 | $feature = 'projet_task'; |
481 | 481 | |
482 | 482 | $check = array('adherent', 'banque', 'don', 'user', 'usergroup', 'product', 'produit', 'service', 'produit|service', 'categorie', 'resource'); // Test on entity only (Objects with no link to company) |
483 | - $checksoc = array('societe'); // Test for societe object |
|
484 | - $checkother = array('contact', 'agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...). |
|
483 | + $checksoc = array('societe'); // Test for societe object |
|
484 | + $checkother = array('contact', 'agenda'); // Test on entity and link to third party. Allowed if link is empty (Ex: contacts...). |
|
485 | 485 | $checkproject = array('projet', 'project'); // Test for project object |
486 | 486 | $checktask = array('projet_task'); |
487 | 487 | $nocheck = array('barcode', 'stock'); // No test |
@@ -489,32 +489,32 @@ discard block |
||
489 | 489 | // If dbtablename not defined, we use same name for table than module name |
490 | 490 | if (empty($dbtablename)) { |
491 | 491 | $dbtablename = $feature; |
492 | - $sharedelement = (!empty($params[1]) ? $params[1] : $dbtablename); // We change dbtablename, so we set sharedelement too. |
|
492 | + $sharedelement = (!empty($params[1]) ? $params[1] : $dbtablename); // We change dbtablename, so we set sharedelement too. |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | // Check permission for object with entity |
496 | 496 | if (in_array($feature, $check)) { |
497 | - $sql = "SELECT COUNT(dbt." . $dbt_select . ") as nb"; |
|
498 | - $sql .= " FROM " . MAIN_DB_PREFIX . $dbtablename . " as dbt"; |
|
497 | + $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; |
|
498 | + $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; |
|
499 | 499 | if (($feature == 'user' || $feature == 'usergroup') && !empty($conf->multicompany->enabled)) { |
500 | 500 | if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
501 | 501 | if ($conf->entity == 1 && $user->admin && !$user->entity) { |
502 | - $sql .= " WHERE dbt." . $dbt_select . " IN (" . $objectid . ")"; |
|
502 | + $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; |
|
503 | 503 | $sql .= " AND dbt.entity IS NOT NULL"; |
504 | 504 | } else { |
505 | - $sql .= "," . MAIN_DB_PREFIX . "usergroup_user as ug"; |
|
506 | - $sql .= " WHERE dbt." . $dbt_select . " IN (" . $objectid . ")"; |
|
505 | + $sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug"; |
|
506 | + $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; |
|
507 | 507 | $sql .= " AND (ug.fk_user = dbt.rowid"; |
508 | - $sql .= " AND ug.entity IN (" . getEntity('user') . "))"; |
|
508 | + $sql .= " AND ug.entity IN (".getEntity('user')."))"; |
|
509 | 509 | $sql .= " OR dbt.entity = 0"; // Show always superadmin |
510 | 510 | } |
511 | 511 | } else { |
512 | - $sql .= " WHERE dbt." . $dbt_select . " IN (" . $objectid . ")"; |
|
513 | - $sql .= " AND dbt.entity IN (" . getEntity($sharedelement, 1) . ")"; |
|
512 | + $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; |
|
513 | + $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; |
|
514 | 514 | } |
515 | 515 | } else { |
516 | - $sql .= " WHERE dbt." . $dbt_select . " IN (" . $objectid . ")"; |
|
517 | - $sql .= " AND dbt.entity IN (" . getEntity($sharedelement, 1) . ")"; |
|
516 | + $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; |
|
517 | + $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; |
|
518 | 518 | } |
519 | 519 | } else if (in_array($feature, $checksoc)) { // We check feature = checksoc |
520 | 520 | // If external user: Check permission for external users |
@@ -525,47 +525,47 @@ discard block |
||
525 | 525 | // If internal user: Check permission for internal users that are restricted on their objects |
526 | 526 | else if (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir)) { |
527 | 527 | $sql = "SELECT COUNT(sc.fk_soc) as nb"; |
528 | - $sql .= " FROM (" . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
529 | - $sql .= ", " . MAIN_DB_PREFIX . "societe as s)"; |
|
530 | - $sql .= " WHERE sc.fk_soc IN (" . $objectid . ")"; |
|
531 | - $sql .= " AND sc.fk_user = " . $user->id; |
|
528 | + $sql .= " FROM (".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
529 | + $sql .= ", ".MAIN_DB_PREFIX."societe as s)"; |
|
530 | + $sql .= " WHERE sc.fk_soc IN (".$objectid.")"; |
|
531 | + $sql .= " AND sc.fk_user = ".$user->id; |
|
532 | 532 | $sql .= " AND sc.fk_soc = s.rowid"; |
533 | - $sql .= " AND s.entity IN (" . getEntity($sharedelement, 1) . ")"; |
|
533 | + $sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")"; |
|
534 | 534 | } |
535 | 535 | // If multicompany and internal users with all permissions, check user is in correct entity |
536 | 536 | else if (!empty($conf->multicompany->enabled)) { |
537 | 537 | $sql = "SELECT COUNT(s.rowid) as nb"; |
538 | - $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; |
|
539 | - $sql .= " WHERE s.rowid IN (" . $objectid . ")"; |
|
540 | - $sql .= " AND s.entity IN (" . getEntity($sharedelement, 1) . ")"; |
|
538 | + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; |
|
539 | + $sql .= " WHERE s.rowid IN (".$objectid.")"; |
|
540 | + $sql .= " AND s.entity IN (".getEntity($sharedelement, 1).")"; |
|
541 | 541 | } |
542 | 542 | } else if (in_array($feature, $checkother)) { // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...). |
543 | 543 | // If external user: Check permission for external users |
544 | 544 | if ($user->socid > 0) { |
545 | - $sql = "SELECT COUNT(dbt." . $dbt_select . ") as nb"; |
|
546 | - $sql .= " FROM " . MAIN_DB_PREFIX . $dbtablename . " as dbt"; |
|
547 | - $sql .= " WHERE dbt." . $dbt_select . " IN (" . $objectid . ")"; |
|
548 | - $sql .= " AND dbt.fk_soc = " . $user->socid; |
|
545 | + $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; |
|
546 | + $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; |
|
547 | + $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; |
|
548 | + $sql .= " AND dbt.fk_soc = ".$user->socid; |
|
549 | 549 | } |
550 | 550 | // If internal user: Check permission for internal users that are restricted on their objects |
551 | 551 | else if (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir)) { |
552 | - $sql = "SELECT COUNT(dbt." . $dbt_select . ") as nb"; |
|
553 | - $sql .= " FROM " . MAIN_DB_PREFIX . $dbtablename . " as dbt"; |
|
554 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_commerciaux as sc ON dbt.fk_soc = sc.fk_soc AND sc.fk_user = '" . $user->id . "'"; |
|
555 | - $sql .= " WHERE dbt." . $dbt_select . " IN (" . $objectid . ")"; |
|
552 | + $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; |
|
553 | + $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; |
|
554 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON dbt.fk_soc = sc.fk_soc AND sc.fk_user = '".$user->id."'"; |
|
555 | + $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; |
|
556 | 556 | $sql .= " AND (dbt.fk_soc IS NULL OR sc.fk_soc IS NOT NULL)"; // Contact not linked to a company or to a company of user |
557 | - $sql .= " AND dbt.entity IN (" . getEntity($sharedelement, 1) . ")"; |
|
557 | + $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; |
|
558 | 558 | } |
559 | 559 | // If multicompany and internal users with all permissions, check user is in correct entity |
560 | 560 | else if (!empty($conf->multicompany->enabled)) { |
561 | - $sql = "SELECT COUNT(dbt." . $dbt_select . ") as nb"; |
|
562 | - $sql .= " FROM " . MAIN_DB_PREFIX . $dbtablename . " as dbt"; |
|
563 | - $sql .= " WHERE dbt." . $dbt_select . " IN (" . $objectid . ")"; |
|
564 | - $sql .= " AND dbt.entity IN (" . getEntity($sharedelement, 1) . ")"; |
|
561 | + $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; |
|
562 | + $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; |
|
563 | + $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; |
|
564 | + $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; |
|
565 | 565 | } |
566 | 566 | } else if (in_array($feature, $checkproject)) { |
567 | 567 | if (!empty($conf->projet->enabled) && empty($user->rights->projet->all->lire)) { |
568 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
568 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
569 | 569 | $projectstatic = new Project($db); |
570 | 570 | $tmps = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, 0); |
571 | 571 | $tmparray = explode(',', $tmps); |
@@ -573,17 +573,17 @@ discard block |
||
573 | 573 | return false; |
574 | 574 | } |
575 | 575 | else { |
576 | - $sql = "SELECT COUNT(dbt." . $dbt_select . ") as nb"; |
|
577 | - $sql .= " FROM " . MAIN_DB_PREFIX . $dbtablename . " as dbt"; |
|
578 | - $sql .= " WHERE dbt." . $dbt_select . " IN (" . $objectid . ")"; |
|
579 | - $sql .= " AND dbt.entity IN (" . getEntity($sharedelement, 1) . ")"; |
|
576 | + $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; |
|
577 | + $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; |
|
578 | + $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; |
|
579 | + $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; |
|
580 | 580 | } |
581 | 581 | } else if (in_array($feature, $checktask)) { |
582 | 582 | if (!empty($conf->projet->enabled) && empty($user->rights->projet->all->lire)) { |
583 | 583 | $task = new Task($db); |
584 | 584 | $task->fetch($objectid); |
585 | 585 | |
586 | - include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; |
|
586 | + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; |
|
587 | 587 | $projectstatic = new Project($db); |
588 | 588 | $tmps = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, 0); |
589 | 589 | $tmparray = explode(',', $tmps); |
@@ -591,41 +591,41 @@ discard block |
||
591 | 591 | return false; |
592 | 592 | } |
593 | 593 | else { |
594 | - $sql = "SELECT COUNT(dbt." . $dbt_select . ") as nb"; |
|
595 | - $sql .= " FROM " . MAIN_DB_PREFIX . $dbtablename . " as dbt"; |
|
596 | - $sql .= " WHERE dbt." . $dbt_select . " IN (" . $objectid . ")"; |
|
597 | - $sql .= " AND dbt.entity IN (" . getEntity($sharedelement, 1) . ")"; |
|
594 | + $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; |
|
595 | + $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; |
|
596 | + $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; |
|
597 | + $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; |
|
598 | 598 | } |
599 | 599 | } else if (!in_array($feature, $nocheck)) { // By default (case of $checkdefault), we check on object entity + link to third party on field $dbt_keyfield |
600 | 600 | // If external user: Check permission for external users |
601 | 601 | if ($user->socid > 0) { |
602 | 602 | if (empty($dbt_keyfield)) |
603 | 603 | dol_print_error('', 'Param dbt_keyfield is required but not defined'); |
604 | - $sql = "SELECT COUNT(dbt." . $dbt_keyfield . ") as nb"; |
|
605 | - $sql .= " FROM " . MAIN_DB_PREFIX . $dbtablename . " as dbt"; |
|
606 | - $sql .= " WHERE dbt.rowid IN (" . $objectid . ")"; |
|
607 | - $sql .= " AND dbt." . $dbt_keyfield . " = " . $user->socid; |
|
604 | + $sql = "SELECT COUNT(dbt.".$dbt_keyfield.") as nb"; |
|
605 | + $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; |
|
606 | + $sql .= " WHERE dbt.rowid IN (".$objectid.")"; |
|
607 | + $sql .= " AND dbt.".$dbt_keyfield." = ".$user->socid; |
|
608 | 608 | } |
609 | 609 | // If internal user: Check permission for internal users that are restricted on their objects |
610 | 610 | else if (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir)) { |
611 | 611 | if (empty($dbt_keyfield)) |
612 | 612 | dol_print_error('', 'Param dbt_keyfield is required but not defined'); |
613 | 613 | $sql = "SELECT COUNT(sc.fk_soc) as nb"; |
614 | - $sql .= " FROM " . MAIN_DB_PREFIX . $dbtablename . " as dbt"; |
|
615 | - $sql .= ", " . MAIN_DB_PREFIX . "societe as s"; |
|
616 | - $sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc"; |
|
617 | - $sql .= " WHERE dbt." . $dbt_select . " IN (" . $objectid . ")"; |
|
618 | - $sql .= " AND sc.fk_soc = dbt." . $dbt_keyfield; |
|
619 | - $sql .= " AND dbt." . $dbt_keyfield . " = s.rowid"; |
|
620 | - $sql .= " AND dbt.entity IN (" . getEntity($sharedelement, 1) . ")"; |
|
621 | - $sql .= " AND sc.fk_user = " . $user->id; |
|
614 | + $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; |
|
615 | + $sql .= ", ".MAIN_DB_PREFIX."societe as s"; |
|
616 | + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; |
|
617 | + $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; |
|
618 | + $sql .= " AND sc.fk_soc = dbt.".$dbt_keyfield; |
|
619 | + $sql .= " AND dbt.".$dbt_keyfield." = s.rowid"; |
|
620 | + $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; |
|
621 | + $sql .= " AND sc.fk_user = ".$user->id; |
|
622 | 622 | } |
623 | 623 | // If multicompany and internal users with all permissions, check user is in correct entity |
624 | 624 | else if (!empty($conf->multicompany->enabled)) { |
625 | - $sql = "SELECT COUNT(dbt." . $dbt_select . ") as nb"; |
|
626 | - $sql .= " FROM " . MAIN_DB_PREFIX . $dbtablename . " as dbt"; |
|
627 | - $sql .= " WHERE dbt." . $dbt_select . " IN (" . $objectid . ")"; |
|
628 | - $sql .= " AND dbt.entity IN (" . getEntity($sharedelement, 1) . ")"; |
|
625 | + $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; |
|
626 | + $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; |
|
627 | + $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; |
|
628 | + $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; |
|
629 | 629 | } |
630 | 630 | } |
631 | 631 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | { |
659 | 659 | global $conf, $db, $user, $langs; |
660 | 660 | if (!is_object($langs)) { |
661 | - include_once DOL_DOCUMENT_ROOT . '/core/class/translate.class.php'; |
|
661 | + include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; |
|
662 | 662 | $langs = new Translate('', $conf); |
663 | 663 | $langs->setDefaultLang(); |
664 | 664 | } |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | print '<br>'; |
681 | 681 | if (empty($showonlymessage)) { |
682 | 682 | if ($user->login) { |
683 | - print $langs->trans("CurrentLogin") . ': <font class="error">' . $user->login . '</font><br>'; |
|
683 | + print $langs->trans("CurrentLogin").': <font class="error">'.$user->login.'</font><br>'; |
|
684 | 684 | print $langs->trans("ErrorForbidden2", $langs->trans("Home"), $langs->trans("Users")); |
685 | 685 | } else { |
686 | 686 | print $langs->trans("ErrorForbidden3"); |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | $monthref = dol_print_date($gmtnow, '%m'); |
90 | 90 | $dayref = dol_print_date($gmtnow, '%d'); |
91 | 91 | if ($refgmtdate == 'now') |
92 | - $newrefgmtdate = $yearref . '-' . $monthref . '-' . $dayref; |
|
92 | + $newrefgmtdate = $yearref.'-'.$monthref.'-'.$dayref; |
|
93 | 93 | elseif ($refgmtdate == 'summer') |
94 | - $newrefgmtdate = $yearref . '-08-01'; |
|
94 | + $newrefgmtdate = $yearref.'-08-01'; |
|
95 | 95 | else |
96 | - $newrefgmtdate = $yearref . '-01-01'; |
|
96 | + $newrefgmtdate = $yearref.'-01-01'; |
|
97 | 97 | $newrefgmtdate .= 'T00:00:00+00:00'; |
98 | 98 | $localtz = new DateTimeZone(getServerTimeZoneString()); |
99 | 99 | $localdt = new DateTime($newrefgmtdate, $localtz); |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | global $langs; |
202 | 202 | |
203 | 203 | if (empty($lengthOfDay)) |
204 | - $lengthOfDay = 86400; // 1 day = 24 hours |
|
204 | + $lengthOfDay = 86400; // 1 day = 24 hours |
|
205 | 205 | if (empty($lengthOfWeek)) |
206 | - $lengthOfWeek = 7; // 1 week = 7 days |
|
206 | + $lengthOfWeek = 7; // 1 week = 7 days |
|
207 | 207 | |
208 | 208 | if ($format == 'all' || $format == 'allwithouthour' || $format == 'allhour' || $format == 'allhourmin') { |
209 | 209 | if ((int) $iSecond === 0) |
@@ -226,12 +226,12 @@ discard block |
||
226 | 226 | if ($lengthOfWeek < 7) { |
227 | 227 | if ($sDay) { |
228 | 228 | if ($sDay >= $lengthOfWeek) { |
229 | - $sWeek = (int) (($sDay - $sDay % $lengthOfWeek ) / $lengthOfWeek); |
|
229 | + $sWeek = (int) (($sDay - $sDay % $lengthOfWeek) / $lengthOfWeek); |
|
230 | 230 | $sDay = $sDay % $lengthOfWeek; |
231 | 231 | $weekTranslate = $langs->trans("DurationWeek"); |
232 | 232 | if ($sWeek >= 2) |
233 | 233 | $weekTranslate = $langs->trans("DurationWeeks"); |
234 | - $sTime .= $sWeek . ' ' . $weekTranslate . ' '; |
|
234 | + $sTime .= $sWeek.' '.$weekTranslate.' '; |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | $dayTranslate = $langs->trans("Day"); |
240 | 240 | if ($sDay > 1) |
241 | 241 | $dayTranslate = $langs->trans("Days"); |
242 | - $sTime .= $sDay . ' ' . $dayTranslate . ' '; |
|
242 | + $sTime .= $sDay.' '.$dayTranslate.' '; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | if ($format == 'all') { |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | } |
249 | 249 | } |
250 | 250 | if ($format == 'allhourmin') { |
251 | - return sprintf("%02d", ($sWeek * $lengthOfWeek * 24 + $sDay * 24 + (int) floor($iSecond / 3600))) . ':' . sprintf("%02d", ((int) floor(($iSecond % 3600) / 60))); |
|
251 | + return sprintf("%02d", ($sWeek * $lengthOfWeek * 24 + $sDay * 24 + (int) floor($iSecond / 3600))).':'.sprintf("%02d", ((int) floor(($iSecond % 3600) / 60))); |
|
252 | 252 | } |
253 | 253 | if ($format == 'allhour') { |
254 | 254 | return sprintf("%02d", ($sWeek * $lengthOfWeek * 24 + $sDay * 24 + (int) floor($iSecond / 3600))); |
@@ -289,16 +289,16 @@ discard block |
||
289 | 289 | $sqldate = ""; |
290 | 290 | if ($month_date > 0) { |
291 | 291 | if ($year_date > 0 && empty($day_date)) { |
292 | - $sqldate .= " AND " . $datefield . " BETWEEN '" . $db->idate(dol_get_first_day($year_date, $month_date, false)); |
|
293 | - $sqldate .= "' AND '" . $db->idate(dol_get_last_day($year_date, $month_date, false)) . "'"; |
|
292 | + $sqldate .= " AND ".$datefield." BETWEEN '".$db->idate(dol_get_first_day($year_date, $month_date, false)); |
|
293 | + $sqldate .= "' AND '".$db->idate(dol_get_last_day($year_date, $month_date, false))."'"; |
|
294 | 294 | } else if ($year_date > 0 && !empty($day_date)) { |
295 | - $sqldate .= " AND " . $datefield . " BETWEEN '" . $db->idate(dol_mktime(0, 0, 0, $month_date, $day_date, $year_date)); |
|
296 | - $sqldate .= "' AND '" . $db->idate(dol_mktime(23, 59, 59, $month_date, $day_date, $year_date)) . "'"; |
|
295 | + $sqldate .= " AND ".$datefield." BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month_date, $day_date, $year_date)); |
|
296 | + $sqldate .= "' AND '".$db->idate(dol_mktime(23, 59, 59, $month_date, $day_date, $year_date))."'"; |
|
297 | 297 | } else |
298 | - $sqldate .= " AND date_format( " . $datefield . ", '%m') = '" . $db->escape($month_date) . "'"; |
|
298 | + $sqldate .= " AND date_format( ".$datefield.", '%m') = '".$db->escape($month_date)."'"; |
|
299 | 299 | } else if ($year_date > 0) { |
300 | - $sqldate .= " AND " . $datefield . " BETWEEN '" . $db->idate(dol_get_first_day($year_date, 1, false)); |
|
301 | - $sqldate .= "' AND '" . $db->idate(dol_get_last_day($year_date, 12, false)) . "'"; |
|
300 | + $sqldate .= " AND ".$datefield." BETWEEN '".$db->idate(dol_get_first_day($year_date, 1, false)); |
|
301 | + $sqldate .= "' AND '".$db->idate(dol_get_last_day($year_date, 12, false))."'"; |
|
302 | 302 | } |
303 | 303 | return $sqldate; |
304 | 304 | } |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | } |
356 | 356 | |
357 | 357 | $string = preg_replace('/([^0-9])/i', '', $string); |
358 | - $tmp = $string . '000000'; |
|
358 | + $tmp = $string.'000000'; |
|
359 | 359 | $date = DolUtils::dol_mktime(substr($tmp, 8, 2), substr($tmp, 10, 2), substr($tmp, 12, 2), substr($tmp, 4, 2), substr($tmp, 6, 2), substr($tmp, 0, 4), ($gm ? 1 : 0)); |
360 | 360 | return $date; |
361 | 361 | } |
@@ -594,7 +594,7 @@ discard block |
||
594 | 594 | return 'ErrorDates must use same hours and must be GMT dates'; |
595 | 595 | |
596 | 596 | $i = 0; |
597 | - while (( ($lastday == 0 && $timestampStart < $timestampEnd) || ($lastday && $timestampStart <= $timestampEnd) ) && ($i < 50000)) { // Loop end when equals (Test on i is a security loop to avoid infinite loop) |
|
597 | + while ((($lastday == 0 && $timestampStart < $timestampEnd) || ($lastday && $timestampStart <= $timestampEnd)) && ($i < 50000)) { // Loop end when equals (Test on i is a security loop to avoid infinite loop) |
|
598 | 598 | $ferie = false; |
599 | 599 | $countryfound = 0; |
600 | 600 | $includesaturdayandsunday = 1; |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | if (empty($country_code)) |
918 | 918 | $country_code = $mysoc->country_code; |
919 | 919 | |
920 | - dol_syslog('num_open_day timestampStart=' . $timestampStart . ' timestampEnd=' . $timestampEnd . ' bit=' . $lastday . ' country_code=' . $country_code); |
|
920 | + dol_syslog('num_open_day timestampStart='.$timestampStart.' timestampEnd='.$timestampEnd.' bit='.$lastday.' country_code='.$country_code); |
|
921 | 921 | |
922 | 922 | // Check parameters |
923 | 923 | if (!is_int($timestampStart) && !is_float($timestampStart)) |
@@ -930,15 +930,15 @@ discard block |
||
930 | 930 | $numdays = num_between_day($timestampStart, $timestampEnd, $lastday); |
931 | 931 | $numholidays = num_public_holiday($timestampStart, $timestampEnd, $country_code, $lastday); |
932 | 932 | $nbOpenDay = $numdays - $numholidays; |
933 | - $nbOpenDay .= " " . $langs->trans("Days"); |
|
933 | + $nbOpenDay .= " ".$langs->trans("Days"); |
|
934 | 934 | if ($inhour == 1 && $nbOpenDay <= 3) |
935 | - $nbOpenDay = $nbOpenDay * 24 . $langs->trans("HourShort"); |
|
935 | + $nbOpenDay = $nbOpenDay * 24.$langs->trans("HourShort"); |
|
936 | 936 | return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday)); |
937 | 937 | } |
938 | 938 | elseif ($timestampStart == $timestampEnd) { |
939 | 939 | $nbOpenDay = $lastday; |
940 | 940 | if ($inhour == 1) |
941 | - $nbOpenDay = $nbOpenDay * 24 . $langs->trans("HourShort"); |
|
941 | + $nbOpenDay = $nbOpenDay * 24.$langs->trans("HourShort"); |
|
942 | 942 | return $nbOpenDay - (($inhour == 1 ? 12 : 0.5) * abs($halfday)); |
943 | 943 | } |
944 | 944 | else { |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | */ |
59 | 59 | public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) |
60 | 60 | { |
61 | - if (empty($conf->ldap->enabled)) return 0; // Module not active, we do nothing |
|
62 | - if (defined('DISABLE_LDAP_SYNCHRO')) return 0; // If constant defined, we do nothing |
|
61 | + if (empty($conf->ldap->enabled)) return 0; // Module not active, we do nothing |
|
62 | + if (defined('DISABLE_LDAP_SYNCHRO')) return 0; // If constant defined, we do nothing |
|
63 | 63 | |
64 | - if (! function_exists('ldap_connect')) |
|
64 | + if (!function_exists('ldap_connect')) |
|
65 | 65 | { |
66 | 66 | dol_syslog("Warning, module LDAP is enabled but LDAP functions not available in this PHP", LOG_WARNING); |
67 | 67 | return 0; |
@@ -70,102 +70,102 @@ discard block |
||
70 | 70 | require_once DOL_DOCUMENT_ROOT."/core/class/ldap.class.php"; |
71 | 71 | require_once DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php"; |
72 | 72 | |
73 | - $result=0; |
|
73 | + $result = 0; |
|
74 | 74 | |
75 | 75 | // Users |
76 | 76 | if ($action == 'USER_CREATE') |
77 | 77 | { |
78 | 78 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
79 | - if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
79 | + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
80 | 80 | { |
81 | - $ldap=new Ldap(); |
|
82 | - $result=$ldap->connect_bind(); |
|
81 | + $ldap = new Ldap(); |
|
82 | + $result = $ldap->connect_bind(); |
|
83 | 83 | |
84 | 84 | if ($result > 0) |
85 | 85 | { |
86 | - $info=$object->_load_ldap_info(); |
|
87 | - $dn=$object->_load_ldap_dn($info); |
|
86 | + $info = $object->_load_ldap_info(); |
|
87 | + $dn = $object->_load_ldap_dn($info); |
|
88 | 88 | |
89 | - $result=$ldap->add($dn,$info,$user); |
|
89 | + $result = $ldap->add($dn, $info, $user); |
|
90 | 90 | } |
91 | 91 | |
92 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
92 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
93 | 93 | } |
94 | 94 | } |
95 | 95 | elseif ($action == 'USER_MODIFY') |
96 | 96 | { |
97 | 97 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
98 | - if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
98 | + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
99 | 99 | { |
100 | - $ldap=new Ldap(); |
|
101 | - $result=$ldap->connect_bind(); |
|
100 | + $ldap = new Ldap(); |
|
101 | + $result = $ldap->connect_bind(); |
|
102 | 102 | |
103 | 103 | if ($result > 0) |
104 | 104 | { |
105 | - if (empty($object->oldcopy) || ! is_object($object->oldcopy)) |
|
105 | + if (empty($object->oldcopy) || !is_object($object->oldcopy)) |
|
106 | 106 | { |
107 | 107 | dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING); |
108 | 108 | $object->oldcopy = clone $object; |
109 | 109 | } |
110 | 110 | |
111 | - $oldinfo=$object->oldcopy->_load_ldap_info(); |
|
112 | - $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); |
|
111 | + $oldinfo = $object->oldcopy->_load_ldap_info(); |
|
112 | + $olddn = $object->oldcopy->_load_ldap_dn($oldinfo); |
|
113 | 113 | |
114 | 114 | // Verify if entry exist |
115 | - $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); |
|
116 | - $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; |
|
117 | - $records=$ldap->search($container,$search); |
|
115 | + $container = $object->oldcopy->_load_ldap_dn($oldinfo, 1); |
|
116 | + $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")"; |
|
117 | + $records = $ldap->search($container, $search); |
|
118 | 118 | if (count($records) && $records['count'] == 0) |
119 | 119 | { |
120 | 120 | $olddn = ''; |
121 | 121 | } |
122 | 122 | |
123 | - $info=$object->_load_ldap_info(); |
|
124 | - $dn=$object->_load_ldap_dn($info); |
|
125 | - $newrdn=$object->_load_ldap_dn($info,2); |
|
126 | - $newparent=$object->_load_ldap_dn($info,1); |
|
123 | + $info = $object->_load_ldap_info(); |
|
124 | + $dn = $object->_load_ldap_dn($info); |
|
125 | + $newrdn = $object->_load_ldap_dn($info, 2); |
|
126 | + $newparent = $object->_load_ldap_dn($info, 1); |
|
127 | 127 | |
128 | - $result=$ldap->update($dn,$info,$user,$olddn,$newrdn,$newparent); |
|
128 | + $result = $ldap->update($dn, $info, $user, $olddn, $newrdn, $newparent); |
|
129 | 129 | } |
130 | 130 | |
131 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
131 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | elseif ($action == 'USER_NEW_PASSWORD') |
135 | 135 | { |
136 | 136 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
137 | - if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
137 | + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
138 | 138 | { |
139 | - $ldap=new Ldap(); |
|
140 | - $result=$ldap->connect_bind(); |
|
139 | + $ldap = new Ldap(); |
|
140 | + $result = $ldap->connect_bind(); |
|
141 | 141 | |
142 | 142 | if ($result > 0) |
143 | 143 | { |
144 | - if (empty($object->oldcopy) || ! is_object($object->oldcopy)) |
|
144 | + if (empty($object->oldcopy) || !is_object($object->oldcopy)) |
|
145 | 145 | { |
146 | 146 | dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING); |
147 | 147 | $object->oldcopy = clone $object; |
148 | 148 | } |
149 | 149 | |
150 | - $oldinfo=$object->oldcopy->_load_ldap_info(); |
|
151 | - $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); |
|
150 | + $oldinfo = $object->oldcopy->_load_ldap_info(); |
|
151 | + $olddn = $object->oldcopy->_load_ldap_dn($oldinfo); |
|
152 | 152 | |
153 | 153 | // Verify if entry exist |
154 | - $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); |
|
155 | - $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; |
|
156 | - $records=$ldap->search($container,$search); |
|
154 | + $container = $object->oldcopy->_load_ldap_dn($oldinfo, 1); |
|
155 | + $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")"; |
|
156 | + $records = $ldap->search($container, $search); |
|
157 | 157 | if (count($records) && $records['count'] == 0) |
158 | 158 | { |
159 | 159 | $olddn = ''; |
160 | 160 | } |
161 | 161 | |
162 | - $info=$object->_load_ldap_info(); |
|
163 | - $dn=$object->_load_ldap_dn($info); |
|
162 | + $info = $object->_load_ldap_info(); |
|
163 | + $dn = $object->_load_ldap_dn($info); |
|
164 | 164 | |
165 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
165 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
166 | 166 | } |
167 | 167 | |
168 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
168 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | elseif ($action == 'USER_ENABLEDISABLE') |
@@ -175,96 +175,96 @@ discard block |
||
175 | 175 | elseif ($action == 'USER_DELETE') |
176 | 176 | { |
177 | 177 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
178 | - if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
178 | + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
179 | 179 | { |
180 | - $ldap=new Ldap(); |
|
181 | - $result=$ldap->connect_bind(); |
|
180 | + $ldap = new Ldap(); |
|
181 | + $result = $ldap->connect_bind(); |
|
182 | 182 | |
183 | 183 | if ($result > 0) |
184 | 184 | { |
185 | - $info=$object->_load_ldap_info(); |
|
186 | - $dn=$object->_load_ldap_dn($info); |
|
185 | + $info = $object->_load_ldap_info(); |
|
186 | + $dn = $object->_load_ldap_dn($info); |
|
187 | 187 | |
188 | - $result=$ldap->delete($dn); |
|
188 | + $result = $ldap->delete($dn); |
|
189 | 189 | } |
190 | 190 | |
191 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
191 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | elseif ($action == 'USER_SETINGROUP') |
195 | 195 | { |
196 | 196 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
197 | - if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
197 | + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
198 | 198 | { |
199 | - $ldap=new Ldap(); |
|
200 | - $result=$ldap->connect_bind(); |
|
199 | + $ldap = new Ldap(); |
|
200 | + $result = $ldap->connect_bind(); |
|
201 | 201 | |
202 | 202 | if ($result > 0) |
203 | 203 | { |
204 | 204 | // Must edit $object->newgroupid |
205 | - $usergroup=new UserGroup($this->db); |
|
205 | + $usergroup = new UserGroup($this->db); |
|
206 | 206 | if ($object->newgroupid > 0) |
207 | 207 | { |
208 | 208 | $usergroup->fetch($object->newgroupid); |
209 | 209 | |
210 | - $oldinfo=$usergroup->_load_ldap_info(); |
|
211 | - $olddn=$usergroup->_load_ldap_dn($oldinfo); |
|
210 | + $oldinfo = $usergroup->_load_ldap_info(); |
|
211 | + $olddn = $usergroup->_load_ldap_dn($oldinfo); |
|
212 | 212 | |
213 | 213 | // Verify if entry exist |
214 | - $container=$usergroup->_load_ldap_dn($oldinfo,1); |
|
215 | - $search = "(".$usergroup->_load_ldap_dn($oldinfo,2).")"; |
|
216 | - $records=$ldap->search($container,$search); |
|
214 | + $container = $usergroup->_load_ldap_dn($oldinfo, 1); |
|
215 | + $search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")"; |
|
216 | + $records = $ldap->search($container, $search); |
|
217 | 217 | if (count($records) && $records['count'] == 0) |
218 | 218 | { |
219 | 219 | $olddn = ''; |
220 | 220 | } |
221 | 221 | |
222 | - $info=$usergroup->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call) |
|
223 | - $dn=$usergroup->_load_ldap_dn($info); |
|
222 | + $info = $usergroup->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call) |
|
223 | + $dn = $usergroup->_load_ldap_dn($info); |
|
224 | 224 | |
225 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
225 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
229 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | elseif ($action == 'USER_REMOVEFROMGROUP') |
233 | 233 | { |
234 | 234 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
235 | - if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
235 | + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
236 | 236 | { |
237 | - $ldap=new Ldap(); |
|
238 | - $result=$ldap->connect_bind(); |
|
237 | + $ldap = new Ldap(); |
|
238 | + $result = $ldap->connect_bind(); |
|
239 | 239 | |
240 | 240 | if ($result > 0) |
241 | 241 | { |
242 | 242 | // Must edit $object->newgroupid |
243 | - $usergroup=new UserGroup($this->db); |
|
243 | + $usergroup = new UserGroup($this->db); |
|
244 | 244 | if ($object->oldgroupid > 0) |
245 | 245 | { |
246 | 246 | $usergroup->fetch($object->oldgroupid); |
247 | 247 | |
248 | - $oldinfo=$usergroup->_load_ldap_info(); |
|
249 | - $olddn=$usergroup->_load_ldap_dn($oldinfo); |
|
248 | + $oldinfo = $usergroup->_load_ldap_info(); |
|
249 | + $olddn = $usergroup->_load_ldap_dn($oldinfo); |
|
250 | 250 | |
251 | 251 | // Verify if entry exist |
252 | - $container=$usergroup->_load_ldap_dn($oldinfo,1); |
|
253 | - $search = "(".$usergroup->_load_ldap_dn($oldinfo,2).")"; |
|
254 | - $records=$ldap->search($container,$search); |
|
252 | + $container = $usergroup->_load_ldap_dn($oldinfo, 1); |
|
253 | + $search = "(".$usergroup->_load_ldap_dn($oldinfo, 2).")"; |
|
254 | + $records = $ldap->search($container, $search); |
|
255 | 255 | if (count($records) && $records['count'] == 0) |
256 | 256 | { |
257 | 257 | $olddn = ''; |
258 | 258 | } |
259 | 259 | |
260 | - $info=$usergroup->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call) |
|
261 | - $dn=$usergroup->_load_ldap_dn($info); |
|
260 | + $info = $usergroup->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call) |
|
261 | + $dn = $usergroup->_load_ldap_dn($info); |
|
262 | 262 | |
263 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
263 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
267 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
268 | 268 | } |
269 | 269 | } |
270 | 270 | |
@@ -272,81 +272,81 @@ discard block |
||
272 | 272 | elseif ($action == 'GROUP_CREATE') |
273 | 273 | { |
274 | 274 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
275 | - if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
275 | + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
276 | 276 | { |
277 | - $ldap=new Ldap(); |
|
278 | - $result=$ldap->connect_bind(); |
|
277 | + $ldap = new Ldap(); |
|
278 | + $result = $ldap->connect_bind(); |
|
279 | 279 | |
280 | 280 | if ($result > 0) |
281 | 281 | { |
282 | - $info=$object->_load_ldap_info(); |
|
283 | - $dn=$object->_load_ldap_dn($info); |
|
282 | + $info = $object->_load_ldap_info(); |
|
283 | + $dn = $object->_load_ldap_dn($info); |
|
284 | 284 | |
285 | 285 | // Get a gid number for objectclass PosixGroup |
286 | - if (in_array('posixGroup',$info['objectclass'])) { |
|
286 | + if (in_array('posixGroup', $info['objectclass'])) { |
|
287 | 287 | $info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_GROUPS'); |
288 | 288 | } |
289 | 289 | |
290 | - $result=$ldap->add($dn,$info,$user); |
|
290 | + $result = $ldap->add($dn, $info, $user); |
|
291 | 291 | } |
292 | 292 | |
293 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
293 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
294 | 294 | } |
295 | 295 | } |
296 | 296 | elseif ($action == 'GROUP_MODIFY') |
297 | 297 | { |
298 | 298 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
299 | - if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
299 | + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
300 | 300 | { |
301 | - $ldap=new Ldap(); |
|
302 | - $result=$ldap->connect_bind(); |
|
301 | + $ldap = new Ldap(); |
|
302 | + $result = $ldap->connect_bind(); |
|
303 | 303 | |
304 | 304 | if ($result > 0) |
305 | 305 | { |
306 | - if (empty($object->oldcopy) || ! is_object($object->oldcopy)) |
|
306 | + if (empty($object->oldcopy) || !is_object($object->oldcopy)) |
|
307 | 307 | { |
308 | 308 | dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING); |
309 | 309 | $object->oldcopy = clone $object; |
310 | 310 | } |
311 | 311 | |
312 | - $oldinfo=$object->oldcopy->_load_ldap_info(); |
|
313 | - $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); |
|
312 | + $oldinfo = $object->oldcopy->_load_ldap_info(); |
|
313 | + $olddn = $object->oldcopy->_load_ldap_dn($oldinfo); |
|
314 | 314 | |
315 | 315 | // Verify if entry exist |
316 | - $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); |
|
317 | - $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; |
|
318 | - $records=$ldap->search($container,$search); |
|
316 | + $container = $object->oldcopy->_load_ldap_dn($oldinfo, 1); |
|
317 | + $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")"; |
|
318 | + $records = $ldap->search($container, $search); |
|
319 | 319 | if (count($records) && $records['count'] == 0) |
320 | 320 | { |
321 | 321 | $olddn = ''; |
322 | 322 | } |
323 | 323 | |
324 | - $info=$object->_load_ldap_info(); |
|
325 | - $dn=$object->_load_ldap_dn($info); |
|
324 | + $info = $object->_load_ldap_info(); |
|
325 | + $dn = $object->_load_ldap_dn($info); |
|
326 | 326 | |
327 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
327 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
328 | 328 | } |
329 | 329 | |
330 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
330 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
331 | 331 | } |
332 | 332 | } |
333 | 333 | elseif ($action == 'GROUP_DELETE') |
334 | 334 | { |
335 | 335 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
336 | - if (! empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
336 | + if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') |
|
337 | 337 | { |
338 | - $ldap=new Ldap(); |
|
339 | - $result=$ldap->connect_bind(); |
|
338 | + $ldap = new Ldap(); |
|
339 | + $result = $ldap->connect_bind(); |
|
340 | 340 | |
341 | 341 | if ($result > 0) |
342 | 342 | { |
343 | - $info=$object->_load_ldap_info(); |
|
344 | - $dn=$object->_load_ldap_dn($info); |
|
343 | + $info = $object->_load_ldap_info(); |
|
344 | + $dn = $object->_load_ldap_dn($info); |
|
345 | 345 | |
346 | - $result=$ldap->delete($dn); |
|
346 | + $result = $ldap->delete($dn); |
|
347 | 347 | } |
348 | 348 | |
349 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
349 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
@@ -354,76 +354,76 @@ discard block |
||
354 | 354 | elseif ($action == 'CONTACT_CREATE') |
355 | 355 | { |
356 | 356 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
357 | - if (! empty($conf->global->LDAP_CONTACT_ACTIVE)) |
|
357 | + if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) |
|
358 | 358 | { |
359 | - $ldap=new Ldap(); |
|
360 | - $result=$ldap->connect_bind(); |
|
359 | + $ldap = new Ldap(); |
|
360 | + $result = $ldap->connect_bind(); |
|
361 | 361 | |
362 | 362 | if ($result > 0) |
363 | 363 | { |
364 | - $info=$object->_load_ldap_info(); |
|
365 | - $dn=$object->_load_ldap_dn($info); |
|
364 | + $info = $object->_load_ldap_info(); |
|
365 | + $dn = $object->_load_ldap_dn($info); |
|
366 | 366 | |
367 | - $result=$ldap->add($dn,$info,$user); |
|
367 | + $result = $ldap->add($dn, $info, $user); |
|
368 | 368 | } |
369 | 369 | |
370 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
370 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | elseif ($action == 'CONTACT_MODIFY') |
374 | 374 | { |
375 | 375 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
376 | - if (! empty($conf->global->LDAP_CONTACT_ACTIVE)) |
|
376 | + if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) |
|
377 | 377 | { |
378 | - $ldap=new Ldap(); |
|
379 | - $result=$ldap->connect_bind(); |
|
378 | + $ldap = new Ldap(); |
|
379 | + $result = $ldap->connect_bind(); |
|
380 | 380 | |
381 | 381 | if ($result > 0) |
382 | 382 | { |
383 | - if (empty($object->oldcopy) || ! is_object($object->oldcopy)) |
|
383 | + if (empty($object->oldcopy) || !is_object($object->oldcopy)) |
|
384 | 384 | { |
385 | 385 | dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING); |
386 | 386 | $object->oldcopy = clone $object; |
387 | 387 | } |
388 | 388 | |
389 | - $oldinfo=$object->oldcopy->_load_ldap_info(); |
|
390 | - $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); |
|
389 | + $oldinfo = $object->oldcopy->_load_ldap_info(); |
|
390 | + $olddn = $object->oldcopy->_load_ldap_dn($oldinfo); |
|
391 | 391 | |
392 | 392 | // Verify if entry exist |
393 | - $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); |
|
394 | - $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; |
|
395 | - $records=$ldap->search($container,$search); |
|
393 | + $container = $object->oldcopy->_load_ldap_dn($oldinfo, 1); |
|
394 | + $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")"; |
|
395 | + $records = $ldap->search($container, $search); |
|
396 | 396 | if (count($records) && $records['count'] == 0) |
397 | 397 | { |
398 | 398 | $olddn = ''; |
399 | 399 | } |
400 | 400 | |
401 | - $info=$object->_load_ldap_info(); |
|
402 | - $dn=$object->_load_ldap_dn($info); |
|
401 | + $info = $object->_load_ldap_info(); |
|
402 | + $dn = $object->_load_ldap_dn($info); |
|
403 | 403 | |
404 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
404 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
405 | 405 | } |
406 | 406 | |
407 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
407 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
408 | 408 | } |
409 | 409 | } |
410 | 410 | elseif ($action == 'CONTACT_DELETE') |
411 | 411 | { |
412 | 412 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
413 | - if (! empty($conf->global->LDAP_CONTACT_ACTIVE)) |
|
413 | + if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) |
|
414 | 414 | { |
415 | - $ldap=new Ldap(); |
|
416 | - $result=$ldap->connect_bind(); |
|
415 | + $ldap = new Ldap(); |
|
416 | + $result = $ldap->connect_bind(); |
|
417 | 417 | |
418 | 418 | if ($result > 0) |
419 | 419 | { |
420 | - $info=$object->_load_ldap_info(); |
|
421 | - $dn=$object->_load_ldap_dn($info); |
|
420 | + $info = $object->_load_ldap_info(); |
|
421 | + $dn = $object->_load_ldap_dn($info); |
|
422 | 422 | |
423 | - $result=$ldap->delete($dn); |
|
423 | + $result = $ldap->delete($dn); |
|
424 | 424 | } |
425 | 425 | |
426 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
426 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
427 | 427 | } |
428 | 428 | } |
429 | 429 | |
@@ -431,78 +431,78 @@ discard block |
||
431 | 431 | elseif ($action == 'MEMBER_CREATE') |
432 | 432 | { |
433 | 433 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
434 | - if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
434 | + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
435 | 435 | { |
436 | - $ldap=new Ldap(); |
|
437 | - $result=$ldap->connect_bind(); |
|
436 | + $ldap = new Ldap(); |
|
437 | + $result = $ldap->connect_bind(); |
|
438 | 438 | |
439 | 439 | if ($result > 0) |
440 | 440 | { |
441 | - $info=$object->_load_ldap_info(); |
|
442 | - $dn=$object->_load_ldap_dn($info); |
|
441 | + $info = $object->_load_ldap_info(); |
|
442 | + $dn = $object->_load_ldap_dn($info); |
|
443 | 443 | |
444 | - $result=$ldap->add($dn,$info,$user); |
|
444 | + $result = $ldap->add($dn, $info, $user); |
|
445 | 445 | |
446 | 446 | // For member type |
447 | - if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
|
447 | + if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
|
448 | 448 | { |
449 | - $membertype=new AdherentType($this->db); |
|
449 | + $membertype = new AdherentType($this->db); |
|
450 | 450 | if ($object->typeid > 0) |
451 | 451 | { |
452 | 452 | $membertype->fetch($object->typeid); |
453 | 453 | $membertype->listMembersForMemberType('', 1); |
454 | 454 | |
455 | - $oldinfo=$membertype->_load_ldap_info(); |
|
456 | - $olddn=$membertype->_load_ldap_dn($oldinfo); |
|
455 | + $oldinfo = $membertype->_load_ldap_info(); |
|
456 | + $olddn = $membertype->_load_ldap_dn($oldinfo); |
|
457 | 457 | |
458 | 458 | // Verify if entry exist |
459 | - $container=$membertype->_load_ldap_dn($oldinfo,1); |
|
460 | - $search = "(".$membertype->_load_ldap_dn($oldinfo,2).")"; |
|
461 | - $records=$ldap->search($container,$search); |
|
459 | + $container = $membertype->_load_ldap_dn($oldinfo, 1); |
|
460 | + $search = "(".$membertype->_load_ldap_dn($oldinfo, 2).")"; |
|
461 | + $records = $ldap->search($container, $search); |
|
462 | 462 | if (count($records) && $records['count'] == 0) |
463 | 463 | { |
464 | 464 | $olddn = ''; |
465 | 465 | } |
466 | 466 | |
467 | - $info=$membertype->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call) |
|
468 | - $dn=$membertype->_load_ldap_dn($info); |
|
467 | + $info = $membertype->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call) |
|
468 | + $dn = $membertype->_load_ldap_dn($info); |
|
469 | 469 | |
470 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
470 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
471 | 471 | } |
472 | 472 | } |
473 | 473 | } |
474 | 474 | |
475 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
475 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
476 | 476 | } |
477 | 477 | } |
478 | 478 | elseif ($action == 'MEMBER_VALIDATE') |
479 | 479 | { |
480 | 480 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
481 | - if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
481 | + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
482 | 482 | { |
483 | 483 | // If status field is setup to be synchronized |
484 | - if (! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) |
|
484 | + if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) |
|
485 | 485 | { |
486 | - $ldap=new Ldap(); |
|
487 | - $result=$ldap->connect_bind(); |
|
486 | + $ldap = new Ldap(); |
|
487 | + $result = $ldap->connect_bind(); |
|
488 | 488 | |
489 | 489 | if ($result > 0) |
490 | 490 | { |
491 | - $info=$object->_load_ldap_info(); |
|
492 | - $dn=$object->_load_ldap_dn($info); |
|
493 | - $olddn=$dn; // We know olddn=dn as we change only status |
|
491 | + $info = $object->_load_ldap_info(); |
|
492 | + $dn = $object->_load_ldap_dn($info); |
|
493 | + $olddn = $dn; // We know olddn=dn as we change only status |
|
494 | 494 | |
495 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
495 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
496 | 496 | } |
497 | 497 | |
498 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
498 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
499 | 499 | } |
500 | 500 | } |
501 | 501 | } |
502 | 502 | elseif ($action == 'MEMBER_SUBSCRIPTION') |
503 | 503 | { |
504 | 504 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
505 | - if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
505 | + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
506 | 506 | { |
507 | 507 | // If subscriptions fields are setup to be synchronized |
508 | 508 | if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE |
@@ -511,212 +511,212 @@ discard block |
||
511 | 511 | || $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_AMOUNT |
512 | 512 | || $conf->global->LDAP_FIELD_MEMBER_END_LASTSUBSCRIPTION) |
513 | 513 | { |
514 | - $ldap=new Ldap(); |
|
515 | - $result=$ldap->connect_bind(); |
|
514 | + $ldap = new Ldap(); |
|
515 | + $result = $ldap->connect_bind(); |
|
516 | 516 | |
517 | 517 | if ($result > 0) |
518 | 518 | { |
519 | - $info=$object->_load_ldap_info(); |
|
520 | - $dn=$object->_load_ldap_dn($info); |
|
521 | - $olddn=$dn; // We know olddn=dn as we change only subscriptions |
|
519 | + $info = $object->_load_ldap_info(); |
|
520 | + $dn = $object->_load_ldap_dn($info); |
|
521 | + $olddn = $dn; // We know olddn=dn as we change only subscriptions |
|
522 | 522 | |
523 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
523 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
524 | 524 | } |
525 | 525 | |
526 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
526 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
527 | 527 | } |
528 | 528 | } |
529 | 529 | } |
530 | 530 | elseif ($action == 'MEMBER_MODIFY') |
531 | 531 | { |
532 | 532 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
533 | - if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
533 | + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
534 | 534 | { |
535 | - $ldap=new Ldap(); |
|
536 | - $result=$ldap->connect_bind(); |
|
535 | + $ldap = new Ldap(); |
|
536 | + $result = $ldap->connect_bind(); |
|
537 | 537 | |
538 | 538 | if ($result > 0) |
539 | 539 | { |
540 | - if (empty($object->oldcopy) || ! is_object($object->oldcopy)) |
|
540 | + if (empty($object->oldcopy) || !is_object($object->oldcopy)) |
|
541 | 541 | { |
542 | 542 | dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING); |
543 | 543 | $object->oldcopy = clone $object; |
544 | 544 | } |
545 | 545 | |
546 | - $oldinfo=$object->oldcopy->_load_ldap_info(); |
|
547 | - $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); |
|
546 | + $oldinfo = $object->oldcopy->_load_ldap_info(); |
|
547 | + $olddn = $object->oldcopy->_load_ldap_dn($oldinfo); |
|
548 | 548 | |
549 | 549 | // Verify if entry exist |
550 | - $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); |
|
551 | - $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; |
|
552 | - $records=$ldap->search($container,$search); |
|
550 | + $container = $object->oldcopy->_load_ldap_dn($oldinfo, 1); |
|
551 | + $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")"; |
|
552 | + $records = $ldap->search($container, $search); |
|
553 | 553 | if (count($records) && $records['count'] == 0) |
554 | 554 | { |
555 | 555 | $olddn = ''; |
556 | 556 | } |
557 | 557 | |
558 | - $info=$object->_load_ldap_info(); |
|
559 | - $dn=$object->_load_ldap_dn($info); |
|
560 | - $newrdn=$object->_load_ldap_dn($info,2); |
|
561 | - $newparent=$object->_load_ldap_dn($info,1); |
|
558 | + $info = $object->_load_ldap_info(); |
|
559 | + $dn = $object->_load_ldap_dn($info); |
|
560 | + $newrdn = $object->_load_ldap_dn($info, 2); |
|
561 | + $newparent = $object->_load_ldap_dn($info, 1); |
|
562 | 562 | |
563 | - $result=$ldap->update($dn,$info,$user,$olddn,$newrdn,$newparent); |
|
563 | + $result = $ldap->update($dn, $info, $user, $olddn, $newrdn, $newparent); |
|
564 | 564 | |
565 | 565 | // For member type |
566 | - if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
|
566 | + if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
|
567 | 567 | { |
568 | 568 | /* |
569 | 569 | * Change member info |
570 | 570 | */ |
571 | - $newmembertype=new AdherentType($this->db); |
|
571 | + $newmembertype = new AdherentType($this->db); |
|
572 | 572 | $newmembertype->fetch($object->typeid); |
573 | 573 | $newmembertype->listMembersForMemberType('', 1); |
574 | 574 | |
575 | - $oldinfo=$newmembertype->_load_ldap_info(); |
|
576 | - $olddn=$newmembertype->_load_ldap_dn($oldinfo); |
|
575 | + $oldinfo = $newmembertype->_load_ldap_info(); |
|
576 | + $olddn = $newmembertype->_load_ldap_dn($oldinfo); |
|
577 | 577 | |
578 | 578 | // Verify if entry exist |
579 | - $container=$newmembertype->_load_ldap_dn($oldinfo,1); |
|
580 | - $search = "(".$newmembertype->_load_ldap_dn($oldinfo,2).")"; |
|
581 | - $records=$ldap->search($container,$search); |
|
579 | + $container = $newmembertype->_load_ldap_dn($oldinfo, 1); |
|
580 | + $search = "(".$newmembertype->_load_ldap_dn($oldinfo, 2).")"; |
|
581 | + $records = $ldap->search($container, $search); |
|
582 | 582 | if (count($records) && $records['count'] == 0) |
583 | 583 | { |
584 | 584 | $olddn = ''; |
585 | 585 | } |
586 | 586 | |
587 | - $info=$newmembertype->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call) |
|
588 | - $dn=$newmembertype->_load_ldap_dn($info); |
|
587 | + $info = $newmembertype->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call) |
|
588 | + $dn = $newmembertype->_load_ldap_dn($info); |
|
589 | 589 | |
590 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
590 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
591 | 591 | |
592 | 592 | if ($object->oldcopy->typeid != $object->typeid) |
593 | 593 | { |
594 | 594 | /* |
595 | 595 | * Remove member in old member type |
596 | 596 | */ |
597 | - $oldmembertype=new AdherentType($this->db); |
|
597 | + $oldmembertype = new AdherentType($this->db); |
|
598 | 598 | $oldmembertype->fetch($object->oldcopy->typeid); |
599 | 599 | $oldmembertype->listMembersForMemberType('', 1); |
600 | 600 | |
601 | - $oldinfo=$oldmembertype->_load_ldap_info(); |
|
602 | - $olddn=$oldmembertype->_load_ldap_dn($oldinfo); |
|
601 | + $oldinfo = $oldmembertype->_load_ldap_info(); |
|
602 | + $olddn = $oldmembertype->_load_ldap_dn($oldinfo); |
|
603 | 603 | |
604 | 604 | // Verify if entry exist |
605 | - $container=$oldmembertype->_load_ldap_dn($oldinfo,1); |
|
606 | - $search = "(".$oldmembertype->_load_ldap_dn($oldinfo,2).")"; |
|
607 | - $records=$ldap->search($container,$search); |
|
605 | + $container = $oldmembertype->_load_ldap_dn($oldinfo, 1); |
|
606 | + $search = "(".$oldmembertype->_load_ldap_dn($oldinfo, 2).")"; |
|
607 | + $records = $ldap->search($container, $search); |
|
608 | 608 | if (count($records) && $records['count'] == 0) |
609 | 609 | { |
610 | 610 | $olddn = ''; |
611 | 611 | } |
612 | 612 | |
613 | - $info=$oldmembertype->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call) |
|
614 | - $dn=$oldmembertype->_load_ldap_dn($info); |
|
613 | + $info = $oldmembertype->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call) |
|
614 | + $dn = $oldmembertype->_load_ldap_dn($info); |
|
615 | 615 | |
616 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
616 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
617 | 617 | } |
618 | 618 | } |
619 | 619 | } |
620 | 620 | |
621 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
621 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
622 | 622 | } |
623 | 623 | } |
624 | 624 | elseif ($action == 'MEMBER_NEW_PASSWORD') |
625 | 625 | { |
626 | 626 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
627 | - if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
627 | + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
628 | 628 | { |
629 | 629 | // If password field is setup to be synchronized |
630 | 630 | if ($conf->global->LDAP_FIELD_PASSWORD || $conf->global->LDAP_FIELD_PASSWORD_CRYPTED) |
631 | 631 | { |
632 | - $ldap=new Ldap(); |
|
633 | - $result=$ldap->connect_bind(); |
|
632 | + $ldap = new Ldap(); |
|
633 | + $result = $ldap->connect_bind(); |
|
634 | 634 | |
635 | 635 | if ($result > 0) |
636 | 636 | { |
637 | - $info=$object->_load_ldap_info(); |
|
638 | - $dn=$object->_load_ldap_dn($info); |
|
639 | - $olddn=$dn; // We know olddn=dn as we change only password |
|
637 | + $info = $object->_load_ldap_info(); |
|
638 | + $dn = $object->_load_ldap_dn($info); |
|
639 | + $olddn = $dn; // We know olddn=dn as we change only password |
|
640 | 640 | |
641 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
641 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
642 | 642 | } |
643 | 643 | |
644 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
644 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
645 | 645 | } |
646 | 646 | } |
647 | 647 | } |
648 | 648 | elseif ($action == 'MEMBER_RESILIATE') |
649 | 649 | { |
650 | 650 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
651 | - if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
651 | + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
652 | 652 | { |
653 | 653 | // If status field is setup to be synchronized |
654 | - if (! empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) |
|
654 | + if (!empty($conf->global->LDAP_FIELD_MEMBER_STATUS)) |
|
655 | 655 | { |
656 | - $ldap=new Ldap(); |
|
657 | - $result=$ldap->connect_bind(); |
|
656 | + $ldap = new Ldap(); |
|
657 | + $result = $ldap->connect_bind(); |
|
658 | 658 | |
659 | 659 | if ($result > 0) |
660 | 660 | { |
661 | - $info=$object->_load_ldap_info(); |
|
662 | - $dn=$object->_load_ldap_dn($info); |
|
663 | - $olddn=$dn; // We know olddn=dn as we change only status |
|
661 | + $info = $object->_load_ldap_info(); |
|
662 | + $dn = $object->_load_ldap_dn($info); |
|
663 | + $olddn = $dn; // We know olddn=dn as we change only status |
|
664 | 664 | |
665 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
665 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
666 | 666 | } |
667 | 667 | |
668 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
668 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
669 | 669 | } |
670 | 670 | } |
671 | 671 | } |
672 | 672 | elseif ($action == 'MEMBER_DELETE') |
673 | 673 | { |
674 | 674 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
675 | - if (! empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
675 | + if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') |
|
676 | 676 | { |
677 | - $ldap=new Ldap(); |
|
678 | - $result=$ldap->connect_bind(); |
|
677 | + $ldap = new Ldap(); |
|
678 | + $result = $ldap->connect_bind(); |
|
679 | 679 | |
680 | 680 | if ($result > 0) |
681 | 681 | { |
682 | - $info=$object->_load_ldap_info(); |
|
683 | - $dn=$object->_load_ldap_dn($info); |
|
682 | + $info = $object->_load_ldap_info(); |
|
683 | + $dn = $object->_load_ldap_dn($info); |
|
684 | 684 | |
685 | - $result=$ldap->delete($dn); |
|
685 | + $result = $ldap->delete($dn); |
|
686 | 686 | |
687 | 687 | // For member type |
688 | - if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
|
688 | + if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
|
689 | 689 | { |
690 | 690 | if ($object->typeid > 0) |
691 | 691 | { |
692 | 692 | /* |
693 | 693 | * Remove member in member type |
694 | 694 | */ |
695 | - $membertype=new AdherentType($this->db); |
|
695 | + $membertype = new AdherentType($this->db); |
|
696 | 696 | $membertype->fetch($object->typeid); |
697 | - $membertype->listMembersForMemberType('a.rowid != ' . $object->id, 1); // remove deleted member from the list |
|
697 | + $membertype->listMembersForMemberType('a.rowid != '.$object->id, 1); // remove deleted member from the list |
|
698 | 698 | |
699 | - $oldinfo=$membertype->_load_ldap_info(); |
|
700 | - $olddn=$membertype->_load_ldap_dn($oldinfo); |
|
699 | + $oldinfo = $membertype->_load_ldap_info(); |
|
700 | + $olddn = $membertype->_load_ldap_dn($oldinfo); |
|
701 | 701 | |
702 | 702 | // Verify if entry exist |
703 | - $container=$membertype->_load_ldap_dn($oldinfo,1); |
|
704 | - $search = "(".$membertype->_load_ldap_dn($oldinfo,2).")"; |
|
705 | - $records=$ldap->search($container,$search); |
|
703 | + $container = $membertype->_load_ldap_dn($oldinfo, 1); |
|
704 | + $search = "(".$membertype->_load_ldap_dn($oldinfo, 2).")"; |
|
705 | + $records = $ldap->search($container, $search); |
|
706 | 706 | if (count($records) && $records['count'] == 0) |
707 | 707 | { |
708 | 708 | $olddn = ''; |
709 | 709 | } |
710 | 710 | |
711 | - $info=$membertype->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call) |
|
712 | - $dn=$membertype->_load_ldap_dn($info); |
|
711 | + $info = $membertype->_load_ldap_info(); // Contains all members, included the new one (insert already done before trigger call) |
|
712 | + $dn = $membertype->_load_ldap_dn($info); |
|
713 | 713 | |
714 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
714 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
715 | 715 | } |
716 | 716 | } |
717 | 717 | } |
718 | 718 | |
719 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
719 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
720 | 720 | } |
721 | 721 | } |
722 | 722 | |
@@ -724,38 +724,38 @@ discard block |
||
724 | 724 | elseif ($action == 'MEMBER_TYPE_CREATE') |
725 | 725 | { |
726 | 726 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
727 | - if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
|
727 | + if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
|
728 | 728 | { |
729 | - $ldap=new Ldap(); |
|
730 | - $result=$ldap->connect_bind(); |
|
729 | + $ldap = new Ldap(); |
|
730 | + $result = $ldap->connect_bind(); |
|
731 | 731 | |
732 | 732 | if ($result > 0) |
733 | 733 | { |
734 | - $info=$object->_load_ldap_info(); |
|
735 | - $dn=$object->_load_ldap_dn($info); |
|
734 | + $info = $object->_load_ldap_info(); |
|
735 | + $dn = $object->_load_ldap_dn($info); |
|
736 | 736 | |
737 | 737 | // Get a gid number for objectclass PosixGroup |
738 | - if (in_array('posixGroup',$info['objectclass'])) { |
|
738 | + if (in_array('posixGroup', $info['objectclass'])) { |
|
739 | 739 | $info['gidNumber'] = $ldap->getNextGroupGid('LDAP_KEY_MEMBERS_TYPE'); |
740 | 740 | } |
741 | 741 | |
742 | - $result=$ldap->add($dn,$info,$user); |
|
742 | + $result = $ldap->add($dn, $info, $user); |
|
743 | 743 | } |
744 | 744 | |
745 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
745 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
746 | 746 | } |
747 | 747 | } |
748 | 748 | elseif ($action == 'MEMBER_TYPE_MODIFY') |
749 | 749 | { |
750 | 750 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
751 | - if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
|
751 | + if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
|
752 | 752 | { |
753 | - $ldap=new Ldap(); |
|
754 | - $result=$ldap->connect_bind(); |
|
753 | + $ldap = new Ldap(); |
|
754 | + $result = $ldap->connect_bind(); |
|
755 | 755 | |
756 | 756 | if ($result > 0) |
757 | 757 | { |
758 | - if (empty($object->oldcopy) || ! is_object($object->oldcopy)) |
|
758 | + if (empty($object->oldcopy) || !is_object($object->oldcopy)) |
|
759 | 759 | { |
760 | 760 | dol_syslog("Trigger ".$action." was called by a function that did not set previously the property ->oldcopy onto object", LOG_WARNING); |
761 | 761 | $object->oldcopy = clone $object; |
@@ -763,13 +763,13 @@ discard block |
||
763 | 763 | |
764 | 764 | $object->oldcopy->listMembersForMemberType('', 1); |
765 | 765 | |
766 | - $oldinfo=$object->oldcopy->_load_ldap_info(); |
|
767 | - $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); |
|
766 | + $oldinfo = $object->oldcopy->_load_ldap_info(); |
|
767 | + $olddn = $object->oldcopy->_load_ldap_dn($oldinfo); |
|
768 | 768 | |
769 | 769 | // Verify if entry exist |
770 | - $container=$object->oldcopy->_load_ldap_dn($oldinfo,1); |
|
771 | - $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo,2).")"; |
|
772 | - $records=$ldap->search($container,$search); |
|
770 | + $container = $object->oldcopy->_load_ldap_dn($oldinfo, 1); |
|
771 | + $search = "(".$object->oldcopy->_load_ldap_dn($oldinfo, 2).")"; |
|
772 | + $records = $ldap->search($container, $search); |
|
773 | 773 | if (count($records) && $records['count'] == 0) |
774 | 774 | { |
775 | 775 | $olddn = ''; |
@@ -777,32 +777,32 @@ discard block |
||
777 | 777 | |
778 | 778 | $object->listMembersForMemberType('', 1); |
779 | 779 | |
780 | - $info=$object->_load_ldap_info(); |
|
781 | - $dn=$object->_load_ldap_dn($info); |
|
780 | + $info = $object->_load_ldap_info(); |
|
781 | + $dn = $object->_load_ldap_dn($info); |
|
782 | 782 | |
783 | - $result=$ldap->update($dn,$info,$user,$olddn); |
|
783 | + $result = $ldap->update($dn, $info, $user, $olddn); |
|
784 | 784 | } |
785 | 785 | |
786 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
786 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
787 | 787 | } |
788 | 788 | } |
789 | 789 | elseif ($action == 'MEMBER_TYPE_DELETE') |
790 | 790 | { |
791 | 791 | dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); |
792 | - if (! empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
|
792 | + if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') |
|
793 | 793 | { |
794 | - $ldap=new Ldap(); |
|
795 | - $result=$ldap->connect_bind(); |
|
794 | + $ldap = new Ldap(); |
|
795 | + $result = $ldap->connect_bind(); |
|
796 | 796 | |
797 | 797 | if ($result > 0) |
798 | 798 | { |
799 | - $info=$object->_load_ldap_info(); |
|
800 | - $dn=$object->_load_ldap_dn($info); |
|
799 | + $info = $object->_load_ldap_info(); |
|
800 | + $dn = $object->_load_ldap_dn($info); |
|
801 | 801 | |
802 | - $result=$ldap->delete($dn); |
|
802 | + $result = $ldap->delete($dn); |
|
803 | 803 | } |
804 | 804 | |
805 | - if ($result < 0) $this->error="ErrorLDAP ".$ldap->error; |
|
805 | + if ($result < 0) $this->error = "ErrorLDAP ".$ldap->error; |
|
806 | 806 | } |
807 | 807 | } |
808 | 808 |