@@ -52,13 +52,13 @@ discard block |
||
| 52 | 52 | // Note: the function dol_getprefix may have been redefined to return a different key to manage another area to protect. |
| 53 | 53 | $prefix = DolUtils::dol_getprefix(''); |
| 54 | 54 | |
| 55 | - $this->sessionname = 'DOLSESSID_' . $prefix; |
|
| 56 | - $sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix; |
|
| 55 | + $this->sessionname = 'DOLSESSID_'.$prefix; |
|
| 56 | + $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; |
|
| 57 | 57 | if (!empty($_COOKIE[$sessiontimeout])) { |
| 58 | 58 | ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]); |
| 59 | 59 | } |
| 60 | 60 | session_name($this->sessionname); |
| 61 | - session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start. |
|
| 61 | + session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start. |
|
| 62 | 62 | // This create lock, released when session_write_close() or end of page. |
| 63 | 63 | // We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished. |
| 64 | 64 | if (!defined('NOSESSION')) { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | Globals::$conf->browser->name = $tmp['browsername']; |
| 82 | 82 | Globals::$conf->browser->os = $tmp['browseros']; |
| 83 | 83 | Globals::$conf->browser->version = $tmp['browserversion']; |
| 84 | - Globals::$conf->browser->layout = $tmp['layout']; // 'classic', 'phone', 'tablet' |
|
| 84 | + Globals::$conf->browser->layout = $tmp['layout']; // 'classic', 'phone', 'tablet' |
|
| 85 | 85 | //var_dump(Globals::$conf->browser); |
| 86 | 86 | |
| 87 | 87 | if (Globals::$conf->browser->layout == 'phone') { |
@@ -102,18 +102,18 @@ discard block |
||
| 102 | 102 | $newurl = preg_replace('/^http:/i', 'https:', $_SERVER["SCRIPT_URI"]); |
| 103 | 103 | } |
| 104 | 104 | } else { // Check HTTPS environment variable (Apache/mod_ssl only) |
| 105 | - $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT) . $_SERVER["REQUEST_URI"]; |
|
| 105 | + $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT).$_SERVER["REQUEST_URI"]; |
|
| 106 | 106 | } |
| 107 | 107 | } else { |
| 108 | 108 | // Check HTTPS environment variable (Apache/mod_ssl only) |
| 109 | - $newurl = Globals::$conf->file->main_force_https . $_SERVER["REQUEST_URI"]; |
|
| 109 | + $newurl = Globals::$conf->file->main_force_https.$_SERVER["REQUEST_URI"]; |
|
| 110 | 110 | } |
| 111 | 111 | // Start redirect |
| 112 | 112 | if ($newurl) { |
| 113 | - DolUtils::dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to " . $newurl); |
|
| 113 | + DolUtils::dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl); |
|
| 114 | 114 | echo $newurl; |
| 115 | 115 | throw Exception('x'); |
| 116 | - header("Location: " . $newurl); |
|
| 116 | + header("Location: ".$newurl); |
|
| 117 | 117 | exit; |
| 118 | 118 | } else { |
| 119 | 119 | DolUtils::dol_syslog("main.inc: dolibarr_main_force_https is on but we failed to forge new https url so no redirect is done", LOG_WARNING); |
@@ -138,29 +138,29 @@ discard block |
||
| 138 | 138 | |
| 139 | 139 | // Loading of additional presentation includes |
| 140 | 140 | if (!defined('NOREQUIREHTML')) { |
| 141 | - require_once DOL_BASE_PATH . '/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2) |
|
| 141 | + require_once DOL_BASE_PATH.'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2) |
|
| 142 | 142 | } |
| 143 | 143 | if (!defined('NOREQUIREAJAX') && Globals::$conf->use_javascript_ajax) { |
| 144 | - require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php'; // Need 22ko memory |
|
| 144 | + require_once DOL_BASE_PATH.'/core/lib/ajax.lib.php'; // Need 22ko memory |
|
| 145 | 145 | } |
| 146 | 146 | // If install or upgrade process not done or not completely finished, we call the install page. |
| 147 | 147 | if (!empty(Globals::$conf->global->MAIN_NOT_INSTALLED) || !empty(Globals::$conf->global->MAIN_NOT_UPGRADED)) { |
| 148 | 148 | DolUtils::dol_syslog("main.inc: A previous install or upgrade was not complete. Redirect to install page.", LOG_WARNING); |
| 149 | 149 | throw Exception('x'); |
| 150 | - header("Location: " . DOL_BASE_URI . "/install/index.php"); |
|
| 150 | + header("Location: ".DOL_BASE_URI."/install/index.php"); |
|
| 151 | 151 | exit; |
| 152 | 152 | } |
| 153 | 153 | // If an upgrade process is required, we call the install page. |
| 154 | 154 | if ((!empty(Globals::$conf->global->MAIN_VERSION_LAST_UPGRADE) && (Globals::$conf->global->MAIN_VERSION_LAST_UPGRADE != DOL_VERSION)) || (empty(Globals::$conf->global->MAIN_VERSION_LAST_UPGRADE) && !empty(Globals::$conf->global->MAIN_VERSION_LAST_INSTALL) && (Globals::$conf->global->MAIN_VERSION_LAST_INSTALL != DOL_VERSION))) { |
| 155 | 155 | $versiontocompare = empty(Globals::$conf->global->MAIN_VERSION_LAST_UPGRADE) ? Globals::$conf->global->MAIN_VERSION_LAST_INSTALL : Globals::$conf->global->MAIN_VERSION_LAST_UPGRADE; |
| 156 | - require_once DOL_BASE_PATH . '/core/lib/admin.lib.php'; |
|
| 156 | + require_once DOL_BASE_PATH.'/core/lib/admin.lib.php'; |
|
| 157 | 157 | $dolibarrversionlastupgrade = preg_split('/[.-]/', $versiontocompare); |
| 158 | 158 | $dolibarrversionprogram = preg_split('/[.-]/', DOL_VERSION); |
| 159 | 159 | $rescomp = versioncompare($dolibarrversionprogram, $dolibarrversionlastupgrade); |
| 160 | 160 | if ($rescomp > 0) { // Programs have a version higher than database. We did not add "&& $rescomp < 3" because we want upgrade process for build upgrades |
| 161 | - DolUtils::dol_syslog("main.inc: database version " . $versiontocompare . " is lower than programs version " . DOL_VERSION . ". Redirect to install page.", LOG_WARNING); |
|
| 161 | + DolUtils::dol_syslog("main.inc: database version ".$versiontocompare." is lower than programs version ".DOL_VERSION.". Redirect to install page.", LOG_WARNING); |
|
| 162 | 162 | throw Exception('x'); |
| 163 | - header("Location: " . DOL_BASE_URI . "/install/index.php"); |
|
| 163 | + header("Location: ".DOL_BASE_URI."/install/index.php"); |
|
| 164 | 164 | exit; |
| 165 | 165 | } |
| 166 | 166 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | if ($_SERVER['REQUEST_METHOD'] === 'POST') { // This test must be after loading $_SESSION['token']. |
| 186 | 186 | if (DolUtils::GETPOST('token', 'alpha') != $_SESSION['token']) { |
| 187 | - DolUtils::dol_syslog("Invalid token in " . $_SERVER['HTTP_REFERER'] . ", action=" . DolUtils::GETPOST('action', 'aZ09') . ", _POST['token']=" . DolUtils::GETPOST('token', 'alpha') . ", _SESSION['token']=" . $_SESSION['token'], LOG_WARNING); |
|
| 187 | + DolUtils::dol_syslog("Invalid token in ".$_SERVER['HTTP_REFERER'].", action=".DolUtils::GETPOST('action', 'aZ09').", _POST['token']=".DolUtils::GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING); |
|
| 188 | 188 | //print 'Unset POST by CSRF protection in main.inc.php.'; // Do not output anything because this create problems when using the BACK button on browsers. |
| 189 | 189 | unset($_POST); |
| 190 | 190 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | if (DolUtils::GETPOST('theme', 'alpha')) { |
| 218 | 218 | Globals::$conf->theme = DolUtils::GETPOST('theme', 'alpha', 1); |
| 219 | 219 | // Globals::$conf->css = "/theme/" . Globals::$conf->theme . "/style.css.php"; |
| 220 | - Globals::$conf->css = '?controller=theme/' . Globals::$conf->theme . '&method=style.css'; |
|
| 220 | + Globals::$conf->css = '?controller=theme/'.Globals::$conf->theme.'&method=style.css'; |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | if (!empty(Globals::$conf->dol_use_jmobile) && in_array(Globals::$conf->theme, array('bureau2crea', 'cameleo', 'amarok'))) { |
| 268 | 268 | Globals::$conf->theme = 'eldy'; |
| 269 | 269 | // Globals::$conf->css = "/theme/" . Globals::$conf->theme . "/style.css.php"; |
| 270 | - Globals::$conf->css = '?controller=theme/' . Globals::$conf->theme . '&method=style.css'; |
|
| 270 | + Globals::$conf->css = '?controller=theme/'.Globals::$conf->theme.'&method=style.css'; |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | if (!defined('NOREQUIRETRAN')) { |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | |
| 307 | - DolUtils::dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . ' - action=' . DolUtils::GETPOST('action', 'az09') . ', massaction=' . DolUtils::GETPOST('massaction', 'az09')); |
|
| 307 | + DolUtils::dol_syslog("--- Access to ".$_SERVER["PHP_SELF"].' - action='.DolUtils::GETPOST('action', 'az09').', massaction='.DolUtils::GETPOST('massaction', 'az09')); |
|
| 308 | 308 | //Another call for easy debugg |
| 309 | 309 | //dol_syslog("Access to ".$_SERVER["PHP_SELF"].' GET='.join(',',array_keys($_GET)).'->'.join(',',$_GET).' POST:'.join(',',array_keys($_POST)).'->'.join(',',$_POST)); |
| 310 | 310 | // Load main languages files |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | // Define some constants used for style of arrays |
| 317 | 317 | $bc = array(0 => 'class="impair"', 1 => 'class="pair"'); |
| 318 | 318 | $bcdd = array(0 => 'class="drag drop oddeven"', 1 => 'class="drag drop oddeven"'); |
| 319 | - $bcnd = array(0 => 'class="nodrag nodrop nohover"', 1 => 'class="nodrag nodrop nohoverpair"'); // Used for tr to add new lines |
|
| 319 | + $bcnd = array(0 => 'class="nodrag nodrop nohover"', 1 => 'class="nodrag nodrop nohoverpair"'); // Used for tr to add new lines |
|
| 320 | 320 | $bctag = array(0 => 'class="impair tagtr"', 1 => 'class="pair tagtr"'); |
| 321 | 321 | |
| 322 | 322 | // Define messages variables |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | // Load the menu manager (only if not already done) |
| 365 | 365 | $file_menu = Globals::$conf->standard_menu; |
| 366 | 366 | if (DolUtils::GETPOST('menu', 'alpha')) { |
| 367 | - $file_menu = DolUtils::GETPOST('menu', 'alpha'); // example: menu=eldy_menu.php |
|
| 367 | + $file_menu = DolUtils::GETPOST('menu', 'alpha'); // example: menu=eldy_menu.php |
|
| 368 | 368 | } |
| 369 | 369 | if (!class_exists('MenuManager')) { |
| 370 | 370 | $menufound = 0; |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | } |
| 377 | 377 | } |
| 378 | 378 | if (!class_exists('MenuManager')) { // If failed to include, we try with standard eldy_menu.php |
| 379 | - DolUtils::dol_syslog("You define a menu manager '" . $file_menu . "' that can not be loaded.", LOG_WARNING); |
|
| 379 | + DolUtils::dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING); |
|
| 380 | 380 | $file_menu = 'eldy_menu.php'; |
| 381 | 381 | // include_once DOL_DOCUMENT_ROOT . "/core/menus/standard/" . $file_menu; |
| 382 | 382 | } |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | |
| 421 | 421 | // This is to make Dolibarr working with Plesk |
| 422 | 422 | if (!empty($_SERVER['DOCUMENT_ROOT']) && substr($_SERVER['DOCUMENT_ROOT'], -6) !== 'htdocs') { |
| 423 | - set_include_path($_SERVER['DOCUMENT_ROOT'] . '/htdocs'); |
|
| 423 | + set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | // If there is a POST parameter to tell to save automatically some POST parameters into cookies, we do it. |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | $tmplist = explode(',', $tmpautoset[1]); |
| 432 | 432 | $cookiearrayvalue = array(); |
| 433 | 433 | foreach ($tmplist as $tmpkey) { |
| 434 | - $postkey = $tmpautoset[0] . '_' . $tmpkey; |
|
| 434 | + $postkey = $tmpautoset[0].'_'.$tmpkey; |
|
| 435 | 435 | //var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]); |
| 436 | 436 | if (!empty($_POST[$postkey])) { |
| 437 | 437 | $cookiearrayvalue[$tmpkey] = $_POST[$postkey]; |
@@ -492,8 +492,8 @@ discard block |
||
| 492 | 492 | $inj += preg_match('/insert\s+into/i', $val); |
| 493 | 493 | $inj += preg_match('/select\s+from/i', $val); |
| 494 | 494 | $inj += preg_match('/into\s+(outfile|dumpfile)/i', $val); |
| 495 | - $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() that return current database login |
|
| 496 | - $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database |
|
| 495 | + $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() that return current database login |
|
| 496 | + $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database |
|
| 497 | 497 | } |
| 498 | 498 | if ($type == 3) { |
| 499 | 499 | $inj += preg_match('/select|update|delete|replace|group\s+by|concat|count|from/i', $val); |
@@ -517,15 +517,15 @@ discard block |
||
| 517 | 517 | $inj += preg_match('/<style/i', $val); |
| 518 | 518 | } |
| 519 | 519 | $inj += preg_match('/base[\s]+href/si', $val); |
| 520 | - $inj += preg_match('/<.*onmouse/si', $val); // onmousexxx can be set on img or any html tag like <img title='...' onmouseover=alert(1)> |
|
| 521 | - $inj += preg_match('/onerror\s*=/i', $val); // onerror can be set on img or any html tag like <img title='...' onerror = alert(1)> |
|
| 522 | - $inj += preg_match('/onfocus\s*=/i', $val); // onfocus can be set on input text html tag like <input type='text' value='...' onfocus = alert(1)> |
|
| 523 | - $inj += preg_match('/onload\s*=/i', $val); // onload can be set on svg tag <svg/onload=alert(1)> or other tag like body <body onload=alert(1)> |
|
| 524 | - $inj += preg_match('/onloadstart\s*=/i', $val); // onload can be set on audio tag <audio onloadstart=alert(1)> |
|
| 525 | - $inj += preg_match('/onclick\s*=/i', $val); // onclick can be set on img text html tag like <img onclick = alert(1)> |
|
| 526 | - $inj += preg_match('/onscroll\s*=/i', $val); // onscroll can be on textarea |
|
| 520 | + $inj += preg_match('/<.*onmouse/si', $val); // onmousexxx can be set on img or any html tag like <img title='...' onmouseover=alert(1)> |
|
| 521 | + $inj += preg_match('/onerror\s*=/i', $val); // onerror can be set on img or any html tag like <img title='...' onerror = alert(1)> |
|
| 522 | + $inj += preg_match('/onfocus\s*=/i', $val); // onfocus can be set on input text html tag like <input type='text' value='...' onfocus = alert(1)> |
|
| 523 | + $inj += preg_match('/onload\s*=/i', $val); // onload can be set on svg tag <svg/onload=alert(1)> or other tag like body <body onload=alert(1)> |
|
| 524 | + $inj += preg_match('/onloadstart\s*=/i', $val); // onload can be set on audio tag <audio onloadstart=alert(1)> |
|
| 525 | + $inj += preg_match('/onclick\s*=/i', $val); // onclick can be set on img text html tag like <img onclick = alert(1)> |
|
| 526 | + $inj += preg_match('/onscroll\s*=/i', $val); // onscroll can be on textarea |
|
| 527 | 527 | //$inj += preg_match('/on[A-Z][a-z]+\*=/', $val); // To lock event handlers onAbort(), ... |
| 528 | - $inj += preg_match('/:|:|:/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...' |
|
| 528 | + $inj += preg_match('/:|:|:/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...' |
|
| 529 | 529 | //if ($type == 1) |
| 530 | 530 | //{ |
| 531 | 531 | $inj += preg_match('/javascript:/i', $val); |
@@ -533,10 +533,10 @@ discard block |
||
| 533 | 533 | //} |
| 534 | 534 | // For XSS Injection done by adding javascript closing html tags like with onmousemove, etc... (closing a src or href tag with not cleaned param) |
| 535 | 535 | if ($type == 1) { |
| 536 | - $inj += preg_match('/"/i', $val); // We refused " in GET parameters value |
|
| 536 | + $inj += preg_match('/"/i', $val); // We refused " in GET parameters value |
|
| 537 | 537 | } |
| 538 | 538 | if ($type == 2) { |
| 539 | - $inj += preg_match('/[;"]/', $val); // PHP_SELF is a file system path. It can contains spaces. |
|
| 539 | + $inj += preg_match('/[;"]/', $val); // PHP_SELF is a file system path. It can contains spaces. |
|
| 540 | 540 | } |
| 541 | 541 | return $inj; |
| 542 | 542 | } |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | if ($this->analyseVarsForSqlAndScriptsInjection($key, $type) && $this->analyseVarsForSqlAndScriptsInjection($value, $type)) { |
| 556 | 556 | //$var[$key] = $value; // This is useless |
| 557 | 557 | } else { |
| 558 | - print 'Access refused by SQL/Script injection protection in main.inc.php (type=' . htmlentities($type) . ' key=' . htmlentities($key) . ' value=' . htmlentities($value) . ' page=' . htmlentities($_SERVER["REQUEST_URI"]) . ')'; |
|
| 558 | + print 'Access refused by SQL/Script injection protection in main.inc.php (type='.htmlentities($type).' key='.htmlentities($key).' value='.htmlentities($value).' page='.htmlentities($_SERVER["REQUEST_URI"]).')'; |
|
| 559 | 559 | exit; |
| 560 | 560 | } |
| 561 | 561 | } |
@@ -626,20 +626,20 @@ discard block |
||
| 626 | 626 | |
| 627 | 627 | // dol_syslog("POST key=".join(array_keys($_POST),',').' value='.join($_POST,',')); |
| 628 | 628 | // If in demo mode, we check we go to home page through the public/demo/index.php page |
| 629 | - if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_BASE_URI . '/index.php') { |
|
| 629 | + if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_BASE_URI.'/index.php') { |
|
| 630 | 630 | // We ask index page |
| 631 | 631 | if (empty($_SERVER['HTTP_REFERER']) || !preg_match('/public/', $_SERVER['HTTP_REFERER'])) { |
| 632 | - DolUtils::dol_syslog("Call index page from another url than demo page (call is done from page " . $_SERVER['HTTP_REFERER'] . ")"); |
|
| 632 | + DolUtils::dol_syslog("Call index page from another url than demo page (call is done from page ".$_SERVER['HTTP_REFERER'].")"); |
|
| 633 | 633 | $url = ''; |
| 634 | - $url .= ($url ? '&' : '') . ($dol_hide_topmenu ? 'dol_hide_topmenu=' . $dol_hide_topmenu : ''); |
|
| 635 | - $url .= ($url ? '&' : '') . ($dol_hide_leftmenu ? 'dol_hide_leftmenu=' . $dol_hide_leftmenu : ''); |
|
| 636 | - $url .= ($url ? '&' : '') . ($dol_optimize_smallscreen ? 'dol_optimize_smallscreen=' . $dol_optimize_smallscreen : ''); |
|
| 637 | - $url .= ($url ? '&' : '') . ($dol_no_mouse_hover ? 'dol_no_mouse_hover=' . $dol_no_mouse_hover : ''); |
|
| 638 | - $url .= ($url ? '&' : '') . ($dol_use_jmobile ? 'dol_use_jmobile=' . $dol_use_jmobile : ''); |
|
| 639 | - $url = DOL_BASE_URI . '/public/demo/index.php' . ($url ? '?' . $url : ''); |
|
| 634 | + $url .= ($url ? '&' : '').($dol_hide_topmenu ? 'dol_hide_topmenu='.$dol_hide_topmenu : ''); |
|
| 635 | + $url .= ($url ? '&' : '').($dol_hide_leftmenu ? 'dol_hide_leftmenu='.$dol_hide_leftmenu : ''); |
|
| 636 | + $url .= ($url ? '&' : '').($dol_optimize_smallscreen ? 'dol_optimize_smallscreen='.$dol_optimize_smallscreen : ''); |
|
| 637 | + $url .= ($url ? '&' : '').($dol_no_mouse_hover ? 'dol_no_mouse_hover='.$dol_no_mouse_hover : ''); |
|
| 638 | + $url .= ($url ? '&' : '').($dol_use_jmobile ? 'dol_use_jmobile='.$dol_use_jmobile : ''); |
|
| 639 | + $url = DOL_BASE_URI.'/public/demo/index.php'.($url ? '?'.$url : ''); |
|
| 640 | 640 | echo $url; |
| 641 | 641 | throw Exception('x'); |
| 642 | - header("Location: " . $url); |
|
| 642 | + header("Location: ".$url); |
|
| 643 | 643 | exit; |
| 644 | 644 | } |
| 645 | 645 | } |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | $test = false; |
| 661 | 661 | |
| 662 | 662 | // Call trigger for the "security events" log |
| 663 | - Globals::$user->trigger_mesg = 'ErrorBadValueForCode - login=' . DolUtils::GETPOST("username", "alpha", 2); |
|
| 663 | + Globals::$user->trigger_mesg = 'ErrorBadValueForCode - login='.DolUtils::GETPOST("username", "alpha", 2); |
|
| 664 | 664 | |
| 665 | 665 | // Call of triggers |
| 666 | 666 | //include_once DOL_BASE_PATH . '/core/class/interfaces.class.php'; |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | $action = ''; |
| 676 | 676 | Globals::$hookManager->initHooks(array('login')); |
| 677 | 677 | $parameters = array('dol_authmode' => $this->dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
| 678 | - $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
| 678 | + $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
| 679 | 679 | if ($reshook < 0) { |
| 680 | 680 | $error++; |
| 681 | 681 | } |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | } |
| 761 | 761 | |
| 762 | 762 | // Call trigger for the "security events" log |
| 763 | - Globals::$user->trigger_mesg = Globals::$langs->trans("ErrorBadLoginPassword") . ' - login=' . DolUtils::GETPOST("username", "alpha", 2); |
|
| 763 | + Globals::$user->trigger_mesg = Globals::$langs->trans("ErrorBadLoginPassword").' - login='.DolUtils::GETPOST("username", "alpha", 2); |
|
| 764 | 764 | |
| 765 | 765 | // Call of triggers |
| 766 | 766 | //include_once DOL_BASE_PATH . '/core/class/interfaces.class.php'; |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | $action = ''; |
| 775 | 775 | Globals::$hookManager->initHooks(array('login')); |
| 776 | 776 | $parameters = array('dol_authmode' => $this->dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
| 777 | - $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
| 777 | + $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
| 778 | 778 | if ($reshook < 0) { |
| 779 | 779 | $error++; |
| 780 | 780 | } |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | // End test login / passwords |
| 787 | 787 | if (!$login || (in_array('ldap', $this->authmode) && empty($passwordtotest))) { // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success. |
| 788 | 788 | // No data to test login, so we show the login page |
| 789 | - DolUtils::dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . " showing the login form and exit"); |
|
| 789 | + DolUtils::dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." showing the login form and exit"); |
|
| 790 | 790 | if (defined('NOREDIRECTBYMAINTOLOGIN')) { |
| 791 | 791 | return 'ERROR_NOT_LOGGED'; |
| 792 | 792 | } else { |
@@ -800,8 +800,8 @@ discard block |
||
| 800 | 800 | DolUtils::dol_syslog('User not found, connexion refused'); |
| 801 | 801 | session_destroy(); |
| 802 | 802 | session_name($this->sessionname); |
| 803 | - session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie |
|
| 804 | - session_start(); // Fixing the bug of register_globals here is useless since session is empty |
|
| 803 | + session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie |
|
| 804 | + session_start(); // Fixing the bug of register_globals here is useless since session is empty |
|
| 805 | 805 | |
| 806 | 806 | if ($resultFetchUser == 0) { |
| 807 | 807 | // Load translation files required by page |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | |
| 810 | 810 | $_SESSION["dol_loginmesg"] = Globals::$langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login); |
| 811 | 811 | |
| 812 | - Globals::$user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login=' . $login; |
|
| 812 | + Globals::$user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login; |
|
| 813 | 813 | } |
| 814 | 814 | if ($resultFetchUser < 0) { |
| 815 | 815 | $_SESSION["dol_loginmesg"] = Globals::$user->error; |
@@ -829,24 +829,24 @@ discard block |
||
| 829 | 829 | $action = ''; |
| 830 | 830 | Globals::$hookManager->initHooks(array('login')); |
| 831 | 831 | $parameters = array('dol_authmode' => $this->dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
| 832 | - $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
| 832 | + $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
| 833 | 833 | if ($reshook < 0) { |
| 834 | 834 | $error++; |
| 835 | 835 | } |
| 836 | 836 | |
| 837 | 837 | $paramsurl = array(); |
| 838 | 838 | if (DolUtils::GETPOST('textbrowser', 'int')) { |
| 839 | - $paramsurl[] = 'textbrowser=' . DolUtils::GETPOST('textbrowser', 'int'); |
|
| 839 | + $paramsurl[] = 'textbrowser='.DolUtils::GETPOST('textbrowser', 'int'); |
|
| 840 | 840 | } |
| 841 | 841 | if (DolUtils::GETPOST('nojs', 'int')) { |
| 842 | - $paramsurl[] = 'nojs=' . DolUtils::GETPOST('nojs', 'int'); |
|
| 842 | + $paramsurl[] = 'nojs='.DolUtils::GETPOST('nojs', 'int'); |
|
| 843 | 843 | } |
| 844 | 844 | if (DolUtils::GETPOST('lang', 'aZ09')) { |
| 845 | - $paramsurl[] = 'lang=' . DolUtils::GETPOST('lang', 'aZ09'); |
|
| 845 | + $paramsurl[] = 'lang='.DolUtils::GETPOST('lang', 'aZ09'); |
|
| 846 | 846 | } |
| 847 | - echo 'Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''); |
|
| 847 | + echo 'Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : ''); |
|
| 848 | 848 | throw Exception('x'); |
| 849 | - header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : '')); |
|
| 849 | + header('Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : '')); |
|
| 850 | 850 | exit; |
| 851 | 851 | } |
| 852 | 852 | } |
@@ -855,16 +855,16 @@ discard block |
||
| 855 | 855 | // We are already into an authenticated session |
| 856 | 856 | $login = $_SESSION["dol_login"]; |
| 857 | 857 | $entity = $_SESSION["dol_entity"]; |
| 858 | - DolUtils::dol_syslog("- This is an already logged session. _SESSION['dol_login']=" . $login . " _SESSION['dol_entity']=" . $entity, LOG_DEBUG); |
|
| 858 | + DolUtils::dol_syslog("- This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG); |
|
| 859 | 859 | |
| 860 | 860 | $resultFetchUser = Globals::$user->fetch('', $login, '', 1, ($entity > 0 ? $entity : -1)); |
| 861 | 861 | if ($resultFetchUser <= 0) { |
| 862 | 862 | // Account has been removed after login |
| 863 | - DolUtils::dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=" . $login, LOG_WARNING); |
|
| 863 | + DolUtils::dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING); |
|
| 864 | 864 | session_destroy(); |
| 865 | 865 | session_name($this->sessionname); |
| 866 | - session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie |
|
| 867 | - session_start(); // Fixing the bug of register_globals here is useless since session is empty |
|
| 866 | + session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie |
|
| 867 | + session_start(); // Fixing the bug of register_globals here is useless since session is empty |
|
| 868 | 868 | |
| 869 | 869 | if ($resultFetchUser == 0) { |
| 870 | 870 | // Load translation files required by page |
@@ -872,7 +872,7 @@ discard block |
||
| 872 | 872 | |
| 873 | 873 | $_SESSION["dol_loginmesg"] = Globals::$langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login); |
| 874 | 874 | |
| 875 | - Globals::$user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login=' . $login; |
|
| 875 | + Globals::$user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login; |
|
| 876 | 876 | } |
| 877 | 877 | if ($resultFetchUser < 0) { |
| 878 | 878 | $_SESSION["dol_loginmesg"] = Globals::$user->error; |
@@ -892,24 +892,24 @@ discard block |
||
| 892 | 892 | $action = ''; |
| 893 | 893 | Globals::$hookManager->initHooks(array('login')); |
| 894 | 894 | $parameters = array('dol_authmode' => $this->dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
| 895 | - $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
| 895 | + $reshook = Globals::$hookManager->executeHooks('afterLoginFailed', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
| 896 | 896 | if ($reshook < 0) { |
| 897 | 897 | $error++; |
| 898 | 898 | } |
| 899 | 899 | |
| 900 | 900 | $paramsurl = array(); |
| 901 | 901 | if (DolUtils::GETPOST('textbrowser', 'int')) { |
| 902 | - $paramsurl[] = 'textbrowser=' . DolUtils::GETPOST('textbrowser', 'int'); |
|
| 902 | + $paramsurl[] = 'textbrowser='.DolUtils::GETPOST('textbrowser', 'int'); |
|
| 903 | 903 | } |
| 904 | 904 | if (DolUtils::GETPOST('nojs', 'int')) { |
| 905 | - $paramsurl[] = 'nojs=' . DolUtils::GETPOST('nojs', 'int'); |
|
| 905 | + $paramsurl[] = 'nojs='.DolUtils::GETPOST('nojs', 'int'); |
|
| 906 | 906 | } |
| 907 | 907 | if (DolUtils::GETPOST('lang', 'aZ09')) { |
| 908 | - $paramsurl[] = 'lang=' . DolUtils::GETPOST('lang', 'aZ09'); |
|
| 908 | + $paramsurl[] = 'lang='.DolUtils::GETPOST('lang', 'aZ09'); |
|
| 909 | 909 | } |
| 910 | - echo 'Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''); |
|
| 910 | + echo 'Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : ''); |
|
| 911 | 911 | throw Exception('x'); |
| 912 | - header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : '')); |
|
| 912 | + header('Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : '')); |
|
| 913 | 913 | exit; |
| 914 | 914 | } else { |
| 915 | 915 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
@@ -918,30 +918,30 @@ discard block |
||
| 918 | 918 | // Code for search criteria persistence. |
| 919 | 919 | if (!empty($_GET['save_lastsearch_values'])) { // We must use $_GET here |
| 920 | 920 | $relativepathstring = preg_replace('/\?.*$/', '', $_SERVER["HTTP_REFERER"]); |
| 921 | - $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring); // Get full path except host server |
|
| 921 | + $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring); // Get full path except host server |
|
| 922 | 922 | // Clean $relativepathstring |
| 923 | 923 | if (constant('DOL_BASE_URI')) { |
| 924 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
| 924 | + $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring); |
|
| 925 | 925 | } |
| 926 | 926 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
| 927 | 927 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
| 928 | 928 | //var_dump($relativepathstring); |
| 929 | 929 | // We click on a link that leave a page we have to save search criteria, contextpage, limit and page. We save them from tmp to no tmp |
| 930 | - if (!empty($_SESSION['lastsearch_values_tmp_' . $relativepathstring])) { |
|
| 931 | - $_SESSION['lastsearch_values_' . $relativepathstring] = $_SESSION['lastsearch_values_tmp_' . $relativepathstring]; |
|
| 932 | - unset($_SESSION['lastsearch_values_tmp_' . $relativepathstring]); |
|
| 930 | + if (!empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) { |
|
| 931 | + $_SESSION['lastsearch_values_'.$relativepathstring] = $_SESSION['lastsearch_values_tmp_'.$relativepathstring]; |
|
| 932 | + unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); |
|
| 933 | 933 | } |
| 934 | - if (!empty($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring])) { |
|
| 935 | - $_SESSION['lastsearch_contextpage_' . $relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]; |
|
| 936 | - unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]); |
|
| 934 | + if (!empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) { |
|
| 935 | + $_SESSION['lastsearch_contextpage_'.$relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]; |
|
| 936 | + unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); |
|
| 937 | 937 | } |
| 938 | - if (!empty($_SESSION['lastsearch_page_tmp_' . $relativepathstring]) && $_SESSION['lastsearch_page_tmp_' . $relativepathstring] > 1) { |
|
| 939 | - $_SESSION['lastsearch_page_' . $relativepathstring] = $_SESSION['lastsearch_page_tmp_' . $relativepathstring]; |
|
| 940 | - unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]); |
|
| 938 | + if (!empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 1) { |
|
| 939 | + $_SESSION['lastsearch_page_'.$relativepathstring] = $_SESSION['lastsearch_page_tmp_'.$relativepathstring]; |
|
| 940 | + unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]); |
|
| 941 | 941 | } |
| 942 | - if (!empty($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]) && $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] != Globals::$conf->liste_limit) { |
|
| 943 | - $_SESSION['lastsearch_limit_' . $relativepathstring] = $_SESSION['lastsearch_limit_tmp_' . $relativepathstring]; |
|
| 944 | - unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]); |
|
| 942 | + if (!empty($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] != Globals::$conf->liste_limit) { |
|
| 943 | + $_SESSION['lastsearch_limit_'.$relativepathstring] = $_SESSION['lastsearch_limit_tmp_'.$relativepathstring]; |
|
| 944 | + unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]); |
|
| 945 | 945 | } |
| 946 | 946 | } |
| 947 | 947 | |
@@ -990,14 +990,14 @@ discard block |
||
| 990 | 990 | $_SESSION['dol_use_jmobile'] = $dol_use_jmobile; |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | - DolUtils::dol_syslog("This is a new started user session. _SESSION['dol_login']=" . $_SESSION["dol_login"] . " Session id=" . session_id()); |
|
| 993 | + DolUtils::dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"]." Session id=".session_id()); |
|
| 994 | 994 | |
| 995 | 995 | // Config::$dbEngine->begin(); |
| 996 | 996 | Config::$dbEngine->beginTransaction(); |
| 997 | 997 | |
| 998 | 998 | Globals::$user->update_last_login_date(); |
| 999 | 999 | |
| 1000 | - $loginfo = 'TZ=' . $_SESSION["dol_tz"] . ';TZString=' . $_SESSION["dol_tz_string"] . ';Screen=' . $_SESSION["dol_screenwidth"] . 'x' . $_SESSION["dol_screenheight"]; |
|
| 1000 | + $loginfo = 'TZ='.$_SESSION["dol_tz"].';TZString='.$_SESSION["dol_tz_string"].';Screen='.$_SESSION["dol_screenwidth"].'x'.$_SESSION["dol_screenheight"]; |
|
| 1001 | 1001 | |
| 1002 | 1002 | // Call triggers for the "security events" log |
| 1003 | 1003 | Globals::$user->trigger_mesg = $loginfo; |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | $action = ''; |
| 1014 | 1014 | Globals::$hookManager->initHooks(array('login')); |
| 1015 | 1015 | $parameters = array('dol_authmode' => $this->dol_authmode, 'dol_loginfo' => $loginfo); |
| 1016 | - $reshook = Globals::$hookManager->executeHooks('afterLogin', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1016 | + $reshook = Globals::$hookManager->executeHooks('afterLogin', $parameters, Globals::$user, $action); // Note that $action and $object may have been modified by some hooks |
|
| 1017 | 1017 | if ($reshook < 0) { |
| 1018 | 1018 | $error++; |
| 1019 | 1019 | } |
@@ -1034,7 +1034,7 @@ discard block |
||
| 1034 | 1034 | if ($_SERVER["PHP_SELF"] != $newpath) { // not already on landing page (avoid infinite loop) |
| 1035 | 1035 | echo $newpath; |
| 1036 | 1036 | throw Exception('x'); |
| 1037 | - header('Location: ' . $newpath); |
|
| 1037 | + header('Location: '.$newpath); |
|
| 1038 | 1038 | exit; |
| 1039 | 1039 | } |
| 1040 | 1040 | } |
@@ -1065,7 +1065,7 @@ discard block |
||
| 1065 | 1065 | if (empty(Globals::$conf->global->MAIN_FORCETHEME) && !empty(Globals::$user->conf->MAIN_THEME)) { |
| 1066 | 1066 | Globals::$conf->theme = Globals::$user->conf->MAIN_THEME; |
| 1067 | 1067 | // Globals::$conf->css = "/theme/" . Globals::$conf->theme . "/style.css.php"; |
| 1068 | - Globals::$conf->css = '?controller=theme/' . Globals::$conf->theme . '&method=style.css'; |
|
| 1068 | + Globals::$conf->css = '?controller=theme/'.Globals::$conf->theme.'&method=style.css'; |
|
| 1069 | 1069 | } |
| 1070 | 1070 | } |
| 1071 | 1071 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | public $skype; |
| 56 | 56 | public $twitter; |
| 57 | 57 | public $facebook; |
| 58 | - public $job; // job position |
|
| 58 | + public $job; // job position |
|
| 59 | 59 | public $signature; |
| 60 | 60 | |
| 61 | 61 | /** |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public $address; |
| 65 | 65 | public $zip; |
| 66 | 66 | public $town; |
| 67 | - public $state_id; // The state/department |
|
| 67 | + public $state_id; // The state/department |
|
| 68 | 68 | public $state_code; |
| 69 | 69 | public $state; |
| 70 | 70 | public $office_phone; |
@@ -118,26 +118,26 @@ discard block |
||
| 118 | 118 | public $datepreviouslogin; |
| 119 | 119 | public $photo; |
| 120 | 120 | public $lang; |
| 121 | - public $rights; // Array of permissions user->rights->permx |
|
| 122 | - public $all_permissions_are_loaded; // All permission are loaded |
|
| 123 | - public $nb_rights; // Number of rights granted to the user |
|
| 124 | - private $_tab_loaded = array(); // Cache array of already loaded permissions |
|
| 125 | - public $conf; // To store personal config |
|
| 126 | - public $default_values; // To store default values for user |
|
| 127 | - public $lastsearch_values_tmp; // To store current search criterias for user |
|
| 128 | - public $lastsearch_values; // To store last saved search criterias for user |
|
| 129 | - public $users = array(); // To store all tree of users hierarchy |
|
| 130 | - public $parentof; // To store an array of all parents for all ids. |
|
| 121 | + public $rights; // Array of permissions user->rights->permx |
|
| 122 | + public $all_permissions_are_loaded; // All permission are loaded |
|
| 123 | + public $nb_rights; // Number of rights granted to the user |
|
| 124 | + private $_tab_loaded = array(); // Cache array of already loaded permissions |
|
| 125 | + public $conf; // To store personal config |
|
| 126 | + public $default_values; // To store default values for user |
|
| 127 | + public $lastsearch_values_tmp; // To store current search criterias for user |
|
| 128 | + public $lastsearch_values; // To store last saved search criterias for user |
|
| 129 | + public $users = array(); // To store all tree of users hierarchy |
|
| 130 | + public $parentof; // To store an array of all parents for all ids. |
|
| 131 | 131 | private $cache_childids; |
| 132 | - public $accountancy_code; // Accountancy code in prevision of the complete accountancy module |
|
| 133 | - public $thm; // Average cost of employee - Used for valuation of time spent |
|
| 134 | - public $tjm; // Average cost of employee |
|
| 135 | - public $salary; // Monthly salary - Denormalized value from llx_user_employment |
|
| 136 | - public $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment |
|
| 137 | - public $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment |
|
| 138 | - public $color; // Define background color for user in agenda |
|
| 139 | - public $dateemployment; // Define date of employment by company |
|
| 140 | - public $dateemploymentend; // Define date of employment end by company |
|
| 132 | + public $accountancy_code; // Accountancy code in prevision of the complete accountancy module |
|
| 133 | + public $thm; // Average cost of employee - Used for valuation of time spent |
|
| 134 | + public $tjm; // Average cost of employee |
|
| 135 | + public $salary; // Monthly salary - Denormalized value from llx_user_employment |
|
| 136 | + public $salaryextra; // Monthly salary extra - Denormalized value from llx_user_employment |
|
| 137 | + public $weeklyhours; // Weekly hours - Denormalized value from llx_user_employment |
|
| 138 | + public $color; // Define background color for user in agenda |
|
| 139 | + public $dateemployment; // Define date of employment by company |
|
| 140 | + public $dateemploymentend; // Define date of employment end by company |
|
| 141 | 141 | public $default_c_exp_tax_cat; |
| 142 | 142 | public $default_range; |
| 143 | 143 | public $fields = array( |
@@ -212,37 +212,37 @@ discard block |
||
| 212 | 212 | $sql .= " u.color,"; |
| 213 | 213 | $sql .= " u.dateemployment, u.dateemploymentend,"; |
| 214 | 214 | $sql .= " u.ref_int, u.ref_ext,"; |
| 215 | - $sql .= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode |
|
| 215 | + $sql .= " u.default_range, u.default_c_exp_tax_cat,"; // Expense report default mode |
|
| 216 | 216 | $sql .= " c.code as country_code, c.label as country,"; |
| 217 | 217 | $sql .= " d.code_departement as state_code, d.nom as state"; |
| 218 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
| 219 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as c ON u.fk_country = c.rowid"; |
|
| 220 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_departements as d ON u.fk_state = d.rowid"; |
|
| 218 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
| 219 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON u.fk_country = c.rowid"; |
|
| 220 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON u.fk_state = d.rowid"; |
|
| 221 | 221 | |
| 222 | 222 | if ($entity < 0) {
|
| 223 | 223 | if ((empty(Globals::$conf->multicompany->enabled) || empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE)) && (!empty(Globals::$user->entity))) {
|
| 224 | - $sql .= " WHERE u.entity IN (0," . Globals::$conf->entity . ")"; |
|
| 224 | + $sql .= " WHERE u.entity IN (0,".Globals::$conf->entity.")"; |
|
| 225 | 225 | } else {
|
| 226 | - $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
| 226 | + $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
| 227 | 227 | } |
| 228 | 228 | } else { // The fetch was forced on an entity
|
| 229 | 229 | if (!empty(Globals::$conf->multicompany->enabled) && !empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
| 230 | - $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
| 230 | + $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database |
|
| 231 | 231 | } else {
|
| 232 | - $sql .= " WHERE u.entity IN (0, " . (($entity != '' && $entity >= 0) ? $entity : Globals::$conf->entity) . ")"; // search in entity provided in parameter |
|
| 232 | + $sql .= " WHERE u.entity IN (0, ".(($entity != '' && $entity >= 0) ? $entity : Globals::$conf->entity).")"; // search in entity provided in parameter |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | if ($sid) { // permet une recherche du user par son SID ActiveDirectory ou Samba
|
| 237 | 237 | //$sql .= " AND (u.ldap_sid = '" . Config::$dbEngine->escape($sid) . "' OR u.login = '" . Config::$dbEngine->escape($login) . "') LIMIT 1"; |
| 238 | - $sql .= " AND (u.ldap_sid = '" . $sid . "' OR u.login = '" . Config::$dbEngine->escape($login) . "') LIMIT 1"; |
|
| 238 | + $sql .= " AND (u.ldap_sid = '".$sid."' OR u.login = '".Config::$dbEngine->escape($login)."') LIMIT 1"; |
|
| 239 | 239 | } else if ($login) {
|
| 240 | 240 | // $sql .= " AND u.login = '" . Config::$dbEngine->escape($login) . "'"; |
| 241 | - $sql .= " AND u.login = '" . $login . "'"; |
|
| 241 | + $sql .= " AND u.login = '".$login."'"; |
|
| 242 | 242 | } else {
|
| 243 | - $sql .= " AND u.rowid = " . $id; |
|
| 243 | + $sql .= " AND u.rowid = ".$id; |
|
| 244 | 244 | } |
| 245 | - $sql .= " ORDER BY u.entity ASC"; // Avoid random result when there is 2 login in 2 different entities |
|
| 245 | + $sql .= " ORDER BY u.entity ASC"; // Avoid random result when there is 2 login in 2 different entities |
|
| 246 | 246 | |
| 247 | 247 | $result = Config::$dbEngine->select($sql); |
| 248 | 248 | // echo "<p>SQL in 2477 of User: '$sql'</p>"; |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | $this->datelastlogin = $obj->datel; |
| 329 | 329 | $this->datepreviouslogin = $obj->datep; |
| 330 | 330 | |
| 331 | - $this->societe_id = $obj->fk_soc; // deprecated |
|
| 331 | + $this->societe_id = $obj->fk_soc; // deprecated |
|
| 332 | 332 | $this->contact_id = $obj->fk_socpeople; // deprecated |
| 333 | 333 | $this->socid = $obj->fk_soc; |
| 334 | 334 | $this->contactid = $obj->fk_socpeople; |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | $this->fetch_optionals(); |
| 350 | 350 | } else {
|
| 351 | 351 | $this->error = "USERNOTFOUND"; |
| 352 | - DolUtils::dol_syslog(get_class($this) . "::fetch user not found", LOG_DEBUG); |
|
| 352 | + DolUtils::dol_syslog(get_class($this)."::fetch user not found", LOG_DEBUG); |
|
| 353 | 353 | return 0; |
| 354 | 354 | } |
| 355 | 355 | } else {
|
@@ -360,9 +360,9 @@ discard block |
||
| 360 | 360 | // To get back the global configuration unique to the user |
| 361 | 361 | if ($loadpersonalconf) {
|
| 362 | 362 | // Load user->conf for user |
| 363 | - $sql = "SELECT param, value FROM " . MAIN_DB_PREFIX . "user_param"; |
|
| 364 | - $sql .= " WHERE fk_user = " . $this->id; |
|
| 365 | - $sql .= " AND entity = " . Globals::$conf->entity; |
|
| 363 | + $sql = "SELECT param, value FROM ".MAIN_DB_PREFIX."user_param"; |
|
| 364 | + $sql .= " WHERE fk_user = ".$this->id; |
|
| 365 | + $sql .= " AND entity = ".Globals::$conf->entity; |
|
| 366 | 366 | //DolUtils::dol_syslog(get_class($this).'::fetch load personalized conf', LOG_DEBUG); |
| 367 | 367 | $resql = Config::$dbEngine->select($sql); |
| 368 | 368 | if (is_array($resql)) {
|
@@ -400,9 +400,9 @@ discard block |
||
| 400 | 400 | // global $conf; |
| 401 | 401 | // Load user->default_values for user. TODO Save this in memcached ? |
| 402 | 402 | $sql = "SELECT rowid, entity, type, page, param, value"; |
| 403 | - $sql .= " FROM " . MAIN_DB_PREFIX . "default_values"; |
|
| 404 | - $sql .= " WHERE entity IN (" . ($this->entity > 0 ? $this->entity . ", " : "") . Globals::$conf->entity . ")"; // Entity of user (if defined) + current entity
|
|
| 405 | - $sql .= " AND user_id IN (0" . ($this->id > 0 ? ", " . $this->id : "") . ")"; // User 0 (all) + me (if defined) |
|
| 403 | + $sql .= " FROM ".MAIN_DB_PREFIX."default_values"; |
|
| 404 | + $sql .= " WHERE entity IN (".($this->entity > 0 ? $this->entity.", " : "").Globals::$conf->entity.")"; // Entity of user (if defined) + current entity
|
|
| 405 | + $sql .= " AND user_id IN (0".($this->id > 0 ? ", ".$this->id : "").")"; // User 0 (all) + me (if defined) |
|
| 406 | 406 | $resql = Config::$dbEngine->select($sql); |
| 407 | 407 | if (is_array($resql)) {
|
| 408 | 408 | foreach ($resql as $array) {
|
@@ -450,7 +450,7 @@ discard block |
||
| 450 | 450 | |
| 451 | 451 | $entity = (!empty($entity) ? $entity : Globals::$conf->entity); |
| 452 | 452 | |
| 453 | - DolUtils::dol_syslog(get_class($this) . "::addrights $rid, $allmodule, $allperms, $entity"); |
|
| 453 | + DolUtils::dol_syslog(get_class($this)."::addrights $rid, $allmodule, $allperms, $entity"); |
|
| 454 | 454 | $error = 0; |
| 455 | 455 | $whereforadd = ''; |
| 456 | 456 | |
@@ -460,9 +460,9 @@ discard block |
||
| 460 | 460 | // Si on a demande ajout d'un droit en particulier, on recupere |
| 461 | 461 | // les caracteristiques (module, perms et subperms) de ce droit. |
| 462 | 462 | $sql = "SELECT module, perms, subperms"; |
| 463 | - $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
| 464 | - $sql .= " WHERE id = '" . Config::$dbEngine->escape($rid) . "'"; |
|
| 465 | - $sql .= " AND entity = " . $entity; |
|
| 463 | + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; |
|
| 464 | + $sql .= " WHERE id = '".Config::$dbEngine->escape($rid)."'"; |
|
| 465 | + $sql .= " AND entity = ".$entity; |
|
| 466 | 466 | |
| 467 | 467 | $result = Config::$dbEngine->query($sql); |
| 468 | 468 | if ($result) {
|
@@ -476,7 +476,7 @@ discard block |
||
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // Where pour la liste des droits a ajouter |
| 479 | - $whereforadd = "id=" . Config::$dbEngine->escape($rid); |
|
| 479 | + $whereforadd = "id=".Config::$dbEngine->escape($rid); |
|
| 480 | 480 | // Ajout des droits induits |
| 481 | 481 | if (!empty($subperms)) {
|
| 482 | 482 | $whereforadd .= " OR (module='$module' AND perms='$perms' AND (subperms='lire' OR subperms='read'))"; |
@@ -493,9 +493,9 @@ discard block |
||
| 493 | 493 | if ($allmodule == 'allmodules') {
|
| 494 | 494 | $whereforadd = 'allmodules'; |
| 495 | 495 | } else {
|
| 496 | - $whereforadd = "module='" . Config::$dbEngine->escape($allmodule) . "'"; |
|
| 496 | + $whereforadd = "module='".Config::$dbEngine->escape($allmodule)."'"; |
|
| 497 | 497 | if (!empty($allperms)) {
|
| 498 | - $whereforadd .= " AND perms='" . Config::$dbEngine->escape($allperms) . "'"; |
|
| 498 | + $whereforadd .= " AND perms='".Config::$dbEngine->escape($allperms)."'"; |
|
| 499 | 499 | } |
| 500 | 500 | } |
| 501 | 501 | } |
@@ -505,10 +505,10 @@ discard block |
||
| 505 | 505 | if (!empty($whereforadd)) {
|
| 506 | 506 | //print "$module-$perms-$subperms"; |
| 507 | 507 | $sql = "SELECT id"; |
| 508 | - $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
| 509 | - $sql .= " WHERE entity = " . $entity; |
|
| 508 | + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; |
|
| 509 | + $sql .= " WHERE entity = ".$entity; |
|
| 510 | 510 | if (!empty($whereforadd) && $whereforadd != 'allmodules') {
|
| 511 | - $sql .= " AND " . $whereforadd; |
|
| 511 | + $sql .= " AND ".$whereforadd; |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | $result = Config::$dbEngine->query($sql); |
@@ -519,10 +519,10 @@ discard block |
||
| 519 | 519 | $obj = Config::$dbEngine->fetch_object($result); |
| 520 | 520 | $nid = $obj->id; |
| 521 | 521 | |
| 522 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights WHERE fk_user = " . $this->id . " AND fk_id=" . $nid . " AND entity = " . $entity; |
|
| 522 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = ".$this->id." AND fk_id=".$nid." AND entity = ".$entity; |
|
| 523 | 523 | if (!Config::$dbEngine->query($sql)) |
| 524 | 524 | $error++; |
| 525 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_rights (entity, fk_user, fk_id) VALUES (" . $entity . ", " . $this->id . ", " . $nid . ")";
|
|
| 525 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_rights (entity, fk_user, fk_id) VALUES (".$entity.", ".$this->id.", ".$nid.")";
|
|
| 526 | 526 | if (!Config::$dbEngine->query($sql)) |
| 527 | 527 | $error++; |
| 528 | 528 | |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | |
| 538 | 538 | if (!$error && !$notrigger) {
|
| 539 | 539 | Globals::$langs->load("other");
|
| 540 | - $this->context = array('audit' => Globals::$langs->trans("PermissionsAdd") . ($rid ? ' (id=' . $rid . ')' : ''));
|
|
| 540 | + $this->context = array('audit' => Globals::$langs->trans("PermissionsAdd").($rid ? ' (id='.$rid.')' : ''));
|
|
| 541 | 541 | |
| 542 | 542 | // Call trigger |
| 543 | 543 | $result = $this->call_trigger('USER_MODIFY', Globals::$user);
|
@@ -581,9 +581,9 @@ discard block |
||
| 581 | 581 | // Si on a demande supression d'un droit en particulier, on recupere |
| 582 | 582 | // les caracteristiques module, perms et subperms de ce droit. |
| 583 | 583 | $sql = "SELECT module, perms, subperms"; |
| 584 | - $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
| 585 | - $sql .= " WHERE id = '" . Config::$dbEngine->escape($rid) . "'"; |
|
| 586 | - $sql .= " AND entity = " . $entity; |
|
| 584 | + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; |
|
| 585 | + $sql .= " WHERE id = '".Config::$dbEngine->escape($rid)."'"; |
|
| 586 | + $sql .= " AND entity = ".$entity; |
|
| 587 | 587 | |
| 588 | 588 | $result = Config::$dbEngine->query($sql); |
| 589 | 589 | if ($result) {
|
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | // Where pour la liste des droits a supprimer |
| 600 | - $wherefordel = "id=" . Config::$dbEngine->escape($rid); |
|
| 600 | + $wherefordel = "id=".Config::$dbEngine->escape($rid); |
|
| 601 | 601 | // Suppression des droits induits |
| 602 | 602 | if ($subperms == 'lire' || $subperms == 'read') {
|
| 603 | 603 | $wherefordel .= " OR (module='$module' AND perms='$perms' AND subperms IS NOT NULL)"; |
@@ -612,9 +612,9 @@ discard block |
||
| 612 | 612 | if ($allmodule == 'allmodules') {
|
| 613 | 613 | $wherefordel = 'allmodules'; |
| 614 | 614 | } else {
|
| 615 | - $wherefordel = "module='" . Config::$dbEngine->escape($allmodule) . "'"; |
|
| 615 | + $wherefordel = "module='".Config::$dbEngine->escape($allmodule)."'"; |
|
| 616 | 616 | if (!empty($allperms)) {
|
| 617 | - $whereforadd .= " AND perms='" . Config::$dbEngine->escape($allperms) . "'"; |
|
| 617 | + $whereforadd .= " AND perms='".Config::$dbEngine->escape($allperms)."'"; |
|
| 618 | 618 | } |
| 619 | 619 | } |
| 620 | 620 | } |
@@ -624,10 +624,10 @@ discard block |
||
| 624 | 624 | if (!empty($wherefordel)) {
|
| 625 | 625 | //print "$module-$perms-$subperms"; |
| 626 | 626 | $sql = "SELECT id"; |
| 627 | - $sql .= " FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
| 628 | - $sql .= " WHERE entity = " . $entity; |
|
| 627 | + $sql .= " FROM ".MAIN_DB_PREFIX."rights_def"; |
|
| 628 | + $sql .= " WHERE entity = ".$entity; |
|
| 629 | 629 | if (!empty($wherefordel) && $wherefordel != 'allmodules') {
|
| 630 | - $sql .= " AND " . $wherefordel; |
|
| 630 | + $sql .= " AND ".$wherefordel; |
|
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | $result = Config::$dbEngine->query($sql); |
@@ -638,9 +638,9 @@ discard block |
||
| 638 | 638 | $obj = Config::$dbEngine->fetch_object($result); |
| 639 | 639 | $nid = $obj->id; |
| 640 | 640 | |
| 641 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights"; |
|
| 642 | - $sql .= " WHERE fk_user = " . $this->id . " AND fk_id=" . $nid; |
|
| 643 | - $sql .= " AND entity = " . $entity; |
|
| 641 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights"; |
|
| 642 | + $sql .= " WHERE fk_user = ".$this->id." AND fk_id=".$nid; |
|
| 643 | + $sql .= " AND entity = ".$entity; |
|
| 644 | 644 | if (!Config::$dbEngine->query($sql)) {
|
| 645 | 645 | $error++; |
| 646 | 646 | } |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | |
| 656 | 656 | if (!$error && !$notrigger) {
|
| 657 | 657 | Globals::$langs->load("other");
|
| 658 | - $this->context = array('audit' => Globals::$langs->trans("PermissionsDelete") . ($rid ? ' (id=' . $rid . ')' : ''));
|
|
| 658 | + $this->context = array('audit' => Globals::$langs->trans("PermissionsDelete").($rid ? ' (id='.$rid.')' : ''));
|
|
| 659 | 659 | |
| 660 | 660 | // Call trigger |
| 661 | 661 | $result = $this->call_trigger('USER_MODIFY', Globals::$user);
|
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | */ |
| 683 | 683 | function clearrights() |
| 684 | 684 | {
|
| 685 | - DolUtils::dol_syslog(get_class($this) . "::clearrights reset user->rights"); |
|
| 685 | + DolUtils::dol_syslog(get_class($this)."::clearrights reset user->rights"); |
|
| 686 | 686 | $this->rights = ''; |
| 687 | 687 | $this->all_permissions_are_loaded = false; |
| 688 | 688 | $this->_tab_loaded = array(); |
@@ -715,19 +715,19 @@ discard block |
||
| 715 | 715 | // Recuperation des droits utilisateurs + recuperation des droits groupes |
| 716 | 716 | // D'abord les droits utilisateurs |
| 717 | 717 | $sql = "SELECT DISTINCT r.module, r.perms, r.subperms"; |
| 718 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user_rights as ur"; |
|
| 719 | - $sql .= ", " . MAIN_DB_PREFIX . "rights_def as r"; |
|
| 718 | + $sql .= " FROM ".MAIN_DB_PREFIX."user_rights as ur"; |
|
| 719 | + $sql .= ", ".MAIN_DB_PREFIX."rights_def as r"; |
|
| 720 | 720 | $sql .= " WHERE r.id = ur.fk_id"; |
| 721 | 721 | if (!empty(Globals::$conf->global->MULTICOMPANY_BACKWARD_COMPATIBILITY)) {
|
| 722 | - $sql .= " AND r.entity IN (0," . (!empty(Globals::$conf->multicompany->enabled) && !empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE) ? "1," : "") . Globals::$conf->entity . ")"; |
|
| 722 | + $sql .= " AND r.entity IN (0,".(!empty(Globals::$conf->multicompany->enabled) && !empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE) ? "1," : "").Globals::$conf->entity.")"; |
|
| 723 | 723 | } else {
|
| 724 | - $sql .= " AND ur.entity = " . Globals::$conf->entity; |
|
| 724 | + $sql .= " AND ur.entity = ".Globals::$conf->entity; |
|
| 725 | 725 | } |
| 726 | - $sql .= " AND ur.fk_user= " . $this->id; |
|
| 726 | + $sql .= " AND ur.fk_user= ".$this->id; |
|
| 727 | 727 | $sql .= " AND r.perms IS NOT NULL"; |
| 728 | 728 | if ($moduletag) {
|
| 729 | 729 | // $sql .= " AND r.module = '" . Config::$dbEngine->escape($moduletag) . "'"; |
| 730 | - $sql .= " AND r.module = '" . $moduletag . "'"; |
|
| 730 | + $sql .= " AND r.module = '".$moduletag."'"; |
|
| 731 | 731 | } |
| 732 | 732 | |
| 733 | 733 | $resql = Config::$dbEngine->select($sql); |
@@ -768,25 +768,25 @@ discard block |
||
| 768 | 768 | |
| 769 | 769 | // Maintenant les droits groupes |
| 770 | 770 | $sql = "SELECT DISTINCT r.module, r.perms, r.subperms"; |
| 771 | - $sql .= " FROM " . MAIN_DB_PREFIX . "usergroup_rights as gr,"; |
|
| 772 | - $sql .= " " . MAIN_DB_PREFIX . "usergroup_user as gu,"; |
|
| 773 | - $sql .= " " . MAIN_DB_PREFIX . "rights_def as r"; |
|
| 771 | + $sql .= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,"; |
|
| 772 | + $sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu,"; |
|
| 773 | + $sql .= " ".MAIN_DB_PREFIX."rights_def as r"; |
|
| 774 | 774 | $sql .= " WHERE r.id = gr.fk_id"; |
| 775 | 775 | if (!empty(Globals::$conf->global->MULTICOMPANY_BACKWARD_COMPATIBILITY)) {
|
| 776 | 776 | if (!empty(Globals::$conf->multicompany->enabled) && !empty(Globals::$conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
| 777 | - $sql .= " AND gu.entity IN (0," . Globals::$conf->entity . ")"; |
|
| 777 | + $sql .= " AND gu.entity IN (0,".Globals::$conf->entity.")"; |
|
| 778 | 778 | } else {
|
| 779 | - $sql .= " AND r.entity = " . Globals::$conf->entity; |
|
| 779 | + $sql .= " AND r.entity = ".Globals::$conf->entity; |
|
| 780 | 780 | } |
| 781 | 781 | } else {
|
| 782 | - $sql .= " AND gr.entity = " . Globals::$conf->entity; |
|
| 783 | - $sql .= " AND r.entity = " . Globals::$conf->entity; |
|
| 782 | + $sql .= " AND gr.entity = ".Globals::$conf->entity; |
|
| 783 | + $sql .= " AND r.entity = ".Globals::$conf->entity; |
|
| 784 | 784 | } |
| 785 | 785 | $sql .= " AND gr.fk_usergroup = gu.fk_usergroup"; |
| 786 | - $sql .= " AND gu.fk_user = " . $this->id; |
|
| 786 | + $sql .= " AND gu.fk_user = ".$this->id; |
|
| 787 | 787 | $sql .= " AND r.perms IS NOT NULL"; |
| 788 | 788 | if ($moduletag) {
|
| 789 | - $sql .= " AND r.module = '" . $moduletag . "'"; |
|
| 789 | + $sql .= " AND r.module = '".$moduletag."'"; |
|
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | $resql = Config::$dbEngine->select($sql); |
@@ -866,12 +866,12 @@ discard block |
||
| 866 | 866 | Config::$dbEngine->begin(); |
| 867 | 867 | |
| 868 | 868 | // Deactivate user |
| 869 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
| 870 | - $sql .= " SET statut = " . $this->statut; |
|
| 871 | - $sql .= " WHERE rowid = " . $this->id; |
|
| 869 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
| 870 | + $sql .= " SET statut = ".$this->statut; |
|
| 871 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 872 | 872 | $result = Config::$dbEngine->query($sql); |
| 873 | 873 | |
| 874 | - DolUtils::dol_syslog(get_class($this) . "::setstatus", LOG_DEBUG); |
|
| 874 | + DolUtils::dol_syslog(get_class($this)."::setstatus", LOG_DEBUG); |
|
| 875 | 875 | if ($result) {
|
| 876 | 876 | // Call trigger |
| 877 | 877 | $result = $this->call_trigger('USER_ENABLEDISABLE', Globals::$user);
|
@@ -908,7 +908,7 @@ discard block |
||
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | // Get current categories |
| 911 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 911 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 912 | 912 | $c = new Categorie(Config::$dbEngine); |
| 913 | 913 | $existing = $c->containing($this->id, Categorie::TYPE_USER, 'id'); |
| 914 | 914 | |
@@ -951,10 +951,10 @@ discard block |
||
| 951 | 951 | |
| 952 | 952 | $this->fetch($this->id); |
| 953 | 953 | |
| 954 | - DolUtils::dol_syslog(get_class($this) . "::delete", LOG_DEBUG); |
|
| 954 | + DolUtils::dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
|
| 955 | 955 | |
| 956 | 956 | // Remove rights |
| 957 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights WHERE fk_user = " . $this->id; |
|
| 957 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = ".$this->id; |
|
| 958 | 958 | |
| 959 | 959 | if (!$error && !Config::$dbEngine->query($sql)) {
|
| 960 | 960 | $error++; |
@@ -962,7 +962,7 @@ discard block |
||
| 962 | 962 | } |
| 963 | 963 | |
| 964 | 964 | // Remove group |
| 965 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "usergroup_user WHERE fk_user = " . $this->id; |
|
| 965 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user WHERE fk_user = ".$this->id; |
|
| 966 | 966 | if (!$error && !Config::$dbEngine->query($sql)) {
|
| 967 | 967 | $error++; |
| 968 | 968 | $this->error = Config::$dbEngine->lasterror(); |
@@ -970,7 +970,7 @@ discard block |
||
| 970 | 970 | |
| 971 | 971 | // If contact, remove link |
| 972 | 972 | if ($this->contact_id) {
|
| 973 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "socpeople SET fk_user_creat = null WHERE rowid = " . $this->contact_id; |
|
| 973 | + $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET fk_user_creat = null WHERE rowid = ".$this->contact_id; |
|
| 974 | 974 | if (!$error && !Config::$dbEngine->query($sql)) {
|
| 975 | 975 | $error++; |
| 976 | 976 | $this->error = Config::$dbEngine->lasterror(); |
@@ -982,14 +982,14 @@ discard block |
||
| 982 | 982 | $result = $this->deleteExtraFields(); |
| 983 | 983 | if ($result < 0) {
|
| 984 | 984 | $error++; |
| 985 | - DolUtils::dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR); |
|
| 985 | + DolUtils::dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); |
|
| 986 | 986 | } |
| 987 | 987 | } |
| 988 | 988 | |
| 989 | 989 | // Remove user |
| 990 | 990 | if (!$error) {
|
| 991 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user WHERE rowid = " . $this->id; |
|
| 992 | - DolUtils::dol_syslog(get_class($this) . "::delete", LOG_DEBUG); |
|
| 991 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->id; |
|
| 992 | + DolUtils::dol_syslog(get_class($this)."::delete", LOG_DEBUG); |
|
| 993 | 993 | if (!Config::$dbEngine->query($sql)) {
|
| 994 | 994 | $error++; |
| 995 | 995 | $this->error = Config::$dbEngine->lasterror(); |
@@ -1030,7 +1030,7 @@ discard block |
||
| 1030 | 1030 | if (!isset($this->entity)) {
|
| 1031 | 1031 | $this->entity = Globals::$conf->entity; // If not defined, we use default value |
| 1032 | 1032 | } |
| 1033 | - DolUtils::dol_syslog(get_class($this) . "::create login=" . $this->login . ", user=" . (is_object(Globals::$user) ? Globals::$user->id : ''), LOG_DEBUG); |
|
| 1033 | + DolUtils::dol_syslog(get_class($this)."::create login=".$this->login.", user=".(is_object(Globals::$user) ? Globals::$user->id : ''), LOG_DEBUG); |
|
| 1034 | 1034 | |
| 1035 | 1035 | // Check parameters |
| 1036 | 1036 | if (!empty(Globals::$conf->global->USER_MAIL_REQUIRED) && !isValidEMail($this->email)) {
|
@@ -1049,11 +1049,11 @@ discard block |
||
| 1049 | 1049 | $error = 0; |
| 1050 | 1050 | Config::$dbEngine->begin(); |
| 1051 | 1051 | |
| 1052 | - $sql = "SELECT login FROM " . MAIN_DB_PREFIX . "user"; |
|
| 1053 | - $sql .= " WHERE login ='" . Config::$dbEngine->escape($this->login) . "'"; |
|
| 1054 | - $sql .= " AND entity IN (0," . Config::$dbEngine->escape(Globals::$conf->entity) . ")"; |
|
| 1052 | + $sql = "SELECT login FROM ".MAIN_DB_PREFIX."user"; |
|
| 1053 | + $sql .= " WHERE login ='".Config::$dbEngine->escape($this->login)."'"; |
|
| 1054 | + $sql .= " AND entity IN (0,".Config::$dbEngine->escape(Globals::$conf->entity).")"; |
|
| 1055 | 1055 | |
| 1056 | - DolUtils::dol_syslog(get_class($this) . "::create", LOG_DEBUG); |
|
| 1056 | + DolUtils::dol_syslog(get_class($this)."::create", LOG_DEBUG); |
|
| 1057 | 1057 | $resql = Config::$dbEngine->query($sql); |
| 1058 | 1058 | if ($resql) {
|
| 1059 | 1059 | $num = Config::$dbEngine->num_rows($resql); |
@@ -1061,17 +1061,17 @@ discard block |
||
| 1061 | 1061 | |
| 1062 | 1062 | if ($num) {
|
| 1063 | 1063 | $this->error = 'ErrorLoginAlreadyExists'; |
| 1064 | - DolUtils::dol_syslog(get_class($this) . "::create " . $this->error, LOG_WARNING); |
|
| 1064 | + DolUtils::dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING); |
|
| 1065 | 1065 | Config::$dbEngine->rollback(); |
| 1066 | 1066 | return -6; |
| 1067 | 1067 | } else {
|
| 1068 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user (datec,login,ldap_sid,entity)"; |
|
| 1069 | - $sql .= " VALUES('" . Config::$dbEngine->idate($this->datec) . "','" . Config::$dbEngine->escape($this->login) . "','" . Config::$dbEngine->escape($this->ldap_sid) . "'," . Config::$dbEngine->escape($this->entity) . ")";
|
|
| 1068 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user (datec,login,ldap_sid,entity)"; |
|
| 1069 | + $sql .= " VALUES('".Config::$dbEngine->idate($this->datec)."','".Config::$dbEngine->escape($this->login)."','".Config::$dbEngine->escape($this->ldap_sid)."',".Config::$dbEngine->escape($this->entity).")";
|
|
| 1070 | 1070 | $result = Config::$dbEngine->query($sql); |
| 1071 | 1071 | |
| 1072 | - DolUtils::dol_syslog(get_class($this) . "::create", LOG_DEBUG); |
|
| 1072 | + DolUtils::dol_syslog(get_class($this)."::create", LOG_DEBUG); |
|
| 1073 | 1073 | if ($result) {
|
| 1074 | - $this->id = Config::$dbEngine->last_insert_id(MAIN_DB_PREFIX . "user"); |
|
| 1074 | + $this->id = Config::$dbEngine->last_insert_id(MAIN_DB_PREFIX."user"); |
|
| 1075 | 1075 | |
| 1076 | 1076 | // Set default rights |
| 1077 | 1077 | if ($this->set_default_rights() < 0) {
|
@@ -1088,7 +1088,7 @@ discard block |
||
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | if (!empty(Globals::$conf->global->STOCK_USERSTOCK_AUTOCREATE)) {
|
| 1091 | - require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; |
|
| 1091 | + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; |
|
| 1092 | 1092 | Globals::$langs->load("stocks");
|
| 1093 | 1093 | $entrepot = new Entrepot(Config::$dbEngine); |
| 1094 | 1094 | $entrepot->libelle = Globals::$langs->trans("PersonalStock", $this->getFullName(Globals::$langs));
|
@@ -1112,7 +1112,7 @@ discard block |
||
| 1112 | 1112 | return $this->id; |
| 1113 | 1113 | } else {
|
| 1114 | 1114 | //$this->error=$interface->error; |
| 1115 | - DolUtils::dol_syslog(get_class($this) . "::create " . $this->error, LOG_ERR); |
|
| 1115 | + DolUtils::dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); |
|
| 1116 | 1116 | Config::$dbEngine->rollback(); |
| 1117 | 1117 | return -3; |
| 1118 | 1118 | } |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | $this->employee = 0; |
| 1166 | 1166 | |
| 1167 | 1167 | if (empty($login)) {
|
| 1168 | - $login = strtolower(substr($contact->firstname, 0, 4)) . strtolower(substr($contact->lastname, 0, 4)); |
|
| 1168 | + $login = strtolower(substr($contact->firstname, 0, 4)).strtolower(substr($contact->lastname, 0, 4)); |
|
| 1169 | 1169 | } |
| 1170 | 1170 | $this->login = $login; |
| 1171 | 1171 | |
@@ -1174,15 +1174,15 @@ discard block |
||
| 1174 | 1174 | // Cree et positionne $this->id |
| 1175 | 1175 | $result = $this->create(Globals::$user); |
| 1176 | 1176 | if ($result > 0) {
|
| 1177 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
| 1178 | - $sql .= " SET fk_socpeople=" . $contact->id; |
|
| 1177 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
| 1178 | + $sql .= " SET fk_socpeople=".$contact->id; |
|
| 1179 | 1179 | if ($contact->socid) {
|
| 1180 | - $sql .= ", fk_soc=" . $contact->socid; |
|
| 1180 | + $sql .= ", fk_soc=".$contact->socid; |
|
| 1181 | 1181 | } |
| 1182 | - $sql .= " WHERE rowid=" . $this->id; |
|
| 1182 | + $sql .= " WHERE rowid=".$this->id; |
|
| 1183 | 1183 | $resql = Config::$dbEngine->query($sql); |
| 1184 | 1184 | |
| 1185 | - DolUtils::dol_syslog(get_class($this) . "::create_from_contact", LOG_DEBUG); |
|
| 1185 | + DolUtils::dol_syslog(get_class($this)."::create_from_contact", LOG_DEBUG); |
|
| 1186 | 1186 | if ($resql) {
|
| 1187 | 1187 | $this->context['createfromcontact'] = 'createfromcontact'; |
| 1188 | 1188 | |
@@ -1205,7 +1205,7 @@ discard block |
||
| 1205 | 1205 | } |
| 1206 | 1206 | } else {
|
| 1207 | 1207 | // $this->error deja positionne |
| 1208 | - DolUtils::dol_syslog(get_class($this) . "::create_from_contact - 0"); |
|
| 1208 | + DolUtils::dol_syslog(get_class($this)."::create_from_contact - 0"); |
|
| 1209 | 1209 | |
| 1210 | 1210 | Config::$dbEngine->rollback(); |
| 1211 | 1211 | return $result; |
@@ -1239,7 +1239,7 @@ discard block |
||
| 1239 | 1239 | $this->country_id = $member->country_id; |
| 1240 | 1240 | |
| 1241 | 1241 | if (empty($login)) {
|
| 1242 | - $login = strtolower(substr($member->firstname, 0, 4)) . strtolower(substr($member->lastname, 0, 4)); |
|
| 1242 | + $login = strtolower(substr($member->firstname, 0, 4)).strtolower(substr($member->lastname, 0, 4)); |
|
| 1243 | 1243 | } |
| 1244 | 1244 | $this->login = $login; |
| 1245 | 1245 | |
@@ -1254,11 +1254,11 @@ discard block |
||
| 1254 | 1254 | } |
| 1255 | 1255 | |
| 1256 | 1256 | if ($result > 0 && $member->fk_soc) { // If member is linked to a thirdparty
|
| 1257 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
| 1258 | - $sql .= " SET fk_soc=" . $member->fk_soc; |
|
| 1259 | - $sql .= " WHERE rowid=" . $this->id; |
|
| 1257 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
| 1258 | + $sql .= " SET fk_soc=".$member->fk_soc; |
|
| 1259 | + $sql .= " WHERE rowid=".$this->id; |
|
| 1260 | 1260 | |
| 1261 | - DolUtils::dol_syslog(get_class($this) . "::create_from_member", LOG_DEBUG); |
|
| 1261 | + DolUtils::dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); |
|
| 1262 | 1262 | $resql = Config::$dbEngine->query($sql); |
| 1263 | 1263 | if ($resql) {
|
| 1264 | 1264 | Config::$dbEngine->commit(); |
@@ -1293,9 +1293,9 @@ discard block |
||
| 1293 | 1293 | // phpcs:enable |
| 1294 | 1294 | global $conf; |
| 1295 | 1295 | |
| 1296 | - $sql = "SELECT id FROM " . MAIN_DB_PREFIX . "rights_def"; |
|
| 1296 | + $sql = "SELECT id FROM ".MAIN_DB_PREFIX."rights_def"; |
|
| 1297 | 1297 | $sql .= " WHERE bydefault = 1"; |
| 1298 | - $sql .= " AND entity = " . Globals::$conf->entity; |
|
| 1298 | + $sql .= " AND entity = ".Globals::$conf->entity; |
|
| 1299 | 1299 | |
| 1300 | 1300 | $resql = Config::$dbEngine->query($sql); |
| 1301 | 1301 | if ($resql) {
|
@@ -1312,10 +1312,10 @@ discard block |
||
| 1312 | 1312 | $i = 0; |
| 1313 | 1313 | while ($i < $num) {
|
| 1314 | 1314 | |
| 1315 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_rights WHERE fk_user = $this->id AND fk_id=$rd[$i]"; |
|
| 1315 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_rights WHERE fk_user = $this->id AND fk_id=$rd[$i]"; |
|
| 1316 | 1316 | $result = Config::$dbEngine->query($sql); |
| 1317 | 1317 | |
| 1318 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_rights (fk_user, fk_id) VALUES ($this->id, $rd[$i])"; |
|
| 1318 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_rights (fk_user, fk_id) VALUES ($this->id, $rd[$i])"; |
|
| 1319 | 1319 | $result = Config::$dbEngine->query($sql); |
| 1320 | 1320 | if (!$result) {
|
| 1321 | 1321 | return -1; |
@@ -1343,7 +1343,7 @@ discard block |
||
| 1343 | 1343 | $nbrowsaffected = 0; |
| 1344 | 1344 | $error = 0; |
| 1345 | 1345 | |
| 1346 | - DolUtils::dol_syslog(get_class($this) . "::update notrigger=" . $notrigger . ", nosyncmember=" . $nosyncmember . ", nosyncmemberpass=" . $nosyncmemberpass); |
|
| 1346 | + DolUtils::dol_syslog(get_class($this)."::update notrigger=".$notrigger.", nosyncmember=".$nosyncmember.", nosyncmemberpass=".$nosyncmemberpass); |
|
| 1347 | 1347 | |
| 1348 | 1348 | // Clean parameters |
| 1349 | 1349 | $this->lastname = trim($this->lastname); |
@@ -1371,7 +1371,7 @@ discard block |
||
| 1371 | 1371 | $this->job = trim($this->job); |
| 1372 | 1372 | $this->signature = trim($this->signature); |
| 1373 | 1373 | $this->note = trim($this->note); |
| 1374 | - $this->openid = trim(empty($this->openid) ? '' : $this->openid); // Avoid warning |
|
| 1374 | + $this->openid = trim(empty($this->openid) ? '' : $this->openid); // Avoid warning |
|
| 1375 | 1375 | $this->admin = $this->admin ? $this->admin : 0; |
| 1376 | 1376 | $this->address = empty($this->address) ? '' : $this->address; |
| 1377 | 1377 | $this->zip = empty($this->zip) ? '' : $this->zip; |
@@ -1396,59 +1396,59 @@ discard block |
||
| 1396 | 1396 | Config::$dbEngine->begin(); |
| 1397 | 1397 | |
| 1398 | 1398 | // Update datas |
| 1399 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET"; |
|
| 1400 | - $sql .= " lastname = '" . Config::$dbEngine->escape($this->lastname) . "'"; |
|
| 1401 | - $sql .= ", firstname = '" . Config::$dbEngine->escape($this->firstname) . "'"; |
|
| 1402 | - $sql .= ", employee = " . $this->employee; |
|
| 1403 | - $sql .= ", login = '" . Config::$dbEngine->escape($this->login) . "'"; |
|
| 1404 | - $sql .= ", api_key = " . ($this->api_key ? "'" . Config::$dbEngine->escape($this->api_key) . "'" : "null"); |
|
| 1405 | - $sql .= ", gender = " . ($this->gender != -1 ? "'" . Config::$dbEngine->escape($this->gender) . "'" : "null"); // 'man' or 'woman' |
|
| 1406 | - $sql .= ", birth=" . (strval($this->birth) != '' ? "'" . Config::$dbEngine->idate($this->birth) . "'" : 'null'); |
|
| 1399 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; |
|
| 1400 | + $sql .= " lastname = '".Config::$dbEngine->escape($this->lastname)."'"; |
|
| 1401 | + $sql .= ", firstname = '".Config::$dbEngine->escape($this->firstname)."'"; |
|
| 1402 | + $sql .= ", employee = ".$this->employee; |
|
| 1403 | + $sql .= ", login = '".Config::$dbEngine->escape($this->login)."'"; |
|
| 1404 | + $sql .= ", api_key = ".($this->api_key ? "'".Config::$dbEngine->escape($this->api_key)."'" : "null"); |
|
| 1405 | + $sql .= ", gender = ".($this->gender != -1 ? "'".Config::$dbEngine->escape($this->gender)."'" : "null"); // 'man' or 'woman' |
|
| 1406 | + $sql .= ", birth=".(strval($this->birth) != '' ? "'".Config::$dbEngine->idate($this->birth)."'" : 'null'); |
|
| 1407 | 1407 | if (!empty(Globals::$user->admin)) {
|
| 1408 | - $sql .= ", admin = " . $this->admin; // admin flag can be set/unset only by an admin user |
|
| 1409 | - } |
|
| 1410 | - $sql .= ", address = '" . Config::$dbEngine->escape($this->address) . "'"; |
|
| 1411 | - $sql .= ", zip = '" . Config::$dbEngine->escape($this->zip) . "'"; |
|
| 1412 | - $sql .= ", town = '" . Config::$dbEngine->escape($this->town) . "'"; |
|
| 1413 | - $sql .= ", fk_state = " . ((!empty($this->state_id) && $this->state_id > 0) ? "'" . Config::$dbEngine->escape($this->state_id) . "'" : "null"); |
|
| 1414 | - $sql .= ", fk_country = " . ((!empty($this->country_id) && $this->country_id > 0) ? "'" . Config::$dbEngine->escape($this->country_id) . "'" : "null"); |
|
| 1415 | - $sql .= ", office_phone = '" . Config::$dbEngine->escape($this->office_phone) . "'"; |
|
| 1416 | - $sql .= ", office_fax = '" . Config::$dbEngine->escape($this->office_fax) . "'"; |
|
| 1417 | - $sql .= ", user_mobile = '" . Config::$dbEngine->escape($this->user_mobile) . "'"; |
|
| 1418 | - $sql .= ", email = '" . Config::$dbEngine->escape($this->email) . "'"; |
|
| 1419 | - $sql .= ", skype = '" . Config::$dbEngine->escape($this->skype) . "'"; |
|
| 1420 | - $sql .= ", twitter = '" . Config::$dbEngine->escape($this->twitter) . "'"; |
|
| 1421 | - $sql .= ", facebook = '" . Config::$dbEngine->escape($this->facebook) . "'"; |
|
| 1422 | - $sql .= ", job = '" . Config::$dbEngine->escape($this->job) . "'"; |
|
| 1423 | - $sql .= ", signature = '" . Config::$dbEngine->escape($this->signature) . "'"; |
|
| 1424 | - $sql .= ", accountancy_code = '" . Config::$dbEngine->escape($this->accountancy_code) . "'"; |
|
| 1425 | - $sql .= ", color = '" . Config::$dbEngine->escape($this->color) . "'"; |
|
| 1426 | - $sql .= ", dateemployment=" . (strval($this->dateemployment) != '' ? "'" . Config::$dbEngine->idate($this->dateemployment) . "'" : 'null'); |
|
| 1427 | - $sql .= ", dateemploymentend=" . (strval($this->dateemploymentend) != '' ? "'" . Config::$dbEngine->idate($this->dateemploymentend) . "'" : 'null'); |
|
| 1428 | - $sql .= ", note = '" . Config::$dbEngine->escape($this->note) . "'"; |
|
| 1429 | - $sql .= ", photo = " . ($this->photo ? "'" . Config::$dbEngine->escape($this->photo) . "'" : "null"); |
|
| 1430 | - $sql .= ", openid = " . ($this->openid ? "'" . Config::$dbEngine->escape($this->openid) . "'" : "null"); |
|
| 1431 | - $sql .= ", fk_user = " . ($this->fk_user > 0 ? "'" . Config::$dbEngine->escape($this->fk_user) . "'" : "null"); |
|
| 1408 | + $sql .= ", admin = ".$this->admin; // admin flag can be set/unset only by an admin user |
|
| 1409 | + } |
|
| 1410 | + $sql .= ", address = '".Config::$dbEngine->escape($this->address)."'"; |
|
| 1411 | + $sql .= ", zip = '".Config::$dbEngine->escape($this->zip)."'"; |
|
| 1412 | + $sql .= ", town = '".Config::$dbEngine->escape($this->town)."'"; |
|
| 1413 | + $sql .= ", fk_state = ".((!empty($this->state_id) && $this->state_id > 0) ? "'".Config::$dbEngine->escape($this->state_id)."'" : "null"); |
|
| 1414 | + $sql .= ", fk_country = ".((!empty($this->country_id) && $this->country_id > 0) ? "'".Config::$dbEngine->escape($this->country_id)."'" : "null"); |
|
| 1415 | + $sql .= ", office_phone = '".Config::$dbEngine->escape($this->office_phone)."'"; |
|
| 1416 | + $sql .= ", office_fax = '".Config::$dbEngine->escape($this->office_fax)."'"; |
|
| 1417 | + $sql .= ", user_mobile = '".Config::$dbEngine->escape($this->user_mobile)."'"; |
|
| 1418 | + $sql .= ", email = '".Config::$dbEngine->escape($this->email)."'"; |
|
| 1419 | + $sql .= ", skype = '".Config::$dbEngine->escape($this->skype)."'"; |
|
| 1420 | + $sql .= ", twitter = '".Config::$dbEngine->escape($this->twitter)."'"; |
|
| 1421 | + $sql .= ", facebook = '".Config::$dbEngine->escape($this->facebook)."'"; |
|
| 1422 | + $sql .= ", job = '".Config::$dbEngine->escape($this->job)."'"; |
|
| 1423 | + $sql .= ", signature = '".Config::$dbEngine->escape($this->signature)."'"; |
|
| 1424 | + $sql .= ", accountancy_code = '".Config::$dbEngine->escape($this->accountancy_code)."'"; |
|
| 1425 | + $sql .= ", color = '".Config::$dbEngine->escape($this->color)."'"; |
|
| 1426 | + $sql .= ", dateemployment=".(strval($this->dateemployment) != '' ? "'".Config::$dbEngine->idate($this->dateemployment)."'" : 'null'); |
|
| 1427 | + $sql .= ", dateemploymentend=".(strval($this->dateemploymentend) != '' ? "'".Config::$dbEngine->idate($this->dateemploymentend)."'" : 'null'); |
|
| 1428 | + $sql .= ", note = '".Config::$dbEngine->escape($this->note)."'"; |
|
| 1429 | + $sql .= ", photo = ".($this->photo ? "'".Config::$dbEngine->escape($this->photo)."'" : "null"); |
|
| 1430 | + $sql .= ", openid = ".($this->openid ? "'".Config::$dbEngine->escape($this->openid)."'" : "null"); |
|
| 1431 | + $sql .= ", fk_user = ".($this->fk_user > 0 ? "'".Config::$dbEngine->escape($this->fk_user)."'" : "null"); |
|
| 1432 | 1432 | if (isset($this->thm) || $this->thm != '') {
|
| 1433 | - $sql .= ", thm= " . ($this->thm != '' ? "'" . Config::$dbEngine->escape($this->thm) . "'" : "null"); |
|
| 1433 | + $sql .= ", thm= ".($this->thm != '' ? "'".Config::$dbEngine->escape($this->thm)."'" : "null"); |
|
| 1434 | 1434 | } |
| 1435 | 1435 | if (isset($this->tjm) || $this->tjm != '') {
|
| 1436 | - $sql .= ", tjm= " . ($this->tjm != '' ? "'" . Config::$dbEngine->escape($this->tjm) . "'" : "null"); |
|
| 1436 | + $sql .= ", tjm= ".($this->tjm != '' ? "'".Config::$dbEngine->escape($this->tjm)."'" : "null"); |
|
| 1437 | 1437 | } |
| 1438 | 1438 | if (isset($this->salary) || $this->salary != '') {
|
| 1439 | - $sql .= ", salary= " . ($this->salary != '' ? "'" . Config::$dbEngine->escape($this->salary) . "'" : "null"); |
|
| 1439 | + $sql .= ", salary= ".($this->salary != '' ? "'".Config::$dbEngine->escape($this->salary)."'" : "null"); |
|
| 1440 | 1440 | } |
| 1441 | 1441 | if (isset($this->salaryextra) || $this->salaryextra != '') {
|
| 1442 | - $sql .= ", salaryextra= " . ($this->salaryextra != '' ? "'" . Config::$dbEngine->escape($this->salaryextra) . "'" : "null"); |
|
| 1442 | + $sql .= ", salaryextra= ".($this->salaryextra != '' ? "'".Config::$dbEngine->escape($this->salaryextra)."'" : "null"); |
|
| 1443 | 1443 | } |
| 1444 | - $sql .= ", weeklyhours= " . ($this->weeklyhours != '' ? "'" . Config::$dbEngine->escape($this->weeklyhours) . "'" : "null"); |
|
| 1445 | - $sql .= ", entity = '" . Config::$dbEngine->escape($this->entity) . "'"; |
|
| 1446 | - $sql .= ", default_range = " . ($this->default_range > 0 ? $this->default_range : 'null'); |
|
| 1447 | - $sql .= ", default_c_exp_tax_cat = " . ($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null'); |
|
| 1444 | + $sql .= ", weeklyhours= ".($this->weeklyhours != '' ? "'".Config::$dbEngine->escape($this->weeklyhours)."'" : "null"); |
|
| 1445 | + $sql .= ", entity = '".Config::$dbEngine->escape($this->entity)."'"; |
|
| 1446 | + $sql .= ", default_range = ".($this->default_range > 0 ? $this->default_range : 'null'); |
|
| 1447 | + $sql .= ", default_c_exp_tax_cat = ".($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null'); |
|
| 1448 | 1448 | |
| 1449 | - $sql .= " WHERE rowid = " . $this->id; |
|
| 1449 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 1450 | 1450 | |
| 1451 | - DolUtils::dol_syslog(get_class($this) . "::update", LOG_DEBUG); |
|
| 1451 | + DolUtils::dol_syslog(get_class($this)."::update", LOG_DEBUG); |
|
| 1452 | 1452 | $resql = Config::$dbEngine->query($sql); |
| 1453 | 1453 | if ($resql) {
|
| 1454 | 1454 | $nbrowsaffected += Config::$dbEngine->affected_rows($resql); |
@@ -1466,8 +1466,8 @@ discard block |
||
| 1466 | 1466 | |
| 1467 | 1467 | // If user is linked to a member, remove old link to this member |
| 1468 | 1468 | if ($this->fk_member > 0) {
|
| 1469 | - DolUtils::dol_syslog(get_class($this) . "::update remove link with member. We will recreate it later", LOG_DEBUG); |
|
| 1470 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member = NULL where fk_member = " . $this->fk_member; |
|
| 1469 | + DolUtils::dol_syslog(get_class($this)."::update remove link with member. We will recreate it later", LOG_DEBUG); |
|
| 1470 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member = NULL where fk_member = ".$this->fk_member; |
|
| 1471 | 1471 | $resql = Config::$dbEngine->query($sql); |
| 1472 | 1472 | if (!$resql) {
|
| 1473 | 1473 | $this->error = Config::$dbEngine->error(); |
@@ -1476,8 +1476,8 @@ discard block |
||
| 1476 | 1476 | } |
| 1477 | 1477 | } |
| 1478 | 1478 | // Set link to user |
| 1479 | - DolUtils::dol_syslog(get_class($this) . "::update set link with member", LOG_DEBUG); |
|
| 1480 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET fk_member =" . ($this->fk_member > 0 ? $this->fk_member : 'null') . " where rowid = " . $this->id; |
|
| 1479 | + DolUtils::dol_syslog(get_class($this)."::update set link with member", LOG_DEBUG); |
|
| 1480 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET fk_member =".($this->fk_member > 0 ? $this->fk_member : 'null')." where rowid = ".$this->id; |
|
| 1481 | 1481 | $resql = Config::$dbEngine->query($sql); |
| 1482 | 1482 | if (!$resql) {
|
| 1483 | 1483 | $this->error = Config::$dbEngine->error(); |
@@ -1487,9 +1487,9 @@ discard block |
||
| 1487 | 1487 | |
| 1488 | 1488 | if ($nbrowsaffected) { // If something has changed in data
|
| 1489 | 1489 | if ($this->fk_member > 0 && !$nosyncmember) {
|
| 1490 | - DolUtils::dol_syslog(get_class($this) . "::update user is linked with a member. We try to update member too.", LOG_DEBUG); |
|
| 1490 | + DolUtils::dol_syslog(get_class($this)."::update user is linked with a member. We try to update member too.", LOG_DEBUG); |
|
| 1491 | 1491 | |
| 1492 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
| 1492 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
| 1493 | 1493 | |
| 1494 | 1494 | // This user is linked with a member, so we also update member information |
| 1495 | 1495 | // if this is an update. |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | if ($result < 0) {
|
| 1530 | 1530 | $this->error = $adh->error; |
| 1531 | 1531 | $this->errors = $adh->errors; |
| 1532 | - DolUtils::dol_syslog(get_class($this) . "::update error after calling adh->update to sync it with user: " . $this->error, LOG_ERR); |
|
| 1532 | + DolUtils::dol_syslog(get_class($this)."::update error after calling adh->update to sync it with user: ".$this->error, LOG_ERR); |
|
| 1533 | 1533 | $error++; |
| 1534 | 1534 | } |
| 1535 | 1535 | } else {
|
@@ -1540,9 +1540,9 @@ discard block |
||
| 1540 | 1540 | } |
| 1541 | 1541 | |
| 1542 | 1542 | if ($this->contact_id > 0 && !$nosynccontact) {
|
| 1543 | - DolUtils::dol_syslog(get_class($this) . "::update user is linked with a contact. We try to update contact too.", LOG_DEBUG); |
|
| 1543 | + DolUtils::dol_syslog(get_class($this)."::update user is linked with a contact. We try to update contact too.", LOG_DEBUG); |
|
| 1544 | 1544 | |
| 1545 | - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
| 1545 | + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
| 1546 | 1546 | |
| 1547 | 1547 | // This user is linked with a contact, so we also update contact information |
| 1548 | 1548 | // if this is an update. |
@@ -1582,7 +1582,7 @@ discard block |
||
| 1582 | 1582 | if ($result < 0) {
|
| 1583 | 1583 | $this->error = $tmpobj->error; |
| 1584 | 1584 | $this->errors = $tmpobj->errors; |
| 1585 | - DolUtils::dol_syslog(get_class($this) . "::update error after calling adh->update to sync it with user: " . $this->error, LOG_ERR); |
|
| 1585 | + DolUtils::dol_syslog(get_class($this)."::update error after calling adh->update to sync it with user: ".$this->error, LOG_ERR); |
|
| 1586 | 1586 | $error++; |
| 1587 | 1587 | } |
| 1588 | 1588 | } else {
|
@@ -1616,7 +1616,7 @@ discard block |
||
| 1616 | 1616 | Config::$dbEngine->commit(); |
| 1617 | 1617 | return $nbrowsaffected; |
| 1618 | 1618 | } else {
|
| 1619 | - DolUtils::dol_syslog(get_class($this) . "::update error=" . $this->error, LOG_ERR); |
|
| 1619 | + DolUtils::dol_syslog(get_class($this)."::update error=".$this->error, LOG_ERR); |
|
| 1620 | 1620 | Config::$dbEngine->rollback(); |
| 1621 | 1621 | return -1; |
| 1622 | 1622 | } |
@@ -1640,21 +1640,21 @@ discard block |
||
| 1640 | 1640 | // $now = DolUtils::dol_now(); |
| 1641 | 1641 | $now = date("Y-m-d H:i:s");
|
| 1642 | 1642 | |
| 1643 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user SET"; |
|
| 1643 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user SET"; |
|
| 1644 | 1644 | $sql .= " datepreviouslogin = datelastlogin,"; |
| 1645 | 1645 | // $sql .= " datelastlogin = '" . Config::$dbEngine->idate($now) . "',"; |
| 1646 | 1646 | $sql .= " datelastlogin = '{$now}',";
|
| 1647 | - $sql .= " tms = tms"; // La date de derniere modif doit changer sauf pour la mise a jour de date de derniere connexion |
|
| 1648 | - $sql .= " WHERE rowid = " . $this->id; |
|
| 1647 | + $sql .= " tms = tms"; // La date de derniere modif doit changer sauf pour la mise a jour de date de derniere connexion |
|
| 1648 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 1649 | 1649 | |
| 1650 | - DolUtils::dol_syslog(get_class($this) . "::update_last_login_date user->id=" . $this->id . " " . $sql, LOG_DEBUG); |
|
| 1650 | + DolUtils::dol_syslog(get_class($this)."::update_last_login_date user->id=".$this->id." ".$sql, LOG_DEBUG); |
|
| 1651 | 1651 | $resql = Config::$dbEngine->exec($sql); |
| 1652 | 1652 | if ($resql) {
|
| 1653 | 1653 | $this->datepreviouslogin = $this->datelastlogin; |
| 1654 | 1654 | $this->datelastlogin = $now; |
| 1655 | 1655 | return 1; |
| 1656 | 1656 | } else {
|
| 1657 | - $this->error = Config::$dbEngine->lasterror() . ' sql=' . $sql; |
|
| 1657 | + $this->error = Config::$dbEngine->lasterror().' sql='.$sql; |
|
| 1658 | 1658 | return -1; |
| 1659 | 1659 | } |
| 1660 | 1660 | } |
@@ -1672,11 +1672,11 @@ discard block |
||
| 1672 | 1672 | function setPassword($user, $password = '', $changelater = 0, $notrigger = 0, $nosyncmember = 0) |
| 1673 | 1673 | {
|
| 1674 | 1674 | //global $conf, Globals::$langs; |
| 1675 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/security2.lib.php'; |
|
| 1675 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; |
|
| 1676 | 1676 | |
| 1677 | 1677 | $error = 0; |
| 1678 | 1678 | |
| 1679 | - DolUtils::dol_syslog(get_class($this) . "::setPassword user=" . Globals::$user->id . " password=" . preg_replace('/./i', '*', $password) . " changelater=" . $changelater . " notrigger=" . $notrigger . " nosyncmember=" . $nosyncmember, LOG_DEBUG);
|
|
| 1679 | + DolUtils::dol_syslog(get_class($this)."::setPassword user=".Globals::$user->id." password=".preg_replace('/./i', '*', $password)." changelater=".$changelater." notrigger=".$notrigger." nosyncmember=".$nosyncmember, LOG_DEBUG);
|
|
| 1680 | 1680 | |
| 1681 | 1681 | // If new password not provided, we generate one |
| 1682 | 1682 | if (!$password) {
|
@@ -1694,17 +1694,17 @@ discard block |
||
| 1694 | 1694 | |
| 1695 | 1695 | Config::$dbEngine->begin(); |
| 1696 | 1696 | |
| 1697 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
| 1698 | - $sql .= " SET pass_crypted = '" . Config::$dbEngine->escape($password_crypted) . "',"; |
|
| 1697 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
| 1698 | + $sql .= " SET pass_crypted = '".Config::$dbEngine->escape($password_crypted)."',"; |
|
| 1699 | 1699 | $sql .= " pass_temp = null"; |
| 1700 | 1700 | if (!empty(Globals::$conf->global->DATABASE_PWD_ENCRYPTED)) {
|
| 1701 | 1701 | $sql .= ", pass = null"; |
| 1702 | 1702 | } else {
|
| 1703 | - $sql .= ", pass = '" . Config::$dbEngine->escape($password) . "'"; |
|
| 1703 | + $sql .= ", pass = '".Config::$dbEngine->escape($password)."'"; |
|
| 1704 | 1704 | } |
| 1705 | - $sql .= " WHERE rowid = " . $this->id; |
|
| 1705 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 1706 | 1706 | |
| 1707 | - DolUtils::dol_syslog(get_class($this) . "::setPassword", LOG_DEBUG); |
|
| 1707 | + DolUtils::dol_syslog(get_class($this)."::setPassword", LOG_DEBUG); |
|
| 1708 | 1708 | $result = Config::$dbEngine->query($sql); |
| 1709 | 1709 | if ($result) {
|
| 1710 | 1710 | if (Config::$dbEngine->affected_rows($result)) {
|
@@ -1713,7 +1713,7 @@ discard block |
||
| 1713 | 1713 | $this->pass_indatabase_crypted = $password_crypted; |
| 1714 | 1714 | |
| 1715 | 1715 | if ($this->fk_member && !$nosyncmember) {
|
| 1716 | - require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; |
|
| 1716 | + require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; |
|
| 1717 | 1717 | |
| 1718 | 1718 | // This user is linked with a member, so we also update members informations |
| 1719 | 1719 | // if this is an update. |
@@ -1724,7 +1724,7 @@ discard block |
||
| 1724 | 1724 | $result = $adh->setPassword(Globals::$user, $this->pass, (empty(Globals::$conf->global->DATABASE_PWD_ENCRYPTED) ? 0 : 1), 1); // Cryptage non gere dans module adherent |
| 1725 | 1725 | if ($result < 0) {
|
| 1726 | 1726 | $this->error = $adh->error; |
| 1727 | - DolUtils::dol_syslog(get_class($this) . "::setPassword " . $this->error, LOG_ERR); |
|
| 1727 | + DolUtils::dol_syslog(get_class($this)."::setPassword ".$this->error, LOG_ERR); |
|
| 1728 | 1728 | $error++; |
| 1729 | 1729 | } |
| 1730 | 1730 | } else {
|
@@ -1733,7 +1733,7 @@ discard block |
||
| 1733 | 1733 | } |
| 1734 | 1734 | } |
| 1735 | 1735 | |
| 1736 | - DolUtils::dol_syslog(get_class($this) . "::setPassword notrigger=" . $notrigger . " error=" . $error, LOG_DEBUG); |
|
| 1736 | + DolUtils::dol_syslog(get_class($this)."::setPassword notrigger=".$notrigger." error=".$error, LOG_DEBUG); |
|
| 1737 | 1737 | |
| 1738 | 1738 | if (!$error && !$notrigger) {
|
| 1739 | 1739 | // Call trigger |
@@ -1760,11 +1760,11 @@ discard block |
||
| 1760 | 1760 | } else {
|
| 1761 | 1761 | // We store clear password in password temporary field. |
| 1762 | 1762 | // After receiving confirmation link, we will crypt it and store it in pass_crypted |
| 1763 | - $sql = "UPDATE " . MAIN_DB_PREFIX . "user"; |
|
| 1764 | - $sql .= " SET pass_temp = '" . Config::$dbEngine->escape($password) . "'"; |
|
| 1765 | - $sql .= " WHERE rowid = " . $this->id; |
|
| 1763 | + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; |
|
| 1764 | + $sql .= " SET pass_temp = '".Config::$dbEngine->escape($password)."'"; |
|
| 1765 | + $sql .= " WHERE rowid = ".$this->id; |
|
| 1766 | 1766 | |
| 1767 | - DolUtils::dol_syslog(get_class($this) . "::setPassword", LOG_DEBUG); // No log |
|
| 1767 | + DolUtils::dol_syslog(get_class($this)."::setPassword", LOG_DEBUG); // No log |
|
| 1768 | 1768 | $result = Config::$dbEngine->query($sql); |
| 1769 | 1769 | if ($result) {
|
| 1770 | 1770 | return $password; |
@@ -1790,7 +1790,7 @@ discard block |
||
| 1790 | 1790 | //global $conf, Globals::$langs; |
| 1791 | 1791 | //global $dolibarr_main_url_root; |
| 1792 | 1792 | |
| 1793 | - require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; |
|
| 1793 | + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; |
|
| 1794 | 1794 | |
| 1795 | 1795 | $msgishtml = 0; |
| 1796 | 1796 | |
@@ -1815,36 +1815,36 @@ discard block |
||
| 1815 | 1815 | $subject = $outputlangs->transnoentitiesnoconv("SubjectNewPassword", $appli);
|
| 1816 | 1816 | |
| 1817 | 1817 | // Define $urlwithroot |
| 1818 | - $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root));
|
|
| 1819 | - $urlwithroot = $urlwithouturlroot . DOL_URL_ROOT; // This is to use external domain name found into config file |
|
| 1818 | + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
|
| 1819 | + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file |
|
| 1820 | 1820 | |
| 1821 | 1821 | if (!$changelater) {
|
| 1822 | - $url = $urlwithroot . '/'; |
|
| 1822 | + $url = $urlwithroot.'/'; |
|
| 1823 | 1823 | |
| 1824 | - $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived") . ".\n";
|
|
| 1825 | - $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyIs") . " :\n\n";
|
|
| 1826 | - $mesg .= $outputlangs->transnoentitiesnoconv("Login") . " = " . $this->login . "\n";
|
|
| 1827 | - $mesg .= $outputlangs->transnoentitiesnoconv("Password") . " = " . $password . "\n\n";
|
|
| 1824 | + $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived").".\n";
|
|
| 1825 | + $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyIs")." :\n\n";
|
|
| 1826 | + $mesg .= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n";
|
|
| 1827 | + $mesg .= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n";
|
|
| 1828 | 1828 | $mesg .= "\n"; |
| 1829 | 1829 | |
| 1830 | - $mesg .= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $appli) . ': ' . $url . "\n\n";
|
|
| 1830 | + $mesg .= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $appli).': '.$url."\n\n";
|
|
| 1831 | 1831 | $mesg .= "--\n"; |
| 1832 | 1832 | $mesg .= Globals::$user->getFullName($outputlangs); // Username that make then sending |
| 1833 | 1833 | |
| 1834 | - DolUtils::dol_syslog(get_class($this) . "::send_password changelater is off, url=" . $url); |
|
| 1834 | + DolUtils::dol_syslog(get_class($this)."::send_password changelater is off, url=".$url); |
|
| 1835 | 1835 | } else {
|
| 1836 | - $url = $urlwithroot . '/user/passwordforgotten.php?action=validatenewpassword&username=' . $this->login . "&passwordhash=" . dol_hash($password); |
|
| 1836 | + $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.$this->login."&passwordhash=".dol_hash($password); |
|
| 1837 | 1837 | |
| 1838 | - $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived") . "\n";
|
|
| 1839 | - $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyWillBe") . " :\n\n";
|
|
| 1840 | - $mesg .= $outputlangs->transnoentitiesnoconv("Login") . " = " . $this->login . "\n";
|
|
| 1841 | - $mesg .= $outputlangs->transnoentitiesnoconv("Password") . " = " . $password . "\n\n";
|
|
| 1838 | + $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n";
|
|
| 1839 | + $mesg .= $outputlangs->transnoentitiesnoconv("NewKeyWillBe")." :\n\n";
|
|
| 1840 | + $mesg .= $outputlangs->transnoentitiesnoconv("Login")." = ".$this->login."\n";
|
|
| 1841 | + $mesg .= $outputlangs->transnoentitiesnoconv("Password")." = ".$password."\n\n";
|
|
| 1842 | 1842 | $mesg .= "\n"; |
| 1843 | - $mesg .= $outputlangs->transnoentitiesnoconv("YouMustClickToChange") . " :\n";
|
|
| 1844 | - $mesg .= $url . "\n\n"; |
|
| 1845 | - $mesg .= $outputlangs->transnoentitiesnoconv("ForgetIfNothing") . "\n\n";
|
|
| 1843 | + $mesg .= $outputlangs->transnoentitiesnoconv("YouMustClickToChange")." :\n";
|
|
| 1844 | + $mesg .= $url."\n\n"; |
|
| 1845 | + $mesg .= $outputlangs->transnoentitiesnoconv("ForgetIfNothing")."\n\n";
|
|
| 1846 | 1846 | |
| 1847 | - DolUtils::dol_syslog(get_class($this) . "::send_password changelater is on, url=" . $url); |
|
| 1847 | + DolUtils::dol_syslog(get_class($this)."::send_password changelater is on, url=".$url); |
|
| 1848 | 1848 | } |
| 1849 | 1849 | |
| 1850 | 1850 | $mailfile = new CMailFile( |
@@ -1855,7 +1855,7 @@ discard block |
||
| 1855 | 1855 | return 1; |
| 1856 | 1856 | } else {
|
| 1857 | 1857 | Globals::$langs->trans("errors");
|
| 1858 | - $this->error = Globals::$langs->trans("ErrorFailedToSendPassword") . ' ' . $mailfile->error;
|
|
| 1858 | + $this->error = Globals::$langs->trans("ErrorFailedToSendPassword").' '.$mailfile->error;
|
|
| 1859 | 1859 | return -1; |
| 1860 | 1860 | } |
| 1861 | 1861 | } |
@@ -1880,8 +1880,8 @@ discard block |
||
| 1880 | 1880 | {
|
| 1881 | 1881 | // phpcs:enable |
| 1882 | 1882 | $sql = "SELECT url, login, pass, poste "; |
| 1883 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user_clicktodial as u"; |
|
| 1884 | - $sql .= " WHERE u.fk_user = " . $this->id; |
|
| 1883 | + $sql .= " FROM ".MAIN_DB_PREFIX."user_clicktodial as u"; |
|
| 1884 | + $sql .= " WHERE u.fk_user = ".$this->id; |
|
| 1885 | 1885 | |
| 1886 | 1886 | $resql = Config::$dbEngine->query($sql); |
| 1887 | 1887 | if ($resql) {
|
@@ -1915,21 +1915,21 @@ discard block |
||
| 1915 | 1915 | // phpcs:enable |
| 1916 | 1916 | Config::$dbEngine->begin(); |
| 1917 | 1917 | |
| 1918 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "user_clicktodial"; |
|
| 1919 | - $sql .= " WHERE fk_user = " . $this->id; |
|
| 1918 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_clicktodial"; |
|
| 1919 | + $sql .= " WHERE fk_user = ".$this->id; |
|
| 1920 | 1920 | |
| 1921 | - DolUtils::dol_syslog(get_class($this) . '::update_clicktodial', LOG_DEBUG); |
|
| 1921 | + DolUtils::dol_syslog(get_class($this).'::update_clicktodial', LOG_DEBUG); |
|
| 1922 | 1922 | $result = Config::$dbEngine->query($sql); |
| 1923 | 1923 | |
| 1924 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "user_clicktodial"; |
|
| 1924 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."user_clicktodial"; |
|
| 1925 | 1925 | $sql .= " (fk_user,url,login,pass,poste)"; |
| 1926 | - $sql .= " VALUES (" . $this->id;
|
|
| 1927 | - $sql .= ", '" . Config::$dbEngine->escape($this->clicktodial_url) . "'"; |
|
| 1928 | - $sql .= ", '" . Config::$dbEngine->escape($this->clicktodial_login) . "'"; |
|
| 1929 | - $sql .= ", '" . Config::$dbEngine->escape($this->clicktodial_password) . "'"; |
|
| 1930 | - $sql .= ", '" . Config::$dbEngine->escape($this->clicktodial_poste) . "')"; |
|
| 1926 | + $sql .= " VALUES (".$this->id;
|
|
| 1927 | + $sql .= ", '".Config::$dbEngine->escape($this->clicktodial_url)."'"; |
|
| 1928 | + $sql .= ", '".Config::$dbEngine->escape($this->clicktodial_login)."'"; |
|
| 1929 | + $sql .= ", '".Config::$dbEngine->escape($this->clicktodial_password)."'"; |
|
| 1930 | + $sql .= ", '".Config::$dbEngine->escape($this->clicktodial_poste)."')"; |
|
| 1931 | 1931 | |
| 1932 | - DolUtils::dol_syslog(get_class($this) . '::update_clicktodial', LOG_DEBUG); |
|
| 1932 | + DolUtils::dol_syslog(get_class($this).'::update_clicktodial', LOG_DEBUG); |
|
| 1933 | 1933 | $result = Config::$dbEngine->query($sql); |
| 1934 | 1934 | if ($result) {
|
| 1935 | 1935 | Config::$dbEngine->commit(); |
@@ -1959,20 +1959,20 @@ discard block |
||
| 1959 | 1959 | |
| 1960 | 1960 | Config::$dbEngine->begin(); |
| 1961 | 1961 | |
| 1962 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "usergroup_user"; |
|
| 1963 | - $sql .= " WHERE fk_user = " . $this->id; |
|
| 1964 | - $sql .= " AND fk_usergroup = " . $group; |
|
| 1965 | - $sql .= " AND entity = " . $entity; |
|
| 1962 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user"; |
|
| 1963 | + $sql .= " WHERE fk_user = ".$this->id; |
|
| 1964 | + $sql .= " AND fk_usergroup = ".$group; |
|
| 1965 | + $sql .= " AND entity = ".$entity; |
|
| 1966 | 1966 | |
| 1967 | 1967 | $result = Config::$dbEngine->query($sql); |
| 1968 | 1968 | |
| 1969 | - $sql = "INSERT INTO " . MAIN_DB_PREFIX . "usergroup_user (entity, fk_user, fk_usergroup)"; |
|
| 1970 | - $sql .= " VALUES (" . $entity . "," . $this->id . "," . $group . ")";
|
|
| 1969 | + $sql = "INSERT INTO ".MAIN_DB_PREFIX."usergroup_user (entity, fk_user, fk_usergroup)"; |
|
| 1970 | + $sql .= " VALUES (".$entity.",".$this->id.",".$group.")";
|
|
| 1971 | 1971 | |
| 1972 | 1972 | $result = Config::$dbEngine->query($sql); |
| 1973 | 1973 | if ($result) {
|
| 1974 | 1974 | if (!$error && !$notrigger) {
|
| 1975 | - $this->newgroupid = $group; // deprecated. Remove this. |
|
| 1975 | + $this->newgroupid = $group; // deprecated. Remove this. |
|
| 1976 | 1976 | $this->context = array('audit' => Globals::$langs->trans("UserSetInGroup"), 'newgroupid' => $group);
|
| 1977 | 1977 | |
| 1978 | 1978 | // Call trigger |
@@ -1987,7 +1987,7 @@ discard block |
||
| 1987 | 1987 | Config::$dbEngine->commit(); |
| 1988 | 1988 | return 1; |
| 1989 | 1989 | } else {
|
| 1990 | - DolUtils::dol_syslog(get_class($this) . "::SetInGroup " . $this->error, LOG_ERR); |
|
| 1990 | + DolUtils::dol_syslog(get_class($this)."::SetInGroup ".$this->error, LOG_ERR); |
|
| 1991 | 1991 | Config::$dbEngine->rollback(); |
| 1992 | 1992 | return -2; |
| 1993 | 1993 | } |
@@ -2016,15 +2016,15 @@ discard block |
||
| 2016 | 2016 | |
| 2017 | 2017 | Config::$dbEngine->begin(); |
| 2018 | 2018 | |
| 2019 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . "usergroup_user"; |
|
| 2020 | - $sql .= " WHERE fk_user = " . $this->id; |
|
| 2021 | - $sql .= " AND fk_usergroup = " . $group; |
|
| 2022 | - $sql .= " AND entity = " . $entity; |
|
| 2019 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX."usergroup_user"; |
|
| 2020 | + $sql .= " WHERE fk_user = ".$this->id; |
|
| 2021 | + $sql .= " AND fk_usergroup = ".$group; |
|
| 2022 | + $sql .= " AND entity = ".$entity; |
|
| 2023 | 2023 | |
| 2024 | 2024 | $result = Config::$dbEngine->query($sql); |
| 2025 | 2025 | if ($result) {
|
| 2026 | 2026 | if (!$error && !$notrigger) {
|
| 2027 | - $this->oldgroupid = $group; // deprecated. Remove this. |
|
| 2027 | + $this->oldgroupid = $group; // deprecated. Remove this. |
|
| 2028 | 2028 | $this->context = array('audit' => Globals::$langs->trans("UserRemovedFromGroup"), 'oldgroupid' => $group);
|
| 2029 | 2029 | |
| 2030 | 2030 | // Call trigger |
@@ -2040,7 +2040,7 @@ discard block |
||
| 2040 | 2040 | return 1; |
| 2041 | 2041 | } else {
|
| 2042 | 2042 | $this->error = $interface->error; |
| 2043 | - DolUtils::dol_syslog(get_class($this) . "::RemoveFromGroup " . $this->error, LOG_ERR); |
|
| 2043 | + DolUtils::dol_syslog(get_class($this)."::RemoveFromGroup ".$this->error, LOG_ERR); |
|
| 2044 | 2044 | Config::$dbEngine->rollback(); |
| 2045 | 2045 | return -2; |
| 2046 | 2046 | } |
@@ -2064,7 +2064,7 @@ discard block |
||
| 2064 | 2064 | function getPhotoUrl($width, $height, $cssclass = '', $imagesize = '') |
| 2065 | 2065 | {
|
| 2066 | 2066 | // $result = '<a href="' . DOL_URL_ROOT . '/user/card.php?id=' . $this->id . '">'; |
| 2067 | - $result = '<a href="' . BASE_URI . '?controller=user&method=card&id=' . $this->id . '">'; |
|
| 2067 | + $result = '<a href="'.BASE_URI.'?controller=user&method=card&id='.$this->id.'">'; |
|
| 2068 | 2068 | $result .= Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass, $imagesize);
|
| 2069 | 2069 | $result .= '</a>'; |
| 2070 | 2070 | |
@@ -2114,49 +2114,49 @@ discard block |
||
| 2114 | 2114 | |
| 2115 | 2115 | // Info Login |
| 2116 | 2116 | $label .= '<div class="centpercent">'; |
| 2117 | - $label .= '<u>' . Globals::$langs->trans("User") . '</u><br>';
|
|
| 2118 | - $label .= '<b>' . Globals::$langs->trans('Name') . ':</b> ' . $this->getFullName(Globals::$langs, '');
|
|
| 2117 | + $label .= '<u>'.Globals::$langs->trans("User").'</u><br>';
|
|
| 2118 | + $label .= '<b>'.Globals::$langs->trans('Name').':</b> '.$this->getFullName(Globals::$langs, '');
|
|
| 2119 | 2119 | if (!empty($this->login)) {
|
| 2120 | - $label .= '<br><b>' . Globals::$langs->trans('Login') . ':</b> ' . $this->login;
|
|
| 2120 | + $label .= '<br><b>'.Globals::$langs->trans('Login').':</b> '.$this->login;
|
|
| 2121 | 2121 | } |
| 2122 | - $label .= '<br><b>' . Globals::$langs->trans("EMail") . ':</b> ' . $this->email;
|
|
| 2122 | + $label .= '<br><b>'.Globals::$langs->trans("EMail").':</b> '.$this->email;
|
|
| 2123 | 2123 | if (!empty($this->admin)) {
|
| 2124 | - $label .= '<br><b>' . Globals::$langs->trans("Administrator") . '</b>: ' . DolUtils::yn($this->admin);
|
|
| 2124 | + $label .= '<br><b>'.Globals::$langs->trans("Administrator").'</b>: '.DolUtils::yn($this->admin);
|
|
| 2125 | 2125 | } |
| 2126 | 2126 | if (!empty($this->socid)) { // Add thirdparty for external users
|
| 2127 | 2127 | $thirdpartystatic = new Societe($db); |
| 2128 | 2128 | $thirdpartystatic->fetch($this->socid); |
| 2129 | 2129 | if (empty($hidethirdpartylogo)) {
|
| 2130 | - $companylink = ' ' . $thirdpartystatic->getNomUrl(2, (($option == 'nolink') ? 'nolink' : '')); // picto only of company |
|
| 2130 | + $companylink = ' '.$thirdpartystatic->getNomUrl(2, (($option == 'nolink') ? 'nolink' : '')); // picto only of company |
|
| 2131 | 2131 | } |
| 2132 | - $company = ' (' . Globals::$langs->trans("Company") . ': ' . $thirdpartystatic->name . ')';
|
|
| 2132 | + $company = ' ('.Globals::$langs->trans("Company").': '.$thirdpartystatic->name.')';
|
|
| 2133 | 2133 | } |
| 2134 | - $type = ($this->socid ? Globals::$langs->trans("External") . $company : Globals::$langs->trans("Internal"));
|
|
| 2135 | - $label .= '<br><b>' . Globals::$langs->trans("Type") . ':</b> ' . $type;
|
|
| 2136 | - $label .= '<br><b>' . Globals::$langs->trans("Status") . '</b>: ' . $this->getLibStatut(0);
|
|
| 2134 | + $type = ($this->socid ? Globals::$langs->trans("External").$company : Globals::$langs->trans("Internal"));
|
|
| 2135 | + $label .= '<br><b>'.Globals::$langs->trans("Type").':</b> '.$type;
|
|
| 2136 | + $label .= '<br><b>'.Globals::$langs->trans("Status").'</b>: '.$this->getLibStatut(0);
|
|
| 2137 | 2137 | $label .= '</div>'; |
| 2138 | 2138 | if ($infologin > 0) {
|
| 2139 | 2139 | $label .= '<br>'; |
| 2140 | - $label .= '<br><u>' . Globals::$langs->trans("Connection") . '</u>';
|
|
| 2141 | - $label .= '<br><b>' . Globals::$langs->trans("IPAddress") . '</b>: ' . $_SERVER["REMOTE_ADDR"];
|
|
| 2140 | + $label .= '<br><u>'.Globals::$langs->trans("Connection").'</u>';
|
|
| 2141 | + $label .= '<br><b>'.Globals::$langs->trans("IPAddress").'</b>: '.$_SERVER["REMOTE_ADDR"];
|
|
| 2142 | 2142 | if (!empty(Globals::$conf->global->MAIN_MODULE_MULTICOMPANY)) {
|
| 2143 | - $label .= '<br><b>' . Globals::$langs->trans("ConnectedOnMultiCompany") . ':</b> ' . Globals::$conf->entity . ' (user entity ' . $this->entity . ')';
|
|
| 2143 | + $label .= '<br><b>'.Globals::$langs->trans("ConnectedOnMultiCompany").':</b> '.Globals::$conf->entity.' (user entity '.$this->entity.')';
|
|
| 2144 | 2144 | } |
| 2145 | - $label .= '<br><b>' . Globals::$langs->trans("AuthenticationMode") . ':</b> ' . $_SESSION["dol_authmode"] . (empty($dolibarr_main_demo) ? '' : ' (demo)');
|
|
| 2146 | - $label .= '<br><b>' . Globals::$langs->trans("ConnectedSince") . ':</b> ' . DolUtils::dol_print_date($this->datelastlogin, "dayhour", 'tzuser');
|
|
| 2147 | - $label .= '<br><b>' . Globals::$langs->trans("PreviousConnexion") . ':</b> ' . DolUtils::dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser');
|
|
| 2148 | - $label .= '<br><b>' . Globals::$langs->trans("CurrentTheme") . ':</b> ' . Globals::$conf->theme;
|
|
| 2149 | - $label .= '<br><b>' . Globals::$langs->trans("CurrentMenuManager") . ':</b> ' . Globals::$menuManager->name;
|
|
| 2145 | + $label .= '<br><b>'.Globals::$langs->trans("AuthenticationMode").':</b> '.$_SESSION["dol_authmode"].(empty($dolibarr_main_demo) ? '' : ' (demo)');
|
|
| 2146 | + $label .= '<br><b>'.Globals::$langs->trans("ConnectedSince").':</b> '.DolUtils::dol_print_date($this->datelastlogin, "dayhour", 'tzuser');
|
|
| 2147 | + $label .= '<br><b>'.Globals::$langs->trans("PreviousConnexion").':</b> '.DolUtils::dol_print_date($this->datepreviouslogin, "dayhour", 'tzuser');
|
|
| 2148 | + $label .= '<br><b>'.Globals::$langs->trans("CurrentTheme").':</b> '.Globals::$conf->theme;
|
|
| 2149 | + $label .= '<br><b>'.Globals::$langs->trans("CurrentMenuManager").':</b> '.Globals::$menuManager->name;
|
|
| 2150 | 2150 | $s = DolUtils::picto_from_langcode(Globals::$langs->getDefaultLang()); |
| 2151 | - $label .= '<br><b>' . Globals::$langs->trans("CurrentUserLanguage") . ':</b> ' . ($s ? $s . ' ' : '') . Globals::$langs->getDefaultLang();
|
|
| 2152 | - $label .= '<br><b>' . Globals::$langs->trans("Browser") . ':</b> ' . Globals::$conf->browser->name . (Globals::$conf->browser->version ? ' ' . Globals::$conf->browser->version : '') . ' (' . $_SERVER['HTTP_USER_AGENT'] . ')';
|
|
| 2153 | - $label .= '<br><b>' . Globals::$langs->trans("Layout") . ':</b> ' . Globals::$conf->browser->layout;
|
|
| 2154 | - $label .= '<br><b>' . Globals::$langs->trans("Screen") . ':</b> ' . $_SESSION['dol_screenwidth'] . ' x ' . $_SESSION['dol_screenheight'];
|
|
| 2151 | + $label .= '<br><b>'.Globals::$langs->trans("CurrentUserLanguage").':</b> '.($s ? $s.' ' : '').Globals::$langs->getDefaultLang();
|
|
| 2152 | + $label .= '<br><b>'.Globals::$langs->trans("Browser").':</b> '.Globals::$conf->browser->name.(Globals::$conf->browser->version ? ' '.Globals::$conf->browser->version : '').' ('.$_SERVER['HTTP_USER_AGENT'].')';
|
|
| 2153 | + $label .= '<br><b>'.Globals::$langs->trans("Layout").':</b> '.Globals::$conf->browser->layout;
|
|
| 2154 | + $label .= '<br><b>'.Globals::$langs->trans("Screen").':</b> '.$_SESSION['dol_screenwidth'].' x '.$_SESSION['dol_screenheight'];
|
|
| 2155 | 2155 | if (Globals::$conf->browser->layout == 'phone') {
|
| 2156 | - $label .= '<br><b>' . Globals::$langs->trans("Phone") . ':</b> ' . Globals::$langs->trans("Yes");
|
|
| 2156 | + $label .= '<br><b>'.Globals::$langs->trans("Phone").':</b> '.Globals::$langs->trans("Yes");
|
|
| 2157 | 2157 | } |
| 2158 | 2158 | if (!empty($_SESSION["disablemodules"])) {
|
| 2159 | - $label .= '<br><b>' . Globals::$langs->trans("DisabledModules") . ':</b> <br>' . join(', ', explode(',', $_SESSION["disablemodules"]));
|
|
| 2159 | + $label .= '<br><b>'.Globals::$langs->trans("DisabledModules").':</b> <br>'.join(', ', explode(',', $_SESSION["disablemodules"]));
|
|
| 2160 | 2160 | } |
| 2161 | 2161 | } |
| 2162 | 2162 | if ($infologin < 0) {
|
@@ -2164,10 +2164,10 @@ discard block |
||
| 2164 | 2164 | } |
| 2165 | 2165 | |
| 2166 | 2166 | // $url = DOL_URL_ROOT . '/user/card.php?id=' . $this->id; |
| 2167 | - $url = BASE_URI . '?controller=user&method=card&id=' . $this->id; |
|
| 2167 | + $url = BASE_URI.'?controller=user&method=card&id='.$this->id; |
|
| 2168 | 2168 | if ($option == 'leave') {
|
| 2169 | 2169 | //$url = DOL_URL_ROOT . '/holiday/list.php?id=' . $this->id; |
| 2170 | - $url = BASE_URI . '?controller=holiday&method=list&id=' . $this->id; |
|
| 2170 | + $url = BASE_URI.'?controller=holiday&method=list&id='.$this->id; |
|
| 2171 | 2171 | } |
| 2172 | 2172 | if ($option != 'nolink') {
|
| 2173 | 2173 | // Add param to save lastsearch_values or not |
@@ -2180,16 +2180,16 @@ discard block |
||
| 2180 | 2180 | } |
| 2181 | 2181 | } |
| 2182 | 2182 | |
| 2183 | - $linkstart = '<a href="' . $url . '"'; |
|
| 2183 | + $linkstart = '<a href="'.$url.'"'; |
|
| 2184 | 2184 | $linkclose = ""; |
| 2185 | 2185 | if (empty($notooltip)) {
|
| 2186 | 2186 | if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
| 2187 | 2187 | Globals::$langs->load("users");
|
| 2188 | 2188 | $label = Globals::$langs->trans("ShowUser");
|
| 2189 | - $linkclose .= ' alt="' . DolUtils::dol_escape_htmltag($label, 1) . '"'; |
|
| 2189 | + $linkclose .= ' alt="'.DolUtils::dol_escape_htmltag($label, 1).'"'; |
|
| 2190 | 2190 | } |
| 2191 | - $linkclose .= ' title="' . DolUtils::dol_escape_htmltag($label, 1) . '"'; |
|
| 2192 | - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; |
|
| 2191 | + $linkclose .= ' title="'.DolUtils::dol_escape_htmltag($label, 1).'"'; |
|
| 2192 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
| 2193 | 2193 | |
| 2194 | 2194 | /* |
| 2195 | 2195 | Globals::$hookManager->initHooks(array('userdao'));
|
@@ -2199,7 +2199,7 @@ discard block |
||
| 2199 | 2199 | */ |
| 2200 | 2200 | } |
| 2201 | 2201 | |
| 2202 | - $linkstart .= $linkclose . '>'; |
|
| 2202 | + $linkstart .= $linkclose.'>'; |
|
| 2203 | 2203 | $linkend = '</a>'; |
| 2204 | 2204 | |
| 2205 | 2205 | //if ($withpictoimg == -1) $result.='<div class="nowrap">'; |
@@ -2211,15 +2211,15 @@ discard block |
||
| 2211 | 2211 | } |
| 2212 | 2212 | // Only picto |
| 2213 | 2213 | if ($withpictoimg > 0) {
|
| 2214 | - $picto = '<!-- picto user --><div class="inline-block nopadding userimg' . ($morecss ? ' ' . $morecss : '') . '">' . img_object('', 'user', $paddafterimage . ' ' . ($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1) . '</div>';
|
|
| 2214 | + $picto = '<!-- picto user --><div class="inline-block nopadding userimg'.($morecss ? ' '.$morecss : '').'">'.img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1).'</div>';
|
|
| 2215 | 2215 | } else { // Picto must be a photo
|
| 2216 | - $picto = '<!-- picto photo user --><div class="inline-block nopadding userimg' . ($morecss ? ' ' . $morecss : '') . '"' . ($paddafterimage ? ' ' . $paddafterimage : '') . '>' . Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto' . ($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1) . '</div>';
|
|
| 2216 | + $picto = '<!-- picto photo user --><div class="inline-block nopadding userimg'.($morecss ? ' '.$morecss : '').'"'.($paddafterimage ? ' '.$paddafterimage : '').'>'.Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1).'</div>';
|
|
| 2217 | 2217 | } |
| 2218 | 2218 | $result .= $picto; |
| 2219 | 2219 | } |
| 2220 | 2220 | if ($withpictoimg > -2 && $withpictoimg != 2) {
|
| 2221 | 2221 | if (empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
| 2222 | - $result .= '<div class="inline-block nopadding valignmiddle usertext' . ((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled') . ($morecss ? ' ' . $morecss : '') . '">'; |
|
| 2222 | + $result .= '<div class="inline-block nopadding valignmiddle usertext'.((!isset($this->statut) || $this->statut) ? '' : ' strikefordisabled').($morecss ? ' '.$morecss : '').'">'; |
|
| 2223 | 2223 | } |
| 2224 | 2224 | if ($mode == 'login') {
|
| 2225 | 2225 | $result .= dol_trunc($this->login, $maxlen); |
@@ -2239,7 +2239,7 @@ discard block |
||
| 2239 | 2239 | global $action; |
| 2240 | 2240 | Globals::$hookManager->initHooks(array('userdao'));
|
| 2241 | 2241 | $parameters = array('id' => $this->id, 'getnomurl' => $result);
|
| 2242 | - $reshook = Globals::$hookManager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
|
| 2242 | + $reshook = Globals::$hookManager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
|
|
| 2243 | 2243 | if ($reshook > 0) {
|
| 2244 | 2244 | $result = Globals::$hookManager->resPrint; |
| 2245 | 2245 | } else {
|
@@ -2263,7 +2263,7 @@ discard block |
||
| 2263 | 2263 | $result = ''; |
| 2264 | 2264 | |
| 2265 | 2265 | // $linkstart = '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">'; |
| 2266 | - $linkstart = '<a href="' . BASE_URI . '?controller=user&method=card&id=' . $this->id . '">'; |
|
| 2266 | + $linkstart = '<a href="'.BASE_URI.'?controller=user&method=card&id='.$this->id.'">'; |
|
| 2267 | 2267 | $linkend = '</a>'; |
| 2268 | 2268 | |
| 2269 | 2269 | //Check user's rights to see an other user |
@@ -2273,7 +2273,7 @@ discard block |
||
| 2273 | 2273 | |
| 2274 | 2274 | if ($option == 'xxx') {
|
| 2275 | 2275 | //$linkstart = '<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$this->id.'">'; |
| 2276 | - $linkstart = '<a href="' . BASE_URI . '?controller=user&method=card.php&id=' . $this->id . '">'; |
|
| 2276 | + $linkstart = '<a href="'.BASE_URI.'?controller=user&method=card.php&id='.$this->id.'">'; |
|
| 2277 | 2277 | $linkend = '</a>'; |
| 2278 | 2278 | } |
| 2279 | 2279 | |
@@ -2330,9 +2330,9 @@ discard block |
||
| 2330 | 2330 | } |
| 2331 | 2331 | } elseif ($mode == 2) {
|
| 2332 | 2332 | if ($statut == 1) {
|
| 2333 | - return img_picto(Globals::$langs->trans('Enabled'), 'statut4', 'class="pictostatus"') . ' ' . Globals::$langs->trans('Enabled');
|
|
| 2333 | + return img_picto(Globals::$langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.Globals::$langs->trans('Enabled');
|
|
| 2334 | 2334 | } elseif ($statut == 0) {
|
| 2335 | - return img_picto(Globals::$langs->trans('Disabled'), 'statut5', 'class="pictostatus"') . ' ' . Globals::$langs->trans('Disabled');
|
|
| 2335 | + return img_picto(Globals::$langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.Globals::$langs->trans('Disabled');
|
|
| 2336 | 2336 | } |
| 2337 | 2337 | } elseif ($mode == 3) {
|
| 2338 | 2338 | if ($statut == 1) {
|
@@ -2342,15 +2342,15 @@ discard block |
||
| 2342 | 2342 | } |
| 2343 | 2343 | } elseif ($mode == 4) {
|
| 2344 | 2344 | if ($statut == 1) {
|
| 2345 | - return img_picto(Globals::$langs->trans('Enabled'), 'statut4', 'class="pictostatus"') . ' ' . Globals::$langs->trans('Enabled');
|
|
| 2345 | + return img_picto(Globals::$langs->trans('Enabled'), 'statut4', 'class="pictostatus"').' '.Globals::$langs->trans('Enabled');
|
|
| 2346 | 2346 | } elseif ($statut == 0) {
|
| 2347 | - return img_picto(Globals::$langs->trans('Disabled'), 'statut5', 'class="pictostatus"') . ' ' . Globals::$langs->trans('Disabled');
|
|
| 2347 | + return img_picto(Globals::$langs->trans('Disabled'), 'statut5', 'class="pictostatus"').' '.Globals::$langs->trans('Disabled');
|
|
| 2348 | 2348 | } |
| 2349 | 2349 | } elseif ($mode == 5) {
|
| 2350 | 2350 | if ($statut == 1) {
|
| 2351 | - return Globals::$langs->trans('Enabled') . ' ' . img_picto(Globals::$langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
|
|
| 2351 | + return Globals::$langs->trans('Enabled').' '.img_picto(Globals::$langs->trans('Enabled'), 'statut4', 'class="pictostatus"');
|
|
| 2352 | 2352 | } elseif ($statut == 0) {
|
| 2353 | - return Globals::$langs->trans('Disabled') . ' ' . img_picto(Globals::$langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
|
|
| 2353 | + return Globals::$langs->trans('Disabled').' '.img_picto(Globals::$langs->trans('Disabled'), 'statut5', 'class="pictostatus"');
|
|
| 2354 | 2354 | } |
| 2355 | 2355 | } |
| 2356 | 2356 | } |
@@ -2371,11 +2371,11 @@ discard block |
||
| 2371 | 2371 | global $conf; |
| 2372 | 2372 | $dn = ''; |
| 2373 | 2373 | if ($mode == 0) {
|
| 2374 | - $dn = Globals::$conf->global->LDAP_KEY_USERS . "=" . $info[Globals::$conf->global->LDAP_KEY_USERS] . "," . Globals::$conf->global->LDAP_USER_DN; |
|
| 2374 | + $dn = Globals::$conf->global->LDAP_KEY_USERS."=".$info[Globals::$conf->global->LDAP_KEY_USERS].",".Globals::$conf->global->LDAP_USER_DN; |
|
| 2375 | 2375 | } elseif ($mode == 1) {
|
| 2376 | 2376 | $dn = Globals::$conf->global->LDAP_USER_DN; |
| 2377 | 2377 | } elseif ($mode == 2) {
|
| 2378 | - $dn = Globals::$conf->global->LDAP_KEY_USERS . "=" . $info[Globals::$conf->global->LDAP_KEY_USERS]; |
|
| 2378 | + $dn = Globals::$conf->global->LDAP_KEY_USERS."=".$info[Globals::$conf->global->LDAP_KEY_USERS]; |
|
| 2379 | 2379 | } |
| 2380 | 2380 | return $dn; |
| 2381 | 2381 | } |
@@ -2573,8 +2573,8 @@ discard block |
||
| 2573 | 2573 | {
|
| 2574 | 2574 | $sql = "SELECT u.rowid, u.login as ref, u.datec,"; |
| 2575 | 2575 | $sql .= " u.tms as date_modification, u.entity"; |
| 2576 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
| 2577 | - $sql .= " WHERE u.rowid = " . $id; |
|
| 2576 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
| 2577 | + $sql .= " WHERE u.rowid = ".$id; |
|
| 2578 | 2578 | |
| 2579 | 2579 | $result = Config::$dbEngine->query($sql); |
| 2580 | 2580 | if ($result) {
|
@@ -2603,9 +2603,9 @@ discard block |
||
| 2603 | 2603 | function getNbOfEMailings() |
| 2604 | 2604 | {
|
| 2605 | 2605 | $sql = "SELECT count(mc.email) as nb"; |
| 2606 | - $sql .= " FROM " . MAIN_DB_PREFIX . "mailing_cibles as mc"; |
|
| 2607 | - $sql .= " WHERE mc.email = '" . Config::$dbEngine->escape($this->email) . "'"; |
|
| 2608 | - $sql .= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes |
|
| 2606 | + $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; |
|
| 2607 | + $sql .= " WHERE mc.email = '".Config::$dbEngine->escape($this->email)."'"; |
|
| 2608 | + $sql .= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes |
|
| 2609 | 2609 | |
| 2610 | 2610 | $resql = Config::$dbEngine->query($sql); |
| 2611 | 2611 | if ($resql) {
|
@@ -2633,19 +2633,19 @@ discard block |
||
| 2633 | 2633 | global $conf; |
| 2634 | 2634 | |
| 2635 | 2635 | $sql = "SELECT count(rowid) as nb"; |
| 2636 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user"; |
|
| 2636 | + $sql .= " FROM ".MAIN_DB_PREFIX."user"; |
|
| 2637 | 2637 | if ($option == 'superadmin') {
|
| 2638 | 2638 | $sql .= " WHERE entity = 0"; |
| 2639 | 2639 | if ($admin >= 0) {
|
| 2640 | - $sql .= " AND admin = " . $admin; |
|
| 2640 | + $sql .= " AND admin = ".$admin; |
|
| 2641 | 2641 | } |
| 2642 | 2642 | } else {
|
| 2643 | - $sql .= " WHERE entity IN (" . getEntity('user', 0) . ")";
|
|
| 2643 | + $sql .= " WHERE entity IN (".getEntity('user', 0).")";
|
|
| 2644 | 2644 | if ($limitTo == 'active') {
|
| 2645 | 2645 | $sql .= " AND statut = 1"; |
| 2646 | 2646 | } |
| 2647 | 2647 | if ($admin >= 0) {
|
| 2648 | - $sql .= " AND admin = " . $admin; |
|
| 2648 | + $sql .= " AND admin = ".$admin; |
|
| 2649 | 2649 | } |
| 2650 | 2650 | } |
| 2651 | 2651 | |
@@ -2696,7 +2696,7 @@ discard block |
||
| 2696 | 2696 | |
| 2697 | 2697 | $result = $this->update(Globals::$user); |
| 2698 | 2698 | |
| 2699 | - DolUtils::dol_syslog(get_class($this) . "::update_ldap2dolibarr result=" . $result, LOG_DEBUG); |
|
| 2699 | + DolUtils::dol_syslog(get_class($this)."::update_ldap2dolibarr result=".$result, LOG_DEBUG); |
|
| 2700 | 2700 | |
| 2701 | 2701 | return $result; |
| 2702 | 2702 | } |
@@ -2711,10 +2711,10 @@ discard block |
||
| 2711 | 2711 | function get_children() |
| 2712 | 2712 | {
|
| 2713 | 2713 | // phpcs:enable |
| 2714 | - $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "user"; |
|
| 2715 | - $sql .= " WHERE fk_user = " . $this->id; |
|
| 2714 | + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."user"; |
|
| 2715 | + $sql .= " WHERE fk_user = ".$this->id; |
|
| 2716 | 2716 | |
| 2717 | - DolUtils::dol_syslog(get_class($this) . "::get_children result=" . $result, LOG_DEBUG); |
|
| 2717 | + DolUtils::dol_syslog(get_class($this)."::get_children result=".$result, LOG_DEBUG); |
|
| 2718 | 2718 | $res = Config::$dbEngine->query($sql); |
| 2719 | 2719 | if ($res) {
|
| 2720 | 2720 | $this->users = array(); |
@@ -2743,11 +2743,11 @@ discard block |
||
| 2743 | 2743 | |
| 2744 | 2744 | // Load array[child]=parent |
| 2745 | 2745 | $sql = "SELECT fk_user as id_parent, rowid as id_son"; |
| 2746 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user"; |
|
| 2746 | + $sql .= " FROM ".MAIN_DB_PREFIX."user"; |
|
| 2747 | 2747 | $sql .= " WHERE fk_user <> 0"; |
| 2748 | - $sql .= " AND entity IN (" . getEntity('user') . ")";
|
|
| 2748 | + $sql .= " AND entity IN (".getEntity('user').")";
|
|
| 2749 | 2749 | |
| 2750 | - DolUtils::dol_syslog(get_class($this) . "::loadParentOf", LOG_DEBUG); |
|
| 2750 | + DolUtils::dol_syslog(get_class($this)."::loadParentOf", LOG_DEBUG); |
|
| 2751 | 2751 | $resql = Config::$dbEngine->query($sql); |
| 2752 | 2752 | if ($resql) {
|
| 2753 | 2753 | while ($obj = Config::$dbEngine->fetch_object($resql)) {
|
@@ -2789,20 +2789,20 @@ discard block |
||
| 2789 | 2789 | |
| 2790 | 2790 | // Init $this->users array |
| 2791 | 2791 | $sql = "SELECT DISTINCT u.rowid, u.firstname, u.lastname, u.fk_user, u.fk_soc, u.login, u.email, u.gender, u.admin, u.statut, u.photo, u.entity"; // Distinct reduce pb with old tables with duplicates |
| 2792 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
| 2792 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
| 2793 | 2793 | // Add fields from hooks |
| 2794 | 2794 | $parameters = array(); |
| 2795 | - $reshook = Globals::$hookManager->executeHooks('printUserListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
|
| 2795 | + $reshook = Globals::$hookManager->executeHooks('printUserListWhere', $parameters); // Note that $action and $object may have been modified by hook
|
|
| 2796 | 2796 | if ($reshook > 0) {
|
| 2797 | 2797 | $sql .= Globals::$hookManager->resPrint; |
| 2798 | 2798 | } else {
|
| 2799 | - $sql .= " WHERE u.entity IN (" . getEntity('user') . ")";
|
|
| 2799 | + $sql .= " WHERE u.entity IN (".getEntity('user').")";
|
|
| 2800 | 2800 | } |
| 2801 | 2801 | if ($filter) {
|
| 2802 | - $sql .= " AND " . $filter; |
|
| 2802 | + $sql .= " AND ".$filter; |
|
| 2803 | 2803 | } |
| 2804 | 2804 | |
| 2805 | - DolUtils::dol_syslog(get_class($this) . "::get_full_tree get user list", LOG_DEBUG); |
|
| 2805 | + DolUtils::dol_syslog(get_class($this)."::get_full_tree get user list", LOG_DEBUG); |
|
| 2806 | 2806 | $resql = Config::$dbEngine->query($sql); |
| 2807 | 2807 | if ($resql) {
|
| 2808 | 2808 | $i = 0; |
@@ -2828,7 +2828,7 @@ discard block |
||
| 2828 | 2828 | } |
| 2829 | 2829 | |
| 2830 | 2830 | // We add the fullpath property to each elements of first level (no parent exists) |
| 2831 | - DolUtils::dol_syslog(get_class($this) . "::get_full_tree call to build_path_from_id_user", LOG_DEBUG); |
|
| 2831 | + DolUtils::dol_syslog(get_class($this)."::get_full_tree call to build_path_from_id_user", LOG_DEBUG); |
|
| 2832 | 2832 | foreach ($this->users as $key => $val) {
|
| 2833 | 2833 | $result = $this->build_path_from_id_user($key, 0); // Process a branch from the root user key (this user has no parent) |
| 2834 | 2834 | if ($result < 0) {
|
@@ -2840,18 +2840,18 @@ discard block |
||
| 2840 | 2840 | // Exclude leaf including $deleteafterid from tree |
| 2841 | 2841 | if ($deleteafterid) {
|
| 2842 | 2842 | //print "Look to discard user ".$deleteafterid."\n"; |
| 2843 | - $keyfilter1 = '^' . $deleteafterid . '$'; |
|
| 2844 | - $keyfilter2 = '_' . $deleteafterid . '$'; |
|
| 2845 | - $keyfilter3 = '^' . $deleteafterid . '_'; |
|
| 2846 | - $keyfilter4 = '_' . $deleteafterid . '_'; |
|
| 2843 | + $keyfilter1 = '^'.$deleteafterid.'$'; |
|
| 2844 | + $keyfilter2 = '_'.$deleteafterid.'$'; |
|
| 2845 | + $keyfilter3 = '^'.$deleteafterid.'_'; |
|
| 2846 | + $keyfilter4 = '_'.$deleteafterid.'_'; |
|
| 2847 | 2847 | foreach ($this->users as $key => $val) {
|
| 2848 | - if (preg_match('/' . $keyfilter1 . '/', $val['fullpath']) || preg_match('/' . $keyfilter2 . '/', $val['fullpath']) || preg_match('/' . $keyfilter3 . '/', $val['fullpath']) || preg_match('/' . $keyfilter4 . '/', $val['fullpath'])) {
|
|
| 2848 | + if (preg_match('/'.$keyfilter1.'/', $val['fullpath']) || preg_match('/'.$keyfilter2.'/', $val['fullpath']) || preg_match('/'.$keyfilter3.'/', $val['fullpath']) || preg_match('/'.$keyfilter4.'/', $val['fullpath'])) {
|
|
| 2849 | 2849 | unset($this->users[$key]); |
| 2850 | 2850 | } |
| 2851 | 2851 | } |
| 2852 | 2852 | } |
| 2853 | 2853 | |
| 2854 | - DolUtils::dol_syslog(get_class($this) . "::get_full_tree dol_sort_array", LOG_DEBUG); |
|
| 2854 | + DolUtils::dol_syslog(get_class($this)."::get_full_tree dol_sort_array", LOG_DEBUG); |
|
| 2855 | 2855 | $this->users = dol_sort_array($this->users, 'fullname', 'asc', true, false); |
| 2856 | 2856 | |
| 2857 | 2857 | //var_dump($this->users); |
@@ -2879,10 +2879,10 @@ discard block |
||
| 2879 | 2879 | |
| 2880 | 2880 | $idtoscan = $this->id; |
| 2881 | 2881 | |
| 2882 | - DolUtils::dol_syslog("Build childid for id = " . $idtoscan);
|
|
| 2882 | + DolUtils::dol_syslog("Build childid for id = ".$idtoscan);
|
|
| 2883 | 2883 | foreach ($this->users as $id => $val) {
|
| 2884 | 2884 | //var_dump($val['fullpath']); |
| 2885 | - if (preg_match('/_' . $idtoscan . '_/', $val['fullpath'])) {
|
|
| 2885 | + if (preg_match('/_'.$idtoscan.'_/', $val['fullpath'])) {
|
|
| 2886 | 2886 | $childids[$val['id']] = $val['id']; |
| 2887 | 2887 | } |
| 2888 | 2888 | } |
@@ -2908,16 +2908,16 @@ discard block |
||
| 2908 | 2908 | function build_path_from_id_user($id_user, $protection = 0) |
| 2909 | 2909 | {
|
| 2910 | 2910 | // phpcs:enable |
| 2911 | - DolUtils::dol_syslog(get_class($this) . "::build_path_from_id_user id_user=" . $id_user . " protection=" . $protection, LOG_DEBUG); |
|
| 2911 | + DolUtils::dol_syslog(get_class($this)."::build_path_from_id_user id_user=".$id_user." protection=".$protection, LOG_DEBUG); |
|
| 2912 | 2912 | |
| 2913 | 2913 | if (!empty($this->users[$id_user]['fullpath'])) {
|
| 2914 | 2914 | // Already defined |
| 2915 | - DolUtils::dol_syslog(get_class($this) . "::build_path_from_id_user fullpath and fullname already defined", LOG_WARNING); |
|
| 2915 | + DolUtils::dol_syslog(get_class($this)."::build_path_from_id_user fullpath and fullname already defined", LOG_WARNING); |
|
| 2916 | 2916 | return 0; |
| 2917 | 2917 | } |
| 2918 | 2918 | |
| 2919 | 2919 | // Define fullpath and fullname |
| 2920 | - $this->users[$id_user]['fullpath'] = '_' . $id_user; |
|
| 2920 | + $this->users[$id_user]['fullpath'] = '_'.$id_user; |
|
| 2921 | 2921 | $this->users[$id_user]['fullname'] = $this->users[$id_user]['lastname']; |
| 2922 | 2922 | $i = 0; |
| 2923 | 2923 | $cursor_user = $id_user; |
@@ -2926,11 +2926,11 @@ discard block |
||
| 2926 | 2926 | while (!empty($this->parentof[$cursor_user])) {
|
| 2927 | 2927 | if (in_array($this->parentof[$cursor_user], Globals::$useridfound)) {
|
| 2928 | 2928 | DolUtils::dol_syslog("The hierarchy of user has a recursive loop", LOG_WARNING);
|
| 2929 | - return -1; // Should not happen. Protection against looping hierarchy |
|
| 2929 | + return -1; // Should not happen. Protection against looping hierarchy |
|
| 2930 | 2930 | } |
| 2931 | 2931 | Globals::$useridfound[] = $this->parentof[$cursor_user]; |
| 2932 | - $this->users[$id_user]['fullpath'] = '_' . $this->parentof[$cursor_user] . $this->users[$id_user]['fullpath']; |
|
| 2933 | - $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['lastname'] . ' >> ' . $this->users[$id_user]['fullname']; |
|
| 2932 | + $this->users[$id_user]['fullpath'] = '_'.$this->parentof[$cursor_user].$this->users[$id_user]['fullpath']; |
|
| 2933 | + $this->users[$id_user]['fullname'] = $this->users[$this->parentof[$cursor_user]]['lastname'].' >> '.$this->users[$id_user]['fullname']; |
|
| 2934 | 2934 | $i++; |
| 2935 | 2935 | $cursor_user = $this->parentof[$cursor_user]; |
| 2936 | 2936 | } |
@@ -2972,10 +2972,10 @@ discard block |
||
| 2972 | 2972 | $this->nb = array(); |
| 2973 | 2973 | |
| 2974 | 2974 | $sql = "SELECT count(u.rowid) as nb"; |
| 2975 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
| 2975 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
| 2976 | 2976 | $sql .= " WHERE u.statut > 0"; |
| 2977 | 2977 | //$sql.= " AND employee != 0"; |
| 2978 | - $sql .= " AND u.entity IN (" . getEntity('user') . ")";
|
|
| 2978 | + $sql .= " AND u.entity IN (".getEntity('user').")";
|
|
| 2979 | 2979 | |
| 2980 | 2980 | $resql = Config::$dbEngine->query($sql); |
| 2981 | 2981 | if ($resql) {
|
@@ -3040,8 +3040,8 @@ discard block |
||
| 3040 | 3040 | } |
| 3041 | 3041 | |
| 3042 | 3042 | $sql = "SELECT rowid, email, user_mobile, civility, lastname, firstname"; |
| 3043 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user"; |
|
| 3044 | - $sql .= " WHERE rowid = '" . $rowid . "'"; |
|
| 3043 | + $sql .= " FROM ".MAIN_DB_PREFIX."user"; |
|
| 3044 | + $sql .= " WHERE rowid = '".$rowid."'"; |
|
| 3045 | 3045 | |
| 3046 | 3046 | $resql = Config::$dbEngine->query($sql); |
| 3047 | 3047 | if ($resql) {
|
@@ -3051,7 +3051,7 @@ discard block |
||
| 3051 | 3051 | $obj = Config::$dbEngine->fetch_object($resql); |
| 3052 | 3052 | |
| 3053 | 3053 | if ($mode == 'email') {
|
| 3054 | - $this->user_property = dolGetFirstLastname($obj->firstname, $obj->lastname) . " <" . $obj->email . ">"; |
|
| 3054 | + $this->user_property = dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">"; |
|
| 3055 | 3055 | } else if ($mode == 'mobile') {
|
| 3056 | 3056 | $this->user_property = $obj->user_mobile; |
| 3057 | 3057 | } |
@@ -3078,7 +3078,7 @@ discard block |
||
| 3078 | 3078 | global $conf; |
| 3079 | 3079 | |
| 3080 | 3080 | $sql = "SELECT t.rowid"; |
| 3081 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t '; |
|
| 3081 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t '; |
|
| 3082 | 3082 | $sql .= " WHERE 1"; |
| 3083 | 3083 | |
| 3084 | 3084 | // Manage filter |
@@ -3086,25 +3086,25 @@ discard block |
||
| 3086 | 3086 | if (!empty($filter)) {
|
| 3087 | 3087 | foreach ($filter as $key => $value) {
|
| 3088 | 3088 | if ($key == 't.rowid') {
|
| 3089 | - $sqlwhere[] = $key . '=' . $value; |
|
| 3089 | + $sqlwhere[] = $key.'='.$value; |
|
| 3090 | 3090 | } elseif (strpos($key, 'date') !== false) {
|
| 3091 | - $sqlwhere[] = $key . ' = \'' . Config::$dbEngine->idate($value) . '\''; |
|
| 3091 | + $sqlwhere[] = $key.' = \''.Config::$dbEngine->idate($value).'\''; |
|
| 3092 | 3092 | } elseif ($key == 'customsql') {
|
| 3093 | 3093 | $sqlwhere[] = $value; |
| 3094 | 3094 | } else {
|
| 3095 | - $sqlwhere[] = $key . ' LIKE \'%' . Config::$dbEngine->escape($value) . '%\''; |
|
| 3095 | + $sqlwhere[] = $key.' LIKE \'%'.Config::$dbEngine->escape($value).'%\''; |
|
| 3096 | 3096 | } |
| 3097 | 3097 | } |
| 3098 | 3098 | } |
| 3099 | 3099 | if (count($sqlwhere) > 0) {
|
| 3100 | - $sql .= ' AND (' . implode(' ' . $filtermode . ' ', $sqlwhere) . ')';
|
|
| 3100 | + $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')';
|
|
| 3101 | 3101 | } |
| 3102 | 3102 | $sql .= Config::$dbEngine->order($sortfield, $sortorder); |
| 3103 | 3103 | if ($limit) {
|
| 3104 | 3104 | $sql .= Config::$dbEngine->plimit($limit + 1, $offset); |
| 3105 | 3105 | } |
| 3106 | 3106 | |
| 3107 | - DolUtils::dol_syslog(get_class($this) . "::" . __METHOD__, LOG_DEBUG); |
|
| 3107 | + DolUtils::dol_syslog(get_class($this)."::".__METHOD__, LOG_DEBUG); |
|
| 3108 | 3108 | |
| 3109 | 3109 | $resql = Config::$dbEngine->query($sql); |
| 3110 | 3110 | if ($resql) {
|
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | $this->llxHeader('', $this->title, '', '', 0, 0, $arrayofjs, $arrayofcss);
|
| 111 | 111 | |
| 112 | 112 | // $newcardbutton = '<a class="butActionNew" href="' . BASE_URI . '/categories/card.php?action=create&type=' . $this->type . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . $this->type) . '"><span class="valignmiddle">' . Globals::$langs->trans("NewCategory") . '</span>';
|
| 113 | - $newcardbutton = '<a class="butActionNew" href="' . BASE_URI . '?call=categories&run=card&action=create&type=' . $this->type . '&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?type=' . $this->type) . '"><span class="valignmiddle">' . Globals::$langs->trans("NewCategory") . '</span>';
|
|
| 113 | + $newcardbutton = '<a class="butActionNew" href="'.BASE_URI.'?call=categories&run=card&action=create&type='.$this->type.'&backtopage='.urlencode($_SERVER["PHP_SELF"].'?type='.$this->type).'"><span class="valignmiddle">'.Globals::$langs->trans("NewCategory").'</span>';
|
|
| 114 | 114 | $newcardbutton .= '<span class="fa fa-plus-circle valignmiddle"></span>'; |
| 115 | 115 | $newcardbutton .= '</a>'; |
| 116 | 116 | |
@@ -124,17 +124,17 @@ discard block |
||
| 124 | 124 | /* |
| 125 | 125 | * Zone recherche produit/service |
| 126 | 126 | */ |
| 127 | - print '<form method="post" action="index.php?type=' . $this->type . '">'; |
|
| 128 | - print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
| 129 | - print '<input type="hidden" name="type" value="' . $this->type . '">'; |
|
| 127 | + print '<form method="post" action="index.php?type='.$this->type.'">'; |
|
| 128 | + print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
| 129 | + print '<input type="hidden" name="type" value="'.$this->type.'">'; |
|
| 130 | 130 | |
| 131 | 131 | |
| 132 | 132 | print '<table class="noborder nohover" width="100%">'; |
| 133 | 133 | print '<tr class="liste_titre">'; |
| 134 | - print '<td colspan="3">' . Globals::$langs->trans("Search") . '</td>';
|
|
| 134 | + print '<td colspan="3">'.Globals::$langs->trans("Search").'</td>';
|
|
| 135 | 135 | print '</tr>'; |
| 136 | 136 | print '<tr class="oddeven"><td>'; |
| 137 | - print Globals::$langs->trans("Name") . ':</td><td><input class="flat inputsearch" type="text" name="catname" value="' . $catname . '"/></td><td><input type="submit" class="button" value="' . Globals::$langs->trans("Search") . '"></td></tr>';
|
|
| 137 | + print Globals::$langs->trans("Name").':</td><td><input class="flat inputsearch" type="text" name="catname" value="'.$catname.'"/></td><td><input type="submit" class="button" value="'.Globals::$langs->trans("Search").'"></td></tr>';
|
|
| 138 | 138 | /* |
| 139 | 139 | // faire une rech dans une sous categorie uniquement |
| 140 | 140 | print '<tr '.$bc[0].'><td>'; |
@@ -159,17 +159,17 @@ discard block |
||
| 159 | 159 | $cats = $categstatic->rechercher($id, $catname, $this->typetext); |
| 160 | 160 | |
| 161 | 161 | print '<table class="noborder" width="100%">'; |
| 162 | - print '<tr class="liste_titre"><td colspan="2">' . Globals::$langs->trans("FoundCats") . '</td></tr>';
|
|
| 162 | + print '<tr class="liste_titre"><td colspan="2">'.Globals::$langs->trans("FoundCats").'</td></tr>';
|
|
| 163 | 163 | |
| 164 | 164 | foreach ($cats as $cat) {
|
| 165 | - print "\t" . '<tr class="oddeven">' . "\n"; |
|
| 165 | + print "\t".'<tr class="oddeven">'."\n"; |
|
| 166 | 166 | print "\t\t<td>"; |
| 167 | 167 | $categstatic->id = $cat->id; |
| 168 | 168 | $categstatic->ref = $cat->label; |
| 169 | 169 | $categstatic->label = $cat->label; |
| 170 | 170 | $categstatic->type = $cat->type; |
| 171 | 171 | $categstatic->color = $cat->color; |
| 172 | - print '<span class="noborderoncategories" ' . ($categstatic->color ? ' style="background: #' . $categstatic->color . ';"' : ' style="background: #aaa"') . '>'; |
|
| 172 | + print '<span class="noborderoncategories" '.($categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>'; |
|
| 173 | 173 | print $categstatic->getNomUrl(1, ''); |
| 174 | 174 | print '</span>'; |
| 175 | 175 | print "</td>\n"; |
@@ -209,9 +209,9 @@ discard block |
||
| 209 | 209 | $data[] = array( |
| 210 | 210 | 'rowid' => $val['rowid'], |
| 211 | 211 | 'fk_menu' => $val['fk_parent'], |
| 212 | - 'entry' => '<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" ' . ($categstatic->color ? ' style="background: #' . $categstatic->color . ';"' : ' style="background: #aaa"') . '>' . $li . '</span></td>' . |
|
| 212 | + 'entry' => '<table class="nobordernopadding centpercent"><tr><td><span class="noborderoncategories" '.($categstatic->color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>'.$li.'</span></td>'. |
|
| 213 | 213 | //'<td width="50%">'.dolGetFirstLineOfText($desc).'</td>'. |
| 214 | - '<td align="right" width="20px;"><a href="' . DOL_URL_ROOT . '/categories/viewcat.php?id=' . $val['id'] . '&type=' . $this->type . '">' . img_view() . '</a></td>' . |
|
| 214 | + '<td align="right" width="20px;"><a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$val['id'].'&type='.$this->type.'">'.img_view().'</a></td>'. |
|
| 215 | 215 | '</tr></table>' |
| 216 | 216 | ); |
| 217 | 217 | } |
@@ -220,9 +220,9 @@ discard block |
||
| 220 | 220 | //print_barre_liste('', 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, 0, '', 0, $newcardbutton, '', 0, 1, 1);
|
| 221 | 221 | |
| 222 | 222 | print '<table class="liste nohover" width="100%">'; |
| 223 | - print '<tr class="liste_titre"><td>' . Globals::$langs->trans("Categories") . '</td><td></td><td align="right">';
|
|
| 223 | + print '<tr class="liste_titre"><td>'.Globals::$langs->trans("Categories").'</td><td></td><td align="right">';
|
|
| 224 | 224 | if (!empty($conf->use_javascript_ajax)) {
|
| 225 | - print '<div id="iddivjstreecontrol"><a class="notasortlink" href="#">' . img_picto('', 'object_category') . ' ' . Globals::$langs->trans("UndoExpandAll") . '</a> | <a class="notasortlink" href="#">' . img_picto('', 'object_category-expanded') . ' ' . Globals::$langs->trans("ExpandAll") . '</a></div>';
|
|
| 225 | + print '<div id="iddivjstreecontrol"><a class="notasortlink" href="#">'.img_picto('', 'object_category').' '.Globals::$langs->trans("UndoExpandAll").'</a> | <a class="notasortlink" href="#">'.img_picto('', 'object_category-expanded').' '.Globals::$langs->trans("ExpandAll").'</a></div>';
|
|
| 226 | 226 | } |
| 227 | 227 | print '</td></tr>'; |
| 228 | 228 | |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | print '</td></tr>'; |
| 235 | 235 | } else {
|
| 236 | 236 | print '<tr class="pair">'; |
| 237 | - print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>' . DolUtils::img_picto_common('', 'treemenu/branchbottom.gif') . '</td>';
|
|
| 237 | + print '<td colspan="3"><table class="nobordernopadding"><tr class="nobordernopadding"><td>'.DolUtils::img_picto_common('', 'treemenu/branchbottom.gif').'</td>';
|
|
| 238 | 238 | print '<td valign="middle">'; |
| 239 | 239 | print Globals::$langs->trans("NoCategoryYet");
|
| 240 | 240 | print '</td>'; |