@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | $inj += preg_match('/insert\s+into/i', $val); |
102 | 102 | $inj += preg_match('/select\s+from/i', $val); |
103 | 103 | $inj += preg_match('/into\s+(outfile|dumpfile)/i', $val); |
104 | - $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() that return current database login |
|
105 | - $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database |
|
104 | + $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() that return current database login |
|
105 | + $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database |
|
106 | 106 | } |
107 | 107 | if ($type == 3) { |
108 | 108 | $inj += preg_match('/select|update|delete|replace|group\s+by|concat|count|from/i', $val); |
@@ -126,15 +126,15 @@ discard block |
||
126 | 126 | $inj += preg_match('/<style/i', $val); |
127 | 127 | } |
128 | 128 | $inj += preg_match('/base[\s]+href/si', $val); |
129 | - $inj += preg_match('/<.*onmouse/si', $val); // onmousexxx can be set on img or any html tag like <img title='...' onmouseover=alert(1)> |
|
130 | - $inj += preg_match('/onerror\s*=/i', $val); // onerror can be set on img or any html tag like <img title='...' onerror = alert(1)> |
|
131 | - $inj += preg_match('/onfocus\s*=/i', $val); // onfocus can be set on input text html tag like <input type='text' value='...' onfocus = alert(1)> |
|
132 | - $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)> |
|
133 | - $inj += preg_match('/onloadstart\s*=/i', $val); // onload can be set on audio tag <audio onloadstart=alert(1)> |
|
134 | - $inj += preg_match('/onclick\s*=/i', $val); // onclick can be set on img text html tag like <img onclick = alert(1)> |
|
135 | - $inj += preg_match('/onscroll\s*=/i', $val); // onscroll can be on textarea |
|
129 | + $inj += preg_match('/<.*onmouse/si', $val); // onmousexxx can be set on img or any html tag like <img title='...' onmouseover=alert(1)> |
|
130 | + $inj += preg_match('/onerror\s*=/i', $val); // onerror can be set on img or any html tag like <img title='...' onerror = alert(1)> |
|
131 | + $inj += preg_match('/onfocus\s*=/i', $val); // onfocus can be set on input text html tag like <input type='text' value='...' onfocus = alert(1)> |
|
132 | + $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)> |
|
133 | + $inj += preg_match('/onloadstart\s*=/i', $val); // onload can be set on audio tag <audio onloadstart=alert(1)> |
|
134 | + $inj += preg_match('/onclick\s*=/i', $val); // onclick can be set on img text html tag like <img onclick = alert(1)> |
|
135 | + $inj += preg_match('/onscroll\s*=/i', $val); // onscroll can be on textarea |
|
136 | 136 | //$inj += preg_match('/on[A-Z][a-z]+\*=/', $val); // To lock event handlers onAbort(), ... |
137 | - $inj += preg_match('/:|:|:/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...' |
|
137 | + $inj += preg_match('/:|:|:/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...' |
|
138 | 138 | //if ($type == 1) |
139 | 139 | //{ |
140 | 140 | $inj += preg_match('/javascript:/i', $val); |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | //} |
143 | 143 | // For XSS Injection done by adding javascript closing html tags like with onmousemove, etc... (closing a src or href tag with not cleaned param) |
144 | 144 | if ($type == 1) { |
145 | - $inj += preg_match('/"/i', $val); // We refused " in GET parameters value |
|
145 | + $inj += preg_match('/"/i', $val); // We refused " in GET parameters value |
|
146 | 146 | } |
147 | 147 | if ($type == 2) { |
148 | - $inj += preg_match('/[;"]/', $val); // PHP_SELF is a file system path. It can contains spaces. |
|
148 | + $inj += preg_match('/[;"]/', $val); // PHP_SELF is a file system path. It can contains spaces. |
|
149 | 149 | } |
150 | 150 | return $inj; |
151 | 151 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | if (analyseVarsForSqlAndScriptsInjection($key, $type) && analyseVarsForSqlAndScriptsInjection($value, $type)) { |
165 | 165 | //$var[$key] = $value; // This is useless |
166 | 166 | } else { |
167 | - 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"]) . ')'; |
|
167 | + 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"]).')'; |
|
168 | 168 | exit; |
169 | 169 | } |
170 | 170 | } |
@@ -198,11 +198,11 @@ discard block |
||
198 | 198 | |
199 | 199 | // This is to make Dolibarr working with Plesk |
200 | 200 | if (!empty($_SERVER['DOCUMENT_ROOT']) && substr($_SERVER['DOCUMENT_ROOT'], -6) !== 'htdocs') { |
201 | - set_include_path($_SERVER['DOCUMENT_ROOT'] . '/htdocs'); |
|
201 | + set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | // Include the conf.php and functions.lib.php |
205 | -require_once DOL_BASE_PATH . '/filefunc.inc.php'; |
|
205 | +require_once DOL_BASE_PATH.'/filefunc.inc.php'; |
|
206 | 206 | |
207 | 207 | // If there is a POST parameter to tell to save automatically some POST parameters into cookies, we do it. |
208 | 208 | // This is used for example by form of boxes to save personalization of some options. |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | $tmplist = explode(',', $tmpautoset[1]); |
213 | 213 | $cookiearrayvalue = array(); |
214 | 214 | foreach ($tmplist as $tmpkey) { |
215 | - $postkey = $tmpautoset[0] . '_' . $tmpkey; |
|
215 | + $postkey = $tmpautoset[0].'_'.$tmpkey; |
|
216 | 216 | //var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]); |
217 | 217 | if (!empty($_POST[$postkey])) |
218 | 218 | $cookiearrayvalue[$tmpkey] = $_POST[$postkey]; |
@@ -230,12 +230,12 @@ discard block |
||
230 | 230 | // Note: the function dol_getprefix may have been redefined to return a different key to manage another area to protect. |
231 | 231 | $prefix = dol_getprefix(''); |
232 | 232 | |
233 | -$sessionname = 'DOLSESSID_' . $prefix; |
|
234 | -$sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix; |
|
233 | +$sessionname = 'DOLSESSID_'.$prefix; |
|
234 | +$sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; |
|
235 | 235 | if (!empty($_COOKIE[$sessiontimeout])) |
236 | 236 | ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]); |
237 | 237 | session_name($sessionname); |
238 | -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. |
|
238 | +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. |
|
239 | 239 | // This create lock, released when session_write_close() or end of page. |
240 | 240 | // We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished. |
241 | 241 | if (!defined('NOSESSION')) { |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $conf->browser->name = $tmp['browsername']; |
262 | 262 | $conf->browser->os = $tmp['browseros']; |
263 | 263 | $conf->browser->version = $tmp['browserversion']; |
264 | - $conf->browser->layout = $tmp['layout']; // 'classic', 'phone', 'tablet' |
|
264 | + $conf->browser->layout = $tmp['layout']; // 'classic', 'phone', 'tablet' |
|
265 | 265 | //var_dump($conf->browser); |
266 | 266 | |
267 | 267 | if ($conf->browser->layout == 'phone') |
@@ -280,16 +280,16 @@ discard block |
||
280 | 280 | $newurl = preg_replace('/^http:/i', 'https:', $_SERVER["SCRIPT_URI"]); |
281 | 281 | } |
282 | 282 | } else { // Check HTTPS environment variable (Apache/mod_ssl only) |
283 | - $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT) . $_SERVER["REQUEST_URI"]; |
|
283 | + $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT).$_SERVER["REQUEST_URI"]; |
|
284 | 284 | } |
285 | 285 | } else { |
286 | 286 | // Check HTTPS environment variable (Apache/mod_ssl only) |
287 | - $newurl = $conf->file->main_force_https . $_SERVER["REQUEST_URI"]; |
|
287 | + $newurl = $conf->file->main_force_https.$_SERVER["REQUEST_URI"]; |
|
288 | 288 | } |
289 | 289 | // Start redirect |
290 | 290 | if ($newurl) { |
291 | - dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to " . $newurl); |
|
292 | - header("Location: " . $newurl); |
|
291 | + dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl); |
|
292 | + header("Location: ".$newurl); |
|
293 | 293 | exit; |
294 | 294 | } else { |
295 | 295 | 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); |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | |
315 | 315 | // Loading of additional presentation includes |
316 | 316 | if (!defined('NOREQUIREHTML')) |
317 | - require_once DOL_BASE_PATH . '/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2) |
|
317 | + require_once DOL_BASE_PATH.'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2) |
|
318 | 318 | if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) |
319 | - require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php'; // Need 22ko memory |
|
319 | + require_once DOL_BASE_PATH.'/core/lib/ajax.lib.php'; // Need 22ko memory |
|
320 | 320 | |
321 | 321 | |
322 | 322 | |
@@ -333,19 +333,19 @@ discard block |
||
333 | 333 | // If install or upgrade process not done or not completely finished, we call the install page. |
334 | 334 | if (!empty($conf->global->MAIN_NOT_INSTALLED) || !empty($conf->global->MAIN_NOT_UPGRADED)) { |
335 | 335 | dol_syslog("main.inc: A previous install or upgrade was not complete. Redirect to install page.", LOG_WARNING); |
336 | - header("Location: " . DOL_BASE_URI . "/install/index.php"); |
|
336 | + header("Location: ".DOL_BASE_URI."/install/index.php"); |
|
337 | 337 | exit; |
338 | 338 | } |
339 | 339 | // If an upgrade process is required, we call the install page. |
340 | 340 | if ((!empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && ($conf->global->MAIN_VERSION_LAST_UPGRADE != DOL_VERSION)) || (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && !empty($conf->global->MAIN_VERSION_LAST_INSTALL) && ($conf->global->MAIN_VERSION_LAST_INSTALL != DOL_VERSION))) { |
341 | 341 | $versiontocompare = empty($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE; |
342 | - require_once DOL_BASE_PATH . '/core/lib/admin.lib.php'; |
|
342 | + require_once DOL_BASE_PATH.'/core/lib/admin.lib.php'; |
|
343 | 343 | $dolibarrversionlastupgrade = preg_split('/[.-]/', $versiontocompare); |
344 | 344 | $dolibarrversionprogram = preg_split('/[.-]/', DOL_VERSION); |
345 | 345 | $rescomp = versioncompare($dolibarrversionprogram, $dolibarrversionlastupgrade); |
346 | 346 | if ($rescomp > 0) { // Programs have a version higher than database. We did not add "&& $rescomp < 3" because we want upgrade process for build upgrades |
347 | - dol_syslog("main.inc: database version " . $versiontocompare . " is lower than programs version " . DOL_VERSION . ". Redirect to install page.", LOG_WARNING); |
|
348 | - header("Location: " . DOL_BASE_URI . "/install/index.php"); |
|
347 | + dol_syslog("main.inc: database version ".$versiontocompare." is lower than programs version ".DOL_VERSION.". Redirect to install page.", LOG_WARNING); |
|
348 | + header("Location: ".DOL_BASE_URI."/install/index.php"); |
|
349 | 349 | exit; |
350 | 350 | } |
351 | 351 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | } |
369 | 369 | if ($_SERVER['REQUEST_METHOD'] === 'POST') { // This test must be after loading $_SESSION['token']. |
370 | 370 | if (GETPOST('token', 'alpha') != $_SESSION['token']) { |
371 | - dol_syslog("Invalid token in " . $_SERVER['HTTP_REFERER'] . ", action=" . GETPOST('action', 'aZ09') . ", _POST['token']=" . GETPOST('token', 'alpha') . ", _SESSION['token']=" . $_SESSION['token'], LOG_WARNING); |
|
371 | + dol_syslog("Invalid token in ".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING); |
|
372 | 372 | //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. |
373 | 373 | unset($_POST); |
374 | 374 | } |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | $test = true; |
429 | 429 | if (!isset($_SESSION["dol_login"])) { |
430 | 430 | // It is not already authenticated and it requests the login / password |
431 | - include_once DOL_BASE_PATH . '/core/lib/security2.lib.php'; |
|
431 | + include_once DOL_BASE_PATH.'/core/lib/security2.lib.php'; |
|
432 | 432 | |
433 | 433 | $dol_dst_observed = GETPOST("dst_observed", 'int', 3); |
434 | 434 | $dol_dst_first = GETPOST("dst_first", 'int', 3); |
@@ -442,17 +442,17 @@ discard block |
||
442 | 442 | $dol_use_jmobile = GETPOST('dol_use_jmobile', 'int', 3); |
443 | 443 | //dol_syslog("POST key=".join(array_keys($_POST),',').' value='.join($_POST,',')); |
444 | 444 | // If in demo mode, we check we go to home page through the public/demo/index.php page |
445 | - if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_BASE_URI . '/index.php') { // We ask index page |
|
445 | + if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_BASE_URI.'/index.php') { // We ask index page |
|
446 | 446 | if (empty($_SERVER['HTTP_REFERER']) || !preg_match('/public/', $_SERVER['HTTP_REFERER'])) { |
447 | - dol_syslog("Call index page from another url than demo page (call is done from page " . $_SERVER['HTTP_REFERER'] . ")"); |
|
447 | + dol_syslog("Call index page from another url than demo page (call is done from page ".$_SERVER['HTTP_REFERER'].")"); |
|
448 | 448 | $url = ''; |
449 | - $url .= ($url ? '&' : '') . ($dol_hide_topmenu ? 'dol_hide_topmenu=' . $dol_hide_topmenu : ''); |
|
450 | - $url .= ($url ? '&' : '') . ($dol_hide_leftmenu ? 'dol_hide_leftmenu=' . $dol_hide_leftmenu : ''); |
|
451 | - $url .= ($url ? '&' : '') . ($dol_optimize_smallscreen ? 'dol_optimize_smallscreen=' . $dol_optimize_smallscreen : ''); |
|
452 | - $url .= ($url ? '&' : '') . ($dol_no_mouse_hover ? 'dol_no_mouse_hover=' . $dol_no_mouse_hover : ''); |
|
453 | - $url .= ($url ? '&' : '') . ($dol_use_jmobile ? 'dol_use_jmobile=' . $dol_use_jmobile : ''); |
|
454 | - $url = DOL_BASE_URI . '/public/demo/index.php' . ($url ? '?' . $url : ''); |
|
455 | - header("Location: " . $url); |
|
449 | + $url .= ($url ? '&' : '').($dol_hide_topmenu ? 'dol_hide_topmenu='.$dol_hide_topmenu : ''); |
|
450 | + $url .= ($url ? '&' : '').($dol_hide_leftmenu ? 'dol_hide_leftmenu='.$dol_hide_leftmenu : ''); |
|
451 | + $url .= ($url ? '&' : '').($dol_optimize_smallscreen ? 'dol_optimize_smallscreen='.$dol_optimize_smallscreen : ''); |
|
452 | + $url .= ($url ? '&' : '').($dol_no_mouse_hover ? 'dol_no_mouse_hover='.$dol_no_mouse_hover : ''); |
|
453 | + $url .= ($url ? '&' : '').($dol_use_jmobile ? 'dol_use_jmobile='.$dol_use_jmobile : ''); |
|
454 | + $url = DOL_BASE_URI.'/public/demo/index.php'.($url ? '?'.$url : ''); |
|
455 | + header("Location: ".$url); |
|
456 | 456 | exit; |
457 | 457 | } |
458 | 458 | } |
@@ -472,9 +472,9 @@ discard block |
||
472 | 472 | $test = false; |
473 | 473 | |
474 | 474 | // Call trigger for the "security events" log |
475 | - $user->trigger_mesg = 'ErrorBadValueForCode - login=' . GETPOST("username", "alpha", 2); |
|
475 | + $user->trigger_mesg = 'ErrorBadValueForCode - login='.GETPOST("username", "alpha", 2); |
|
476 | 476 | // Call of triggers |
477 | - include_once DOL_BASE_PATH . '/core/class/interfaces.class.php'; |
|
477 | + include_once DOL_BASE_PATH.'/core/class/interfaces.class.php'; |
|
478 | 478 | $interface = new Interfaces($db); |
479 | 479 | $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf); |
480 | 480 | if ($result < 0) { |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | $action = ''; |
486 | 486 | $hookmanager->initHooks(array('login')); |
487 | 487 | $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
488 | - $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
|
488 | + $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
|
489 | 489 | if ($reshook < 0) |
490 | 490 | $error++; |
491 | 491 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | $goontestloop = true; |
511 | 511 | |
512 | 512 | if (!is_object($langs)) { // This can occurs when calling page with NOREQUIRETRAN defined, however we need langs for error messages. |
513 | - include_once DOL_BASE_PATH . '/core/class/translate.class.php'; |
|
513 | + include_once DOL_BASE_PATH.'/core/class/translate.class.php'; |
|
514 | 514 | $langs = new Translate("", $conf); |
515 | 515 | $langcode = (GETPOST('lang', 'aZ09', 1) ? GETPOST('lang', 'aZ09', 1) : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT)); |
516 | 516 | if (defined('MAIN_LANG_DEFAULT')) |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | $dol_tz_string = preg_replace('/\s/', '_', $dol_tz_string); |
533 | 533 | $dol_dst = 0; |
534 | 534 | if (isset($_POST["dst_first"]) && isset($_POST["dst_second"])) { |
535 | - include_once DOL_BASE_PATH . '/core/lib/date.lib.php'; |
|
535 | + include_once DOL_BASE_PATH.'/core/lib/date.lib.php'; |
|
536 | 536 | $datenow = dol_now(); |
537 | 537 | $datefirst = dol_stringtotime($_POST["dst_first"]); |
538 | 538 | $datesecond = dol_stringtotime($_POST["dst_second"]); |
@@ -553,9 +553,9 @@ discard block |
||
553 | 553 | $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword"); |
554 | 554 | |
555 | 555 | // Call trigger for the "security events" log |
556 | - $user->trigger_mesg = $langs->trans("ErrorBadLoginPassword") . ' - login=' . GETPOST("username", "alpha", 2); |
|
556 | + $user->trigger_mesg = $langs->trans("ErrorBadLoginPassword").' - login='.GETPOST("username", "alpha", 2); |
|
557 | 557 | // Call of triggers |
558 | - include_once DOL_BASE_PATH . '/core/class/interfaces.class.php'; |
|
558 | + include_once DOL_BASE_PATH.'/core/class/interfaces.class.php'; |
|
559 | 559 | $interface = new Interfaces($db); |
560 | 560 | $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf, GETPOST("username", "alpha", 2)); |
561 | 561 | if ($result < 0) { |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | $action = ''; |
567 | 567 | $hookmanager->initHooks(array('login')); |
568 | 568 | $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
569 | - $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
|
569 | + $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
|
570 | 570 | if ($reshook < 0) |
571 | 571 | $error++; |
572 | 572 | |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | // End test login / passwords |
578 | 578 | if (!$login || (in_array('ldap', $authmode) && empty($passwordtotest))) { // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success. |
579 | 579 | // No data to test login, so we show the login page |
580 | - dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . " showing the login form and exit"); |
|
580 | + dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." showing the login form and exit"); |
|
581 | 581 | if (defined('NOREDIRECTBYMAINTOLOGIN')) |
582 | 582 | return 'ERROR_NOT_LOGGED'; |
583 | 583 | else |
@@ -590,8 +590,8 @@ discard block |
||
590 | 590 | dol_syslog('User not found, connexion refused'); |
591 | 591 | session_destroy(); |
592 | 592 | session_name($sessionname); |
593 | - session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie |
|
594 | - session_start(); // Fixing the bug of register_globals here is useless since session is empty |
|
593 | + session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie |
|
594 | + session_start(); // Fixing the bug of register_globals here is useless since session is empty |
|
595 | 595 | |
596 | 596 | if ($resultFetchUser == 0) { |
597 | 597 | // Load translation files required by page |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | |
600 | 600 | $_SESSION["dol_loginmesg"] = $langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login); |
601 | 601 | |
602 | - $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login=' . $login; |
|
602 | + $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login; |
|
603 | 603 | } |
604 | 604 | if ($resultFetchUser < 0) { |
605 | 605 | $_SESSION["dol_loginmesg"] = $user->error; |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | } |
609 | 609 | |
610 | 610 | // Call triggers for the "security events" log |
611 | - include_once DOL_BASE_PATH . '/core/class/interfaces.class.php'; |
|
611 | + include_once DOL_BASE_PATH.'/core/class/interfaces.class.php'; |
|
612 | 612 | $interface = new Interfaces($db); |
613 | 613 | $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf); |
614 | 614 | if ($result < 0) { |
@@ -619,18 +619,18 @@ discard block |
||
619 | 619 | $action = ''; |
620 | 620 | $hookmanager->initHooks(array('login')); |
621 | 621 | $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
622 | - $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
|
622 | + $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
|
623 | 623 | if ($reshook < 0) |
624 | 624 | $error++; |
625 | 625 | |
626 | 626 | $paramsurl = array(); |
627 | 627 | if (GETPOST('textbrowser', 'int')) |
628 | - $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int'); |
|
628 | + $paramsurl[] = 'textbrowser='.GETPOST('textbrowser', 'int'); |
|
629 | 629 | if (GETPOST('nojs', 'int')) |
630 | - $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int'); |
|
630 | + $paramsurl[] = 'nojs='.GETPOST('nojs', 'int'); |
|
631 | 631 | if (GETPOST('lang', 'aZ09')) |
632 | - $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09'); |
|
633 | - header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : '')); |
|
632 | + $paramsurl[] = 'lang='.GETPOST('lang', 'aZ09'); |
|
633 | + header('Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : '')); |
|
634 | 634 | exit; |
635 | 635 | } |
636 | 636 | } |
@@ -638,16 +638,16 @@ discard block |
||
638 | 638 | // We are already into an authenticated session |
639 | 639 | $login = $_SESSION["dol_login"]; |
640 | 640 | $entity = $_SESSION["dol_entity"]; |
641 | - dol_syslog("- This is an already logged session. _SESSION['dol_login']=" . $login . " _SESSION['dol_entity']=" . $entity, LOG_DEBUG); |
|
641 | + dol_syslog("- This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG); |
|
642 | 642 | |
643 | 643 | $resultFetchUser = $user->fetch('', $login, '', 1, ($entity > 0 ? $entity : -1)); |
644 | 644 | if ($resultFetchUser <= 0) { |
645 | 645 | // Account has been removed after login |
646 | - dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=" . $login, LOG_WARNING); |
|
646 | + dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING); |
|
647 | 647 | session_destroy(); |
648 | 648 | session_name($sessionname); |
649 | - session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie |
|
650 | - session_start(); // Fixing the bug of register_globals here is useless since session is empty |
|
649 | + session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie |
|
650 | + session_start(); // Fixing the bug of register_globals here is useless since session is empty |
|
651 | 651 | |
652 | 652 | if ($resultFetchUser == 0) { |
653 | 653 | // Load translation files required by page |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | $_SESSION["dol_loginmesg"] = $langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login); |
657 | 657 | |
658 | - $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login=' . $login; |
|
658 | + $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login; |
|
659 | 659 | } |
660 | 660 | if ($resultFetchUser < 0) { |
661 | 661 | $_SESSION["dol_loginmesg"] = $user->error; |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | } |
665 | 665 | |
666 | 666 | // Call triggers for the "security events" log |
667 | - include_once DOL_BASE_PATH . '/core/class/interfaces.class.php'; |
|
667 | + include_once DOL_BASE_PATH.'/core/class/interfaces.class.php'; |
|
668 | 668 | $interface = new Interfaces($db); |
669 | 669 | $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf); |
670 | 670 | if ($result < 0) { |
@@ -675,18 +675,18 @@ discard block |
||
675 | 675 | $action = ''; |
676 | 676 | $hookmanager->initHooks(array('login')); |
677 | 677 | $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
678 | - $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
|
678 | + $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
|
679 | 679 | if ($reshook < 0) |
680 | 680 | $error++; |
681 | 681 | |
682 | 682 | $paramsurl = array(); |
683 | 683 | if (GETPOST('textbrowser', 'int')) |
684 | - $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int'); |
|
684 | + $paramsurl[] = 'textbrowser='.GETPOST('textbrowser', 'int'); |
|
685 | 685 | if (GETPOST('nojs', 'int')) |
686 | - $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int'); |
|
686 | + $paramsurl[] = 'nojs='.GETPOST('nojs', 'int'); |
|
687 | 687 | if (GETPOST('lang', 'aZ09')) |
688 | - $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09'); |
|
689 | - header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : '')); |
|
688 | + $paramsurl[] = 'lang='.GETPOST('lang', 'aZ09'); |
|
689 | + header('Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : '')); |
|
690 | 690 | exit; |
691 | 691 | } |
692 | 692 | else { |
@@ -696,29 +696,29 @@ discard block |
||
696 | 696 | // Code for search criteria persistence. |
697 | 697 | if (!empty($_GET['save_lastsearch_values'])) { // We must use $_GET here |
698 | 698 | $relativepathstring = preg_replace('/\?.*$/', '', $_SERVER["HTTP_REFERER"]); |
699 | - $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring); // Get full path except host server |
|
699 | + $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring); // Get full path except host server |
|
700 | 700 | // Clean $relativepathstring |
701 | 701 | if (constant('DOL_BASE_URI')) |
702 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
702 | + $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring); |
|
703 | 703 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
704 | 704 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
705 | 705 | //var_dump($relativepathstring); |
706 | 706 | // 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 |
707 | - if (!empty($_SESSION['lastsearch_values_tmp_' . $relativepathstring])) { |
|
708 | - $_SESSION['lastsearch_values_' . $relativepathstring] = $_SESSION['lastsearch_values_tmp_' . $relativepathstring]; |
|
709 | - unset($_SESSION['lastsearch_values_tmp_' . $relativepathstring]); |
|
707 | + if (!empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) { |
|
708 | + $_SESSION['lastsearch_values_'.$relativepathstring] = $_SESSION['lastsearch_values_tmp_'.$relativepathstring]; |
|
709 | + unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]); |
|
710 | 710 | } |
711 | - if (!empty($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring])) { |
|
712 | - $_SESSION['lastsearch_contextpage_' . $relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]; |
|
713 | - unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]); |
|
711 | + if (!empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) { |
|
712 | + $_SESSION['lastsearch_contextpage_'.$relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]; |
|
713 | + unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); |
|
714 | 714 | } |
715 | - if (!empty($_SESSION['lastsearch_page_tmp_' . $relativepathstring]) && $_SESSION['lastsearch_page_tmp_' . $relativepathstring] > 1) { |
|
716 | - $_SESSION['lastsearch_page_' . $relativepathstring] = $_SESSION['lastsearch_page_tmp_' . $relativepathstring]; |
|
717 | - unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]); |
|
715 | + if (!empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 1) { |
|
716 | + $_SESSION['lastsearch_page_'.$relativepathstring] = $_SESSION['lastsearch_page_tmp_'.$relativepathstring]; |
|
717 | + unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]); |
|
718 | 718 | } |
719 | - if (!empty($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]) && $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] != $conf->liste_limit) { |
|
720 | - $_SESSION['lastsearch_limit_' . $relativepathstring] = $_SESSION['lastsearch_limit_tmp_' . $relativepathstring]; |
|
721 | - unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]); |
|
719 | + if (!empty($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] != $conf->liste_limit) { |
|
720 | + $_SESSION['lastsearch_limit_'.$relativepathstring] = $_SESSION['lastsearch_limit_tmp_'.$relativepathstring]; |
|
721 | + unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]); |
|
722 | 722 | } |
723 | 723 | } |
724 | 724 | |
@@ -761,18 +761,18 @@ discard block |
||
761 | 761 | if (!empty($dol_use_jmobile)) |
762 | 762 | $_SESSION['dol_use_jmobile'] = $dol_use_jmobile; |
763 | 763 | |
764 | - dol_syslog("This is a new started user session. _SESSION['dol_login']=" . $_SESSION["dol_login"] . " Session id=" . session_id()); |
|
764 | + dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"]." Session id=".session_id()); |
|
765 | 765 | |
766 | 766 | $db->begin(); |
767 | 767 | |
768 | 768 | $user->update_last_login_date(); |
769 | 769 | |
770 | - $loginfo = 'TZ=' . $_SESSION["dol_tz"] . ';TZString=' . $_SESSION["dol_tz_string"] . ';Screen=' . $_SESSION["dol_screenwidth"] . 'x' . $_SESSION["dol_screenheight"]; |
|
770 | + $loginfo = 'TZ='.$_SESSION["dol_tz"].';TZString='.$_SESSION["dol_tz_string"].';Screen='.$_SESSION["dol_screenwidth"].'x'.$_SESSION["dol_screenheight"]; |
|
771 | 771 | |
772 | 772 | // Call triggers for the "security events" log |
773 | 773 | $user->trigger_mesg = $loginfo; |
774 | 774 | // Call triggers |
775 | - include_once DOL_BASE_PATH . '/core/class/interfaces.class.php'; |
|
775 | + include_once DOL_BASE_PATH.'/core/class/interfaces.class.php'; |
|
776 | 776 | $interface = new Interfaces($db); |
777 | 777 | $result = $interface->run_triggers('USER_LOGIN', $user, $user, $langs, $conf); |
778 | 778 | if ($result < 0) { |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | $action = ''; |
784 | 784 | $hookmanager->initHooks(array('login')); |
785 | 785 | $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginfo' => $loginfo); |
786 | - $reshook = $hookmanager->executeHooks('afterLogin', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
|
786 | + $reshook = $hookmanager->executeHooks('afterLogin', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
|
787 | 787 | if ($reshook < 0) |
788 | 788 | $error++; |
789 | 789 | |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | if (!empty($landingpage)) { // Example: /index.php |
802 | 802 | $newpath = dol_buildpath($landingpage, 1); |
803 | 803 | if ($_SERVER["PHP_SELF"] != $newpath) { // not already on landing page (avoid infinite loop) |
804 | - header('Location: ' . $newpath); |
|
804 | + header('Location: '.$newpath); |
|
805 | 805 | exit; |
806 | 806 | } |
807 | 807 | } |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | if (empty($conf->global->MAIN_FORCETHEME) && !empty($user->conf->MAIN_THEME)) { |
845 | 845 | $conf->theme = $user->conf->MAIN_THEME; |
846 | 846 | // $conf->css = "/theme/" . $conf->theme . "/style.css.php"; |
847 | - $conf->css = '?controller=theme/' . $conf->theme . '&method=style.css'; |
|
847 | + $conf->css = '?controller=theme/'.$conf->theme.'&method=style.css'; |
|
848 | 848 | } |
849 | 849 | } |
850 | 850 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | if (GETPOST('theme', 'alpha')) { |
853 | 853 | $conf->theme = GETPOST('theme', 'alpha', 1); |
854 | 854 | // $conf->css = "/theme/" . $conf->theme . "/style.css.php"; |
855 | - $conf->css = '?controller=theme/' . $conf->theme . '&method=style.css'; |
|
855 | + $conf->css = '?controller=theme/'.$conf->theme.'&method=style.css'; |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array('bureau2crea', 'cameleo', 'amarok'))) { |
895 | 895 | $conf->theme = 'eldy'; |
896 | 896 | // $conf->css = "/theme/" . $conf->theme . "/style.css.php"; |
897 | - $conf->css = '?controller=theme/' . $conf->theme . '&method=style.css'; |
|
897 | + $conf->css = '?controller=theme/'.$conf->theme.'&method=style.css'; |
|
898 | 898 | } |
899 | 899 | |
900 | 900 | if (!defined('NOREQUIRETRAN')) { |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | } |
931 | 931 | |
932 | 932 | |
933 | -dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . ' - action=' . GETPOST('action', 'az09') . ', massaction=' . GETPOST('massaction', 'az09')); |
|
933 | +dol_syslog("--- Access to ".$_SERVER["PHP_SELF"].' - action='.GETPOST('action', 'az09').', massaction='.GETPOST('massaction', 'az09')); |
|
934 | 934 | //Another call for easy debugg |
935 | 935 | //dol_syslog("Access to ".$_SERVER["PHP_SELF"].' GET='.join(',',array_keys($_GET)).'->'.join(',',$_GET).' POST:'.join(',',array_keys($_POST)).'->'.join(',',$_POST)); |
936 | 936 | // Load main languages files |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | // Define some constants used for style of arrays |
943 | 943 | $bc = array(0 => 'class="impair"', 1 => 'class="pair"'); |
944 | 944 | $bcdd = array(0 => 'class="drag drop oddeven"', 1 => 'class="drag drop oddeven"'); |
945 | -$bcnd = array(0 => 'class="nodrag nodrop nohover"', 1 => 'class="nodrag nodrop nohoverpair"'); // Used for tr to add new lines |
|
945 | +$bcnd = array(0 => 'class="nodrag nodrop nohover"', 1 => 'class="nodrag nodrop nohoverpair"'); // Used for tr to add new lines |
|
946 | 946 | $bctag = array(0 => 'class="impair tagtr"', 1 => 'class="pair tagtr"'); |
947 | 947 | |
948 | 948 | // Define messages variables |
@@ -990,19 +990,19 @@ discard block |
||
990 | 990 | // Load the menu manager (only if not already done) |
991 | 991 | $file_menu = $conf->standard_menu; |
992 | 992 | if (GETPOST('menu', 'alpha')) |
993 | - $file_menu = GETPOST('menu', 'alpha'); // example: menu=eldy_menu.php |
|
993 | + $file_menu = GETPOST('menu', 'alpha'); // example: menu=eldy_menu.php |
|
994 | 994 | if (!class_exists('MenuManager')) { |
995 | 995 | $menufound = 0; |
996 | 996 | $dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']); |
997 | 997 | foreach ($dirmenus as $dirmenu) { |
998 | - $menufound = dol_include_once($dirmenu . "standard/" . $file_menu); |
|
998 | + $menufound = dol_include_once($dirmenu."standard/".$file_menu); |
|
999 | 999 | if (class_exists('MenuManager')) |
1000 | 1000 | break; |
1001 | 1001 | } |
1002 | 1002 | if (!class_exists('MenuManager')) { // If failed to include, we try with standard eldy_menu.php |
1003 | - dol_syslog("You define a menu manager '" . $file_menu . "' that can not be loaded.", LOG_WARNING); |
|
1003 | + dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING); |
|
1004 | 1004 | $file_menu = 'eldy_menu.php'; |
1005 | - include_once DOL_DOCUMENT_ROOT . "/core/menus/standard/" . $file_menu; |
|
1005 | + include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu; |
|
1006 | 1006 | } |
1007 | 1007 | } |
1008 | 1008 | $menumanager = new MenuManager($db, empty($user->societe_id) ? 0 : 1); |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | // html header |
1041 | 1041 | top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); |
1042 | 1042 | |
1043 | - print '<body id="mainbody"' . ($morecssonbody ? ' class="' . $morecssonbody . '"' : '') . '>' . "\n"; |
|
1043 | + print '<body id="mainbody"'.($morecssonbody ? ' class="'.$morecssonbody.'"' : '').'>'."\n"; |
|
1044 | 1044 | |
1045 | 1045 | // top menu and left menu area |
1046 | 1046 | if (empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) { |
@@ -1048,7 +1048,7 @@ discard block |
||
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | if (empty($conf->dol_hide_leftmenu)) { |
1051 | - left_menu('', $help_url, '', '', 1, $title, 1); // $menumanager is retreived with a global $menumanager inside this function |
|
1051 | + left_menu('', $help_url, '', '', 1, $title, 1); // $menumanager is retreived with a global $menumanager inside this function |
|
1052 | 1052 | } |
1053 | 1053 | |
1054 | 1054 | // main area |
@@ -1072,13 +1072,13 @@ discard block |
||
1072 | 1072 | global $db, $conf, $hookmanager; |
1073 | 1073 | |
1074 | 1074 | if ($contenttype == 'text/html') { |
1075 | - header("Content-Type: text/html; charset=" . $conf->file->character_set_client); |
|
1075 | + header("Content-Type: text/html; charset=".$conf->file->character_set_client); |
|
1076 | 1076 | } else { |
1077 | - header("Content-Type: " . $contenttype); |
|
1077 | + header("Content-Type: ".$contenttype); |
|
1078 | 1078 | } |
1079 | 1079 | // Security options |
1080 | - header("X-Content-Type-Options: nosniff"); // With the nosniff option, if the server says the content is text/html, the browser will render it as text/html (note that most browsers now force this option to on) |
|
1081 | - header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks) |
|
1080 | + header("X-Content-Type-Options: nosniff"); // With the nosniff option, if the server says the content is text/html, the browser will render it as text/html (note that most browsers now force this option to on) |
|
1081 | + header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks) |
|
1082 | 1082 | //header("X-XSS-Protection: 1"); // XSS protection of some browsers (note: use of Content-Security-Policy is more efficient). Disabled as deprecated. |
1083 | 1083 | if (!defined('FORCECSP')) { |
1084 | 1084 | //if (! isset($conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY)) |
@@ -1095,11 +1095,11 @@ discard block |
||
1095 | 1095 | $hookmanager->initHooks("main"); |
1096 | 1096 | |
1097 | 1097 | $parameters = array('contentsecuritypolicy' => $contentsecuritypolicy); |
1098 | - $result = $hookmanager->executeHooks('setContentSecurityPolicy', $parameters); // Note that $action and $object may have been modified by some hooks |
|
1098 | + $result = $hookmanager->executeHooks('setContentSecurityPolicy', $parameters); // Note that $action and $object may have been modified by some hooks |
|
1099 | 1099 | if ($result > 0) { |
1100 | 1100 | $contentsecuritypolicy = $hookmanager->resPrint; // Replace CSP |
1101 | 1101 | } else { |
1102 | - $contentsecuritypolicy .= $hookmanager->resPrint; // Concat CSP |
|
1102 | + $contentsecuritypolicy .= $hookmanager->resPrint; // Concat CSP |
|
1103 | 1103 | } |
1104 | 1104 | |
1105 | 1105 | if (!empty($contentsecuritypolicy)) { |
@@ -1111,10 +1111,10 @@ discard block |
||
1111 | 1111 | // default-src 'self'; img-src *; |
1112 | 1112 | // Pre-existing site that uses too much inline code to fix but wants to ensure resources are loaded only over https and disable plugins: |
1113 | 1113 | // default-src http: https: 'unsafe-eval' 'unsafe-inline'; object-src 'none' |
1114 | - header("Content-Security-Policy: " . $contentsecuritypolicy); |
|
1114 | + header("Content-Security-Policy: ".$contentsecuritypolicy); |
|
1115 | 1115 | } |
1116 | 1116 | } elseif (constant('FORCECSP')) { |
1117 | - header("Content-Security-Policy: " . constant('FORCECSP')); |
|
1117 | + header("Content-Security-Policy: ".constant('FORCECSP')); |
|
1118 | 1118 | } |
1119 | 1119 | if ($forcenocache) { |
1120 | 1120 | header("Cache-Control: no-cache, no-store, must-revalidate, max-age=0"); |
@@ -1145,33 +1145,33 @@ discard block |
||
1145 | 1145 | // $conf->css = '/theme/eldy/style.css.php'; // If not defined, eldy by default |
1146 | 1146 | $conf->css = '?controller=theme/eldy&method=style.css'; |
1147 | 1147 | } |
1148 | - print '<!doctype html>' . "\n"; |
|
1148 | + print '<!doctype html>'."\n"; |
|
1149 | 1149 | |
1150 | 1150 | if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST)) |
1151 | - print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_BASE_URI . '/cache.manifest">' . "\n"; |
|
1151 | + print '<html lang="'.substr($langs->defaultlang, 0, 2).'" manifest="'.DOL_BASE_URI.'/cache.manifest">'."\n"; |
|
1152 | 1152 | else |
1153 | - print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n"; |
|
1153 | + print '<html lang="'.substr($langs->defaultlang, 0, 2).'">'."\n"; |
|
1154 | 1154 | //print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'."\n"; |
1155 | 1155 | if (empty($disablehead)) { |
1156 | - $ext = 'layout=' . $conf->browser->layout . '&version=' . urlencode(DOL_VERSION); |
|
1156 | + $ext = 'layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); |
|
1157 | 1157 | |
1158 | 1158 | print "<head>\n"; |
1159 | 1159 | |
1160 | 1160 | if (GETPOST('dol_basehref', 'alpha')) |
1161 | - print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')) . '">' . "\n"; |
|
1161 | + print '<base href="'.dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')).'">'."\n"; |
|
1162 | 1162 | |
1163 | 1163 | // Displays meta |
1164 | - print '<meta charset="UTF-8">' . "\n"; |
|
1165 | - print '<meta name="robots" content="noindex' . ($disablenofollow ? '' : ',nofollow') . '">' . "\n"; // Do not index |
|
1166 | - print '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\n"; // Scale for mobile device |
|
1167 | - print '<meta name="author" content="Dolibarr Development Team">' . "\n"; |
|
1164 | + print '<meta charset="UTF-8">'."\n"; |
|
1165 | + print '<meta name="robots" content="noindex'.($disablenofollow ? '' : ',nofollow').'">'."\n"; // Do not index |
|
1166 | + print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n"; // Scale for mobile device |
|
1167 | + print '<meta name="author" content="Dolibarr Development Team">'."\n"; |
|
1168 | 1168 | |
1169 | 1169 | // Favicon |
1170 | - $favicon = dol_buildpath('/theme/' . $conf->theme . '/img/favicon.ico', 1); |
|
1170 | + $favicon = dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico', 1); |
|
1171 | 1171 | if (!empty($conf->global->MAIN_FAVICON_URL)) |
1172 | 1172 | $favicon = $conf->global->MAIN_FAVICON_URL; |
1173 | 1173 | if (empty($conf->dol_use_jmobile)) |
1174 | - print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n"; // Not required into an Android webview |
|
1174 | + print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n"; // Not required into an Android webview |
|
1175 | 1175 | |
1176 | 1176 | |
1177 | 1177 | |
@@ -1190,7 +1190,7 @@ discard block |
||
1190 | 1190 | //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="author" title="Dolibarr Development Team" href="https://www.dolibarr.org">'."\n"; |
1191 | 1191 | // Auto refresh page |
1192 | 1192 | if (GETPOST('autorefresh', 'int') > 0) |
1193 | - print '<meta http-equiv="refresh" content="' . GETPOST('autorefresh', 'int') . '">'; |
|
1193 | + print '<meta http-equiv="refresh" content="'.GETPOST('autorefresh', 'int').'">'; |
|
1194 | 1194 | |
1195 | 1195 | // Displays title |
1196 | 1196 | $appli = constant('DOL_APPLICATION_TITLE'); |
@@ -1202,7 +1202,7 @@ discard block |
||
1202 | 1202 | if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE)) |
1203 | 1203 | $titletoshow = dol_htmlentities($title); |
1204 | 1204 | else if ($title) |
1205 | - $titletoshow = dol_htmlentities($appli . ' - ' . $title); |
|
1205 | + $titletoshow = dol_htmlentities($appli.' - '.$title); |
|
1206 | 1206 | else |
1207 | 1207 | $titletoshow = dol_htmlentities($appli); |
1208 | 1208 | |
@@ -1210,11 +1210,11 @@ discard block |
||
1210 | 1210 | $hookmanager = new HookManager($db); |
1211 | 1211 | $hookmanager->initHooks("main"); |
1212 | 1212 | $parameters = array('title' => $titletoshow); |
1213 | - $result = $hookmanager->executeHooks('setHtmlTitle', $parameters); // Note that $action and $object may have been modified by some hooks |
|
1213 | + $result = $hookmanager->executeHooks('setHtmlTitle', $parameters); // Note that $action and $object may have been modified by some hooks |
|
1214 | 1214 | if ($result > 0) |
1215 | - $titletoshow = $hookmanager->resPrint; // Replace Title to show |
|
1215 | + $titletoshow = $hookmanager->resPrint; // Replace Title to show |
|
1216 | 1216 | else |
1217 | - $titletoshow .= $hookmanager->resPrint; // Concat to Title to show |
|
1217 | + $titletoshow .= $hookmanager->resPrint; // Concat to Title to show |
|
1218 | 1218 | |
1219 | 1219 | print $titletoshow; |
1220 | 1220 | print '</title>'; |
@@ -1222,64 +1222,64 @@ discard block |
||
1222 | 1222 | print "\n"; |
1223 | 1223 | |
1224 | 1224 | if (GETPOST('version', 'int')) |
1225 | - $ext = 'version=' . GETPOST('version', 'int'); // usefull to force no cache on css/js |
|
1225 | + $ext = 'version='.GETPOST('version', 'int'); // usefull to force no cache on css/js |
|
1226 | 1226 | if (GETPOST('testmenuhider', 'int') || !empty($conf->global->MAIN_TESTMENUHIDER)) |
1227 | - $ext .= '&testmenuhider=' . (GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER); |
|
1227 | + $ext .= '&testmenuhider='.(GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER); |
|
1228 | 1228 | |
1229 | - $themeparam = '&lang=' . $langs->defaultlang . '&theme=' . $conf->theme . (GETPOST('optioncss', 'aZ09') ? '&optioncss=' . GETPOST('optioncss', 'aZ09', 1) : '') . '&userid=' . $user->id . '&entity=' . $conf->entity; |
|
1230 | - $themeparam .= ($ext ? '&' . $ext : ''); |
|
1229 | + $themeparam = '&lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').'&userid='.$user->id.'&entity='.$conf->entity; |
|
1230 | + $themeparam .= ($ext ? '&'.$ext : ''); |
|
1231 | 1231 | if (!empty($_SESSION['dol_resetcache'])) |
1232 | - $themeparam .= '&dol_resetcache=' . $_SESSION['dol_resetcache']; |
|
1232 | + $themeparam .= '&dol_resetcache='.$_SESSION['dol_resetcache']; |
|
1233 | 1233 | if (GETPOST('dol_hide_topmenu', 'int')) { |
1234 | - $themeparam .= '&dol_hide_topmenu=' . GETPOST('dol_hide_topmenu', 'int'); |
|
1234 | + $themeparam .= '&dol_hide_topmenu='.GETPOST('dol_hide_topmenu', 'int'); |
|
1235 | 1235 | } |
1236 | 1236 | if (GETPOST('dol_hide_leftmenu', 'int')) { |
1237 | - $themeparam .= '&dol_hide_leftmenu=' . GETPOST('dol_hide_leftmenu', 'int'); |
|
1237 | + $themeparam .= '&dol_hide_leftmenu='.GETPOST('dol_hide_leftmenu', 'int'); |
|
1238 | 1238 | } |
1239 | 1239 | if (GETPOST('dol_optimize_smallscreen', 'int')) { |
1240 | - $themeparam .= '&dol_optimize_smallscreen=' . GETPOST('dol_optimize_smallscreen', 'int'); |
|
1240 | + $themeparam .= '&dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen', 'int'); |
|
1241 | 1241 | } |
1242 | 1242 | if (GETPOST('dol_no_mouse_hover', 'int')) { |
1243 | - $themeparam .= '&dol_no_mouse_hover=' . GETPOST('dol_no_mouse_hover', 'int'); |
|
1243 | + $themeparam .= '&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover', 'int'); |
|
1244 | 1244 | } |
1245 | 1245 | if (GETPOST('dol_use_jmobile', 'int')) { |
1246 | - $themeparam .= '&dol_use_jmobile=' . GETPOST('dol_use_jmobile', 'int'); |
|
1246 | + $themeparam .= '&dol_use_jmobile='.GETPOST('dol_use_jmobile', 'int'); |
|
1247 | 1247 | $conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int'); |
1248 | 1248 | } |
1249 | 1249 | |
1250 | 1250 | if (!defined('DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax) { |
1251 | - print '<!-- Includes CSS for JQuery (Ajax library) -->' . "\n"; |
|
1251 | + print '<!-- Includes CSS for JQuery (Ajax library) -->'."\n"; |
|
1252 | 1252 | $jquerytheme = 'base'; |
1253 | 1253 | if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) { |
1254 | 1254 | $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME; |
1255 | 1255 | } |
1256 | 1256 | if (constant('JS_JQUERY_UI')) { |
1257 | - print '<link rel="stylesheet" type="text/css" href="' . JS_JQUERY_UI . 'css/' . $jquerytheme . '/jquery-ui.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; // JQuery |
|
1257 | + print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css'.($ext ? '?'.$ext : '').'">'."\n"; // JQuery |
|
1258 | 1258 | } else { |
1259 | - print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; // JQuery |
|
1259 | + print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui.css'.($ext ? '?'.$ext : '').'">'."\n"; // JQuery |
|
1260 | 1260 | } |
1261 | 1261 | if (!defined('DISABLE_JQUERY_JNOTIFY')) { |
1262 | - print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; // JNotify |
|
1262 | + print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css'.($ext ? '?'.$ext : '').'">'."\n"; // JNotify |
|
1263 | 1263 | } |
1264 | 1264 | if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) { // jQuery plugin "mutiselect", "multiple-select", "select2"... |
1265 | 1265 | $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; |
1266 | - print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/' . $tmpplugin . '/dist/css/' . $tmpplugin . '.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; |
|
1266 | + print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/includes/jquery/plugins/'.$tmpplugin.'/dist/css/'.$tmpplugin.'.css'.($ext ? '?'.$ext : '').'">'."\n"; |
|
1267 | 1267 | } |
1268 | 1268 | } |
1269 | 1269 | |
1270 | 1270 | if (!defined('DISABLE_FONT_AWSOME')) { |
1271 | - print '<!-- Includes CSS for font awesome -->' . "\n"; |
|
1272 | - print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/theme/common/fontawesome/css/font-awesome.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n"; |
|
1271 | + print '<!-- Includes CSS for font awesome -->'."\n"; |
|
1272 | + print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/theme/common/fontawesome/css/font-awesome.min.css'.($ext ? '?'.$ext : '').'">'."\n"; |
|
1273 | 1273 | } |
1274 | 1274 | |
1275 | - print '<!-- Includes CSS for Dolibarr theme -->' . "\n"; |
|
1275 | + print '<!-- Includes CSS for Dolibarr theme -->'."\n"; |
|
1276 | 1276 | // Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php' |
1277 | 1277 | $themepath = dol_buildpath($conf->css, 3); |
1278 | 1278 | $themesubdir = ''; |
1279 | 1279 | if (!empty($conf->modules_parts['theme'])) { // This slow down |
1280 | 1280 | foreach ($conf->modules_parts['theme'] as $reldir) { |
1281 | - if (file_exists(dol_buildpath($reldir . $conf->css, 0))) { |
|
1282 | - $themepath = dol_buildpath($reldir . $conf->css, 1); |
|
1281 | + if (file_exists(dol_buildpath($reldir.$conf->css, 0))) { |
|
1282 | + $themepath = dol_buildpath($reldir.$conf->css, 1); |
|
1283 | 1283 | $themesubdir = $reldir; |
1284 | 1284 | break; |
1285 | 1285 | } |
@@ -1287,9 +1287,9 @@ discard block |
||
1287 | 1287 | } |
1288 | 1288 | |
1289 | 1289 | //print 'themepath='.$themepath.' themeparam='.$themeparam;exit; |
1290 | - print '<link rel="stylesheet" type="text/css" href="' . $themepath . $themeparam . '">' . "\n"; |
|
1290 | + print '<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.'">'."\n"; |
|
1291 | 1291 | if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME)) |
1292 | - print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->' . "\n" . '<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">' . "\n"; |
|
1292 | + print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->'."\n".'<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">'."\n"; |
|
1293 | 1293 | |
1294 | 1294 | // CSS forced by modules (relative url starting with /) |
1295 | 1295 | if (!empty($conf->modules_parts['css'])) { |
@@ -1298,121 +1298,121 @@ discard block |
||
1298 | 1298 | $filescss = (array) $filescss; // To be sure filecss is an array |
1299 | 1299 | foreach ($filescss as $cssfile) { |
1300 | 1300 | if (empty($cssfile)) |
1301 | - dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING); |
|
1301 | + dol_syslog("Warning: module ".$modcss." declared a css path file into its descriptor that is empty.", LOG_WARNING); |
|
1302 | 1302 | // cssfile is a relative path |
1303 | - print '<!-- Includes CSS added by module ' . $modcss . ' -->' . "\n" . '<link rel="stylesheet" type="text/css" href="' . dol_buildpath($cssfile, 1); |
|
1303 | + print '<!-- Includes CSS added by module '.$modcss.' -->'."\n".'<link rel="stylesheet" type="text/css" href="'.dol_buildpath($cssfile, 1); |
|
1304 | 1304 | // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used. |
1305 | 1305 | if (!preg_match('/\.css$/i', $cssfile)) |
1306 | 1306 | print $themeparam; |
1307 | - print '">' . "\n"; |
|
1307 | + print '">'."\n"; |
|
1308 | 1308 | } |
1309 | 1309 | } |
1310 | 1310 | } |
1311 | 1311 | // CSS forced by page in top_htmlhead call (relative url starting with /) |
1312 | 1312 | if (is_array($arrayofcss)) { |
1313 | 1313 | foreach ($arrayofcss as $cssfile) { |
1314 | - print '<!-- Includes CSS added by page -->' . "\n" . '<link rel="stylesheet" type="text/css" title="default" href="' . dol_buildpath($cssfile, 1); |
|
1314 | + print '<!-- Includes CSS added by page -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile, 1); |
|
1315 | 1315 | // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters and browser cache is not used. |
1316 | 1316 | if (!preg_match('/\.css$/i', $cssfile)) |
1317 | 1317 | print $themeparam; |
1318 | - print '">' . "\n"; |
|
1318 | + print '">'."\n"; |
|
1319 | 1319 | } |
1320 | 1320 | } |
1321 | 1321 | |
1322 | 1322 | // Output standard javascript links |
1323 | 1323 | if (!defined('DISABLE_JQUERY') && !$disablejs && !empty($conf->use_javascript_ajax)) { |
1324 | 1324 | // JQuery. Must be before other includes |
1325 | - print '<!-- Includes JS for JQuery -->' . "\n"; |
|
1325 | + print '<!-- Includes JS for JQuery -->'."\n"; |
|
1326 | 1326 | if (defined('JS_JQUERY') && constant('JS_JQUERY')) { |
1327 | - print '<script type="text/javascript" src="' . JS_JQUERY . 'jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1327 | + print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1328 | 1328 | } else { |
1329 | 1329 | // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
1330 | - print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jquery/jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1330 | + print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jquery/jquery.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1331 | 1331 | } |
1332 | 1332 | if (!empty($conf->global->MAIN_FEATURES_LEVEL) && !defined('JS_JQUERY_MIGRATE_DISABLED')) { |
1333 | 1333 | if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE')) { |
1334 | - print '<script type="text/javascript" src="' . JS_JQUERY_MIGRATE . 'jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1334 | + print '<script type="text/javascript" src="'.JS_JQUERY_MIGRATE.'jquery-migrate.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1335 | 1335 | } else { |
1336 | 1336 | // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
1337 | - print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jquery/jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1337 | + print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jquery/jquery-migrate.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1338 | 1338 | } |
1339 | 1339 | } |
1340 | 1340 | if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) { |
1341 | - print '<script type="text/javascript" src="' . JS_JQUERY_UI . 'jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1341 | + print '<script type="text/javascript" src="'.JS_JQUERY_UI.'jquery-ui.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1342 | 1342 | } else { |
1343 | 1343 | // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
1344 | - print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jqueryui/jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1344 | + print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jqueryui/jquery-ui.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1345 | 1345 | } |
1346 | 1346 | if (!defined('DISABLE_JQUERY_TABLEDND')) { |
1347 | - print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/tablednd/jquery.tablednd.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1347 | + print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/tablednd/jquery.tablednd.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1348 | 1348 | } |
1349 | 1349 | // jQuery jnotify |
1350 | 1350 | if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) { |
1351 | - print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1351 | + print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1352 | 1352 | } |
1353 | 1353 | // Flot |
1354 | 1354 | if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT) && !defined('DISABLE_JQUERY_FLOT')) { |
1355 | 1355 | if (constant('JS_JQUERY_FLOT')) { |
1356 | - print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1357 | - print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.pie.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1358 | - print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.stack.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1356 | + print '<script type="text/javascript" src="'.JS_JQUERY_FLOT.'jquery.flot.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1357 | + print '<script type="text/javascript" src="'.JS_JQUERY_FLOT.'jquery.flot.pie.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1358 | + print '<script type="text/javascript" src="'.JS_JQUERY_FLOT.'jquery.flot.stack.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1359 | 1359 | } else { |
1360 | - print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/flot/jquery.flot.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1361 | - print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/flot/jquery.flot.pie.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1362 | - print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/flot/jquery.flot.stack.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1360 | + print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/flot/jquery.flot.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1361 | + print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/flot/jquery.flot.pie.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1362 | + print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/flot/jquery.flot.stack.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1363 | 1363 | } |
1364 | 1364 | } |
1365 | 1365 | // jQuery jeditable |
1366 | 1366 | if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !defined('DISABLE_JQUERY_JEDITABLE')) { |
1367 | - print '<!-- JS to manage editInPlace feature -->' . "\n"; |
|
1368 | - print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1369 | - print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1370 | - print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1371 | - print '<script type="text/javascript">' . "\n"; |
|
1372 | - print 'var urlSaveInPlace = \'' . DOL_BASE_URI . '/core/ajax/saveinplace.php\';' . "\n"; |
|
1373 | - print 'var urlLoadInPlace = \'' . DOL_BASE_URI . '/core/ajax/loadinplace.php\';' . "\n"; |
|
1374 | - print 'var tooltipInPlace = \'' . $langs->transnoentities('ClickToEdit') . '\';' . "\n"; // Added in title attribute of span |
|
1375 | - print 'var placeholderInPlace = \' \';' . "\n"; // If we put another string than $langs->trans("ClickToEdit") here, nothing is shown. If we put empty string, there is error, Why ? |
|
1376 | - print 'var cancelInPlace = \'' . $langs->trans('Cancel') . '\';' . "\n"; |
|
1377 | - print 'var submitInPlace = \'' . $langs->trans('Ok') . '\';' . "\n"; |
|
1378 | - print 'var indicatorInPlace = \'<img src="' . DOL_BASE_URI . "/theme/" . $conf->theme . "/img/working.gif" . '">\';' . "\n"; |
|
1379 | - print 'var withInPlace = 300;'; // width in pixel for default string edit |
|
1380 | - print '</script>' . "\n"; |
|
1381 | - print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/editinplace.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1382 | - print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1367 | + print '<!-- JS to manage editInPlace feature -->'."\n"; |
|
1368 | + print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1369 | + print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1370 | + print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1371 | + print '<script type="text/javascript">'."\n"; |
|
1372 | + print 'var urlSaveInPlace = \''.DOL_BASE_URI.'/core/ajax/saveinplace.php\';'."\n"; |
|
1373 | + print 'var urlLoadInPlace = \''.DOL_BASE_URI.'/core/ajax/loadinplace.php\';'."\n"; |
|
1374 | + print 'var tooltipInPlace = \''.$langs->transnoentities('ClickToEdit').'\';'."\n"; // Added in title attribute of span |
|
1375 | + print 'var placeholderInPlace = \' \';'."\n"; // If we put another string than $langs->trans("ClickToEdit") here, nothing is shown. If we put empty string, there is error, Why ? |
|
1376 | + print 'var cancelInPlace = \''.$langs->trans('Cancel').'\';'."\n"; |
|
1377 | + print 'var submitInPlace = \''.$langs->trans('Ok').'\';'."\n"; |
|
1378 | + print 'var indicatorInPlace = \'<img src="'.DOL_BASE_URI."/theme/".$conf->theme."/img/working.gif".'">\';'."\n"; |
|
1379 | + print 'var withInPlace = 300;'; // width in pixel for default string edit |
|
1380 | + print '</script>'."\n"; |
|
1381 | + print '<script type="text/javascript" src="'.DOL_BASE_URI.'/core/js/editinplace.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1382 | + print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1383 | 1383 | } |
1384 | 1384 | // jQuery Timepicker |
1385 | 1385 | if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) { |
1386 | 1386 | // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/timepicker/jquery-ui-timepicker-addon.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
1387 | - print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jqueryui/ui/widgets/timepicker.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1388 | - print '<script type="text/javascript" src="' . BASE_PATH . '?controller=core/js/&method=timepicker.js&lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n"; |
|
1387 | + print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jqueryui/ui/widgets/timepicker.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1388 | + print '<script type="text/javascript" src="'.BASE_PATH.'?controller=core/js/&method=timepicker.js&lang='.$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n"; |
|
1389 | 1389 | } |
1390 | 1390 | if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) { // jQuery plugin "mutiselect", "multiple-select", "select2", ... |
1391 | 1391 | $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; |
1392 | - print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/' . $tmpplugin . '/dist/js/' . $tmpplugin . '.full.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; // We include full because we need the support of containerCssClass |
|
1392 | + print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/'.$tmpplugin.'/dist/js/'.$tmpplugin.'.full.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; // We include full because we need the support of containerCssClass |
|
1393 | 1393 | } |
1394 | 1394 | if (!defined('DISABLE_MULTISELECT')) { // jQuery plugin "mutiselect" to select with checkboxes |
1395 | - print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/multiselect/jquery.multi-select.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1395 | + print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/multiselect/jquery.multi-select.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1396 | 1396 | } |
1397 | 1397 | } |
1398 | 1398 | |
1399 | 1399 | if (!$disablejs && !empty($conf->use_javascript_ajax)) { |
1400 | 1400 | // CKEditor |
1401 | 1401 | if (!empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') && !defined('DISABLE_CKEDITOR')) { |
1402 | - print '<!-- Includes JS for CKEditor -->' . "\n"; |
|
1402 | + print '<!-- Includes JS for CKEditor -->'."\n"; |
|
1403 | 1403 | // $pathckeditor = DOL_BASE_URI . '/includes/ckeditor/ckeditor/'; |
1404 | - $pathckeditor = BASE_URI . '/vendor/ckeditor/ckeditor/'; |
|
1404 | + $pathckeditor = BASE_URI.'/vendor/ckeditor/ckeditor/'; |
|
1405 | 1405 | $jsckeditor = 'ckeditor.js'; |
1406 | 1406 | if (constant('JS_CKEDITOR')) { // To use external ckeditor 4 js lib |
1407 | 1407 | $pathckeditor = constant('JS_CKEDITOR'); |
1408 | 1408 | } |
1409 | 1409 | print '<script type="text/javascript">'; |
1410 | - print 'var CKEDITOR_BASEPATH = \'' . $pathckeditor . '\';' . "\n"; |
|
1411 | - print 'var ckeditorConfig = \'' . dol_buildpath($themesubdir . '/theme/' . $conf->theme . '/ckeditor/config.js' . ($ext ? '?' . $ext : ''), 1) . '\';' . "\n"; // $themesubdir='' in standard usage |
|
1412 | - print 'var ckeditorFilebrowserBrowseUrl = \'' . DOL_BASE_URI . '/core/filemanagerdol/browser/default/browser.php?Connector=' . DOL_BASE_URI . '/core/filemanagerdol/connectors/php/connector.php\';' . "\n"; |
|
1413 | - print 'var ckeditorFilebrowserImageBrowseUrl = \'' . DOL_BASE_URI . '/core/filemanagerdol/browser/default/browser.php?Type=Image&Connector=' . DOL_BASE_URI . '/core/filemanagerdol/connectors/php/connector.php\';' . "\n"; |
|
1414 | - print '</script>' . "\n"; |
|
1415 | - print '<script type="text/javascript" src="' . $pathckeditor . $jsckeditor . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1410 | + print 'var CKEDITOR_BASEPATH = \''.$pathckeditor.'\';'."\n"; |
|
1411 | + print 'var ckeditorConfig = \''.dol_buildpath($themesubdir.'/theme/'.$conf->theme.'/ckeditor/config.js'.($ext ? '?'.$ext : ''), 1).'\';'."\n"; // $themesubdir='' in standard usage |
|
1412 | + print 'var ckeditorFilebrowserBrowseUrl = \''.DOL_BASE_URI.'/core/filemanagerdol/browser/default/browser.php?Connector='.DOL_BASE_URI.'/core/filemanagerdol/connectors/php/connector.php\';'."\n"; |
|
1413 | + print 'var ckeditorFilebrowserImageBrowseUrl = \''.DOL_BASE_URI.'/core/filemanagerdol/browser/default/browser.php?Type=Image&Connector='.DOL_BASE_URI.'/core/filemanagerdol/connectors/php/connector.php\';'."\n"; |
|
1414 | + print '</script>'."\n"; |
|
1415 | + print '<script type="text/javascript" src="'.$pathckeditor.$jsckeditor.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | // Browser notifications |
@@ -1423,16 +1423,16 @@ discard block |
||
1423 | 1423 | if ($conf->browser->layout == 'phone') |
1424 | 1424 | $enablebrowsernotif = false; |
1425 | 1425 | if ($enablebrowsernotif) { |
1426 | - print '<!-- Includes JS of Dolibarr (brwoser layout = ' . $conf->browser->layout . ')-->' . "\n"; |
|
1426 | + print '<!-- Includes JS of Dolibarr (brwoser layout = '.$conf->browser->layout.')-->'."\n"; |
|
1427 | 1427 | //print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/lib_notification.js.php' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
1428 | - print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_notification.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
|
1428 | + print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_notification.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; |
|
1429 | 1429 | } |
1430 | 1430 | } |
1431 | 1431 | |
1432 | 1432 | // Global js function |
1433 | - print '<!-- Includes JS of Dolibarr -->' . "\n"; |
|
1433 | + print '<!-- Includes JS of Dolibarr -->'."\n"; |
|
1434 | 1434 | //print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/lib_head.js.php?lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n"; |
1435 | - print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_head.js&lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n"; |
|
1435 | + print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_head.js&lang='.$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n"; |
|
1436 | 1436 | |
1437 | 1437 | // JS forced by modules (relative url starting with /) |
1438 | 1438 | if (!empty($conf->modules_parts['js'])) { // $conf->modules_parts['js'] is array('module'=>array('file1','file2')) |
@@ -1441,27 +1441,27 @@ discard block |
||
1441 | 1441 | $filesjs = (array) $filesjs; // To be sure filejs is an array |
1442 | 1442 | foreach ($filesjs as $jsfile) { |
1443 | 1443 | // jsfile is a relative path |
1444 | - print '<!-- Include JS added by module ' . $modjs . '-->' . "\n" . '<script type="text/javascript" src="' . dol_buildpath($jsfile, 1) . '"></script>' . "\n"; |
|
1444 | + print '<!-- Include JS added by module '.$modjs.'-->'."\n".'<script type="text/javascript" src="'.dol_buildpath($jsfile, 1).'"></script>'."\n"; |
|
1445 | 1445 | } |
1446 | 1446 | } |
1447 | 1447 | } |
1448 | 1448 | // JS forced by page in top_htmlhead (relative url starting with /) |
1449 | 1449 | if (is_array($arrayofjs)) { |
1450 | - print '<!-- Includes JS added by page -->' . "\n"; |
|
1450 | + print '<!-- Includes JS added by page -->'."\n"; |
|
1451 | 1451 | foreach ($arrayofjs as $jsfile) { |
1452 | 1452 | if (preg_match('/^http/i', $jsfile)) { |
1453 | - print '<script type="text/javascript" src="' . $jsfile . '"></script>' . "\n"; |
|
1453 | + print '<script type="text/javascript" src="'.$jsfile.'"></script>'."\n"; |
|
1454 | 1454 | } else { |
1455 | - print '<script type="text/javascript" src="' . dol_buildpath($jsfile, 1) . '"></script>' . "\n"; |
|
1455 | + print '<script type="text/javascript" src="'.dol_buildpath($jsfile, 1).'"></script>'."\n"; |
|
1456 | 1456 | } |
1457 | 1457 | } |
1458 | 1458 | } |
1459 | 1459 | } |
1460 | 1460 | |
1461 | 1461 | if (!empty($head)) |
1462 | - print $head . "\n"; |
|
1462 | + print $head."\n"; |
|
1463 | 1463 | if (!empty($conf->global->MAIN_HTML_HEADER)) |
1464 | - print $conf->global->MAIN_HTML_HEADER . "\n"; |
|
1464 | + print $conf->global->MAIN_HTML_HEADER."\n"; |
|
1465 | 1465 | |
1466 | 1466 | print "<!-- Alixar debugBar header -->"; |
1467 | 1467 | print Debug::getRenderHeader(); // Includes Alixar debugBar header |
@@ -1512,13 +1512,13 @@ discard block |
||
1512 | 1512 | * Top menu |
1513 | 1513 | */ |
1514 | 1514 | if ((empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) { |
1515 | - print "\n" . '<!-- Start top horizontal -->' . "\n"; |
|
1515 | + print "\n".'<!-- Start top horizontal -->'."\n"; |
|
1516 | 1516 | |
1517 | - print '<div class="side-nav-vert' . (GETPOST('dol_invisible_topmenu', 'int') ? ' hidden' : '') . '"><div id="id-top">'; // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible. |
|
1517 | + print '<div class="side-nav-vert'.(GETPOST('dol_invisible_topmenu', 'int') ? ' hidden' : '').'"><div id="id-top">'; // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible. |
|
1518 | 1518 | // Show menu entries |
1519 | - print '<div id="tmenu_tooltip' . (empty($conf->global->MAIN_MENU_INVERT) ? '' : 'invert') . '" class="tmenu">' . "\n"; |
|
1519 | + print '<div id="tmenu_tooltip'.(empty($conf->global->MAIN_MENU_INVERT) ? '' : 'invert').'" class="tmenu">'."\n"; |
|
1520 | 1520 | $menumanager->atarget = $target; |
1521 | - $menumanager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks)); // This contains a \n |
|
1521 | + $menumanager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks)); // This contains a \n |
|
1522 | 1522 | print "</div>\n"; |
1523 | 1523 | |
1524 | 1524 | // Define link to login card |
@@ -1526,34 +1526,34 @@ discard block |
||
1526 | 1526 | if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { |
1527 | 1527 | $appli = $conf->global->MAIN_APPLICATION_TITLE; |
1528 | 1528 | if (preg_match('/\d\.\d/', $appli)) { |
1529 | - if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) |
|
1530 | - $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core |
|
1529 | + if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) |
|
1530 | + $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core |
|
1531 | 1531 | } else |
1532 | - $appli .= " " . DOL_VERSION; |
|
1532 | + $appli .= " ".DOL_VERSION; |
|
1533 | 1533 | } else |
1534 | - $appli .= " " . DOL_VERSION; |
|
1534 | + $appli .= " ".DOL_VERSION; |
|
1535 | 1535 | |
1536 | 1536 | if (!empty($conf->global->MAIN_FEATURES_LEVEL)) |
1537 | - $appli .= "<br>" . $langs->trans("LevelOfFeature") . ': ' . $conf->global->MAIN_FEATURES_LEVEL; |
|
1537 | + $appli .= "<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL; |
|
1538 | 1538 | |
1539 | 1539 | $logouttext = ''; |
1540 | 1540 | if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
1541 | 1541 | //$logouthtmltext=$appli.'<br>'; |
1542 | 1542 | if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') { |
1543 | - $logouthtmltext .= $langs->trans("Logout") . '<br>'; |
|
1543 | + $logouthtmltext .= $langs->trans("Logout").'<br>'; |
|
1544 | 1544 | |
1545 | 1545 | //$logouttext .='<a accesskey="l" href="'.DOL_BASE_URI.'/user/logout.php">'; |
1546 | - $logouttext .= '<a accesskey="l" href="' . BASE_URI . '?controller=user&method=logout">'; |
|
1546 | + $logouttext .= '<a accesskey="l" href="'.BASE_URI.'?controller=user&method=logout">'; |
|
1547 | 1547 | //$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); |
1548 | 1548 | $logouttext .= '<span class="fa fa-sign-out atoplogin"></span>'; |
1549 | 1549 | $logouttext .= '</a>'; |
1550 | 1550 | } else { |
1551 | 1551 | $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]); |
1552 | - $logouttext .= img_picto($langs->trans('Logout') . ":" . $langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); |
|
1552 | + $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); |
|
1553 | 1553 | } |
1554 | 1554 | } |
1555 | 1555 | |
1556 | - print '<div class="login_block">' . "\n"; |
|
1556 | + print '<div class="login_block">'."\n"; |
|
1557 | 1557 | |
1558 | 1558 | // Add login user link |
1559 | 1559 | $toprightmenu .= '<div class="login_block_user">'; |
@@ -1564,18 +1564,18 @@ discard block |
||
1564 | 1564 | $toprightmenu .= $user->getNomUrl($mode, '', 1, 0, 11, 0, ($user->firstname ? 'firstname' : -1), 'atoplogin'); |
1565 | 1565 | $toprightmenu .= '</div></div>'; |
1566 | 1566 | |
1567 | - $toprightmenu .= '</div>' . "\n"; |
|
1567 | + $toprightmenu .= '</div>'."\n"; |
|
1568 | 1568 | |
1569 | 1569 | $toprightmenu .= '<div class="login_block_other">'; |
1570 | 1570 | |
1571 | 1571 | // Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>') |
1572 | 1572 | $parameters = array(); |
1573 | - $result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks |
|
1573 | + $result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks |
|
1574 | 1574 | if (is_numeric($result)) { |
1575 | 1575 | if ($result == 0) |
1576 | - $toprightmenu .= $hookmanager->resPrint; // add |
|
1576 | + $toprightmenu .= $hookmanager->resPrint; // add |
|
1577 | 1577 | else |
1578 | - $toprightmenu = $hookmanager->resPrint; // replace |
|
1578 | + $toprightmenu = $hookmanager->resPrint; // replace |
|
1579 | 1579 | } |
1580 | 1580 | else { |
1581 | 1581 | $toprightmenu .= $result; // For backward compatibility |
@@ -1584,7 +1584,7 @@ discard block |
||
1584 | 1584 | // Link to module builder |
1585 | 1585 | if (!empty($conf->modulebuilder->enabled)) { |
1586 | 1586 | //$text = '<a href="' . DOL_BASE_URI . '/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="_modulebuilder">'; |
1587 | - $text = '<a href="' . BASE_URI . '?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">'; |
|
1587 | + $text = '<a href="'.BASE_URI.'?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">'; |
|
1588 | 1588 | //$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"'); |
1589 | 1589 | $text .= '<span class="fa fa-bug atoplogin"></span>'; |
1590 | 1590 | $text .= '</a>'; |
@@ -1598,11 +1598,11 @@ discard block |
||
1598 | 1598 | if (is_array($_POST)) { |
1599 | 1599 | foreach ($_POST as $key => $value) { |
1600 | 1600 | if ($key !== 'action' && $key !== 'password' && !is_array($value)) |
1601 | - $qs .= '&' . $key . '=' . urlencode($value); |
|
1601 | + $qs .= '&'.$key.'='.urlencode($value); |
|
1602 | 1602 | } |
1603 | 1603 | } |
1604 | - $qs .= (($qs && $morequerystring) ? '&' : '') . $morequerystring; |
|
1605 | - $text = '<a href="' . dol_escape_htmltag($_SERVER["PHP_SELF"]) . '?' . $qs . ($qs ? '&' : '') . 'optioncss=print" target="_blank">'; |
|
1604 | + $qs .= (($qs && $morequerystring) ? '&' : '').$morequerystring; |
|
1605 | + $text = '<a href="'.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.$qs.($qs ? '&' : '').'optioncss=print" target="_blank">'; |
|
1606 | 1606 | //$text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"'); |
1607 | 1607 | $text .= '<span class="fa fa-print atoplogin"></span>'; |
1608 | 1608 | $text .= '</a>'; |
@@ -1631,12 +1631,12 @@ discard block |
||
1631 | 1631 | $text = ''; |
1632 | 1632 | if (!empty($conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) { |
1633 | 1633 | $langs->load('admin'); |
1634 | - $appli .= '<br>' . $langs->trans("Database") . ': ' . $db->database_name; |
|
1634 | + $appli .= '<br>'.$langs->trans("Database").': '.$db->database_name; |
|
1635 | 1635 | } |
1636 | - $title = $appli . '<br>'; |
|
1636 | + $title = $appli.'<br>'; |
|
1637 | 1637 | $title .= $langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage'); |
1638 | 1638 | if ($mode == 'wiki') |
1639 | - $title .= ' - ' . $langs->trans("PageWiki") . ' "' . dol_escape_htmltag(strtr($helppage, '_', ' ')) . '"'; |
|
1639 | + $title .= ' - '.$langs->trans("PageWiki").' "'.dol_escape_htmltag(strtr($helppage, '_', ' ')).'"'; |
|
1640 | 1640 | $text .= '<a class="help" target="_blank" rel="noopener" href="'; |
1641 | 1641 | if ($mode == 'wiki') |
1642 | 1642 | $text .= sprintf($helpbaseurl, urlencode(html_entity_decode($helppage))); |
@@ -1660,7 +1660,7 @@ discard block |
||
1660 | 1660 | |
1661 | 1661 | print $toprightmenu; |
1662 | 1662 | |
1663 | - print "</div>\n"; // end div class="login_block" |
|
1663 | + print "</div>\n"; // end div class="login_block" |
|
1664 | 1664 | |
1665 | 1665 | print '</div></div>'; |
1666 | 1666 | |
@@ -1669,7 +1669,7 @@ discard block |
||
1669 | 1669 | } |
1670 | 1670 | |
1671 | 1671 | if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) |
1672 | - print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">'; |
|
1672 | + print '<!-- Begin div id-container --><div id="id-container" class="id-container'.($morecss ? ' '.$morecss : '').'">'; |
|
1673 | 1673 | } |
1674 | 1674 | |
1675 | 1675 | /** |
@@ -1701,7 +1701,7 @@ discard block |
||
1701 | 1701 | // Instantiate hooks of thirdparty module |
1702 | 1702 | $hookmanager->initHooks(array('searchform', 'leftblock')); |
1703 | 1703 | |
1704 | - print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n"; |
|
1704 | + print "\n".'<!-- Begin side-nav id-left -->'."\n".'<div class="side-nav"><div id="id-left">'."\n"; |
|
1705 | 1705 | |
1706 | 1706 | if ($conf->browser->layout == 'phone') |
1707 | 1707 | $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ? |
@@ -1713,7 +1713,7 @@ discard block |
||
1713 | 1713 | } |
1714 | 1714 | $selected = -1; |
1715 | 1715 | $usedbyinclude = 1; |
1716 | - include_once DOL_BASE_PATH . '/core/ajax/selectsearchbox.php'; // This set $arrayresult |
|
1716 | + include_once DOL_BASE_PATH.'/core/ajax/selectsearchbox.php'; // This set $arrayresult |
|
1717 | 1717 | |
1718 | 1718 | if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) { |
1719 | 1719 | //$searchform.=$form->selectArrayAjax('searchselectcombo', DOL_BASE_URI.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'vmenusearchselectcombo', 1, $langs->trans("Search"), 1); |
@@ -1728,7 +1728,7 @@ discard block |
||
1728 | 1728 | // Execute hook printSearchForm |
1729 | 1729 | $parameters = array('searchform' => $searchform); |
1730 | 1730 | |
1731 | - $reshook = $hookmanager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks |
|
1731 | + $reshook = $hookmanager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks |
|
1732 | 1732 | if (empty($reshook)) { |
1733 | 1733 | $searchform .= $hookmanager->resPrint; |
1734 | 1734 | } else |
@@ -1736,10 +1736,10 @@ discard block |
||
1736 | 1736 | |
1737 | 1737 | // Force special value for $searchform |
1738 | 1738 | if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax)) { |
1739 | - $urltosearch = DOL_BASE_URI . '/core/search_page.php?showtitlebefore=1'; |
|
1740 | - $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="' . $urltosearch . '" alt="' . dol_escape_htmltag($langs->trans("ShowSearchFields")) . '">' . $langs->trans("Search") . '...</a></div></div>'; |
|
1739 | + $urltosearch = DOL_BASE_URI.'/core/search_page.php?showtitlebefore=1'; |
|
1740 | + $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="'.$urltosearch.'" alt="'.dol_escape_htmltag($langs->trans("ShowSearchFields")).'">'.$langs->trans("Search").'...</a></div></div>'; |
|
1741 | 1741 | } elseif ($conf->use_javascript_ajax && !empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) { |
1742 | - $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="' . dol_escape_htmltag($langs->trans("ShowSearchFields")) . '">' . $langs->trans("Search") . '...</a></div><div id="divsearchforms2" style="display: none">' . $searchform . '</div>'; |
|
1742 | + $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="'.dol_escape_htmltag($langs->trans("ShowSearchFields")).'">'.$langs->trans("Search").'...</a></div><div id="divsearchforms2" style="display: none">'.$searchform.'</div>'; |
|
1743 | 1743 | $searchform .= '<script type="text/javascript"> |
1744 | 1744 | jQuery(document).ready(function () { |
1745 | 1745 | jQuery("#divsearchforms1").click(function(){ |
@@ -1752,16 +1752,16 @@ discard block |
||
1752 | 1752 | |
1753 | 1753 | // Define $bookmarks |
1754 | 1754 | if (!empty($conf->bookmark->enabled) && $user->rights->bookmark->lire) { |
1755 | - include_once DOL_BASE_PATH . '/bookmarks/bookmarks.lib.php'; |
|
1755 | + include_once DOL_BASE_PATH.'/bookmarks/bookmarks.lib.php'; |
|
1756 | 1756 | $langs->load("bookmarks"); |
1757 | 1757 | |
1758 | 1758 | $bookmarks = printBookmarksList($db, $langs); |
1759 | 1759 | } |
1760 | 1760 | |
1761 | 1761 | // Left column |
1762 | - print '<!-- Begin left menu -->' . "\n"; |
|
1762 | + print '<!-- Begin left menu -->'."\n"; |
|
1763 | 1763 | |
1764 | - print '<div class="vmenu"' . (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"') . '>' . "\n\n"; |
|
1764 | + print '<div class="vmenu"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"').'>'."\n\n"; |
|
1765 | 1765 | |
1766 | 1766 | // Show left menu with other forms |
1767 | 1767 | $menumanager->menu_array = $menu_array_before; |
@@ -1770,7 +1770,7 @@ discard block |
||
1770 | 1770 | // Dolibarr version + help + bug report link |
1771 | 1771 | print "\n"; |
1772 | 1772 | print "<!-- Begin Help Block-->\n"; |
1773 | - print '<div id="blockvmenuhelp" class="blockvmenuhelp">' . "\n"; |
|
1773 | + print '<div id="blockvmenuhelp" class="blockvmenuhelp">'."\n"; |
|
1774 | 1774 | |
1775 | 1775 | // Version |
1776 | 1776 | if (empty($conf->global->MAIN_HIDE_VERSION)) { // Version is already on help picto and on login page. |
@@ -1792,15 +1792,15 @@ discard block |
||
1792 | 1792 | $appli = $conf->global->MAIN_APPLICATION_TITLE; |
1793 | 1793 | $doliurl = ''; |
1794 | 1794 | if (preg_match('/\d\.\d/', $appli)) { |
1795 | - if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) |
|
1796 | - $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core |
|
1795 | + if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) |
|
1796 | + $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core |
|
1797 | 1797 | } else |
1798 | - $appli .= " " . DOL_VERSION; |
|
1798 | + $appli .= " ".DOL_VERSION; |
|
1799 | 1799 | } else |
1800 | - $appli .= " " . DOL_VERSION; |
|
1800 | + $appli .= " ".DOL_VERSION; |
|
1801 | 1801 | print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">'; |
1802 | 1802 | if ($doliurl) |
1803 | - print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">'; |
|
1803 | + print '<a class="help" target="_blank" rel="noopener" href="'.$doliurl.'">'; |
|
1804 | 1804 | else |
1805 | 1805 | print '<span class="help">'; |
1806 | 1806 | print $appli; |
@@ -1808,12 +1808,12 @@ discard block |
||
1808 | 1808 | print '</a>'; |
1809 | 1809 | else |
1810 | 1810 | print '</span>'; |
1811 | - print '</div>' . "\n"; |
|
1811 | + print '</div>'."\n"; |
|
1812 | 1812 | } |
1813 | 1813 | |
1814 | 1814 | // Link to bugtrack |
1815 | 1815 | if (!empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) { |
1816 | - require_once DOL_BASE_PATH . '/core/lib/functions2.lib.php'; |
|
1816 | + require_once DOL_BASE_PATH.'/core/lib/functions2.lib.php'; |
|
1817 | 1817 | |
1818 | 1818 | $bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new'; |
1819 | 1819 | $bugbaseurl .= '?title='; |
@@ -1822,16 +1822,16 @@ discard block |
||
1822 | 1822 | $bugbaseurl .= urlencode("# Bug\n"); |
1823 | 1823 | $bugbaseurl .= urlencode("\n"); |
1824 | 1824 | $bugbaseurl .= urlencode("## Environment\n"); |
1825 | - $bugbaseurl .= urlencode("- **Version**: " . DOL_VERSION . "\n"); |
|
1826 | - $bugbaseurl .= urlencode("- **OS**: " . php_uname('s') . "\n"); |
|
1827 | - $bugbaseurl .= urlencode("- **Web server**: " . $_SERVER["SERVER_SOFTWARE"] . "\n"); |
|
1828 | - $bugbaseurl .= urlencode("- **PHP**: " . php_sapi_name() . ' ' . phpversion() . "\n"); |
|
1829 | - $bugbaseurl .= urlencode("- **Database**: " . $db::LABEL . ' ' . $db->getVersion() . "\n"); |
|
1830 | - $bugbaseurl .= urlencode("- **URL**: " . $_SERVER["REQUEST_URI"] . "\n"); |
|
1825 | + $bugbaseurl .= urlencode("- **Version**: ".DOL_VERSION."\n"); |
|
1826 | + $bugbaseurl .= urlencode("- **OS**: ".php_uname('s')."\n"); |
|
1827 | + $bugbaseurl .= urlencode("- **Web server**: ".$_SERVER["SERVER_SOFTWARE"]."\n"); |
|
1828 | + $bugbaseurl .= urlencode("- **PHP**: ".php_sapi_name().' '.phpversion()."\n"); |
|
1829 | + $bugbaseurl .= urlencode("- **Database**: ".$db::LABEL.' '.$db->getVersion()."\n"); |
|
1830 | + $bugbaseurl .= urlencode("- **URL**: ".$_SERVER["REQUEST_URI"]."\n"); |
|
1831 | 1831 | $bugbaseurl .= urlencode("\n"); |
1832 | 1832 | $bugbaseurl .= urlencode("## Report\n"); |
1833 | 1833 | print '<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">'; |
1834 | - print '<a class="help" target="_blank" rel="noopener" href="' . $bugbaseurl . '">' . $langs->trans("FindBug") . '</a>'; |
|
1834 | + print '<a class="help" target="_blank" rel="noopener" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a>'; |
|
1835 | 1835 | print '</div>'; |
1836 | 1836 | } |
1837 | 1837 | |
@@ -1845,14 +1845,14 @@ discard block |
||
1845 | 1845 | |
1846 | 1846 | // Execute hook printLeftBlock |
1847 | 1847 | $parameters = array(); |
1848 | - $reshook = $hookmanager->executeHooks('printLeftBlock', $parameters); // Note that $action and $object may have been modified by some hooks |
|
1848 | + $reshook = $hookmanager->executeHooks('printLeftBlock', $parameters); // Note that $action and $object may have been modified by some hooks |
|
1849 | 1849 | print $hookmanager->resPrint; |
1850 | 1850 | |
1851 | 1851 | print '</div></div> <!-- End side-nav id-left -->'; // End div id="side-nav" div id="id-left" |
1852 | 1852 | } |
1853 | 1853 | |
1854 | 1854 | print "\n"; |
1855 | - print '<!-- Begin right area -->' . "\n"; |
|
1855 | + print '<!-- Begin right area -->'."\n"; |
|
1856 | 1856 | |
1857 | 1857 | if (empty($leftmenuwithoutmainarea)) |
1858 | 1858 | main_area($title); |
@@ -1873,7 +1873,7 @@ discard block |
||
1873 | 1873 | |
1874 | 1874 | print "\n"; |
1875 | 1875 | |
1876 | - print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n"; |
|
1876 | + print '<!-- Begin div class="fiche" -->'."\n".'<div class="fiche">'."\n"; |
|
1877 | 1877 | |
1878 | 1878 | if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) |
1879 | 1879 | print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED)); |
@@ -1939,17 +1939,17 @@ discard block |
||
1939 | 1939 | global $conf, $langs, $user; |
1940 | 1940 | |
1941 | 1941 | $ret = ''; |
1942 | - $ret .= '<form action="' . $urlaction . '" method="post" class="searchform">'; |
|
1943 | - $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
|
1942 | + $ret .= '<form action="'.$urlaction.'" method="post" class="searchform">'; |
|
1943 | + $ret .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; |
|
1944 | 1944 | $ret .= '<input type="hidden" name="mode" value="search">'; |
1945 | - $ret .= '<input type="hidden" name="savelogin" value="' . dol_escape_htmltag($user->login) . '">'; |
|
1945 | + $ret .= '<input type="hidden" name="savelogin" value="'.dol_escape_htmltag($user->login).'">'; |
|
1946 | 1946 | if ($showtitlebefore) |
1947 | - $ret .= $title . ' '; |
|
1948 | - $ret .= '<input type="text" class="flat ' . $htmlmorecss . '"'; |
|
1949 | - $ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"'; |
|
1950 | - $ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : ''); |
|
1951 | - $ret .= ' placeholder="' . strip_tags($title) . '"'; |
|
1952 | - $ret .= ' name="' . $htmlinputname . '" id="' . $prefhtmlinputname . $htmlinputname . '" />'; |
|
1947 | + $ret .= $title.' '; |
|
1948 | + $ret .= '<input type="text" class="flat '.$htmlmorecss.'"'; |
|
1949 | + $ret .= ' style="text-indent: 22px; background-image: url(\''.$img.'\'); background-repeat: no-repeat; background-position: 3px;"'; |
|
1950 | + $ret .= ($accesskey ? ' accesskey="'.$accesskey.'"' : ''); |
|
1951 | + $ret .= ' placeholder="'.strip_tags($title).'"'; |
|
1952 | + $ret .= ' name="'.$htmlinputname.'" id="'.$prefhtmlinputname.$htmlinputname.'" />'; |
|
1953 | 1953 | //$ret.='<input type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px" value="'.$langs->trans("Go").'">'; |
1954 | 1954 | $ret .= '<button type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">'; |
1955 | 1955 | $ret .= '<span class="fa fa-search"></span>'; |
@@ -1975,7 +1975,7 @@ discard block |
||
1975 | 1975 | global $delayedhtmlcontent; |
1976 | 1976 | global $contextpage, $page, $limit; |
1977 | 1977 | |
1978 | - $ext = 'layout=' . $conf->browser->layout . '&version=' . urlencode(DOL_VERSION); |
|
1978 | + $ext = 'layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION); |
|
1979 | 1979 | |
1980 | 1980 | // Global html output events ($mesgs, $errors, $warnings) |
1981 | 1981 | dol_htmloutput_events($disabledoutputofmessages); |
@@ -1985,15 +1985,15 @@ discard block |
||
1985 | 1985 | if (is_object($user) && !empty($user->lastsearch_values_tmp) && is_array($user->lastsearch_values_tmp)) { |
1986 | 1986 | // Clean and save data |
1987 | 1987 | foreach ($user->lastsearch_values_tmp as $key => $val) { |
1988 | - unset($_SESSION['lastsearch_values_tmp_' . $key]); // Clean array to rebuild it just after |
|
1988 | + unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean array to rebuild it just after |
|
1989 | 1989 | if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button |
1990 | 1990 | if (empty($val['sortfield'])) |
1991 | 1991 | unset($val['sortfield']); |
1992 | 1992 | if (empty($val['sortorder'])) |
1993 | 1993 | unset($val['sortorder']); |
1994 | - dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)"); |
|
1995 | - $_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val); |
|
1996 | - unset($_SESSION['lastsearch_values_' . $key]); |
|
1994 | + dol_syslog('Save lastsearch_values_tmp_'.$key.'='.json_encode($val, 0)." (systematic recording of last search criterias)"); |
|
1995 | + $_SESSION['lastsearch_values_tmp_'.$key] = json_encode($val); |
|
1996 | + unset($_SESSION['lastsearch_values_'.$key]); |
|
1997 | 1997 | } |
1998 | 1998 | } |
1999 | 1999 | } |
@@ -2002,37 +2002,37 @@ discard block |
||
2002 | 2002 | $relativepathstring = $_SERVER["PHP_SELF"]; |
2003 | 2003 | // Clean $relativepathstring |
2004 | 2004 | if (constant('DOL_BASE_URI')) |
2005 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
2005 | + $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring); |
|
2006 | 2006 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
2007 | 2007 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
2008 | 2008 | if (preg_match('/list\.php$/', $relativepathstring)) { |
2009 | - unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]); |
|
2010 | - unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]); |
|
2011 | - unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]); |
|
2009 | + unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]); |
|
2010 | + unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]); |
|
2011 | + unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]); |
|
2012 | 2012 | |
2013 | 2013 | if (!empty($contextpage)) |
2014 | - $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage; |
|
2014 | + $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring] = $contextpage; |
|
2015 | 2015 | if (!empty($page) && $page > 1) |
2016 | - $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page; |
|
2016 | + $_SESSION['lastsearch_page_tmp_'.$relativepathstring] = $page; |
|
2017 | 2017 | if (!empty($limit) && $limit != $conf->limit) |
2018 | - $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit; |
|
2018 | + $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] = $limit; |
|
2019 | 2019 | |
2020 | - unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]); |
|
2021 | - unset($_SESSION['lastsearch_page_' . $relativepathstring]); |
|
2022 | - unset($_SESSION['lastsearch_limit_' . $relativepathstring]); |
|
2020 | + unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]); |
|
2021 | + unset($_SESSION['lastsearch_page_'.$relativepathstring]); |
|
2022 | + unset($_SESSION['lastsearch_limit_'.$relativepathstring]); |
|
2023 | 2023 | } |
2024 | 2024 | |
2025 | 2025 | // Core error message |
2026 | 2026 | if (!empty($conf->global->MAIN_CORE_ERROR)) { |
2027 | 2027 | // Ajax version |
2028 | 2028 | if ($conf->use_javascript_ajax) { |
2029 | - $title = img_warning() . ' ' . $langs->trans('CoreErrorTitle'); |
|
2029 | + $title = img_warning().' '.$langs->trans('CoreErrorTitle'); |
|
2030 | 2030 | print ajax_dialog($title, $langs->trans('CoreErrorMessage')); |
2031 | 2031 | } |
2032 | 2032 | // html version |
2033 | 2033 | else { |
2034 | - $msg = img_warning() . ' ' . $langs->trans('CoreErrorMessage'); |
|
2035 | - print '<div class="error">' . $msg . '</div>'; |
|
2034 | + $msg = img_warning().' '.$langs->trans('CoreErrorMessage'); |
|
2035 | + print '<div class="error">'.$msg.'</div>'; |
|
2036 | 2036 | } |
2037 | 2037 | |
2038 | 2038 | //define("MAIN_CORE_ERROR",0); // Constant was defined and we can't change value of a constant |
@@ -2040,17 +2040,17 @@ discard block |
||
2040 | 2040 | |
2041 | 2041 | print "\n\n"; |
2042 | 2042 | |
2043 | - print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche |
|
2043 | + print '</div> <!-- End div class="fiche" -->'."\n"; // End div fiche |
|
2044 | 2044 | |
2045 | 2045 | if (empty($conf->dol_hide_leftmenu)) |
2046 | - print '</div> <!-- End div id-right -->' . "\n"; // End div id-right |
|
2046 | + print '</div> <!-- End div id-right -->'."\n"; // End div id-right |
|
2047 | 2047 | |
2048 | 2048 | if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) |
2049 | - print '</div> <!-- End div id-container -->' . "\n"; // End div container |
|
2049 | + print '</div> <!-- End div id-container -->'."\n"; // End div container |
|
2050 | 2050 | |
2051 | 2051 | print "\n"; |
2052 | 2052 | if ($comment) |
2053 | - print '<!-- ' . $comment . ' -->' . "\n"; |
|
2053 | + print '<!-- '.$comment.' -->'."\n"; |
|
2054 | 2054 | |
2055 | 2055 | printCommonFooter($zone); |
2056 | 2056 | |
@@ -2058,8 +2058,8 @@ discard block |
||
2058 | 2058 | print $delayedhtmlcontent; |
2059 | 2059 | |
2060 | 2060 | if (!empty($conf->use_javascript_ajax)) { |
2061 | - print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n"; |
|
2062 | - print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_foot.js&lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n"; |
|
2061 | + print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n"; |
|
2062 | + print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_foot.js&lang='.$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n"; |
|
2063 | 2063 | } |
2064 | 2064 | |
2065 | 2065 | // Wrapper to add log when clicking on download or preview |
@@ -2071,7 +2071,7 @@ discard block |
||
2071 | 2071 | <script type="text/javascript"> |
2072 | 2072 | jQuery(document).ready(function () { |
2073 | 2073 | $('a.documentpreview').click(function () { |
2074 | - $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>' |
|
2074 | + $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>' |
|
2075 | 2075 | , { |
2076 | 2076 | id:<?php echo $object->id; ?> |
2077 | 2077 | , element: '<?php echo $object->element ?>' |
@@ -2080,7 +2080,7 @@ discard block |
||
2080 | 2080 | ); |
2081 | 2081 | }); |
2082 | 2082 | $('a.documentdownload').click(function () { |
2083 | - $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>' |
|
2083 | + $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>' |
|
2084 | 2084 | , { |
2085 | 2085 | id:<?php echo $object->id; ?> |
2086 | 2086 | , element: '<?php echo $object->element ?>' |
@@ -2096,7 +2096,7 @@ discard block |
||
2096 | 2096 | |
2097 | 2097 | // A div for the address popup |
2098 | 2098 | print "\n<!-- A div to allow dialog popup -->\n"; |
2099 | - print '<div id="dialogforpopup" style="display: none;"></div>' . "\n"; |
|
2099 | + print '<div id="dialogforpopup" style="display: none;"></div>'."\n"; |
|
2100 | 2100 | |
2101 | 2101 | print "</body>\n"; |
2102 | 2102 |
@@ -214,16 +214,18 @@ discard block |
||
214 | 214 | foreach ($tmplist as $tmpkey) { |
215 | 215 | $postkey = $tmpautoset[0] . '_' . $tmpkey; |
216 | 216 | //var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]); |
217 | - if (!empty($_POST[$postkey])) |
|
218 | - $cookiearrayvalue[$tmpkey] = $_POST[$postkey]; |
|
217 | + if (!empty($_POST[$postkey])) { |
|
218 | + $cookiearrayvalue[$tmpkey] = $_POST[$postkey]; |
|
219 | + } |
|
219 | 220 | } |
220 | 221 | $cookiename = $tmpautoset[0]; |
221 | 222 | $cookievalue = json_encode($cookiearrayvalue); |
222 | 223 | //var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue); |
223 | 224 | setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, false, true); // keep cookie 1 year and add tag httponly |
224 | - if (empty($cookievalue)) |
|
225 | - unset($_COOKIE[$cookiename]); |
|
226 | -} |
|
225 | + if (empty($cookievalue)) { |
|
226 | + unset($_COOKIE[$cookiename]); |
|
227 | + } |
|
228 | + } |
|
227 | 229 | |
228 | 230 | |
229 | 231 | // Init session. Name of session is specific to Dolibarr instance. |
@@ -232,8 +234,9 @@ discard block |
||
232 | 234 | |
233 | 235 | $sessionname = 'DOLSESSID_' . $prefix; |
234 | 236 | $sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix; |
235 | -if (!empty($_COOKIE[$sessiontimeout])) |
|
237 | +if (!empty($_COOKIE[$sessiontimeout])) { |
|
236 | 238 | ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]); |
239 | +} |
|
237 | 240 | session_name($sessionname); |
238 | 241 | 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. |
239 | 242 | // This create lock, released when session_write_close() or end of page. |
@@ -264,11 +267,13 @@ discard block |
||
264 | 267 | $conf->browser->layout = $tmp['layout']; // 'classic', 'phone', 'tablet' |
265 | 268 | //var_dump($conf->browser); |
266 | 269 | |
267 | - if ($conf->browser->layout == 'phone') |
|
268 | - $conf->dol_no_mouse_hover = 1; |
|
269 | - if ($conf->browser->layout == 'phone') |
|
270 | - $conf->global->MAIN_TESTMENUHIDER = 1; |
|
271 | -} |
|
270 | + if ($conf->browser->layout == 'phone') { |
|
271 | + $conf->dol_no_mouse_hover = 1; |
|
272 | + } |
|
273 | + if ($conf->browser->layout == 'phone') { |
|
274 | + $conf->global->MAIN_TESTMENUHIDER = 1; |
|
275 | + } |
|
276 | + } |
|
272 | 277 | |
273 | 278 | // Force HTTPS if required ($conf->file->main_force_https is 0/1 or https dolibarr root url) |
274 | 279 | // $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off' |
@@ -313,10 +318,14 @@ discard block |
||
313 | 318 | } |
314 | 319 | |
315 | 320 | // Loading of additional presentation includes |
316 | -if (!defined('NOREQUIREHTML')) |
|
317 | - require_once DOL_BASE_PATH . '/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2) |
|
318 | -if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) |
|
319 | - require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php'; // Need 22ko memory |
|
321 | +if (!defined('NOREQUIREHTML')) { |
|
322 | + require_once DOL_BASE_PATH . '/core/class/html.form.class.php'; |
|
323 | +} |
|
324 | +// Need 660ko memory (800ko in 2.2) |
|
325 | +if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) { |
|
326 | + require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php'; |
|
327 | +} |
|
328 | +// Need 22ko memory |
|
320 | 329 | |
321 | 330 | |
322 | 331 | |
@@ -353,8 +362,9 @@ discard block |
||
353 | 362 | // Creation of a token against CSRF vulnerabilities |
354 | 363 | if (!defined('NOTOKENRENEWAL')) { |
355 | 364 | // roulement des jetons car cree a chaque appel |
356 | - if (isset($_SESSION['newtoken'])) |
|
357 | - $_SESSION['token'] = $_SESSION['newtoken']; |
|
365 | + if (isset($_SESSION['newtoken'])) { |
|
366 | + $_SESSION['token'] = $_SESSION['newtoken']; |
|
367 | + } |
|
358 | 368 | |
359 | 369 | // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken'] |
360 | 370 | $token = dol_hash(uniqid(mt_rand(), true)); // Generates a hash of a random number |
@@ -376,14 +386,16 @@ discard block |
||
376 | 386 | } |
377 | 387 | |
378 | 388 | // Disable modules (this must be after session_start and after conf has been loaded) |
379 | -if (GETPOST('disablemodules', 'alpha')) |
|
389 | +if (GETPOST('disablemodules', 'alpha')) { |
|
380 | 390 | $_SESSION["disablemodules"] = GETPOST('disablemodules', 'alpha'); |
391 | +} |
|
381 | 392 | if (!empty($_SESSION["disablemodules"])) { |
382 | 393 | $disabled_modules = explode(',', $_SESSION["disablemodules"]); |
383 | 394 | foreach ($disabled_modules as $module) { |
384 | 395 | if ($module) { |
385 | - if (empty($conf->$module)) |
|
386 | - $conf->$module = new stdClass(); |
|
396 | + if (empty($conf->$module)) { |
|
397 | + $conf->$module = new stdClass(); |
|
398 | + } |
|
387 | 399 | $conf->$module->enabled = false; |
388 | 400 | if ($module == 'fournisseur') { // Special case |
389 | 401 | $conf->supplier_order->enabled = 0; |
@@ -405,11 +417,13 @@ discard block |
||
405 | 417 | $dolibarr_main_authentication = constant('MAIN_AUTHENTICATION_MODE'); |
406 | 418 | } else { |
407 | 419 | // Authentication mode |
408 | - if (empty($dolibarr_main_authentication)) |
|
409 | - $dolibarr_main_authentication = 'http,dolibarr'; |
|
420 | + if (empty($dolibarr_main_authentication)) { |
|
421 | + $dolibarr_main_authentication = 'http,dolibarr'; |
|
422 | + } |
|
410 | 423 | // Authentication mode: forceuser |
411 | - if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) |
|
412 | - $dolibarr_auto_user = 'auto'; |
|
424 | + if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) { |
|
425 | + $dolibarr_auto_user = 'auto'; |
|
426 | + } |
|
413 | 427 | } |
414 | 428 | // Set authmode |
415 | 429 | $authmode = explode(',', $dolibarr_main_authentication); |
@@ -486,35 +500,41 @@ discard block |
||
486 | 500 | $hookmanager->initHooks(array('login')); |
487 | 501 | $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
488 | 502 | $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
489 | - if ($reshook < 0) |
|
490 | - $error++; |
|
503 | + if ($reshook < 0) { |
|
504 | + $error++; |
|
505 | + } |
|
491 | 506 | |
492 | 507 | // Note: exit is done later |
493 | 508 | } |
494 | 509 | } |
495 | 510 | |
496 | 511 | $allowedmethodtopostusername = 2; |
497 | - if (defined('MAIN_AUTHENTICATION_POST_METHOD')) |
|
498 | - $allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD'); |
|
512 | + if (defined('MAIN_AUTHENTICATION_POST_METHOD')) { |
|
513 | + $allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD'); |
|
514 | + } |
|
499 | 515 | $usertotest = (!empty($_COOKIE['login_dolibarr']) ? $_COOKIE['login_dolibarr'] : GETPOST("username", "alpha", $allowedmethodtopostusername)); |
500 | 516 | $passwordtotest = GETPOST('password', 'none', $allowedmethodtopostusername); |
501 | 517 | $entitytotest = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : (!empty($conf->entity) ? $conf->entity : 1)); |
502 | 518 | |
503 | 519 | // Define if we received data to test the login. |
504 | 520 | $goontestloop = false; |
505 | - if (isset($_SERVER["REMOTE_USER"]) && in_array('http', $authmode)) |
|
506 | - $goontestloop = true; |
|
507 | - if ($dolibarr_main_authentication == 'forceuser' && !empty($dolibarr_auto_user)) |
|
508 | - $goontestloop = true; |
|
509 | - if (GETPOST("username", "alpha", $allowedmethodtopostusername) || !empty($_COOKIE['login_dolibarr']) || GETPOST('openid_mode', 'alpha', 1)) |
|
510 | - $goontestloop = true; |
|
521 | + if (isset($_SERVER["REMOTE_USER"]) && in_array('http', $authmode)) { |
|
522 | + $goontestloop = true; |
|
523 | + } |
|
524 | + if ($dolibarr_main_authentication == 'forceuser' && !empty($dolibarr_auto_user)) { |
|
525 | + $goontestloop = true; |
|
526 | + } |
|
527 | + if (GETPOST("username", "alpha", $allowedmethodtopostusername) || !empty($_COOKIE['login_dolibarr']) || GETPOST('openid_mode', 'alpha', 1)) { |
|
528 | + $goontestloop = true; |
|
529 | + } |
|
511 | 530 | |
512 | 531 | if (!is_object($langs)) { // This can occurs when calling page with NOREQUIRETRAN defined, however we need langs for error messages. |
513 | 532 | include_once DOL_BASE_PATH . '/core/class/translate.class.php'; |
514 | 533 | $langs = new Translate("", $conf); |
515 | 534 | $langcode = (GETPOST('lang', 'aZ09', 1) ? GETPOST('lang', 'aZ09', 1) : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT)); |
516 | - if (defined('MAIN_LANG_DEFAULT')) |
|
517 | - $langcode = constant('MAIN_LANG_DEFAULT'); |
|
535 | + if (defined('MAIN_LANG_DEFAULT')) { |
|
536 | + $langcode = constant('MAIN_LANG_DEFAULT'); |
|
537 | + } |
|
518 | 538 | $langs->setDefaultLang($langcode); |
519 | 539 | } |
520 | 540 | |
@@ -536,8 +556,9 @@ discard block |
||
536 | 556 | $datenow = dol_now(); |
537 | 557 | $datefirst = dol_stringtotime($_POST["dst_first"]); |
538 | 558 | $datesecond = dol_stringtotime($_POST["dst_second"]); |
539 | - if ($datenow >= $datefirst && $datenow < $datesecond) |
|
540 | - $dol_dst = 1; |
|
559 | + if ($datenow >= $datefirst && $datenow < $datesecond) { |
|
560 | + $dol_dst = 1; |
|
561 | + } |
|
541 | 562 | } |
542 | 563 | //print $datefirst.'-'.$datesecond.'-'.$datenow.'-'.$dol_tz.'-'.$dol_tzstring.'-'.$dol_dst; exit; |
543 | 564 | } |
@@ -549,8 +570,9 @@ discard block |
||
549 | 570 | |
550 | 571 | // Bad password. No authmode has found a good password. |
551 | 572 | // We set a generic message if not defined inside function checkLoginPassEntity or subfunctions |
552 | - if (empty($_SESSION["dol_loginmesg"])) |
|
553 | - $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword"); |
|
573 | + if (empty($_SESSION["dol_loginmesg"])) { |
|
574 | + $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword"); |
|
575 | + } |
|
554 | 576 | |
555 | 577 | // Call trigger for the "security events" log |
556 | 578 | $user->trigger_mesg = $langs->trans("ErrorBadLoginPassword") . ' - login=' . GETPOST("username", "alpha", 2); |
@@ -567,8 +589,9 @@ discard block |
||
567 | 589 | $hookmanager->initHooks(array('login')); |
568 | 590 | $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
569 | 591 | $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
570 | - if ($reshook < 0) |
|
571 | - $error++; |
|
592 | + if ($reshook < 0) { |
|
593 | + $error++; |
|
594 | + } |
|
572 | 595 | |
573 | 596 | // Note: exit is done in next chapter |
574 | 597 | } |
@@ -578,10 +601,11 @@ discard block |
||
578 | 601 | if (!$login || (in_array('ldap', $authmode) && empty($passwordtotest))) { // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success. |
579 | 602 | // No data to test login, so we show the login page |
580 | 603 | dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . " showing the login form and exit"); |
581 | - if (defined('NOREDIRECTBYMAINTOLOGIN')) |
|
582 | - return 'ERROR_NOT_LOGGED'; |
|
583 | - else |
|
584 | - dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : '')); |
|
604 | + if (defined('NOREDIRECTBYMAINTOLOGIN')) { |
|
605 | + return 'ERROR_NOT_LOGGED'; |
|
606 | + } else { |
|
607 | + dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : '')); |
|
608 | + } |
|
585 | 609 | exit; |
586 | 610 | } |
587 | 611 | |
@@ -620,21 +644,24 @@ discard block |
||
620 | 644 | $hookmanager->initHooks(array('login')); |
621 | 645 | $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
622 | 646 | $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
623 | - if ($reshook < 0) |
|
624 | - $error++; |
|
647 | + if ($reshook < 0) { |
|
648 | + $error++; |
|
649 | + } |
|
625 | 650 | |
626 | 651 | $paramsurl = array(); |
627 | - if (GETPOST('textbrowser', 'int')) |
|
628 | - $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int'); |
|
629 | - if (GETPOST('nojs', 'int')) |
|
630 | - $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int'); |
|
631 | - if (GETPOST('lang', 'aZ09')) |
|
632 | - $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09'); |
|
652 | + if (GETPOST('textbrowser', 'int')) { |
|
653 | + $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int'); |
|
654 | + } |
|
655 | + if (GETPOST('nojs', 'int')) { |
|
656 | + $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int'); |
|
657 | + } |
|
658 | + if (GETPOST('lang', 'aZ09')) { |
|
659 | + $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09'); |
|
660 | + } |
|
633 | 661 | header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : '')); |
634 | 662 | exit; |
635 | 663 | } |
636 | - } |
|
637 | - else { |
|
664 | + } else { |
|
638 | 665 | // We are already into an authenticated session |
639 | 666 | $login = $_SESSION["dol_login"]; |
640 | 667 | $entity = $_SESSION["dol_entity"]; |
@@ -676,20 +703,23 @@ discard block |
||
676 | 703 | $hookmanager->initHooks(array('login')); |
677 | 704 | $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]); |
678 | 705 | $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
679 | - if ($reshook < 0) |
|
680 | - $error++; |
|
706 | + if ($reshook < 0) { |
|
707 | + $error++; |
|
708 | + } |
|
681 | 709 | |
682 | 710 | $paramsurl = array(); |
683 | - if (GETPOST('textbrowser', 'int')) |
|
684 | - $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int'); |
|
685 | - if (GETPOST('nojs', 'int')) |
|
686 | - $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int'); |
|
687 | - if (GETPOST('lang', 'aZ09')) |
|
688 | - $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09'); |
|
711 | + if (GETPOST('textbrowser', 'int')) { |
|
712 | + $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int'); |
|
713 | + } |
|
714 | + if (GETPOST('nojs', 'int')) { |
|
715 | + $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int'); |
|
716 | + } |
|
717 | + if (GETPOST('lang', 'aZ09')) { |
|
718 | + $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09'); |
|
719 | + } |
|
689 | 720 | header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : '')); |
690 | 721 | exit; |
691 | - } |
|
692 | - else { |
|
722 | + } else { |
|
693 | 723 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
694 | 724 | $hookmanager->initHooks(array('main')); |
695 | 725 | |
@@ -698,8 +728,9 @@ discard block |
||
698 | 728 | $relativepathstring = preg_replace('/\?.*$/', '', $_SERVER["HTTP_REFERER"]); |
699 | 729 | $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring); // Get full path except host server |
700 | 730 | // Clean $relativepathstring |
701 | - if (constant('DOL_BASE_URI')) |
|
702 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
731 | + if (constant('DOL_BASE_URI')) { |
|
732 | + $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
733 | + } |
|
703 | 734 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
704 | 735 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
705 | 736 | //var_dump($relativepathstring); |
@@ -750,16 +781,21 @@ discard block |
||
750 | 781 | $_SESSION["dol_company"] = $conf->global->MAIN_INFO_SOCIETE_NOM; |
751 | 782 | $_SESSION["dol_entity"] = $conf->entity; |
752 | 783 | // Store value into session (values stored only if defined) |
753 | - if (!empty($dol_hide_topmenu)) |
|
754 | - $_SESSION['dol_hide_topmenu'] = $dol_hide_topmenu; |
|
755 | - if (!empty($dol_hide_leftmenu)) |
|
756 | - $_SESSION['dol_hide_leftmenu'] = $dol_hide_leftmenu; |
|
757 | - if (!empty($dol_optimize_smallscreen)) |
|
758 | - $_SESSION['dol_optimize_smallscreen'] = $dol_optimize_smallscreen; |
|
759 | - if (!empty($dol_no_mouse_hover)) |
|
760 | - $_SESSION['dol_no_mouse_hover'] = $dol_no_mouse_hover; |
|
761 | - if (!empty($dol_use_jmobile)) |
|
762 | - $_SESSION['dol_use_jmobile'] = $dol_use_jmobile; |
|
784 | + if (!empty($dol_hide_topmenu)) { |
|
785 | + $_SESSION['dol_hide_topmenu'] = $dol_hide_topmenu; |
|
786 | + } |
|
787 | + if (!empty($dol_hide_leftmenu)) { |
|
788 | + $_SESSION['dol_hide_leftmenu'] = $dol_hide_leftmenu; |
|
789 | + } |
|
790 | + if (!empty($dol_optimize_smallscreen)) { |
|
791 | + $_SESSION['dol_optimize_smallscreen'] = $dol_optimize_smallscreen; |
|
792 | + } |
|
793 | + if (!empty($dol_no_mouse_hover)) { |
|
794 | + $_SESSION['dol_no_mouse_hover'] = $dol_no_mouse_hover; |
|
795 | + } |
|
796 | + if (!empty($dol_use_jmobile)) { |
|
797 | + $_SESSION['dol_use_jmobile'] = $dol_use_jmobile; |
|
798 | + } |
|
763 | 799 | |
764 | 800 | dol_syslog("This is a new started user session. _SESSION['dol_login']=" . $_SESSION["dol_login"] . " Session id=" . session_id()); |
765 | 801 | |
@@ -784,8 +820,9 @@ discard block |
||
784 | 820 | $hookmanager->initHooks(array('login')); |
785 | 821 | $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginfo' => $loginfo); |
786 | 822 | $reshook = $hookmanager->executeHooks('afterLogin', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks |
787 | - if ($reshook < 0) |
|
788 | - $error++; |
|
823 | + if ($reshook < 0) { |
|
824 | + $error++; |
|
825 | + } |
|
789 | 826 | |
790 | 827 | if ($error) { |
791 | 828 | $db->rollback(); |
@@ -823,10 +860,14 @@ discard block |
||
823 | 860 | */ |
824 | 861 | |
825 | 862 | // Set liste_limit |
826 | - if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) |
|
827 | - $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT; // Can be 0 |
|
828 | - if (isset($user->conf->PRODUIT_LIMIT_SIZE)) |
|
829 | - $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE; // Can be 0 |
|
863 | + if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) { |
|
864 | + $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT; |
|
865 | + } |
|
866 | + // Can be 0 |
|
867 | + if (isset($user->conf->PRODUIT_LIMIT_SIZE)) { |
|
868 | + $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE; |
|
869 | + } |
|
870 | + // Can be 0 |
|
830 | 871 | |
831 | 872 | |
832 | 873 | |
@@ -861,8 +902,9 @@ discard block |
||
861 | 902 | if (!empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) { |
862 | 903 | $conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT; |
863 | 904 | } |
864 | -} else |
|
905 | +} else { |
|
865 | 906 | $conf->use_javascript_ajax = 0; |
907 | +} |
|
866 | 908 | // Set MAIN_OPTIMIZEFORTEXTBROWSER |
867 | 909 | if (GETPOST('textbrowser', 'int') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks') || !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) { // If we must enable text browser |
868 | 910 | $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1; |
@@ -871,25 +913,32 @@ discard block |
||
871 | 913 | } |
872 | 914 | |
873 | 915 | // Set terminal output option according to conf->browser. |
874 | -if (GETPOST('dol_hide_leftmenu', 'int') || !empty($_SESSION['dol_hide_leftmenu'])) |
|
916 | +if (GETPOST('dol_hide_leftmenu', 'int') || !empty($_SESSION['dol_hide_leftmenu'])) { |
|
875 | 917 | $conf->dol_hide_leftmenu = 1; |
876 | -if (GETPOST('dol_hide_topmenu', 'int') || !empty($_SESSION['dol_hide_topmenu'])) |
|
918 | +} |
|
919 | +if (GETPOST('dol_hide_topmenu', 'int') || !empty($_SESSION['dol_hide_topmenu'])) { |
|
877 | 920 | $conf->dol_hide_topmenu = 1; |
878 | -if (GETPOST('dol_optimize_smallscreen', 'int') || !empty($_SESSION['dol_optimize_smallscreen'])) |
|
921 | +} |
|
922 | +if (GETPOST('dol_optimize_smallscreen', 'int') || !empty($_SESSION['dol_optimize_smallscreen'])) { |
|
879 | 923 | $conf->dol_optimize_smallscreen = 1; |
880 | -if (GETPOST('dol_no_mouse_hover', 'int') || !empty($_SESSION['dol_no_mouse_hover'])) |
|
924 | +} |
|
925 | +if (GETPOST('dol_no_mouse_hover', 'int') || !empty($_SESSION['dol_no_mouse_hover'])) { |
|
881 | 926 | $conf->dol_no_mouse_hover = 1; |
882 | -if (GETPOST('dol_use_jmobile', 'int') || !empty($_SESSION['dol_use_jmobile'])) |
|
927 | +} |
|
928 | +if (GETPOST('dol_use_jmobile', 'int') || !empty($_SESSION['dol_use_jmobile'])) { |
|
883 | 929 | $conf->dol_use_jmobile = 1; |
884 | -if (!empty($conf->browser->layout) && $conf->browser->layout != 'classic') |
|
930 | +} |
|
931 | +if (!empty($conf->browser->layout) && $conf->browser->layout != 'classic') { |
|
885 | 932 | $conf->dol_no_mouse_hover = 1; |
933 | +} |
|
886 | 934 | if ((!empty($conf->browser->layout) && $conf->browser->layout == 'phone') || (!empty($_SESSION['dol_screenwidth']) && $_SESSION['dol_screenwidth'] < 400) || (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 400) |
887 | 935 | ) { |
888 | 936 | $conf->dol_optimize_smallscreen = 1; |
889 | 937 | } |
890 | 938 | // If we force to use jmobile, then we reenable javascript |
891 | -if (!empty($conf->dol_use_jmobile)) |
|
939 | +if (!empty($conf->dol_use_jmobile)) { |
|
892 | 940 | $conf->use_javascript_ajax = 1; |
941 | +} |
|
893 | 942 | // Replace themes bugged with jmobile with eldy |
894 | 943 | if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array('bureau2crea', 'cameleo', 'amarok'))) { |
895 | 944 | $conf->theme = 'eldy'; |
@@ -913,8 +962,9 @@ discard block |
||
913 | 962 | if (!defined('NOLOGIN')) { |
914 | 963 | // If the login is not recovered, it is identified with an account that does not exist. |
915 | 964 | // Hacking attempt? |
916 | - if (!$user->login) |
|
917 | - accessforbidden(); |
|
965 | + if (!$user->login) { |
|
966 | + accessforbidden(); |
|
967 | + } |
|
918 | 968 | |
919 | 969 | // Check if user is active |
920 | 970 | if ($user->statut < 1) { |
@@ -989,15 +1039,18 @@ discard block |
||
989 | 1039 | |
990 | 1040 | // Load the menu manager (only if not already done) |
991 | 1041 | $file_menu = $conf->standard_menu; |
992 | - if (GETPOST('menu', 'alpha')) |
|
993 | - $file_menu = GETPOST('menu', 'alpha'); // example: menu=eldy_menu.php |
|
1042 | + if (GETPOST('menu', 'alpha')) { |
|
1043 | + $file_menu = GETPOST('menu', 'alpha'); |
|
1044 | + } |
|
1045 | + // example: menu=eldy_menu.php |
|
994 | 1046 | if (!class_exists('MenuManager')) { |
995 | 1047 | $menufound = 0; |
996 | 1048 | $dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']); |
997 | 1049 | foreach ($dirmenus as $dirmenu) { |
998 | 1050 | $menufound = dol_include_once($dirmenu . "standard/" . $file_menu); |
999 | - if (class_exists('MenuManager')) |
|
1000 | - break; |
|
1051 | + if (class_exists('MenuManager')) { |
|
1052 | + break; |
|
1053 | + } |
|
1001 | 1054 | } |
1002 | 1055 | if (!class_exists('MenuManager')) { // If failed to include, we try with standard eldy_menu.php |
1003 | 1056 | dol_syslog("You define a menu manager '" . $file_menu . "' that can not be loaded.", LOG_WARNING); |
@@ -1147,18 +1200,20 @@ discard block |
||
1147 | 1200 | } |
1148 | 1201 | print '<!doctype html>' . "\n"; |
1149 | 1202 | |
1150 | - if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST)) |
|
1151 | - print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_BASE_URI . '/cache.manifest">' . "\n"; |
|
1152 | - else |
|
1153 | - print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n"; |
|
1203 | + if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST)) { |
|
1204 | + print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_BASE_URI . '/cache.manifest">' . "\n"; |
|
1205 | + } else { |
|
1206 | + print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n"; |
|
1207 | + } |
|
1154 | 1208 | //print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'."\n"; |
1155 | 1209 | if (empty($disablehead)) { |
1156 | 1210 | $ext = 'layout=' . $conf->browser->layout . '&version=' . urlencode(DOL_VERSION); |
1157 | 1211 | |
1158 | 1212 | print "<head>\n"; |
1159 | 1213 | |
1160 | - if (GETPOST('dol_basehref', 'alpha')) |
|
1161 | - print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')) . '">' . "\n"; |
|
1214 | + if (GETPOST('dol_basehref', 'alpha')) { |
|
1215 | + print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')) . '">' . "\n"; |
|
1216 | + } |
|
1162 | 1217 | |
1163 | 1218 | // Displays meta |
1164 | 1219 | print '<meta charset="UTF-8">' . "\n"; |
@@ -1168,10 +1223,13 @@ discard block |
||
1168 | 1223 | |
1169 | 1224 | // Favicon |
1170 | 1225 | $favicon = dol_buildpath('/theme/' . $conf->theme . '/img/favicon.ico', 1); |
1171 | - if (!empty($conf->global->MAIN_FAVICON_URL)) |
|
1172 | - $favicon = $conf->global->MAIN_FAVICON_URL; |
|
1173 | - if (empty($conf->dol_use_jmobile)) |
|
1174 | - print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n"; // Not required into an Android webview |
|
1226 | + if (!empty($conf->global->MAIN_FAVICON_URL)) { |
|
1227 | + $favicon = $conf->global->MAIN_FAVICON_URL; |
|
1228 | + } |
|
1229 | + if (empty($conf->dol_use_jmobile)) { |
|
1230 | + print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n"; |
|
1231 | + } |
|
1232 | + // Not required into an Android webview |
|
1175 | 1233 | |
1176 | 1234 | |
1177 | 1235 | |
@@ -1189,47 +1247,59 @@ discard block |
||
1189 | 1247 | //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n"; |
1190 | 1248 | //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="author" title="Dolibarr Development Team" href="https://www.dolibarr.org">'."\n"; |
1191 | 1249 | // Auto refresh page |
1192 | - if (GETPOST('autorefresh', 'int') > 0) |
|
1193 | - print '<meta http-equiv="refresh" content="' . GETPOST('autorefresh', 'int') . '">'; |
|
1250 | + if (GETPOST('autorefresh', 'int') > 0) { |
|
1251 | + print '<meta http-equiv="refresh" content="' . GETPOST('autorefresh', 'int') . '">'; |
|
1252 | + } |
|
1194 | 1253 | |
1195 | 1254 | // Displays title |
1196 | 1255 | $appli = constant('DOL_APPLICATION_TITLE'); |
1197 | - if (!empty($conf->global->MAIN_APPLICATION_TITLE)) |
|
1198 | - $appli = $conf->global->MAIN_APPLICATION_TITLE; |
|
1256 | + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { |
|
1257 | + $appli = $conf->global->MAIN_APPLICATION_TITLE; |
|
1258 | + } |
|
1199 | 1259 | |
1200 | 1260 | print '<title>'; |
1201 | 1261 | $titletoshow = ''; |
1202 | - if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE)) |
|
1203 | - $titletoshow = dol_htmlentities($title); |
|
1204 | - else if ($title) |
|
1205 | - $titletoshow = dol_htmlentities($appli . ' - ' . $title); |
|
1206 | - else |
|
1207 | - $titletoshow = dol_htmlentities($appli); |
|
1208 | - |
|
1209 | - if (!is_object($hookmanager)) |
|
1210 | - $hookmanager = new HookManager($db); |
|
1262 | + if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE)) { |
|
1263 | + $titletoshow = dol_htmlentities($title); |
|
1264 | + } else if ($title) { |
|
1265 | + $titletoshow = dol_htmlentities($appli . ' - ' . $title); |
|
1266 | + } else { |
|
1267 | + $titletoshow = dol_htmlentities($appli); |
|
1268 | + } |
|
1269 | + |
|
1270 | + if (!is_object($hookmanager)) { |
|
1271 | + $hookmanager = new HookManager($db); |
|
1272 | + } |
|
1211 | 1273 | $hookmanager->initHooks("main"); |
1212 | 1274 | $parameters = array('title' => $titletoshow); |
1213 | 1275 | $result = $hookmanager->executeHooks('setHtmlTitle', $parameters); // Note that $action and $object may have been modified by some hooks |
1214 | - if ($result > 0) |
|
1215 | - $titletoshow = $hookmanager->resPrint; // Replace Title to show |
|
1216 | - else |
|
1217 | - $titletoshow .= $hookmanager->resPrint; // Concat to Title to show |
|
1276 | + if ($result > 0) { |
|
1277 | + $titletoshow = $hookmanager->resPrint; |
|
1278 | + } |
|
1279 | + // Replace Title to show |
|
1280 | + else { |
|
1281 | + $titletoshow .= $hookmanager->resPrint; |
|
1282 | + } |
|
1283 | + // Concat to Title to show |
|
1218 | 1284 | |
1219 | 1285 | print $titletoshow; |
1220 | 1286 | print '</title>'; |
1221 | 1287 | |
1222 | 1288 | print "\n"; |
1223 | 1289 | |
1224 | - if (GETPOST('version', 'int')) |
|
1225 | - $ext = 'version=' . GETPOST('version', 'int'); // usefull to force no cache on css/js |
|
1226 | - if (GETPOST('testmenuhider', 'int') || !empty($conf->global->MAIN_TESTMENUHIDER)) |
|
1227 | - $ext .= '&testmenuhider=' . (GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER); |
|
1290 | + if (GETPOST('version', 'int')) { |
|
1291 | + $ext = 'version=' . GETPOST('version', 'int'); |
|
1292 | + } |
|
1293 | + // usefull to force no cache on css/js |
|
1294 | + if (GETPOST('testmenuhider', 'int') || !empty($conf->global->MAIN_TESTMENUHIDER)) { |
|
1295 | + $ext .= '&testmenuhider=' . (GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER); |
|
1296 | + } |
|
1228 | 1297 | |
1229 | 1298 | $themeparam = '&lang=' . $langs->defaultlang . '&theme=' . $conf->theme . (GETPOST('optioncss', 'aZ09') ? '&optioncss=' . GETPOST('optioncss', 'aZ09', 1) : '') . '&userid=' . $user->id . '&entity=' . $conf->entity; |
1230 | 1299 | $themeparam .= ($ext ? '&' . $ext : ''); |
1231 | - if (!empty($_SESSION['dol_resetcache'])) |
|
1232 | - $themeparam .= '&dol_resetcache=' . $_SESSION['dol_resetcache']; |
|
1300 | + if (!empty($_SESSION['dol_resetcache'])) { |
|
1301 | + $themeparam .= '&dol_resetcache=' . $_SESSION['dol_resetcache']; |
|
1302 | + } |
|
1233 | 1303 | if (GETPOST('dol_hide_topmenu', 'int')) { |
1234 | 1304 | $themeparam .= '&dol_hide_topmenu=' . GETPOST('dol_hide_topmenu', 'int'); |
1235 | 1305 | } |
@@ -1288,8 +1358,9 @@ discard block |
||
1288 | 1358 | |
1289 | 1359 | //print 'themepath='.$themepath.' themeparam='.$themeparam;exit; |
1290 | 1360 | print '<link rel="stylesheet" type="text/css" href="' . $themepath . $themeparam . '">' . "\n"; |
1291 | - if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME)) |
|
1292 | - print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->' . "\n" . '<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">' . "\n"; |
|
1361 | + if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME)) { |
|
1362 | + print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->' . "\n" . '<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">' . "\n"; |
|
1363 | + } |
|
1293 | 1364 | |
1294 | 1365 | // CSS forced by modules (relative url starting with /) |
1295 | 1366 | if (!empty($conf->modules_parts['css'])) { |
@@ -1297,13 +1368,15 @@ discard block |
||
1297 | 1368 | foreach ($arraycss as $modcss => $filescss) { |
1298 | 1369 | $filescss = (array) $filescss; // To be sure filecss is an array |
1299 | 1370 | foreach ($filescss as $cssfile) { |
1300 | - if (empty($cssfile)) |
|
1301 | - dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING); |
|
1371 | + if (empty($cssfile)) { |
|
1372 | + dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING); |
|
1373 | + } |
|
1302 | 1374 | // cssfile is a relative path |
1303 | 1375 | print '<!-- Includes CSS added by module ' . $modcss . ' -->' . "\n" . '<link rel="stylesheet" type="text/css" href="' . dol_buildpath($cssfile, 1); |
1304 | 1376 | // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used. |
1305 | - if (!preg_match('/\.css$/i', $cssfile)) |
|
1306 | - print $themeparam; |
|
1377 | + if (!preg_match('/\.css$/i', $cssfile)) { |
|
1378 | + print $themeparam; |
|
1379 | + } |
|
1307 | 1380 | print '">' . "\n"; |
1308 | 1381 | } |
1309 | 1382 | } |
@@ -1313,8 +1386,9 @@ discard block |
||
1313 | 1386 | foreach ($arrayofcss as $cssfile) { |
1314 | 1387 | print '<!-- Includes CSS added by page -->' . "\n" . '<link rel="stylesheet" type="text/css" title="default" href="' . dol_buildpath($cssfile, 1); |
1315 | 1388 | // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters and browser cache is not used. |
1316 | - if (!preg_match('/\.css$/i', $cssfile)) |
|
1317 | - print $themeparam; |
|
1389 | + if (!preg_match('/\.css$/i', $cssfile)) { |
|
1390 | + print $themeparam; |
|
1391 | + } |
|
1318 | 1392 | print '">' . "\n"; |
1319 | 1393 | } |
1320 | 1394 | } |
@@ -1418,10 +1492,12 @@ discard block |
||
1418 | 1492 | // Browser notifications |
1419 | 1493 | if (!defined('DISABLE_BROWSER_NOTIF')) { |
1420 | 1494 | $enablebrowsernotif = false; |
1421 | - if (!empty($conf->agenda->enabled) && !empty($conf->global->AGENDA_REMINDER_BROWSER)) |
|
1422 | - $enablebrowsernotif = true; |
|
1423 | - if ($conf->browser->layout == 'phone') |
|
1424 | - $enablebrowsernotif = false; |
|
1495 | + if (!empty($conf->agenda->enabled) && !empty($conf->global->AGENDA_REMINDER_BROWSER)) { |
|
1496 | + $enablebrowsernotif = true; |
|
1497 | + } |
|
1498 | + if ($conf->browser->layout == 'phone') { |
|
1499 | + $enablebrowsernotif = false; |
|
1500 | + } |
|
1425 | 1501 | if ($enablebrowsernotif) { |
1426 | 1502 | print '<!-- Includes JS of Dolibarr (brwoser layout = ' . $conf->browser->layout . ')-->' . "\n"; |
1427 | 1503 | //print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/lib_notification.js.php' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; |
@@ -1458,10 +1534,12 @@ discard block |
||
1458 | 1534 | } |
1459 | 1535 | } |
1460 | 1536 | |
1461 | - if (!empty($head)) |
|
1462 | - print $head . "\n"; |
|
1463 | - if (!empty($conf->global->MAIN_HTML_HEADER)) |
|
1464 | - print $conf->global->MAIN_HTML_HEADER . "\n"; |
|
1537 | + if (!empty($head)) { |
|
1538 | + print $head . "\n"; |
|
1539 | + } |
|
1540 | + if (!empty($conf->global->MAIN_HTML_HEADER)) { |
|
1541 | + print $conf->global->MAIN_HTML_HEADER . "\n"; |
|
1542 | + } |
|
1465 | 1543 | |
1466 | 1544 | print "<!-- Alixar debugBar header -->"; |
1467 | 1545 | print Debug::getRenderHeader(); // Includes Alixar debugBar header |
@@ -1526,15 +1604,20 @@ discard block |
||
1526 | 1604 | if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { |
1527 | 1605 | $appli = $conf->global->MAIN_APPLICATION_TITLE; |
1528 | 1606 | if (preg_match('/\d\.\d/', $appli)) { |
1529 | - if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) |
|
1530 | - $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core |
|
1531 | - } else |
|
1532 | - $appli .= " " . DOL_VERSION; |
|
1533 | - } else |
|
1534 | - $appli .= " " . DOL_VERSION; |
|
1607 | + if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) { |
|
1608 | + $appli .= " (" . DOL_VERSION . ")"; |
|
1609 | + } |
|
1610 | + // If new title contains a version that is different than core |
|
1611 | + } else { |
|
1612 | + $appli .= " " . DOL_VERSION; |
|
1613 | + } |
|
1614 | + } else { |
|
1615 | + $appli .= " " . DOL_VERSION; |
|
1616 | + } |
|
1535 | 1617 | |
1536 | - if (!empty($conf->global->MAIN_FEATURES_LEVEL)) |
|
1537 | - $appli .= "<br>" . $langs->trans("LevelOfFeature") . ': ' . $conf->global->MAIN_FEATURES_LEVEL; |
|
1618 | + if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { |
|
1619 | + $appli .= "<br>" . $langs->trans("LevelOfFeature") . ': ' . $conf->global->MAIN_FEATURES_LEVEL; |
|
1620 | + } |
|
1538 | 1621 | |
1539 | 1622 | $logouttext = ''; |
1540 | 1623 | if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { |
@@ -1572,12 +1655,15 @@ discard block |
||
1572 | 1655 | $parameters = array(); |
1573 | 1656 | $result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks |
1574 | 1657 | if (is_numeric($result)) { |
1575 | - if ($result == 0) |
|
1576 | - $toprightmenu .= $hookmanager->resPrint; // add |
|
1577 | - else |
|
1578 | - $toprightmenu = $hookmanager->resPrint; // replace |
|
1579 | - } |
|
1580 | - else { |
|
1658 | + if ($result == 0) { |
|
1659 | + $toprightmenu .= $hookmanager->resPrint; |
|
1660 | + } |
|
1661 | + // add |
|
1662 | + else { |
|
1663 | + $toprightmenu = $hookmanager->resPrint; |
|
1664 | + } |
|
1665 | + // replace |
|
1666 | + } else { |
|
1581 | 1667 | $toprightmenu .= $result; // For backward compatibility |
1582 | 1668 | } |
1583 | 1669 | |
@@ -1597,8 +1683,9 @@ discard block |
||
1597 | 1683 | |
1598 | 1684 | if (is_array($_POST)) { |
1599 | 1685 | foreach ($_POST as $key => $value) { |
1600 | - if ($key !== 'action' && $key !== 'password' && !is_array($value)) |
|
1601 | - $qs .= '&' . $key . '=' . urlencode($value); |
|
1686 | + if ($key !== 'action' && $key !== 'password' && !is_array($value)) { |
|
1687 | + $qs .= '&' . $key . '=' . urlencode($value); |
|
1688 | + } |
|
1602 | 1689 | } |
1603 | 1690 | } |
1604 | 1691 | $qs .= (($qs && $morequerystring) ? '&' : '') . $morequerystring; |
@@ -1617,8 +1704,9 @@ discard block |
||
1617 | 1704 | $helppage = ''; |
1618 | 1705 | $mode = ''; |
1619 | 1706 | |
1620 | - if (empty($helppagename)) |
|
1621 | - $helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios'; |
|
1707 | + if (empty($helppagename)) { |
|
1708 | + $helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios'; |
|
1709 | + } |
|
1622 | 1710 | |
1623 | 1711 | // Get helpbaseurl, helppage and mode from helppagename and langs |
1624 | 1712 | $arrayres = getHelpParamFor($helppagename, $langs); |
@@ -1635,13 +1723,15 @@ discard block |
||
1635 | 1723 | } |
1636 | 1724 | $title = $appli . '<br>'; |
1637 | 1725 | $title .= $langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage'); |
1638 | - if ($mode == 'wiki') |
|
1639 | - $title .= ' - ' . $langs->trans("PageWiki") . ' "' . dol_escape_htmltag(strtr($helppage, '_', ' ')) . '"'; |
|
1726 | + if ($mode == 'wiki') { |
|
1727 | + $title .= ' - ' . $langs->trans("PageWiki") . ' "' . dol_escape_htmltag(strtr($helppage, '_', ' ')) . '"'; |
|
1728 | + } |
|
1640 | 1729 | $text .= '<a class="help" target="_blank" rel="noopener" href="'; |
1641 | - if ($mode == 'wiki') |
|
1642 | - $text .= sprintf($helpbaseurl, urlencode(html_entity_decode($helppage))); |
|
1643 | - else |
|
1644 | - $text .= sprintf($helpbaseurl, $helppage); |
|
1730 | + if ($mode == 'wiki') { |
|
1731 | + $text .= sprintf($helpbaseurl, urlencode(html_entity_decode($helppage))); |
|
1732 | + } else { |
|
1733 | + $text .= sprintf($helpbaseurl, $helppage); |
|
1734 | + } |
|
1645 | 1735 | $text .= '">'; |
1646 | 1736 | //$text.=img_picto('', 'helpdoc_top').' '; |
1647 | 1737 | $text .= '<span class="fa fa-question-circle atoplogin"></span>'; |
@@ -1668,9 +1758,10 @@ discard block |
||
1668 | 1758 | print "<!-- End top horizontal menu -->\n\n"; |
1669 | 1759 | } |
1670 | 1760 | |
1671 | - if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) |
|
1672 | - print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">'; |
|
1673 | -} |
|
1761 | + if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) { |
|
1762 | + print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">'; |
|
1763 | + } |
|
1764 | + } |
|
1674 | 1765 | |
1675 | 1766 | /** |
1676 | 1767 | * Show left menu bar |
@@ -1694,8 +1785,9 @@ discard block |
||
1694 | 1785 | $searchform = ''; |
1695 | 1786 | $bookmarks = ''; |
1696 | 1787 | |
1697 | - if (!empty($menu_array_before)) |
|
1698 | - dol_syslog("Deprecated parameter menu_array_before was used when calling main::left_menu function. Menu entries of module should now be defined into module descriptor and not provided when calling left_menu.", LOG_WARNING); |
|
1788 | + if (!empty($menu_array_before)) { |
|
1789 | + dol_syslog("Deprecated parameter menu_array_before was used when calling main::left_menu function. Menu entries of module should now be defined into module descriptor and not provided when calling left_menu.", LOG_WARNING); |
|
1790 | + } |
|
1699 | 1791 | |
1700 | 1792 | if (empty($conf->dol_hide_leftmenu) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) { |
1701 | 1793 | // Instantiate hooks of thirdparty module |
@@ -1703,8 +1795,10 @@ discard block |
||
1703 | 1795 | |
1704 | 1796 | print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n"; |
1705 | 1797 | |
1706 | - if ($conf->browser->layout == 'phone') |
|
1707 | - $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ? |
|
1798 | + if ($conf->browser->layout == 'phone') { |
|
1799 | + $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; |
|
1800 | + } |
|
1801 | + // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ? |
|
1708 | 1802 | |
1709 | 1803 | print "\n"; |
1710 | 1804 | |
@@ -1731,8 +1825,9 @@ discard block |
||
1731 | 1825 | $reshook = $hookmanager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks |
1732 | 1826 | if (empty($reshook)) { |
1733 | 1827 | $searchform .= $hookmanager->resPrint; |
1734 | - } else |
|
1735 | - $searchform = $hookmanager->resPrint; |
|
1828 | + } else { |
|
1829 | + $searchform = $hookmanager->resPrint; |
|
1830 | + } |
|
1736 | 1831 | |
1737 | 1832 | // Force special value for $searchform |
1738 | 1833 | if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax)) { |
@@ -1776,38 +1871,49 @@ discard block |
||
1776 | 1871 | if (empty($conf->global->MAIN_HIDE_VERSION)) { // Version is already on help picto and on login page. |
1777 | 1872 | $doliurl = 'https://www.dolibarr.org'; |
1778 | 1873 | //local communities |
1779 | - if (preg_match('/fr/i', $langs->defaultlang)) |
|
1780 | - $doliurl = 'https://www.dolibarr.fr'; |
|
1781 | - if (preg_match('/es/i', $langs->defaultlang)) |
|
1782 | - $doliurl = 'https://www.dolibarr.es'; |
|
1783 | - if (preg_match('/de/i', $langs->defaultlang)) |
|
1784 | - $doliurl = 'https://www.dolibarr.de'; |
|
1785 | - if (preg_match('/it/i', $langs->defaultlang)) |
|
1786 | - $doliurl = 'https://www.dolibarr.it'; |
|
1787 | - if (preg_match('/gr/i', $langs->defaultlang)) |
|
1788 | - $doliurl = 'https://www.dolibarr.gr'; |
|
1874 | + if (preg_match('/fr/i', $langs->defaultlang)) { |
|
1875 | + $doliurl = 'https://www.dolibarr.fr'; |
|
1876 | + } |
|
1877 | + if (preg_match('/es/i', $langs->defaultlang)) { |
|
1878 | + $doliurl = 'https://www.dolibarr.es'; |
|
1879 | + } |
|
1880 | + if (preg_match('/de/i', $langs->defaultlang)) { |
|
1881 | + $doliurl = 'https://www.dolibarr.de'; |
|
1882 | + } |
|
1883 | + if (preg_match('/it/i', $langs->defaultlang)) { |
|
1884 | + $doliurl = 'https://www.dolibarr.it'; |
|
1885 | + } |
|
1886 | + if (preg_match('/gr/i', $langs->defaultlang)) { |
|
1887 | + $doliurl = 'https://www.dolibarr.gr'; |
|
1888 | + } |
|
1789 | 1889 | |
1790 | 1890 | $appli = constant('DOL_APPLICATION_TITLE'); |
1791 | 1891 | if (!empty($conf->global->MAIN_APPLICATION_TITLE)) { |
1792 | 1892 | $appli = $conf->global->MAIN_APPLICATION_TITLE; |
1793 | 1893 | $doliurl = ''; |
1794 | 1894 | if (preg_match('/\d\.\d/', $appli)) { |
1795 | - if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) |
|
1796 | - $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core |
|
1797 | - } else |
|
1798 | - $appli .= " " . DOL_VERSION; |
|
1799 | - } else |
|
1800 | - $appli .= " " . DOL_VERSION; |
|
1895 | + if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) { |
|
1896 | + $appli .= " (" . DOL_VERSION . ")"; |
|
1897 | + } |
|
1898 | + // If new title contains a version that is different than core |
|
1899 | + } else { |
|
1900 | + $appli .= " " . DOL_VERSION; |
|
1901 | + } |
|
1902 | + } else { |
|
1903 | + $appli .= " " . DOL_VERSION; |
|
1904 | + } |
|
1801 | 1905 | print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">'; |
1802 | - if ($doliurl) |
|
1803 | - print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">'; |
|
1804 | - else |
|
1805 | - print '<span class="help">'; |
|
1906 | + if ($doliurl) { |
|
1907 | + print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">'; |
|
1908 | + } else { |
|
1909 | + print '<span class="help">'; |
|
1910 | + } |
|
1806 | 1911 | print $appli; |
1807 | - if ($doliurl) |
|
1808 | - print '</a>'; |
|
1809 | - else |
|
1810 | - print '</span>'; |
|
1912 | + if ($doliurl) { |
|
1913 | + print '</a>'; |
|
1914 | + } else { |
|
1915 | + print '</span>'; |
|
1916 | + } |
|
1811 | 1917 | print '</div>' . "\n"; |
1812 | 1918 | } |
1813 | 1919 | |
@@ -1854,9 +1960,10 @@ discard block |
||
1854 | 1960 | print "\n"; |
1855 | 1961 | print '<!-- Begin right area -->' . "\n"; |
1856 | 1962 | |
1857 | - if (empty($leftmenuwithoutmainarea)) |
|
1858 | - main_area($title); |
|
1859 | -} |
|
1963 | + if (empty($leftmenuwithoutmainarea)) { |
|
1964 | + main_area($title); |
|
1965 | + } |
|
1966 | + } |
|
1860 | 1967 | |
1861 | 1968 | /** |
1862 | 1969 | * Begin main area |
@@ -1868,16 +1975,18 @@ discard block |
||
1868 | 1975 | { |
1869 | 1976 | global $conf, $langs; |
1870 | 1977 | |
1871 | - if (empty($conf->dol_hide_leftmenu)) |
|
1872 | - print '<div id="id-right">'; |
|
1978 | + if (empty($conf->dol_hide_leftmenu)) { |
|
1979 | + print '<div id="id-right">'; |
|
1980 | + } |
|
1873 | 1981 | |
1874 | 1982 | print "\n"; |
1875 | 1983 | |
1876 | 1984 | print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n"; |
1877 | 1985 | |
1878 | - if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) |
|
1879 | - print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED)); |
|
1880 | -} |
|
1986 | + if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) { |
|
1987 | + print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED)); |
|
1988 | + } |
|
1989 | + } |
|
1881 | 1990 | |
1882 | 1991 | /** |
1883 | 1992 | * Return helpbaseurl, helppage and mode |
@@ -1901,18 +2010,21 @@ discard block |
||
1901 | 2010 | // If WIKI URL |
1902 | 2011 | if (preg_match('/^es/i', $langs->defaultlang)) { |
1903 | 2012 | $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s'; |
1904 | - if (preg_match('/ES:([^|]+)/i', $helppagename, $reg)) |
|
1905 | - $helppage = $reg[1]; |
|
2013 | + if (preg_match('/ES:([^|]+)/i', $helppagename, $reg)) { |
|
2014 | + $helppage = $reg[1]; |
|
2015 | + } |
|
1906 | 2016 | } |
1907 | 2017 | if (preg_match('/^fr/i', $langs->defaultlang)) { |
1908 | 2018 | $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s'; |
1909 | - if (preg_match('/FR:([^|]+)/i', $helppagename, $reg)) |
|
1910 | - $helppage = $reg[1]; |
|
2019 | + if (preg_match('/FR:([^|]+)/i', $helppagename, $reg)) { |
|
2020 | + $helppage = $reg[1]; |
|
2021 | + } |
|
1911 | 2022 | } |
1912 | 2023 | if (empty($helppage)) { // If help page not already found |
1913 | 2024 | $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s'; |
1914 | - if (preg_match('/EN:([^|]+)/i', $helppagename, $reg)) |
|
1915 | - $helppage = $reg[1]; |
|
2025 | + if (preg_match('/EN:([^|]+)/i', $helppagename, $reg)) { |
|
2026 | + $helppage = $reg[1]; |
|
2027 | + } |
|
1916 | 2028 | } |
1917 | 2029 | $mode = 'wiki'; |
1918 | 2030 | } |
@@ -1943,8 +2055,9 @@ discard block |
||
1943 | 2055 | $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; |
1944 | 2056 | $ret .= '<input type="hidden" name="mode" value="search">'; |
1945 | 2057 | $ret .= '<input type="hidden" name="savelogin" value="' . dol_escape_htmltag($user->login) . '">'; |
1946 | - if ($showtitlebefore) |
|
1947 | - $ret .= $title . ' '; |
|
2058 | + if ($showtitlebefore) { |
|
2059 | + $ret .= $title . ' '; |
|
2060 | + } |
|
1948 | 2061 | $ret .= '<input type="text" class="flat ' . $htmlmorecss . '"'; |
1949 | 2062 | $ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"'; |
1950 | 2063 | $ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : ''); |
@@ -1987,10 +2100,12 @@ discard block |
||
1987 | 2100 | foreach ($user->lastsearch_values_tmp as $key => $val) { |
1988 | 2101 | unset($_SESSION['lastsearch_values_tmp_' . $key]); // Clean array to rebuild it just after |
1989 | 2102 | if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button |
1990 | - if (empty($val['sortfield'])) |
|
1991 | - unset($val['sortfield']); |
|
1992 | - if (empty($val['sortorder'])) |
|
1993 | - unset($val['sortorder']); |
|
2103 | + if (empty($val['sortfield'])) { |
|
2104 | + unset($val['sortfield']); |
|
2105 | + } |
|
2106 | + if (empty($val['sortorder'])) { |
|
2107 | + unset($val['sortorder']); |
|
2108 | + } |
|
1994 | 2109 | dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)"); |
1995 | 2110 | $_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val); |
1996 | 2111 | unset($_SESSION['lastsearch_values_' . $key]); |
@@ -2001,8 +2116,9 @@ discard block |
||
2001 | 2116 | |
2002 | 2117 | $relativepathstring = $_SERVER["PHP_SELF"]; |
2003 | 2118 | // Clean $relativepathstring |
2004 | - if (constant('DOL_BASE_URI')) |
|
2005 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
2119 | + if (constant('DOL_BASE_URI')) { |
|
2120 | + $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
2121 | + } |
|
2006 | 2122 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring); |
2007 | 2123 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring); |
2008 | 2124 | if (preg_match('/list\.php$/', $relativepathstring)) { |
@@ -2010,12 +2126,15 @@ discard block |
||
2010 | 2126 | unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]); |
2011 | 2127 | unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]); |
2012 | 2128 | |
2013 | - if (!empty($contextpage)) |
|
2014 | - $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage; |
|
2015 | - if (!empty($page) && $page > 1) |
|
2016 | - $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page; |
|
2017 | - if (!empty($limit) && $limit != $conf->limit) |
|
2018 | - $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit; |
|
2129 | + if (!empty($contextpage)) { |
|
2130 | + $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage; |
|
2131 | + } |
|
2132 | + if (!empty($page) && $page > 1) { |
|
2133 | + $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page; |
|
2134 | + } |
|
2135 | + if (!empty($limit) && $limit != $conf->limit) { |
|
2136 | + $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit; |
|
2137 | + } |
|
2019 | 2138 | |
2020 | 2139 | unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]); |
2021 | 2140 | unset($_SESSION['lastsearch_page_' . $relativepathstring]); |
@@ -2042,20 +2161,26 @@ discard block |
||
2042 | 2161 | |
2043 | 2162 | print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche |
2044 | 2163 | |
2045 | - if (empty($conf->dol_hide_leftmenu)) |
|
2046 | - print '</div> <!-- End div id-right -->' . "\n"; // End div id-right |
|
2164 | + if (empty($conf->dol_hide_leftmenu)) { |
|
2165 | + print '</div> <!-- End div id-right -->' . "\n"; |
|
2166 | + } |
|
2167 | + // End div id-right |
|
2047 | 2168 | |
2048 | - if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) |
|
2049 | - print '</div> <!-- End div id-container -->' . "\n"; // End div container |
|
2169 | + if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) { |
|
2170 | + print '</div> <!-- End div id-container -->' . "\n"; |
|
2171 | + } |
|
2172 | + // End div container |
|
2050 | 2173 | |
2051 | 2174 | print "\n"; |
2052 | - if ($comment) |
|
2053 | - print '<!-- ' . $comment . ' -->' . "\n"; |
|
2175 | + if ($comment) { |
|
2176 | + print '<!-- ' . $comment . ' -->' . "\n"; |
|
2177 | + } |
|
2054 | 2178 | |
2055 | 2179 | printCommonFooter($zone); |
2056 | 2180 | |
2057 | - if (!empty($delayedhtmlcontent)) |
|
2058 | - print $delayedhtmlcontent; |
|
2181 | + if (!empty($delayedhtmlcontent)) { |
|
2182 | + print $delayedhtmlcontent; |
|
2183 | + } |
|
2059 | 2184 | |
2060 | 2185 | if (!empty($conf->use_javascript_ajax)) { |
2061 | 2186 | print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n"; |
@@ -1,19 +1,19 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //define("NOLOGIN",1); // This means this output page does not require to be logged. |
3 | -define("NOCSRFCHECK",1); // We accept to go on this page from external web site. |
|
3 | +define("NOCSRFCHECK", 1); // We accept to go on this page from external web site. |
|
4 | 4 | |
5 | 5 | |
6 | 6 | // Copyright (C) 2018 Alxarafe/Alixar <[email protected]> |
7 | 7 | defined('BASE_PATH') or die('Single entry point through the index.php of the main folder'); |
8 | -require DOL_BASE_PATH . '/main.inc.php'; |
|
8 | +require DOL_BASE_PATH.'/main.inc.php'; |
|
9 | 9 | |
10 | 10 | if ($dolibarr_main_prod) { |
11 | 11 | accessforbidden(); |
12 | 12 | } |
13 | 13 | |
14 | -$usedolheader=1; // 1 = Test inside a dolibarr page, 0 = Use hard coded header |
|
14 | +$usedolheader = 1; // 1 = Test inside a dolibarr page, 0 = Use hard coded header |
|
15 | 15 | |
16 | -$form=new Form($db); |
|
16 | +$form = new Form($db); |
|
17 | 17 | |
18 | 18 | |
19 | 19 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | <!-- Includes for JQuery (Ajax library) --> |
36 | 36 | <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/css/base/jquery-ui.css" /> |
37 | 37 | <!-- <link rel="stylesheet" type="text/css" href="<?php echo DOL_URL_ROOT ?>/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css" /> --> |
38 | - <link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php<?php echo ($_GET["dol_use_jmobile"] == 1)?'?dol_use_jmobile=1&dol_optimize_smallscreen=1':''; ?>" /> |
|
38 | + <link rel="stylesheet" type="text/css" title="default" href="<?php echo DOL_URL_ROOT ?>/theme/eldy/style.css.php<?php echo ($_GET["dol_use_jmobile"] == 1) ? '?dol_use_jmobile=1&dol_optimize_smallscreen=1' : ''; ?>" /> |
|
39 | 39 | <!-- Includes JS for JQuery --> |
40 | 40 | <!-- <script type="text/javascript" src="<?php echo DOL_URL_ROOT ?>/includes/jquery/js/jquery.min.js"></script> --> |
41 | 41 | <script type="text/javascript" src="<?php echo BASE_URI ?>/vendor/components/jquery/jquery.min.js"></script> |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | } |
55 | 55 | else |
56 | 56 | { |
57 | - $arraycss=array(); |
|
58 | - $arrayjs=array(); |
|
57 | + $arraycss = array(); |
|
58 | + $arrayjs = array(); |
|
59 | 59 | /* |
60 | 60 | $arraycss=array('/includes/jquery/plugins/datatables/media/css/jquery.dataTables.css', |
61 | 61 | '/includes/jquery/plugins/datatables/extensions/Buttons/css/buttons.dataTables.min.css', |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | ); |
75 | 75 | */ |
76 | 76 | |
77 | - llxHeader('','','','',0,0,$arrayjs,$arraycss); |
|
77 | + llxHeader('', '', '', '', 0, 0, $arrayjs, $arraycss); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | |
@@ -159,76 +159,76 @@ discard block |
||
159 | 159 | |
160 | 160 | <?php |
161 | 161 | include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; |
162 | -$productspecimen=new Product($db); |
|
162 | +$productspecimen = new Product($db); |
|
163 | 163 | $productspecimen->initAsSpecimen(); |
164 | 164 | |
165 | -$sortfield='aaa'; |
|
166 | -$sortorder='ASC'; |
|
167 | -$tasksarray=array(1,2,3); // To force having several lines |
|
168 | -$tagidfortablednd='tablelines3'; |
|
169 | -if (! empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
170 | - |
|
171 | -$nav=''; |
|
172 | -$nav.='<form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">'; |
|
173 | -if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav.='<input type="hidden" name="actioncode" value="'.$actioncode.'">'; |
|
174 | -if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.='<input type="hidden" name="status" value="'.$status.'">'; |
|
175 | -if ($filter) $nav.='<input type="hidden" name="filter" value="'.$filter.'">'; |
|
176 | -if ($filtert) $nav.='<input type="hidden" name="filtert" value="'.$filtert.'">'; |
|
177 | -if ($socid) $nav.='<input type="hidden" name="socid" value="'.$socid.'">'; |
|
178 | -if ($showbirthday) $nav.='<input type="hidden" name="showbirthday" value="1">'; |
|
179 | -if ($pid) $nav.='<input type="hidden" name="projectid" value="'.$pid.'">'; |
|
180 | -if ($type) $nav.='<input type="hidden" name="type" value="'.$type.'">'; |
|
181 | -if ($usergroup) $nav.='<input type="hidden" name="usergroup" value="'.$usergroup.'">'; |
|
182 | -$nav.= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); |
|
183 | -$nav.= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">'; |
|
184 | -$nav.= '</form>'; |
|
185 | - |
|
186 | -$limit=10; |
|
165 | +$sortfield = 'aaa'; |
|
166 | +$sortorder = 'ASC'; |
|
167 | +$tasksarray = array(1, 2, 3); // To force having several lines |
|
168 | +$tagidfortablednd = 'tablelines3'; |
|
169 | +if (!empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
170 | + |
|
171 | +$nav = ''; |
|
172 | +$nav .= '<form name="dateselect" action="'.$_SERVER["PHP_SELF"].'?action=show_peruser'.$param.'">'; |
|
173 | +if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav .= '<input type="hidden" name="actioncode" value="'.$actioncode.'">'; |
|
174 | +if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav .= '<input type="hidden" name="status" value="'.$status.'">'; |
|
175 | +if ($filter) $nav .= '<input type="hidden" name="filter" value="'.$filter.'">'; |
|
176 | +if ($filtert) $nav .= '<input type="hidden" name="filtert" value="'.$filtert.'">'; |
|
177 | +if ($socid) $nav .= '<input type="hidden" name="socid" value="'.$socid.'">'; |
|
178 | +if ($showbirthday) $nav .= '<input type="hidden" name="showbirthday" value="1">'; |
|
179 | +if ($pid) $nav .= '<input type="hidden" name="projectid" value="'.$pid.'">'; |
|
180 | +if ($type) $nav .= '<input type="hidden" name="type" value="'.$type.'">'; |
|
181 | +if ($usergroup) $nav .= '<input type="hidden" name="usergroup" value="'.$usergroup.'">'; |
|
182 | +$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0); |
|
183 | +$nav .= ' <input type="submit" name="submitdateselect" class="button" value="'.$langs->trans("Refresh").'">'; |
|
184 | +$nav .= '</form>'; |
|
185 | + |
|
186 | +$limit = 10; |
|
187 | 187 | print_barre_liste('Title of my list', 12, $_SERVER["PHP_SELF"], '', '', '', 'Text in middle', 20, 500, '', 0, $nav, '', $limit); |
188 | 188 | |
189 | 189 | |
190 | -$moreforfilter.='<div class="divsearchfield">'; |
|
191 | -$moreforfilter.=$langs->trans('This is a select list for a filter A'). ': '; |
|
192 | -$cate_arbo = array('field1'=>'value1a into the select list A','field2'=>'value2a'); |
|
193 | -$moreforfilter.=$form->selectarray('search_aaa', $cate_arbo, '', 1); // List without js combo |
|
194 | -$moreforfilter.='</div>'; |
|
190 | +$moreforfilter .= '<div class="divsearchfield">'; |
|
191 | +$moreforfilter .= $langs->trans('This is a select list for a filter A').': '; |
|
192 | +$cate_arbo = array('field1'=>'value1a into the select list A', 'field2'=>'value2a'); |
|
193 | +$moreforfilter .= $form->selectarray('search_aaa', $cate_arbo, '', 1); // List without js combo |
|
194 | +$moreforfilter .= '</div>'; |
|
195 | 195 | |
196 | -$moreforfilter.='<div class="divsearchfield">'; |
|
197 | -$moreforfilter.=$langs->trans('This is a select list for a filter B'). ': '; |
|
198 | -$cate_arbo = array('field1'=>'value1b into the select list B','field2'=>'value2b'); |
|
199 | -$moreforfilter.=$form->selectarray('search_bbb', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo |
|
200 | -$moreforfilter.='</div>'; |
|
196 | +$moreforfilter .= '<div class="divsearchfield">'; |
|
197 | +$moreforfilter .= $langs->trans('This is a select list for a filter B').': '; |
|
198 | +$cate_arbo = array('field1'=>'value1b into the select list B', 'field2'=>'value2b'); |
|
199 | +$moreforfilter .= $form->selectarray('search_bbb', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo |
|
200 | +$moreforfilter .= '</div>'; |
|
201 | 201 | |
202 | -$moreforfilter.='<div class="divsearchfield">'; |
|
203 | -$moreforfilter.=$langs->trans('This is a select list for a filter C'). ': '; |
|
204 | -$cate_arbo = array('field1'=>'value1c into the select list C','field2'=>'value2c'); |
|
205 | -$moreforfilter.=$form->selectarray('search_ccc', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo |
|
206 | -$moreforfilter.='</div>'; |
|
202 | +$moreforfilter .= '<div class="divsearchfield">'; |
|
203 | +$moreforfilter .= $langs->trans('This is a select list for a filter C').': '; |
|
204 | +$cate_arbo = array('field1'=>'value1c into the select list C', 'field2'=>'value2c'); |
|
205 | +$moreforfilter .= $form->selectarray('search_ccc', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo |
|
206 | +$moreforfilter .= '</div>'; |
|
207 | 207 | |
208 | -$moreforfilter.='<div class="divsearchfield">'; |
|
209 | -$moreforfilter.=$langs->trans('This is a select list for a filter D'). ': '; |
|
210 | -$cate_arbo = array('field1'=>'value1d into the select list D','field2'=>'value2d'); |
|
211 | -$moreforfilter.=$form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo |
|
212 | -$moreforfilter.='</div>'; |
|
208 | +$moreforfilter .= '<div class="divsearchfield">'; |
|
209 | +$moreforfilter .= $langs->trans('This is a select list for a filter D').': '; |
|
210 | +$cate_arbo = array('field1'=>'value1d into the select list D', 'field2'=>'value2d'); |
|
211 | +$moreforfilter .= $form->selectarray('search_ddd', $cate_arbo, '', 1, 0, 0, '', 0, 0, 0, 0, '', 1); // List with js combo |
|
212 | +$moreforfilter .= '</div>'; |
|
213 | 213 | |
214 | -if (! empty($moreforfilter)) |
|
214 | +if (!empty($moreforfilter)) |
|
215 | 215 | { |
216 | 216 | print '<div class="liste_titre liste_titre_bydiv centpercent">'; |
217 | 217 | print $moreforfilter; |
218 | - $parameters=array(); |
|
219 | - $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook |
|
218 | + $parameters = array(); |
|
219 | + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook |
|
220 | 220 | print $hookmanager->resPrint; |
221 | 221 | print '</div>'; |
222 | 222 | } |
223 | 223 | |
224 | 224 | ?> |
225 | 225 | |
226 | -<table class="stripe row-border order-column centpercent tagtable liste<?php echo $moreforfilter?" listwithfilterbefore":""; ?>" id="tablelines3"> |
|
226 | +<table class="stripe row-border order-column centpercent tagtable liste<?php echo $moreforfilter ? " listwithfilterbefore" : ""; ?>" id="tablelines3"> |
|
227 | 227 | <thead> |
228 | 228 | <tr class="liste_titre"> |
229 | -<?php print getTitleFieldOfList($langs->trans('title1'),0,$_SERVER["PHP_SELF"],'aaa','','','align="left"',$sortfield,$sortorder); ?> |
|
230 | -<?php print getTitleFieldOfList($langs->trans('title2'),0,$_SERVER["PHP_SELF"],'bbb','','','align="right"',$sortfield,$sortorder); ?> |
|
231 | -<?php print getTitleFieldOfList($langs->trans('title3'),0,$_SERVER["PHP_SELF"],'ccc','','','align="center"',$sortfield,$sortorder); ?> |
|
229 | +<?php print getTitleFieldOfList($langs->trans('title1'), 0, $_SERVER["PHP_SELF"], 'aaa', '', '', 'align="left"', $sortfield, $sortorder); ?> |
|
230 | +<?php print getTitleFieldOfList($langs->trans('title2'), 0, $_SERVER["PHP_SELF"], 'bbb', '', '', 'align="right"', $sortfield, $sortorder); ?> |
|
231 | +<?php print getTitleFieldOfList($langs->trans('title3'), 0, $_SERVER["PHP_SELF"], 'ccc', '', '', 'align="center"', $sortfield, $sortorder); ?> |
|
232 | 232 | </tr> |
233 | 233 | </thead> |
234 | 234 | <tbody> |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $(document).ready(function(){ |
252 | 252 | $('#idtableexample2').dataTable( { |
253 | 253 | <?php |
254 | - if ($optioncss=='print') { |
|
254 | + if ($optioncss == 'print') { |
|
255 | 255 | print '\'dom\': \'lfrtip\','; |
256 | 256 | } else { |
257 | 257 | print '\'dom\': \'Blfrtip\','; |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | |
299 | 299 | |
300 | 300 | <?php |
301 | - $tasksarray=array(1,2,3); // To force having several lines |
|
302 | - $tagidfortablednd='tablelines'; |
|
303 | - if (! empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
301 | + $tasksarray = array(1, 2, 3); // To force having several lines |
|
302 | + $tagidfortablednd = 'tablelines'; |
|
303 | + if (!empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
304 | 304 | ?> |
305 | 305 | <div class="tagtable centpercent liste_titre_bydiv" id="tablelines"> |
306 | 306 | <div class="tagtr liste_titre"> |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | |
347 | 347 | |
348 | 348 | <?php |
349 | -if (! empty($usedolheader)) |
|
349 | +if (!empty($usedolheader)) |
|
350 | 350 | { |
351 | 351 | llxFooter(); |
352 | 352 | } else { ?> |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | // Just to define version DOL_VERSION |
34 | 34 | if (!defined('DOL_INC_FOR_VERSION_ERROR')) |
35 | 35 | define('DOL_INC_FOR_VERSION_ERROR', '1'); |
36 | -require_once DOL_BASE_PATH . '/filefunc.inc.php'; |
|
36 | +require_once DOL_BASE_PATH.'/filefunc.inc.php'; |
|
37 | 37 | |
38 | -require_once DOL_BASE_PATH . '/core/class/translate.class.php'; |
|
39 | -require_once DOL_BASE_PATH . '/core/lib/functions.lib.php'; |
|
40 | -require_once DOL_BASE_PATH . '/core/lib/admin.lib.php'; |
|
41 | -require_once DOL_BASE_PATH . '/core/lib/files.lib.php'; |
|
38 | +require_once DOL_BASE_PATH.'/core/class/translate.class.php'; |
|
39 | +require_once DOL_BASE_PATH.'/core/lib/functions.lib.php'; |
|
40 | +require_once DOL_BASE_PATH.'/core/lib/admin.lib.php'; |
|
41 | +require_once DOL_BASE_PATH.'/core/lib/files.lib.php'; |
|
42 | 42 | |
43 | 43 | /* |
44 | 44 | * adobdbtime package |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | // Define vars |
79 | 79 | $conffiletoshowshort = "conf.php"; |
80 | 80 | // Define localization of conf file |
81 | -$conffile = DOL_BASE_PATH . "/conf/conf.php"; |
|
81 | +$conffile = DOL_BASE_PATH."/conf/conf.php"; |
|
82 | 82 | $conffiletoshow = "htdocs/conf/conf.php"; |
83 | 83 | // For debian/redhat like systems |
84 | 84 | //$conffile = "/etc/dolibarr/conf.php"; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $dolibarr_main_db_port = '3306'; // For backward compatibility |
101 | 101 | } |
102 | 102 | // Clean parameters |
103 | - $dolibarr_main_data_root = isset($dolibarr_main_data_root) ? trim($dolibarr_main_data_root) : DOL_BASE_PATH . '../documents'; |
|
103 | + $dolibarr_main_data_root = isset($dolibarr_main_data_root) ? trim($dolibarr_main_data_root) : DOL_BASE_PATH.'../documents'; |
|
104 | 104 | $dolibarr_main_url_root = isset($dolibarr_main_url_root) ? trim($dolibarr_main_url_root) : ''; |
105 | 105 | $dolibarr_main_url_root_alt = isset($dolibarr_main_url_root_alt) ? trim($dolibarr_main_url_root_alt) : ''; |
106 | 106 | $dolibarr_main_document_root = isset($dolibarr_main_document_root) ? trim($dolibarr_main_document_root) : ''; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | // Load database driver |
127 | 127 | if ($result) { |
128 | 128 | if (!empty($dolibarr_main_document_root) && !empty($dolibarr_main_db_type)) { |
129 | - $result = include_once $dolibarr_main_document_root . "/core/db/" . $dolibarr_main_db_type . '.class.php'; |
|
129 | + $result = include_once $dolibarr_main_document_root."/core/db/".$dolibarr_main_db_type.'.class.php'; |
|
130 | 130 | if (!$result) { |
131 | 131 | $includeconferror = 'ErrorBadValueForDolibarrMainDBType'; |
132 | 132 | } |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | $dolibarr_main_db_prefix = 'llx_'; |
146 | 146 | define('MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : '')); |
147 | 147 | |
148 | -define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir |
|
149 | -define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root : DOL_BASE_PATH . '../documents')); |
|
150 | -define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : '')); // URL relative root |
|
151 | -$uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* |
|
152 | -$suburi = strstr($uri, '/'); // $suburi contains url without domain |
|
148 | +define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir |
|
149 | +define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root : DOL_BASE_PATH.'../documents')); |
|
150 | +define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : '')); // URL relative root |
|
151 | +$uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* |
|
152 | +$suburi = strstr($uri, '/'); // $suburi contains url without domain |
|
153 | 153 | if ($suburi == '/') |
154 | - $suburi = ''; // If $suburi is /, it is now '' |
|
155 | -define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) |
|
154 | + $suburi = ''; // If $suburi is /, it is now '' |
|
155 | +define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) |
|
156 | 156 | |
157 | 157 | |
158 | 158 | if (empty($conf->file->character_set_client)) |
@@ -188,14 +188,14 @@ discard block |
||
188 | 188 | $langs->load("install"); |
189 | 189 | print $langs->trans("YouTryInstallDisabledByDirLock"); |
190 | 190 | if (!empty($dolibarr_main_url_root)) { |
191 | - print 'Click on following link, <a href="' . $dolibarr_main_url_root . '/admin/index.php?mainmenu=home&leftmenu=setup' . (isset($_POST["login"]) ? '&username=' . urlencode($_POST["login"]) : '') . '">'; |
|
191 | + print 'Click on following link, <a href="'.$dolibarr_main_url_root.'/admin/index.php?mainmenu=home&leftmenu=setup'.(isset($_POST["login"]) ? '&username='.urlencode($_POST["login"]) : '').'">'; |
|
192 | 192 | print $langs->trans("ClickHereToGoToApp"); |
193 | 193 | print '</a>'; |
194 | 194 | } |
195 | 195 | exit; |
196 | 196 | } |
197 | 197 | |
198 | -$lockfile = DOL_DATA_ROOT . '/install.lock'; |
|
198 | +$lockfile = DOL_DATA_ROOT.'/install.lock'; |
|
199 | 199 | if (constant('DOL_DATA_ROOT') === null) { |
200 | 200 | // We don't have a configuration file yet |
201 | 201 | // Try to detect any lockfile in the default documents path |
@@ -209,8 +209,8 @@ discard block |
||
209 | 209 | $langs->load("install"); |
210 | 210 | print $langs->trans("YouTryInstallDisabledByFileLock"); |
211 | 211 | if (!empty($dolibarr_main_url_root)) { |
212 | - print $langs->trans("ClickOnLinkOrRemoveManualy") . '<br>'; |
|
213 | - print '<a href="' . $dolibarr_main_url_root . '/admin/index.php?mainmenu=home&leftmenu=setup' . (isset($_POST["login"]) ? '&username=' . urlencode($_POST["login"]) : '') . '">'; |
|
212 | + print $langs->trans("ClickOnLinkOrRemoveManualy").'<br>'; |
|
213 | + print '<a href="'.$dolibarr_main_url_root.'/admin/index.php?mainmenu=home&leftmenu=setup'.(isset($_POST["login"]) ? '&username='.urlencode($_POST["login"]) : '').'">'; |
|
214 | 214 | print $langs->trans("ClickHereToGoToApp"); |
215 | 215 | print '</a>'; |
216 | 216 | } else { |
@@ -229,13 +229,13 @@ discard block |
||
229 | 229 | if (@is_writable('/tmp')) |
230 | 230 | define('SYSLOG_FILE', '/tmp/dolibarr_install.log'); |
231 | 231 | else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) |
232 | - define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log'); |
|
232 | + define('SYSLOG_FILE', $_ENV["TMP"].'/dolibarr_install.log'); |
|
233 | 233 | else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) |
234 | - define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log'); |
|
234 | + define('SYSLOG_FILE', $_ENV["TEMP"].'/dolibarr_install.log'); |
|
235 | 235 | else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) |
236 | 236 | define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp |
237 | 237 | else if (@is_writable('../../')) |
238 | - define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others |
|
238 | + define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others |
|
239 | 239 | |
240 | 240 | |
241 | 241 | |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | // We init log handler for install |
256 | 256 | $handlers = array('mod_syslog_file'); |
257 | 257 | foreach ($handlers as $handler) { |
258 | - $file = DOL_BASE_PATH . '/core/modules/syslog/' . $handler . '.php'; |
|
258 | + $file = DOL_BASE_PATH.'/core/modules/syslog/'.$handler.'.php'; |
|
259 | 259 | if (!file_exists($file)) { |
260 | - throw new Exception('Missing log handler file ' . $handler . '.php'); |
|
260 | + throw new Exception('Missing log handler file '.$handler.'.php'); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | require_once $file; |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | global $dolibarr_main_db_pass; |
318 | 318 | global $character_set_client; |
319 | 319 | |
320 | - $return = include_once $dolibarr_main_document_root . '/core/class/conf.class.php'; |
|
320 | + $return = include_once $dolibarr_main_document_root.'/core/class/conf.class.php'; |
|
321 | 321 | if (!$return) |
322 | 322 | return -1; |
323 | 323 | |
@@ -357,13 +357,13 @@ discard block |
||
357 | 357 | if (@is_writable('/tmp')) |
358 | 358 | define('SYSLOG_FILE', '/tmp/dolibarr_install.log'); |
359 | 359 | else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) |
360 | - define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log'); |
|
360 | + define('SYSLOG_FILE', $_ENV["TMP"].'/dolibarr_install.log'); |
|
361 | 361 | else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) |
362 | - define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log'); |
|
362 | + define('SYSLOG_FILE', $_ENV["TEMP"].'/dolibarr_install.log'); |
|
363 | 363 | else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) |
364 | 364 | define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp |
365 | 365 | else if (@is_writable('../../')) |
366 | - define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others |
|
366 | + define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others |
|
367 | 367 | |
368 | 368 | |
369 | 369 | |
@@ -383,9 +383,9 @@ discard block |
||
383 | 383 | // We init log handler for install |
384 | 384 | $handlers = array('mod_syslog_file'); |
385 | 385 | foreach ($handlers as $handler) { |
386 | - $file = DOL_BASE_PATH . '/core/modules/syslog/' . $handler . '.php'; |
|
386 | + $file = DOL_BASE_PATH.'/core/modules/syslog/'.$handler.'.php'; |
|
387 | 387 | if (!file_exists($file)) { |
388 | - throw new Exception('Missing log handler file ' . $handler . '.php'); |
|
388 | + throw new Exception('Missing log handler file '.$handler.'.php'); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | require_once $file; |
@@ -431,63 +431,63 @@ discard block |
||
431 | 431 | } |
432 | 432 | |
433 | 433 | // We force the content charset |
434 | - header("Content-type: text/html; charset=" . $conf->file->character_set_client); |
|
434 | + header("Content-type: text/html; charset=".$conf->file->character_set_client); |
|
435 | 435 | header("X-Content-Type-Options: nosniff"); |
436 | 436 | |
437 | - print '<!DOCTYPE HTML>' . "\n"; |
|
438 | - print '<html>' . "\n"; |
|
439 | - print '<head>' . "\n"; |
|
440 | - print '<meta charset="' . $conf->file->character_set_client . '">' . "\n"; |
|
441 | - print '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\n"; |
|
442 | - print '<meta name="generator" content="Dolibarr installer">' . "\n"; |
|
443 | - print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/install/default.css">' . "\n"; |
|
437 | + print '<!DOCTYPE HTML>'."\n"; |
|
438 | + print '<html>'."\n"; |
|
439 | + print '<head>'."\n"; |
|
440 | + print '<meta charset="'.$conf->file->character_set_client.'">'."\n"; |
|
441 | + print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n"; |
|
442 | + print '<meta name="generator" content="Dolibarr installer">'."\n"; |
|
443 | + print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/install/default.css">'."\n"; |
|
444 | 444 | |
445 | - print '<!-- Includes CSS for JQuery -->' . "\n"; |
|
445 | + print '<!-- Includes CSS for JQuery -->'."\n"; |
|
446 | 446 | if ($jQueryUiCustomPath) { |
447 | - print '<link rel="stylesheet" type="text/css" href="' . $jQueryUiCustomPath . 'css/' . $jquerytheme . '/jquery-ui.min.css" />' . "\n"; // JQuery |
|
447 | + print '<link rel="stylesheet" type="text/css" href="'.$jQueryUiCustomPath.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery |
|
448 | 448 | } else { |
449 | 449 | //print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.min.css" />' . "\n"; // JQuery |
450 | - print '<link rel="stylesheet" type="text/css" href="' . BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.min.css" />' . "\n"; // JQuery |
|
450 | + print '<link rel="stylesheet" type="text/css" href="'.BASE_URI.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery |
|
451 | 451 | } |
452 | - print '<!-- Includes JS for JQuery -->' . "\n"; |
|
452 | + print '<!-- Includes JS for JQuery -->'."\n"; |
|
453 | 453 | if ($jQueryCustomPath) { |
454 | - print '<script type="text/javascript" src="' . $jQueryCustomPath . 'jquery.min.js"></script>' . "\n"; |
|
454 | + print '<script type="text/javascript" src="'.$jQueryCustomPath.'jquery.min.js"></script>'."\n"; |
|
455 | 455 | } else { |
456 | 456 | // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery.min.js"></script>' . "\n"; |
457 | - print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jquery/jquery.min.js"></script>' . "\n"; |
|
457 | + print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jquery/jquery.min.js"></script>'."\n"; |
|
458 | 458 | } |
459 | 459 | if ($jQueryUiCustomPath) { |
460 | - print '<script type="text/javascript" src="' . $jQueryUiCustomPath . 'jquery-ui.min.js"></script>' . "\n"; |
|
460 | + print '<script type="text/javascript" src="'.$jQueryUiCustomPath.'jquery-ui.min.js"></script>'."\n"; |
|
461 | 461 | } else { |
462 | 462 | // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-ui.min.js"></script>' . "\n"; |
463 | - print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jqueryui/jquery-ui.min.js"></script>' . "\n"; |
|
463 | + print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jqueryui/jquery-ui.min.js"></script>'."\n"; |
|
464 | 464 | } |
465 | - print '<title>' . $langs->trans("DolibarrSetup") . '</title>' . "\n"; |
|
465 | + print '<title>'.$langs->trans("DolibarrSetup").'</title>'."\n"; |
|
466 | 466 | print "<!-- Alixar debugBar header -->"; |
467 | 467 | print Debug::getRenderHeader(); // Includes Alixar debugBar header |
468 | - print '</head>' . "\n"; |
|
468 | + print '</head>'."\n"; |
|
469 | 469 | |
470 | - print '<body>' . "\n"; |
|
470 | + print '<body>'."\n"; |
|
471 | 471 | |
472 | 472 | print '<div class="divlogoinstall" style="text-align:center">'; |
473 | - print '<img class="imglogoinstall" src="' . DOL_BASE_URI . '/theme/dolibarr_logo.png" alt="Dolibarr logo"><br>'; |
|
473 | + print '<img class="imglogoinstall" src="'.DOL_BASE_URI.'/theme/dolibarr_logo.png" alt="Dolibarr logo"><br>'; |
|
474 | 474 | print DOL_VERSION; |
475 | 475 | print '</div><br>'; |
476 | 476 | |
477 | - print '<span class="titre">' . $langs->trans("DolibarrSetup"); |
|
477 | + print '<span class="titre">'.$langs->trans("DolibarrSetup"); |
|
478 | 478 | if ($subtitle) { |
479 | - print ' - ' . $subtitle; |
|
479 | + print ' - '.$subtitle; |
|
480 | 480 | } |
481 | - print '</span>' . "\n"; |
|
481 | + print '</span>'."\n"; |
|
482 | 482 | |
483 | 483 | //print '<form name="forminstall" style="width: 100%" action="' . $next . '.php' . ($param ? '?' . $param : '') . '" method="POST">' . "\n"; |
484 | - print '<form name="forminstall" style="width: 100%" action="' . BASE_URI . '?controller=install&method=' . $next . ($param ? '&' . $param : '') . '" method="POST">' . "\n"; |
|
485 | - print '<input type="hidden" name="testpost" value="ok">' . "\n"; |
|
486 | - print '<input type="hidden" name="action" value="' . $action . '">' . "\n"; |
|
484 | + print '<form name="forminstall" style="width: 100%" action="'.BASE_URI.'?controller=install&method='.$next.($param ? '&'.$param : '').'" method="POST">'."\n"; |
|
485 | + print '<input type="hidden" name="testpost" value="ok">'."\n"; |
|
486 | + print '<input type="hidden" name="action" value="'.$action.'">'."\n"; |
|
487 | 487 | |
488 | - print '<table class="main" width="100%"><tr><td>' . "\n"; |
|
488 | + print '<table class="main" width="100%"><tr><td>'."\n"; |
|
489 | 489 | |
490 | - print '<table class="' . $csstable . '" width="100%"><tr><td>' . "\n"; |
|
490 | + print '<table class="'.$csstable.'" width="100%"><tr><td>'."\n"; |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | /** |
@@ -507,27 +507,27 @@ discard block |
||
507 | 507 | $langs->load("other"); |
508 | 508 | $langs->load("admin"); |
509 | 509 | |
510 | - print '</td></tr></table>' . "\n"; |
|
511 | - print '</td></tr></table>' . "\n"; |
|
510 | + print '</td></tr></table>'."\n"; |
|
511 | + print '</td></tr></table>'."\n"; |
|
512 | 512 | |
513 | 513 | if (!$nonext || ($nonext == '2')) { |
514 | 514 | print '<div class="nextbutton" id="nextbutton">'; |
515 | 515 | if ($nonext == '2') { |
516 | - print $langs->trans("ErrorFoundDuringMigration", isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] . '&ignoreerrors=1' : '') . '<br><br>'; |
|
516 | + print $langs->trans("ErrorFoundDuringMigration", isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"].'&ignoreerrors=1' : '').'<br><br>'; |
|
517 | 517 | } |
518 | 518 | |
519 | - print '<input type="submit" ' . ($nonext == '2' ? 'disabled="disabled" ' : '') . 'value="' . $langs->trans("NextStep") . ' ->"'; |
|
519 | + print '<input type="submit" '.($nonext == '2' ? 'disabled="disabled" ' : '').'value="'.$langs->trans("NextStep").' ->"'; |
|
520 | 520 | if ($jscheckfunction) |
521 | - print ' onClick="return ' . $jscheckfunction . '();"'; |
|
521 | + print ' onClick="return '.$jscheckfunction.'();"'; |
|
522 | 522 | print '></div>'; |
523 | 523 | if ($withpleasewait) |
524 | - print '<div style="visibility: hidden;" class="pleasewait" id="pleasewait"><br>' . $langs->trans("NextStepMightLastALongTime") . '<br><br><div class="blinkwait">' . $langs->trans("PleaseBePatient") . '</div></div>'; |
|
524 | + print '<div style="visibility: hidden;" class="pleasewait" id="pleasewait"><br>'.$langs->trans("NextStepMightLastALongTime").'<br><br><div class="blinkwait">'.$langs->trans("PleaseBePatient").'</div></div>'; |
|
525 | 525 | } |
526 | 526 | if ($setuplang) { |
527 | - print '<input type="hidden" name="selectlang" value="' . $setuplang . '">'; |
|
527 | + print '<input type="hidden" name="selectlang" value="'.$setuplang.'">'; |
|
528 | 528 | } |
529 | 529 | |
530 | - print '</form>' . "\n"; |
|
530 | + print '</form>'."\n"; |
|
531 | 531 | |
532 | 532 | // If there is some logs in buffer to show |
533 | 533 | if (isset($conf->logbuffer) && count($conf->logbuffer)) { |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | print "<!-- Start of log output\n"; |
536 | 536 | //print '<div class="hidden">'."\n"; |
537 | 537 | foreach ($conf->logbuffer as $logline) { |
538 | - print $logline . "<br>\n"; |
|
538 | + print $logline."<br>\n"; |
|
539 | 539 | } |
540 | 540 | //print '</div>'."\n"; |
541 | 541 | print "End of log output -->\n"; |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | |
545 | 545 | print "<!-- Alixar debugBar footer -->"; |
546 | 546 | print Debug::getRenderFooter(); // Includes Alixar debugBar footer |
547 | - print '</body>' . "\n"; |
|
548 | - print '</html>' . "\n"; |
|
547 | + print '</body>'."\n"; |
|
548 | + print '</html>'."\n"; |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | /** |
@@ -610,16 +610,16 @@ discard block |
||
610 | 610 | $dolibarr_main_url_root = $_SERVER["SCRIPT_URI"]; |
611 | 611 | } // If defined (Ie: Apache with Caudium) |
612 | 612 | elseif (isset($_SERVER["SERVER_URL"]) && isset($_SERVER["DOCUMENT_URI"])) { |
613 | - $dolibarr_main_url_root = $_SERVER["SERVER_URL"] . $_SERVER["DOCUMENT_URI"]; |
|
613 | + $dolibarr_main_url_root = $_SERVER["SERVER_URL"].$_SERVER["DOCUMENT_URI"]; |
|
614 | 614 | } // If SCRIPT_URI, SERVER_URL, DOCUMENT_URI not defined (Ie: Apache 2.0.44 for Windows) |
615 | 615 | else { |
616 | - $proto = ( (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') || $_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http'; |
|
616 | + $proto = ((!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') || $_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http'; |
|
617 | 617 | if (!empty($_SERVER["HTTP_HOST"])) { |
618 | 618 | $serverport = $_SERVER["HTTP_HOST"]; |
619 | 619 | } else { |
620 | 620 | $serverport = $_SERVER["SERVER_NAME"]; |
621 | 621 | } |
622 | - $dolibarr_main_url_root = $proto . "://" . $serverport . $_SERVER["SCRIPT_NAME"]; |
|
622 | + $dolibarr_main_url_root = $proto."://".$serverport.$_SERVER["SCRIPT_NAME"]; |
|
623 | 623 | } |
624 | 624 | // Clean proposed URL |
625 | 625 | // We assume /install to be under /htdocs, so we get the parent path of the current URL |
@@ -31,8 +31,9 @@ discard block |
||
31 | 31 | * \brief File that define environment for support pages |
32 | 32 | */ |
33 | 33 | // Just to define version DOL_VERSION |
34 | -if (!defined('DOL_INC_FOR_VERSION_ERROR')) |
|
34 | +if (!defined('DOL_INC_FOR_VERSION_ERROR')) { |
|
35 | 35 | define('DOL_INC_FOR_VERSION_ERROR', '1'); |
36 | +} |
|
36 | 37 | require_once DOL_BASE_PATH . '/filefunc.inc.php'; |
37 | 38 | |
38 | 39 | require_once DOL_BASE_PATH . '/core/class/translate.class.php'; |
@@ -141,8 +142,9 @@ discard block |
||
141 | 142 | $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; |
142 | 143 | |
143 | 144 | // Define prefix |
144 | -if (!isset($dolibarr_main_db_prefix) || !$dolibarr_main_db_prefix) |
|
145 | +if (!isset($dolibarr_main_db_prefix) || !$dolibarr_main_db_prefix) { |
|
145 | 146 | $dolibarr_main_db_prefix = 'llx_'; |
147 | +} |
|
146 | 148 | define('MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : '')); |
147 | 149 | |
148 | 150 | define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir |
@@ -150,23 +152,31 @@ discard block |
||
150 | 152 | define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : '')); // URL relative root |
151 | 153 | $uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* |
152 | 154 | $suburi = strstr($uri, '/'); // $suburi contains url without domain |
153 | -if ($suburi == '/') |
|
154 | - $suburi = ''; // If $suburi is /, it is now '' |
|
155 | +if ($suburi == '/') { |
|
156 | + $suburi = ''; |
|
157 | +} |
|
158 | +// If $suburi is /, it is now '' |
|
155 | 159 | define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) |
156 | 160 | |
157 | 161 | |
158 | -if (empty($conf->file->character_set_client)) |
|
162 | +if (empty($conf->file->character_set_client)) { |
|
159 | 163 | $conf->file->character_set_client = "utf-8"; |
160 | -if (empty($conf->db->character_set)) |
|
164 | +} |
|
165 | +if (empty($conf->db->character_set)) { |
|
161 | 166 | $conf->db->character_set = 'utf8'; |
162 | -if (empty($conf->db->dolibarr_main_db_collation)) |
|
167 | +} |
|
168 | +if (empty($conf->db->dolibarr_main_db_collation)) { |
|
163 | 169 | $conf->db->dolibarr_main_db_collation = 'utf8_unicode_ci'; |
164 | -if (empty($conf->db->dolibarr_main_db_encryption)) |
|
170 | +} |
|
171 | +if (empty($conf->db->dolibarr_main_db_encryption)) { |
|
165 | 172 | $conf->db->dolibarr_main_db_encryption = 0; |
166 | -if (empty($conf->db->dolibarr_main_db_cryptkey)) |
|
173 | +} |
|
174 | +if (empty($conf->db->dolibarr_main_db_cryptkey)) { |
|
167 | 175 | $conf->db->dolibarr_main_db_cryptkey = ''; |
168 | -if (empty($conf->db->user)) |
|
176 | +} |
|
177 | +if (empty($conf->db->user)) { |
|
169 | 178 | $conf->db->user = ''; |
179 | +} |
|
170 | 180 | |
171 | 181 | // Define array of document root directories |
172 | 182 | $conf->file->dol_document_root = array(DOL_DOCUMENT_ROOT); |
@@ -223,19 +233,24 @@ discard block |
||
223 | 233 | // Force usage of log file for install and upgrades |
224 | 234 | $conf->syslog->enabled = 1; |
225 | 235 | $conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG'); |
226 | -if (!defined('SYSLOG_HANDLERS')) |
|
236 | +if (!defined('SYSLOG_HANDLERS')) { |
|
227 | 237 | define('SYSLOG_HANDLERS', '["mod_syslog_file"]'); |
238 | +} |
|
228 | 239 | if (!defined('SYSLOG_FILE')) { // To avoid warning on systems with constant already defined |
229 | - if (@is_writable('/tmp')) |
|
230 | - define('SYSLOG_FILE', '/tmp/dolibarr_install.log'); |
|
231 | - else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) |
|
232 | - define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log'); |
|
233 | - else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) |
|
234 | - define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log'); |
|
235 | - else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) |
|
236 | - define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp |
|
237 | - else if (@is_writable('../../')) |
|
238 | - define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others |
|
240 | + if (@is_writable('/tmp')) { |
|
241 | + define('SYSLOG_FILE', '/tmp/dolibarr_install.log'); |
|
242 | + } else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) { |
|
243 | + define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log'); |
|
244 | + } else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) { |
|
245 | + define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log'); |
|
246 | + } else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) { |
|
247 | + define('SYSLOG_FILE', '../../../../dolibarr_install.log'); |
|
248 | + } |
|
249 | + // For DoliWamp |
|
250 | + else if (@is_writable('../../')) { |
|
251 | + define('SYSLOG_FILE', '../../dolibarr_install.log'); |
|
252 | + } |
|
253 | + // For others |
|
239 | 254 | |
240 | 255 | |
241 | 256 | |
@@ -248,10 +263,12 @@ discard block |
||
248 | 263 | |
249 | 264 | //print 'SYSLOG_FILE='.SYSLOG_FILE;exit; |
250 | 265 | } |
251 | -if (defined('SYSLOG_FILE')) |
|
266 | +if (defined('SYSLOG_FILE')) { |
|
252 | 267 | $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
253 | -if (!defined('SYSLOG_FILE_NO_ERROR')) |
|
268 | +} |
|
269 | +if (!defined('SYSLOG_FILE_NO_ERROR')) { |
|
254 | 270 | define('SYSLOG_FILE_NO_ERROR', 1); |
271 | +} |
|
255 | 272 | // We init log handler for install |
256 | 273 | $handlers = array('mod_syslog_file'); |
257 | 274 | foreach ($handlers as $handler) { |
@@ -266,9 +283,10 @@ discard block |
||
266 | 283 | throw new Exception('Log handler does not extend LogHandlerInterface'); |
267 | 284 | } |
268 | 285 | |
269 | - if (empty($conf->loghandlers[$handler])) |
|
270 | - $conf->loghandlers[$handler] = $loghandlerinstance; |
|
271 | -} |
|
286 | + if (empty($conf->loghandlers[$handler])) { |
|
287 | + $conf->loghandlers[$handler] = $loghandlerinstance; |
|
288 | + } |
|
289 | + } |
|
272 | 290 | |
273 | 291 | // Removed magic_quotes |
274 | 292 | if (function_exists('get_magic_quotes_gpc')) { // magic_quotes_* removed in PHP 5.4 |
@@ -292,10 +310,11 @@ discard block |
||
292 | 310 | |
293 | 311 | // Defini objet langs |
294 | 312 | $langs = new Translate('..', $conf); |
295 | -if (GETPOST('lang', 'aZ09')) |
|
313 | +if (GETPOST('lang', 'aZ09')) { |
|
296 | 314 | $langs->setDefaultLang(GETPOST('lang', 'aZ09')); |
297 | -else |
|
315 | +} else { |
|
298 | 316 | $langs->setDefaultLang('auto'); |
317 | +} |
|
299 | 318 | |
300 | 319 | $bc[false] = ' class="bg1"'; |
301 | 320 | $bc[true] = ' class="bg2"'; |
@@ -318,8 +337,9 @@ discard block |
||
318 | 337 | global $character_set_client; |
319 | 338 | |
320 | 339 | $return = include_once $dolibarr_main_document_root . '/core/class/conf.class.php'; |
321 | - if (!$return) |
|
322 | - return -1; |
|
340 | + if (!$return) { |
|
341 | + return -1; |
|
342 | + } |
|
323 | 343 | |
324 | 344 | $conf = new Conf(); |
325 | 345 | $conf->db->type = trim($dolibarr_main_db_type); |
@@ -330,40 +350,51 @@ discard block |
||
330 | 350 | $conf->db->pass = trim($dolibarr_main_db_pass); |
331 | 351 | |
332 | 352 | // Mysql driver support has been removed in favor of mysqli |
333 | - if ($conf->db->type == 'mysql') |
|
334 | - $conf->db->type = 'mysqli'; |
|
335 | - if (empty($character_set_client)) |
|
336 | - $character_set_client = "UTF-8"; |
|
353 | + if ($conf->db->type == 'mysql') { |
|
354 | + $conf->db->type = 'mysqli'; |
|
355 | + } |
|
356 | + if (empty($character_set_client)) { |
|
357 | + $character_set_client = "UTF-8"; |
|
358 | + } |
|
337 | 359 | $conf->file->character_set_client = strtoupper($character_set_client); |
338 | - if (empty($dolibarr_main_db_character_set)) |
|
339 | - $dolibarr_main_db_character_set = ($conf->db->type == 'mysqli' ? 'utf8' : ''); |
|
360 | + if (empty($dolibarr_main_db_character_set)) { |
|
361 | + $dolibarr_main_db_character_set = ($conf->db->type == 'mysqli' ? 'utf8' : ''); |
|
362 | + } |
|
340 | 363 | $conf->db->character_set = $dolibarr_main_db_character_set; |
341 | - if (empty($dolibarr_main_db_collation)) |
|
342 | - $dolibarr_main_db_collation = ($conf->db->type == 'mysqli' ? 'utf8_unicode_ci' : ''); |
|
364 | + if (empty($dolibarr_main_db_collation)) { |
|
365 | + $dolibarr_main_db_collation = ($conf->db->type == 'mysqli' ? 'utf8_unicode_ci' : ''); |
|
366 | + } |
|
343 | 367 | $conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation; |
344 | - if (empty($dolibarr_main_db_encryption)) |
|
345 | - $dolibarr_main_db_encryption = 0; |
|
368 | + if (empty($dolibarr_main_db_encryption)) { |
|
369 | + $dolibarr_main_db_encryption = 0; |
|
370 | + } |
|
346 | 371 | $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption; |
347 | - if (empty($dolibarr_main_db_cryptkey)) |
|
348 | - $dolibarr_main_db_cryptkey = ''; |
|
372 | + if (empty($dolibarr_main_db_cryptkey)) { |
|
373 | + $dolibarr_main_db_cryptkey = ''; |
|
374 | + } |
|
349 | 375 | $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; |
350 | 376 | |
351 | 377 | // Force usage of log file for install and upgrades |
352 | 378 | $conf->syslog->enabled = 1; |
353 | 379 | $conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG'); |
354 | - if (!defined('SYSLOG_HANDLERS')) |
|
355 | - define('SYSLOG_HANDLERS', '["mod_syslog_file"]'); |
|
380 | + if (!defined('SYSLOG_HANDLERS')) { |
|
381 | + define('SYSLOG_HANDLERS', '["mod_syslog_file"]'); |
|
382 | + } |
|
356 | 383 | if (!defined('SYSLOG_FILE')) { // To avoid warning on systems with constant already defined |
357 | - if (@is_writable('/tmp')) |
|
358 | - define('SYSLOG_FILE', '/tmp/dolibarr_install.log'); |
|
359 | - else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) |
|
360 | - define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log'); |
|
361 | - else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) |
|
362 | - define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log'); |
|
363 | - else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) |
|
364 | - define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp |
|
365 | - else if (@is_writable('../../')) |
|
366 | - define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others |
|
384 | + if (@is_writable('/tmp')) { |
|
385 | + define('SYSLOG_FILE', '/tmp/dolibarr_install.log'); |
|
386 | + } else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) { |
|
387 | + define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log'); |
|
388 | + } else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) { |
|
389 | + define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log'); |
|
390 | + } else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) { |
|
391 | + define('SYSLOG_FILE', '../../../../dolibarr_install.log'); |
|
392 | + } |
|
393 | + // For DoliWamp |
|
394 | + else if (@is_writable('../../')) { |
|
395 | + define('SYSLOG_FILE', '../../dolibarr_install.log'); |
|
396 | + } |
|
397 | + // For others |
|
367 | 398 | |
368 | 399 | |
369 | 400 | |
@@ -376,10 +407,12 @@ discard block |
||
376 | 407 | |
377 | 408 | //print 'SYSLOG_FILE='.SYSLOG_FILE;exit; |
378 | 409 | } |
379 | - if (defined('SYSLOG_FILE')) |
|
380 | - $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
|
381 | - if (!defined('SYSLOG_FILE_NO_ERROR')) |
|
382 | - define('SYSLOG_FILE_NO_ERROR', 1); |
|
410 | + if (defined('SYSLOG_FILE')) { |
|
411 | + $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
|
412 | + } |
|
413 | + if (!defined('SYSLOG_FILE_NO_ERROR')) { |
|
414 | + define('SYSLOG_FILE_NO_ERROR', 1); |
|
415 | + } |
|
383 | 416 | // We init log handler for install |
384 | 417 | $handlers = array('mod_syslog_file'); |
385 | 418 | foreach ($handlers as $handler) { |
@@ -394,8 +427,9 @@ discard block |
||
394 | 427 | throw new Exception('Log handler does not extend LogHandlerInterface'); |
395 | 428 | } |
396 | 429 | |
397 | - if (empty($conf->loghandlers[$handler])) |
|
398 | - $conf->loghandlers[$handler] = $loghandlerinstance; |
|
430 | + if (empty($conf->loghandlers[$handler])) { |
|
431 | + $conf->loghandlers[$handler] = $loghandlerinstance; |
|
432 | + } |
|
399 | 433 | } |
400 | 434 | |
401 | 435 | return 1; |
@@ -517,11 +551,13 @@ discard block |
||
517 | 551 | } |
518 | 552 | |
519 | 553 | print '<input type="submit" ' . ($nonext == '2' ? 'disabled="disabled" ' : '') . 'value="' . $langs->trans("NextStep") . ' ->"'; |
520 | - if ($jscheckfunction) |
|
521 | - print ' onClick="return ' . $jscheckfunction . '();"'; |
|
554 | + if ($jscheckfunction) { |
|
555 | + print ' onClick="return ' . $jscheckfunction . '();"'; |
|
556 | + } |
|
522 | 557 | print '></div>'; |
523 | - if ($withpleasewait) |
|
524 | - print '<div style="visibility: hidden;" class="pleasewait" id="pleasewait"><br>' . $langs->trans("NextStepMightLastALongTime") . '<br><br><div class="blinkwait">' . $langs->trans("PleaseBePatient") . '</div></div>'; |
|
558 | + if ($withpleasewait) { |
|
559 | + print '<div style="visibility: hidden;" class="pleasewait" id="pleasewait"><br>' . $langs->trans("NextStepMightLastALongTime") . '<br><br><div class="blinkwait">' . $langs->trans("PleaseBePatient") . '</div></div>'; |
|
560 | + } |
|
525 | 561 | } |
526 | 562 | if ($setuplang) { |
527 | 563 | print '<input type="hidden" name="selectlang" value="' . $setuplang . '">'; |
@@ -557,8 +593,9 @@ discard block |
||
557 | 593 | */ |
558 | 594 | function dolibarr_install_syslog($message, $level = LOG_DEBUG) |
559 | 595 | { |
560 | - if (!defined('LOG_DEBUG')) |
|
561 | - define('LOG_DEBUG', 6); |
|
596 | + if (!defined('LOG_DEBUG')) { |
|
597 | + define('LOG_DEBUG', 6); |
|
598 | + } |
|
562 | 599 | dol_syslog($message, $level); |
563 | 600 | } |
564 | 601 |