@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | name="main_dir" |
| 151 | 151 | value="<?php print $dolibarr_main_document_root ?>" |
| 152 | 152 | <?php |
| 153 | - if (!empty($force_install_noedit)) {
|
|
| 154 | - print ' disabled'; |
|
| 155 | - } |
|
| 153 | + if (!empty($force_install_noedit)) {
|
|
| 154 | + print ' disabled'; |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | - ?> |
|
| 157 | + ?> |
|
| 158 | 158 | > |
| 159 | 159 | </td> |
| 160 | 160 | <td class="comment"><?php |
@@ -187,11 +187,11 @@ discard block |
||
| 187 | 187 | name="main_data_dir" |
| 188 | 188 | value="<?php print $dolibarr_main_data_root ?>" |
| 189 | 189 | <?php |
| 190 | - if (!empty($force_install_noedit)) {
|
|
| 191 | - print ' disabled'; |
|
| 192 | - } |
|
| 190 | + if (!empty($force_install_noedit)) {
|
|
| 191 | + print ' disabled'; |
|
| 192 | + } |
|
| 193 | 193 | |
| 194 | - ?> |
|
| 194 | + ?> |
|
| 195 | 195 | > |
| 196 | 196 | </td> |
| 197 | 197 | <td class="comment"><?php |
@@ -225,11 +225,11 @@ discard block |
||
| 225 | 225 | name="main_url" |
| 226 | 226 | value="<?php print $dolibarr_main_url_root; ?> " |
| 227 | 227 | <?php |
| 228 | - if (!empty($force_install_noedit)) {
|
|
| 229 | - print ' disabled'; |
|
| 230 | - } |
|
| 228 | + if (!empty($force_install_noedit)) {
|
|
| 229 | + print ' disabled'; |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | - ?> |
|
| 232 | + ?> |
|
| 233 | 233 | > |
| 234 | 234 | </td> |
| 235 | 235 | <td class="comment"><?php print $langs->trans("Examples") . ":<br>"; ?>
|
@@ -252,17 +252,17 @@ discard block |
||
| 252 | 252 | id="main_force_https" |
| 253 | 253 | name="main_force_https" |
| 254 | 254 | <?php |
| 255 | - if (!empty($force_install_mainforcehttps)) {
|
|
| 256 | - print ' checked'; |
|
| 257 | - } |
|
| 255 | + if (!empty($force_install_mainforcehttps)) {
|
|
| 256 | + print ' checked'; |
|
| 257 | + } |
|
| 258 | 258 | |
| 259 | - ?> |
|
| 259 | + ?> |
|
| 260 | 260 | <?php |
| 261 | - if ($force_install_noedit == 2 && $force_install_mainforcehttps !== null) {
|
|
| 262 | - print ' disabled'; |
|
| 263 | - } |
|
| 261 | + if ($force_install_noedit == 2 && $force_install_mainforcehttps !== null) {
|
|
| 262 | + print ' disabled'; |
|
| 263 | + } |
|
| 264 | 264 | |
| 265 | - ?> |
|
| 265 | + ?> |
|
| 266 | 266 | > |
| 267 | 267 | </td> |
| 268 | 268 | <td class="comment"><?php echo $langs->trans("CheckToForceHttps"); ?>
|
@@ -290,11 +290,11 @@ discard block |
||
| 290 | 290 | name="db_name" |
| 291 | 291 | value="<?php echo (!empty($dolibarr_main_db_name)) ? $dolibarr_main_db_name : ($force_install_database ? $force_install_database : 'dolibarr'); ?>" |
| 292 | 292 | <?php |
| 293 | - if ($force_install_noedit == 2 && $force_install_database !== null) {
|
|
| 294 | - print ' disabled'; |
|
| 295 | - } |
|
| 293 | + if ($force_install_noedit == 2 && $force_install_database !== null) {
|
|
| 294 | + print ' disabled'; |
|
| 295 | + } |
|
| 296 | 296 | |
| 297 | - ?> |
|
| 297 | + ?> |
|
| 298 | 298 | > |
| 299 | 299 | </td> |
| 300 | 300 | <td class="comment"><?php echo $langs->trans("DatabaseName"); ?></td>
|
@@ -428,11 +428,11 @@ discard block |
||
| 428 | 428 | name="db_host" |
| 429 | 429 | value="<?php print (!empty($force_install_dbserver) ? $force_install_dbserver : (!empty($dolibarr_main_db_host) ? $dolibarr_main_db_host : 'localhost')); ?>" |
| 430 | 430 | <?php |
| 431 | - if ($force_install_noedit == 2 && $force_install_dbserver !== null) {
|
|
| 432 | - print ' disabled'; |
|
| 433 | - } |
|
| 431 | + if ($force_install_noedit == 2 && $force_install_dbserver !== null) {
|
|
| 432 | + print ' disabled'; |
|
| 433 | + } |
|
| 434 | 434 | |
| 435 | - ?> |
|
| 435 | + ?> |
|
| 436 | 436 | > |
| 437 | 437 | </td> |
| 438 | 438 | <td class="comment"><?php echo $langs->trans("ServerAddressDescription"); ?>
|
@@ -448,11 +448,11 @@ discard block |
||
| 448 | 448 | id="db_port" |
| 449 | 449 | value="<?php print (!empty($force_install_port)) ? $force_install_port : $dolibarr_main_db_port; ?>" |
| 450 | 450 | <?php |
| 451 | - if ($force_install_noedit == 2 && $force_install_port !== null) {
|
|
| 452 | - print ' disabled'; |
|
| 453 | - } |
|
| 451 | + if ($force_install_noedit == 2 && $force_install_port !== null) {
|
|
| 452 | + print ' disabled'; |
|
| 453 | + } |
|
| 454 | 454 | |
| 455 | - ?> |
|
| 455 | + ?> |
|
| 456 | 456 | > |
| 457 | 457 | </td> |
| 458 | 458 | <td class="comment"><?php echo $langs->trans("ServerPortDescription"); ?>
|
@@ -468,11 +468,11 @@ discard block |
||
| 468 | 468 | name="db_prefix" |
| 469 | 469 | value="<?php echo(!empty($force_install_prefix) ? $force_install_prefix : (!empty($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : 'llx_')); ?>" |
| 470 | 470 | <?php |
| 471 | - if ($force_install_noedit == 2 && $force_install_prefix !== null) {
|
|
| 472 | - print ' disabled'; |
|
| 473 | - } |
|
| 471 | + if ($force_install_noedit == 2 && $force_install_prefix !== null) {
|
|
| 472 | + print ' disabled'; |
|
| 473 | + } |
|
| 474 | 474 | |
| 475 | - ?> |
|
| 475 | + ?> |
|
| 476 | 476 | > |
| 477 | 477 | </td> |
| 478 | 478 | <td class="comment"><?php echo $langs->trans("DatabasePrefixDescription"); ?></td>
|
@@ -485,17 +485,17 @@ discard block |
||
| 485 | 485 | id="db_create_database" |
| 486 | 486 | name="db_create_database" |
| 487 | 487 | <?php |
| 488 | - if ($force_install_createdatabase) {
|
|
| 489 | - print ' checked'; |
|
| 490 | - } |
|
| 488 | + if ($force_install_createdatabase) {
|
|
| 489 | + print ' checked'; |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | - ?> |
|
| 492 | + ?> |
|
| 493 | 493 | <?php |
| 494 | - if ($force_install_noedit == 2 && $force_install_createdatabase !== null) {
|
|
| 495 | - print ' disabled'; |
|
| 496 | - } |
|
| 494 | + if ($force_install_noedit == 2 && $force_install_createdatabase !== null) {
|
|
| 495 | + print ' disabled'; |
|
| 496 | + } |
|
| 497 | 497 | |
| 498 | - ?> |
|
| 498 | + ?> |
|
| 499 | 499 | > |
| 500 | 500 | </td> |
| 501 | 501 | <td class="comment"><?php echo $langs->trans("CheckToCreateDatabase"); ?>
|
@@ -510,11 +510,11 @@ discard block |
||
| 510 | 510 | name="db_user" |
| 511 | 511 | value="<?php print (!empty($force_install_databaselogin)) ? $force_install_databaselogin : $dolibarr_main_db_user; ?>" |
| 512 | 512 | <?php |
| 513 | - if ($force_install_noedit == 2 && $force_install_databaselogin !== null) {
|
|
| 514 | - print ' disabled'; |
|
| 515 | - } |
|
| 513 | + if ($force_install_noedit == 2 && $force_install_databaselogin !== null) {
|
|
| 514 | + print ' disabled'; |
|
| 515 | + } |
|
| 516 | 516 | |
| 517 | - ?> |
|
| 517 | + ?> |
|
| 518 | 518 | > |
| 519 | 519 | </td> |
| 520 | 520 | <td class="comment"><?php echo $langs->trans("AdminLogin"); ?></td>
|
@@ -527,20 +527,20 @@ discard block |
||
| 527 | 527 | id="db_pass" autocomplete="off" |
| 528 | 528 | name="db_pass" |
| 529 | 529 | value="<?php |
| 530 | - // If $force_install_databasepass is on, we don't want to set password, we just show '***'. Real value will be extracted from the forced install file at step1. |
|
| 531 | - $autofill = ((!empty($_SESSION['dol_save_pass'])) ? $_SESSION['dol_save_pass'] : str_pad('', strlen($force_install_databasepass), '*'));
|
|
| 532 | - if (!empty($dolibarr_main_prod)) {
|
|
| 533 | - $autofill = ''; |
|
| 534 | - } |
|
| 535 | - print dol_escape_htmltag($autofill); |
|
| 536 | - |
|
| 537 | - ?>" |
|
| 530 | + // If $force_install_databasepass is on, we don't want to set password, we just show '***'. Real value will be extracted from the forced install file at step1. |
|
| 531 | + $autofill = ((!empty($_SESSION['dol_save_pass'])) ? $_SESSION['dol_save_pass'] : str_pad('', strlen($force_install_databasepass), '*'));
|
|
| 532 | + if (!empty($dolibarr_main_prod)) {
|
|
| 533 | + $autofill = ''; |
|
| 534 | + } |
|
| 535 | + print dol_escape_htmltag($autofill); |
|
| 536 | + |
|
| 537 | + ?>" |
|
| 538 | 538 | <?php |
| 539 | - if ($force_install_noedit == 2 && $force_install_databasepass !== null) {
|
|
| 540 | - print ' disabled'; |
|
| 541 | - } |
|
| 539 | + if ($force_install_noedit == 2 && $force_install_databasepass !== null) {
|
|
| 540 | + print ' disabled'; |
|
| 541 | + } |
|
| 542 | 542 | |
| 543 | - ?> |
|
| 543 | + ?> |
|
| 544 | 544 | > |
| 545 | 545 | </td> |
| 546 | 546 | <td class="comment"><?php echo $langs->trans("AdminPassword"); ?></td>
|
@@ -553,17 +553,17 @@ discard block |
||
| 553 | 553 | id="db_create_user" |
| 554 | 554 | name="db_create_user" |
| 555 | 555 | <?php |
| 556 | - if (!empty($force_install_createuser)) {
|
|
| 557 | - print ' checked'; |
|
| 558 | - } |
|
| 556 | + if (!empty($force_install_createuser)) {
|
|
| 557 | + print ' checked'; |
|
| 558 | + } |
|
| 559 | 559 | |
| 560 | - ?> |
|
| 560 | + ?> |
|
| 561 | 561 | <?php |
| 562 | - if ($force_install_noedit == 2 && $force_install_createuser !== null) {
|
|
| 563 | - print ' disabled'; |
|
| 564 | - } |
|
| 562 | + if ($force_install_noedit == 2 && $force_install_createuser !== null) {
|
|
| 563 | + print ' disabled'; |
|
| 564 | + } |
|
| 565 | 565 | |
| 566 | - ?> |
|
| 566 | + ?> |
|
| 567 | 567 | > |
| 568 | 568 | </td> |
| 569 | 569 | <td class="comment"><?php echo $langs->trans("CheckToCreateUser"); ?>
|
@@ -592,11 +592,11 @@ discard block |
||
| 592 | 592 | class="needroot" |
| 593 | 593 | value="<?php print (!empty($force_install_databaserootlogin)) ? $force_install_databaserootlogin : @$db_user_root; ?>" |
| 594 | 594 | <?php |
| 595 | - if ($force_install_noedit > 0 && !empty($force_install_databaserootlogin)) {
|
|
| 596 | - print ' disabled'; |
|
| 597 | - } |
|
| 595 | + if ($force_install_noedit > 0 && !empty($force_install_databaserootlogin)) {
|
|
| 596 | + print ' disabled'; |
|
| 597 | + } |
|
| 598 | 598 | |
| 599 | - ?> |
|
| 599 | + ?> |
|
| 600 | 600 | > |
| 601 | 601 | </td> |
| 602 | 602 | <td class="comment"><?php echo $langs->trans("DatabaseRootLoginDescription"); ?>
|
@@ -620,24 +620,24 @@ discard block |
||
| 620 | 620 | class="needroot" |
| 621 | 621 | value="<?php |
| 622 | 622 | // If $force_install_databaserootpass is on, we don't want to set password here, we just show '***'. Real value will be extracted from the forced install file at step1. |
| 623 | - $autofill = ((!empty($force_install_databaserootpass)) ? str_pad('', strlen($force_install_databaserootpass), '*') : @$db_pass_root);
|
|
| 624 | - if (!empty($dolibarr_main_prod)) {
|
|
| 625 | - $autofill = ''; |
|
| 626 | - } |
|
| 623 | + $autofill = ((!empty($force_install_databaserootpass)) ? str_pad('', strlen($force_install_databaserootpass), '*') : @$db_pass_root);
|
|
| 624 | + if (!empty($dolibarr_main_prod)) {
|
|
| 625 | + $autofill = ''; |
|
| 626 | + } |
|
| 627 | 627 | // Do not autofill password if instance is a production instance |
| 628 | - if (!empty($_SERVER["SERVER_NAME"]) && !in_array($_SERVER["SERVER_NAME"], array('127.0.0.1', 'localhost', 'localhostgit'))
|
|
| 629 | - ) {
|
|
| 630 | - $autofill = ''; |
|
| 631 | - } // Do not autofill password for remote access |
|
| 632 | - print dol_escape_htmltag($autofill); |
|
| 628 | + if (!empty($_SERVER["SERVER_NAME"]) && !in_array($_SERVER["SERVER_NAME"], array('127.0.0.1', 'localhost', 'localhostgit'))
|
|
| 629 | + ) {
|
|
| 630 | + $autofill = ''; |
|
| 631 | + } // Do not autofill password for remote access |
|
| 632 | + print dol_escape_htmltag($autofill); |
|
| 633 | 633 | |
| 634 | - ?>" |
|
| 634 | + ?>" |
|
| 635 | 635 | <?php |
| 636 | - if ($force_install_noedit > 0 && !empty($force_install_databaserootpass)) {
|
|
| 637 | - print ' disabled'; // May be removed by javascript |
|
| 638 | - } |
|
| 636 | + if ($force_install_noedit > 0 && !empty($force_install_databaserootpass)) {
|
|
| 637 | + print ' disabled'; // May be removed by javascript |
|
| 638 | + } |
|
| 639 | 639 | |
| 640 | - ?> |
|
| 640 | + ?> |
|
| 641 | 641 | > |
| 642 | 642 | </td> |
| 643 | 643 | <td class="comment"><?php echo $langs->trans("KeepEmptyIfNoPassword"); ?>
|
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | session_start(); // To be able to keep info into session (used for not losing pass during navigation. pass must not transit through parmaeters) |
| 95 | 95 | |
| 96 | -pHeader($langs->trans("ConfigurationFile"), "step1", "set", "", (empty($force_dolibarr_js_JQUERY) ? '' : $force_dolibarr_js_JQUERY . '/'), 'main-inside-bis');
|
|
| 96 | +pHeader($langs->trans("ConfigurationFile"), "step1", "set", "", (empty($force_dolibarr_js_JQUERY) ? '' : $force_dolibarr_js_JQUERY.'/'), 'main-inside-bis');
|
|
| 97 | 97 | |
| 98 | 98 | // Test if we can run a first install process |
| 99 | 99 | if (!is_writable($conffile)) {
|
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | if (!empty($force_install_message)) {
|
| 108 | - print '<div><br>' . $langs->trans($force_install_message) . '</div>'; |
|
| 108 | + print '<div><br>'.$langs->trans($force_install_message).'</div>'; |
|
| 109 | 109 | |
| 110 | 110 | /* print '<script type="text/javascript">'; |
| 111 | 111 | print ' jQuery(document).ready(function() {
|
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | > |
| 159 | 159 | </td> |
| 160 | 160 | <td class="comment"><?php |
| 161 | - print $langs->trans("WithNoSlashAtTheEnd") . "<br>";
|
|
| 162 | - print $langs->trans("Examples") . ":<br>";
|
|
| 161 | + print $langs->trans("WithNoSlashAtTheEnd")."<br>";
|
|
| 162 | + print $langs->trans("Examples").":<br>";
|
|
| 163 | 163 | |
| 164 | 164 | ?> |
| 165 | 165 | <ul> |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | $dolibarr_main_data_root = @$force_install_main_data_root; |
| 177 | 177 | if (empty($dolibarr_main_data_root)) {
|
| 178 | 178 | //$dolibarr_main_data_root = detect_dolibarr_main_data_root($dolibarr_main_document_root); |
| 179 | - $dolibarr_main_data_root = BASE_PATH . 'dolibarr/documents'; |
|
| 179 | + $dolibarr_main_data_root = BASE_PATH.'dolibarr/documents'; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | ?> |
@@ -195,9 +195,9 @@ discard block |
||
| 195 | 195 | > |
| 196 | 196 | </td> |
| 197 | 197 | <td class="comment"><?php |
| 198 | - print $langs->trans("WithNoSlashAtTheEnd") . "<br>";
|
|
| 199 | - print $langs->trans("DirectoryRecommendation") . "<br>";
|
|
| 200 | - print $langs->trans("Examples") . ":<br>";
|
|
| 198 | + print $langs->trans("WithNoSlashAtTheEnd")."<br>";
|
|
| 199 | + print $langs->trans("DirectoryRecommendation")."<br>";
|
|
| 200 | + print $langs->trans("Examples").":<br>";
|
|
| 201 | 201 | |
| 202 | 202 | ?> |
| 203 | 203 | <ul> |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | ?> |
| 233 | 233 | > |
| 234 | 234 | </td> |
| 235 | - <td class="comment"><?php print $langs->trans("Examples") . ":<br>"; ?>
|
|
| 235 | + <td class="comment"><?php print $langs->trans("Examples").":<br>"; ?>
|
|
| 236 | 236 | <ul> |
| 237 | 237 | <li>http://localhost/</li> |
| 238 | 238 | <li>http://www.myserver.com:8180/dolibarr</li> |
@@ -321,21 +321,21 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | // Scan les drivers |
| 323 | 323 | //$dir=DOL_DOCUMENT_ROOT.'/core/db'; |
| 324 | - $dir = DOL_BASE_PATH . '/core/db'; |
|
| 324 | + $dir = DOL_BASE_PATH.'/core/db'; |
|
| 325 | 325 | $handle = opendir($dir); |
| 326 | 326 | if (is_resource($handle)) {
|
| 327 | 327 | while (($file = readdir($handle)) !== false) {
|
| 328 | - if (is_readable($dir . "/" . $file) && preg_match('/^(.*)\.class\.php$/i', $file, $reg)) {
|
|
| 328 | + if (is_readable($dir."/".$file) && preg_match('/^(.*)\.class\.php$/i', $file, $reg)) {
|
|
| 329 | 329 | $type = $reg[1]; |
| 330 | 330 | if ($type === 'DoliDB') |
| 331 | 331 | continue; // Skip abstract class |
| 332 | - $class = 'DoliDB' . ucfirst($type); |
|
| 333 | - include_once $dir . "/" . $file; |
|
| 332 | + $class = 'DoliDB'.ucfirst($type); |
|
| 333 | + include_once $dir."/".$file; |
|
| 334 | 334 | |
| 335 | 335 | if ($type == 'sqlite') |
| 336 | - continue; // We hide sqlite because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported) |
|
| 336 | + continue; // We hide sqlite because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported) |
|
| 337 | 337 | if ($type == 'sqlite3') |
| 338 | - continue; // We hide sqlite3 because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported) |
|
| 338 | + continue; // We hide sqlite3 because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported) |
|
| 339 | 339 | |
| 340 | 340 | |
| 341 | 341 | |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | |
| 346 | 346 | // Version min of database |
| 347 | 347 | $versionbasemin = explode('.', $class::VERSIONMIN);
|
| 348 | - $note = '(' . $class::LABEL . ' >= ' . $class::VERSIONMIN . ')';
|
|
| 348 | + $note = '('.$class::LABEL.' >= '.$class::VERSIONMIN.')';
|
|
| 349 | 349 | |
| 350 | 350 | // Switch to mysql if mysqli is not present |
| 351 | 351 | if ($defaultype == 'mysqli' && !function_exists('mysqli_connect'))
|
@@ -376,27 +376,27 @@ discard block |
||
| 376 | 376 | $testfunction = ''; |
| 377 | 377 | $testclass = 'SQLite3'; |
| 378 | 378 | } |
| 379 | - $option .= '<option value="' . $type . '"' . ($defaultype == $type ? ' selected' : ''); |
|
| 379 | + $option .= '<option value="'.$type.'"'.($defaultype == $type ? ' selected' : ''); |
|
| 380 | 380 | if ($testfunction && !function_exists($testfunction)) |
| 381 | 381 | $option .= ' disabled'; |
| 382 | 382 | if ($testclass && !class_exists($testclass)) |
| 383 | 383 | $option .= ' disabled'; |
| 384 | 384 | $option .= '>'; |
| 385 | - $option .= $type . ' '; |
|
| 385 | + $option .= $type.' '; |
|
| 386 | 386 | if ($note) |
| 387 | - $option .= ' ' . $note; |
|
| 387 | + $option .= ' '.$note; |
|
| 388 | 388 | // Deprecated and experimental |
| 389 | 389 | if ($type == 'mysql') |
| 390 | - $option .= ' ' . $langs->trans("Deprecated");
|
|
| 390 | + $option .= ' '.$langs->trans("Deprecated");
|
|
| 391 | 391 | elseif ($type == 'mssql') |
| 392 | - $option .= ' ' . $langs->trans("VersionExperimental");
|
|
| 392 | + $option .= ' '.$langs->trans("VersionExperimental");
|
|
| 393 | 393 | elseif ($type == 'sqlite') |
| 394 | - $option .= ' ' . $langs->trans("VersionExperimental");
|
|
| 394 | + $option .= ' '.$langs->trans("VersionExperimental");
|
|
| 395 | 395 | elseif ($type == 'sqlite3') |
| 396 | - $option .= ' ' . $langs->trans("VersionExperimental");
|
|
| 396 | + $option .= ' '.$langs->trans("VersionExperimental");
|
|
| 397 | 397 | // No available |
| 398 | 398 | elseif (!function_exists($testfunction)) |
| 399 | - $option .= ' - ' . $langs->trans("FunctionNotAvailableInThisPHP");
|
|
| 399 | + $option .= ' - '.$langs->trans("FunctionNotAvailableInThisPHP");
|
|
| 400 | 400 | $option .= '</option>'; |
| 401 | 401 | } |
| 402 | 402 | } |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | </td> |
| 602 | 602 | <td class="comment"><?php echo $langs->trans("DatabaseRootLoginDescription"); ?>
|
| 603 | 603 | <!-- |
| 604 | - <?php echo '<br>' . $langs->trans("Examples") . ':<br>' ?>
|
|
| 604 | + <?php echo '<br>'.$langs->trans("Examples").':<br>' ?>
|
|
| 605 | 605 | <ul> |
| 606 | 606 | <li>root (Mysql)</li> |
| 607 | 607 | <li>postgres (PostgreSql)</li> |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | ?>" |
| 635 | 635 | <?php |
| 636 | 636 | if ($force_install_noedit > 0 && !empty($force_install_databaserootpass)) {
|
| 637 | - print ' disabled'; // May be removed by javascript |
|
| 637 | + print ' disabled'; // May be removed by javascript |
|
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | ?> |
@@ -125,7 +125,10 @@ discard block |
||
| 125 | 125 | <div> |
| 126 | 126 | |
| 127 | 127 | |
| 128 | - <table class="nobordernopadding<?php if ($force_install_noedit) print ' hidewhennoedit'; ?>"> |
|
| 128 | + <table class="nobordernopadding<?php if ($force_install_noedit) { |
|
| 129 | + print ' hidewhennoedit'; |
|
| 130 | +} |
|
| 131 | +?>"> |
|
| 129 | 132 | |
| 130 | 133 | <tr> |
| 131 | 134 | <td colspan="3" class="label"> |
@@ -327,15 +330,21 @@ discard block |
||
| 327 | 330 | while (($file = readdir($handle)) !== false) {
|
| 328 | 331 | if (is_readable($dir . "/" . $file) && preg_match('/^(.*)\.class\.php$/i', $file, $reg)) {
|
| 329 | 332 | $type = $reg[1]; |
| 330 | - if ($type === 'DoliDB') |
|
| 331 | - continue; // Skip abstract class |
|
| 333 | + if ($type === 'DoliDB') { |
|
| 334 | + continue; |
|
| 335 | + } |
|
| 336 | + // Skip abstract class |
|
| 332 | 337 | $class = 'DoliDB' . ucfirst($type); |
| 333 | 338 | include_once $dir . "/" . $file; |
| 334 | 339 | |
| 335 | - if ($type == 'sqlite') |
|
| 336 | - continue; // We hide sqlite because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported) |
|
| 337 | - if ($type == 'sqlite3') |
|
| 338 | - continue; // We hide sqlite3 because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported) |
|
| 340 | + if ($type == 'sqlite') { |
|
| 341 | + continue; |
|
| 342 | + } |
|
| 343 | + // We hide sqlite because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported) |
|
| 344 | + if ($type == 'sqlite3') { |
|
| 345 | + continue; |
|
| 346 | + } |
|
| 347 | + // We hide sqlite3 because support can't be complete until sqlite does not manage foreign key creation after table creation (ALTER TABLE child ADD CONSTRAINT not supported) |
|
| 339 | 348 | |
| 340 | 349 | |
| 341 | 350 | |
@@ -348,8 +357,9 @@ discard block |
||
| 348 | 357 | $note = '(' . $class::LABEL . ' >= ' . $class::VERSIONMIN . ')';
|
| 349 | 358 | |
| 350 | 359 | // Switch to mysql if mysqli is not present |
| 351 | - if ($defaultype == 'mysqli' && !function_exists('mysqli_connect'))
|
|
| 352 | - $defaultype = 'mysql'; |
|
| 360 | + if ($defaultype == 'mysqli' && !function_exists('mysqli_connect')) { |
|
| 361 | + $defaultype = 'mysql'; |
|
| 362 | + } |
|
| 353 | 363 | |
| 354 | 364 | // Show line into list |
| 355 | 365 | if ($type == 'mysql') {
|
@@ -377,26 +387,31 @@ discard block |
||
| 377 | 387 | $testclass = 'SQLite3'; |
| 378 | 388 | } |
| 379 | 389 | $option .= '<option value="' . $type . '"' . ($defaultype == $type ? ' selected' : ''); |
| 380 | - if ($testfunction && !function_exists($testfunction)) |
|
| 381 | - $option .= ' disabled'; |
|
| 382 | - if ($testclass && !class_exists($testclass)) |
|
| 383 | - $option .= ' disabled'; |
|
| 390 | + if ($testfunction && !function_exists($testfunction)) { |
|
| 391 | + $option .= ' disabled'; |
|
| 392 | + } |
|
| 393 | + if ($testclass && !class_exists($testclass)) { |
|
| 394 | + $option .= ' disabled'; |
|
| 395 | + } |
|
| 384 | 396 | $option .= '>'; |
| 385 | 397 | $option .= $type . ' '; |
| 386 | - if ($note) |
|
| 387 | - $option .= ' ' . $note; |
|
| 398 | + if ($note) { |
|
| 399 | + $option .= ' ' . $note; |
|
| 400 | + } |
|
| 388 | 401 | // Deprecated and experimental |
| 389 | - if ($type == 'mysql') |
|
| 390 | - $option .= ' ' . $langs->trans("Deprecated");
|
|
| 391 | - elseif ($type == 'mssql') |
|
| 392 | - $option .= ' ' . $langs->trans("VersionExperimental");
|
|
| 393 | - elseif ($type == 'sqlite') |
|
| 394 | - $option .= ' ' . $langs->trans("VersionExperimental");
|
|
| 395 | - elseif ($type == 'sqlite3') |
|
| 396 | - $option .= ' ' . $langs->trans("VersionExperimental");
|
|
| 402 | + if ($type == 'mysql') { |
|
| 403 | + $option .= ' ' . $langs->trans("Deprecated"); |
|
| 404 | + } elseif ($type == 'mssql') { |
|
| 405 | + $option .= ' ' . $langs->trans("VersionExperimental"); |
|
| 406 | + } elseif ($type == 'sqlite') { |
|
| 407 | + $option .= ' ' . $langs->trans("VersionExperimental"); |
|
| 408 | + } elseif ($type == 'sqlite3') { |
|
| 409 | + $option .= ' ' . $langs->trans("VersionExperimental"); |
|
| 410 | + } |
|
| 397 | 411 | // No available |
| 398 | - elseif (!function_exists($testfunction)) |
|
| 399 | - $option .= ' - ' . $langs->trans("FunctionNotAvailableInThisPHP");
|
|
| 412 | + elseif (!function_exists($testfunction)) { |
|
| 413 | + $option .= ' - ' . $langs->trans("FunctionNotAvailableInThisPHP"); |
|
| 414 | + } |
|
| 400 | 415 | $option .= '</option>'; |
| 401 | 416 | } |
| 402 | 417 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | // Dolibarr pages directory |
| 41 | 41 | $main_dir = GETPOST('main_dir') ? GETPOST('main_dir') : (empty($argv[3]) ? '' : $argv[3]);
|
| 42 | 42 | // Directory for generated documents (invoices, orders, ecm, etc...) |
| 43 | -$main_data_dir = GETPOST('main_data_dir') ? GETPOST('main_data_dir') : (empty($argv[4]) ? ($main_dir . '/documents') : $argv[4]);
|
|
| 43 | +$main_data_dir = GETPOST('main_data_dir') ? GETPOST('main_data_dir') : (empty($argv[4]) ? ($main_dir.'/documents') : $argv[4]);
|
|
| 44 | 44 | // Dolibarr root URL |
| 45 | 45 | $main_url = GETPOST('main_url') ? GETPOST('main_url') : (empty($argv[5]) ? '' : $argv[5]);
|
| 46 | 46 | // Database login information |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | // Alternative root directory name |
| 64 | 64 | $main_alt_dir_name = ((GETPOST("main_alt_dir_name", 'alpha') && GETPOST("main_alt_dir_name", 'alpha') != '') ? GETPOST("main_alt_dir_name", 'alpha') : 'custom');
|
| 65 | 65 | |
| 66 | -session_start(); // To be able to keep info into session (used for not losing password during navigation. The password must not transit through parameters) |
|
| 66 | +session_start(); // To be able to keep info into session (used for not losing password during navigation. The password must not transit through parameters) |
|
| 67 | 67 | // Save a flag to tell to restore input value if we go back |
| 68 | 68 | $_SESSION['dol_save_pass'] = $db_pass; |
| 69 | 69 | //$_SESSION['dol_save_passroot']=$passroot; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | if (@file_exists($forcedfile)) {
|
| 78 | - die($forcedfile . ' exists!'); |
|
| 78 | + die($forcedfile.' exists!'); |
|
| 79 | 79 | $useforcedwizard = true; |
| 80 | 80 | include_once $forcedfile; |
| 81 | 81 | // If forced install is enabled, replace the post values. These are empty because form fields are disabled. |
@@ -149,29 +149,29 @@ discard block |
||
| 149 | 149 | // Check parameters |
| 150 | 150 | $is_sqlite = false; |
| 151 | 151 | if (empty($db_type)) {
|
| 152 | - print '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("DatabaseType")) . '</div>';
|
|
| 152 | + print '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentities("DatabaseType")).'</div>';
|
|
| 153 | 153 | $error++; |
| 154 | 154 | } else {
|
| 155 | - $is_sqlite = ($db_type === 'sqlite' || $db_type === 'sqlite3' ); |
|
| 155 | + $is_sqlite = ($db_type === 'sqlite' || $db_type === 'sqlite3'); |
|
| 156 | 156 | } |
| 157 | 157 | if (empty($db_host) && !$is_sqlite) {
|
| 158 | - print '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Server")) . '</div>';
|
|
| 158 | + print '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentities("Server")).'</div>';
|
|
| 159 | 159 | $error++; |
| 160 | 160 | } |
| 161 | 161 | if (empty($db_name)) {
|
| 162 | - print '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("DatabaseName")) . '</div>';
|
|
| 162 | + print '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentities("DatabaseName")).'</div>';
|
|
| 163 | 163 | $error++; |
| 164 | 164 | } |
| 165 | 165 | if (empty($db_user) && !$is_sqlite) {
|
| 166 | - print '<div class="error">' . $langs->trans("ErrorFieldRequired", $langs->transnoentities("Login")) . '</div>';
|
|
| 166 | + print '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentities("Login")).'</div>';
|
|
| 167 | 167 | $error++; |
| 168 | 168 | } |
| 169 | 169 | if (!empty($db_port) && !is_numeric($db_port)) {
|
| 170 | - print '<div class="error">' . $langs->trans("ErrorBadValueForParameter", $db_port, $langs->transnoentities("Port")) . '</div>';
|
|
| 170 | + print '<div class="error">'.$langs->trans("ErrorBadValueForParameter", $db_port, $langs->transnoentities("Port")).'</div>';
|
|
| 171 | 171 | $error++; |
| 172 | 172 | } |
| 173 | 173 | if (!empty($db_prefix) && !preg_match('/^[a-z0-9]+_$/i', $db_prefix)) {
|
| 174 | - print '<div class="error">' . $langs->trans("ErrorBadValueForParameter", $db_prefix, $langs->transnoentities("DatabasePrefix")) . '</div>';
|
|
| 174 | + print '<div class="error">'.$langs->trans("ErrorBadValueForParameter", $db_prefix, $langs->transnoentities("DatabasePrefix")).'</div>';
|
|
| 175 | 175 | $error++; |
| 176 | 176 | } |
| 177 | 177 | |
@@ -187,20 +187,20 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | // Test database connection |
| 189 | 189 | if (!$error) {
|
| 190 | - $result = @include_once $main_dir . "/core/db/" . $db_type . '.class.php'; |
|
| 190 | + $result = @include_once $main_dir."/core/db/".$db_type.'.class.php'; |
|
| 191 | 191 | if ($result) {
|
| 192 | 192 | // If we require database or user creation we need to connect as root, so we need root login credentials |
| 193 | 193 | if (!empty($db_create_database) && !$userroot) {
|
| 194 | - print '<div class="error">' . $langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect", $db_name) . '</div>';
|
|
| 194 | + print '<div class="error">'.$langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect", $db_name).'</div>';
|
|
| 195 | 195 | print '<br>'; |
| 196 | - print $langs->trans("BecauseConnectionFailedParametersMayBeWrong") . '<br><br>';
|
|
| 196 | + print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
|
|
| 197 | 197 | print $langs->trans("ErrorGoBackAndCorrectParameters");
|
| 198 | 198 | $error++; |
| 199 | 199 | } |
| 200 | 200 | if (!empty($db_create_user) && !$userroot) {
|
| 201 | - print '<div class="error">' . $langs->trans("YouAskLoginCreationSoDolibarrNeedToConnect", $db_user) . '</div>';
|
|
| 201 | + print '<div class="error">'.$langs->trans("YouAskLoginCreationSoDolibarrNeedToConnect", $db_user).'</div>';
|
|
| 202 | 202 | print '<br>'; |
| 203 | - print $langs->trans("BecauseConnectionFailedParametersMayBeWrong") . '<br><br>';
|
|
| 203 | + print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
|
|
| 204 | 204 | print $langs->trans("ErrorGoBackAndCorrectParameters");
|
| 205 | 205 | $error++; |
| 206 | 206 | } |
@@ -221,24 +221,24 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | $db = getDoliDBInstance($db_type, $db_host, $userroot, $passroot, $databasefortest, $db_port); |
| 223 | 223 | |
| 224 | - dol_syslog("databasefortest=" . $databasefortest . " connected=" . $db->connected . " database_selected=" . $db->database_selected, LOG_DEBUG);
|
|
| 224 | + dol_syslog("databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected, LOG_DEBUG);
|
|
| 225 | 225 | //print "databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected; |
| 226 | 226 | |
| 227 | 227 | if (empty($db_create_database) && $db->connected && !$db->database_selected) {
|
| 228 | - print '<div class="error">' . $langs->trans("ErrorConnectedButDatabaseNotFound", $db_name) . '</div>';
|
|
| 228 | + print '<div class="error">'.$langs->trans("ErrorConnectedButDatabaseNotFound", $db_name).'</div>';
|
|
| 229 | 229 | print '<br>'; |
| 230 | 230 | if (!$db->connected) |
| 231 | - print $langs->trans("IfDatabaseNotExistsGoBackAndUncheckCreate") . '<br><br>';
|
|
| 231 | + print $langs->trans("IfDatabaseNotExistsGoBackAndUncheckCreate").'<br><br>';
|
|
| 232 | 232 | print $langs->trans("ErrorGoBackAndCorrectParameters");
|
| 233 | 233 | $error++; |
| 234 | 234 | } elseif ($db->error && !(!empty($db_create_database) && $db->connected)) {
|
| 235 | 235 | // Note: you may experience error here with message "No such file or directory" when mysql was installed for the first time but not yet launched. |
| 236 | 236 | if ($db->error == "No such file or directory") |
| 237 | - print '<div class="error">' . $langs->trans("ErrorToConnectToMysqlCheckInstance") . '</div>';
|
|
| 237 | + print '<div class="error">'.$langs->trans("ErrorToConnectToMysqlCheckInstance").'</div>';
|
|
| 238 | 238 | else |
| 239 | - print '<div class="error">' . $db->error . '</div>'; |
|
| 239 | + print '<div class="error">'.$db->error.'</div>'; |
|
| 240 | 240 | if (!$db->connected) |
| 241 | - print $langs->trans("BecauseConnectionFailedParametersMayBeWrong") . '<br><br>';
|
|
| 241 | + print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
|
|
| 242 | 242 | //print '<a href="#" onClick="javascript: history.back();">'; |
| 243 | 243 | print $langs->trans("ErrorGoBackAndCorrectParameters");
|
| 244 | 244 | //print '</a>'; |
@@ -250,9 +250,9 @@ discard block |
||
| 250 | 250 | $db = getDoliDBInstance($db_type, $db_host, $db_user, $db_pass, $db_name, $db_port); |
| 251 | 251 | |
| 252 | 252 | if ($db->error) {
|
| 253 | - print '<div class="error">' . $db->error . '</div>'; |
|
| 253 | + print '<div class="error">'.$db->error.'</div>'; |
|
| 254 | 254 | if (!$db->connected) |
| 255 | - print $langs->trans("BecauseConnectionFailedParametersMayBeWrong") . '<br><br>';
|
|
| 255 | + print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
|
|
| 256 | 256 | //print '<a href="#" onClick="javascript: history.back();">'; |
| 257 | 257 | print $langs->trans("ErrorGoBackAndCorrectParameters");
|
| 258 | 258 | //print '</a>'; |
@@ -261,8 +261,8 @@ discard block |
||
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | else {
|
| 264 | - print "<br>\nFailed to include_once(\"" . $main_dir . "/core/db/" . $db_type . ".class.php\")<br>\n"; |
|
| 265 | - print '<div class="error">' . $langs->trans("ErrorWrongValueForParameter", $langs->transnoentities("WebPagesDirectory")) . '</div>';
|
|
| 264 | + print "<br>\nFailed to include_once(\"".$main_dir."/core/db/".$db_type.".class.php\")<br>\n"; |
|
| 265 | + print '<div class="error">'.$langs->trans("ErrorWrongValueForParameter", $langs->transnoentities("WebPagesDirectory")).'</div>';
|
|
| 266 | 266 | //print '<a href="#" onClick="javascript: history.back();">'; |
| 267 | 267 | print $langs->trans("ErrorGoBackAndCorrectParameters");
|
| 268 | 268 | //print '</a>'; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | if (isset($db)) |
| 273 | 273 | print $db->lasterror(); |
| 274 | 274 | if (isset($db) && !$db->connected) |
| 275 | - print '<br>' . $langs->trans("BecauseConnectionFailedParametersMayBeWrong") . '<br><br>';
|
|
| 275 | + print '<br>'.$langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
|
|
| 276 | 276 | print $langs->trans("ErrorGoBackAndCorrectParameters");
|
| 277 | 277 | $error++; |
| 278 | 278 | } |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | if (!empty($db_create_database)) {
|
| 282 | 282 | $result = $db->select_db($db_name); |
| 283 | 283 | if ($result) {
|
| 284 | - print '<div class="error">' . $langs->trans("ErrorDatabaseAlreadyExists", $db_name) . '</div>';
|
|
| 285 | - print $langs->trans("IfDatabaseExistsGoBackAndCheckCreate") . '<br><br>';
|
|
| 284 | + print '<div class="error">'.$langs->trans("ErrorDatabaseAlreadyExists", $db_name).'</div>';
|
|
| 285 | + print $langs->trans("IfDatabaseExistsGoBackAndCheckCreate").'<br><br>';
|
|
| 286 | 286 | print $langs->trans("ErrorGoBackAndCorrectParameters");
|
| 287 | 287 | $error++; |
| 288 | 288 | } |
@@ -307,11 +307,11 @@ discard block |
||
| 307 | 307 | $defaultDBSortingCollation = 'utf8_unicode_ci'; |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - print '<input type="hidden" name="dolibarr_main_db_character_set" value="' . $defaultCharacterSet . '">'; |
|
| 311 | - print '<input type="hidden" name="dolibarr_main_db_collation" value="' . $defaultDBSortingCollation . '">'; |
|
| 310 | + print '<input type="hidden" name="dolibarr_main_db_character_set" value="'.$defaultCharacterSet.'">'; |
|
| 311 | + print '<input type="hidden" name="dolibarr_main_db_collation" value="'.$defaultDBSortingCollation.'">'; |
|
| 312 | 312 | $db_character_set = $defaultCharacterSet; |
| 313 | 313 | $db_collation = $defaultDBSortingCollation; |
| 314 | - dolibarr_install_syslog("step1: db_character_set=" . $db_character_set . " db_collation=" . $db_collation);
|
|
| 314 | + dolibarr_install_syslog("step1: db_character_set=".$db_character_set." db_collation=".$db_collation);
|
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | |
@@ -321,24 +321,24 @@ discard block |
||
| 321 | 321 | if (is_array($_POST)) {
|
| 322 | 322 | foreach ($_POST as $key => $value) {
|
| 323 | 323 | if (!preg_match('/^db_pass/i', $key)) {
|
| 324 | - dolibarr_install_syslog("step1: choice for " . $key . " = " . $value);
|
|
| 324 | + dolibarr_install_syslog("step1: choice for ".$key." = ".$value);
|
|
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | // Show title of step |
| 330 | - print '<h3><img class="valigntextbottom" src="' . DOL_BASE_URI . '/theme/common/octicons/build/svg/gear.svg" width="20" alt="Configuration"> ' . $langs->trans("ConfigurationFile") . '</h3>';
|
|
| 330 | + print '<h3><img class="valigntextbottom" src="'.DOL_BASE_URI.'/theme/common/octicons/build/svg/gear.svg" width="20" alt="Configuration"> '.$langs->trans("ConfigurationFile").'</h3>';
|
|
| 331 | 331 | print '<table cellspacing="0" width="100%" cellpadding="1" border="0">'; |
| 332 | 332 | |
| 333 | 333 | // Check parameter main_dir |
| 334 | 334 | if (!$error) {
|
| 335 | 335 | if (!is_dir($main_dir)) {
|
| 336 | - dolibarr_install_syslog("step1: directory '" . $main_dir . "' is unavailable or can't be accessed");
|
|
| 336 | + dolibarr_install_syslog("step1: directory '".$main_dir."' is unavailable or can't be accessed");
|
|
| 337 | 337 | |
| 338 | 338 | print "<tr><td>"; |
| 339 | - print $langs->trans("ErrorDirDoesNotExists", $main_dir) . '<br>';
|
|
| 340 | - print $langs->trans("ErrorWrongValueForParameter", $langs->trans("WebPagesDirectory")) . '<br>';
|
|
| 341 | - print $langs->trans("ErrorGoBackAndCorrectParameters") . '<br><br>';
|
|
| 339 | + print $langs->trans("ErrorDirDoesNotExists", $main_dir).'<br>';
|
|
| 340 | + print $langs->trans("ErrorWrongValueForParameter", $langs->trans("WebPagesDirectory")).'<br>';
|
|
| 341 | + print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
|
|
| 342 | 342 | print '</td><td>'; |
| 343 | 343 | print $langs->trans("Error");
|
| 344 | 344 | print "</td></tr>"; |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | if (!$error) {
|
| 350 | - dolibarr_install_syslog("step1: directory '" . $main_dir . "' exists");
|
|
| 350 | + dolibarr_install_syslog("step1: directory '".$main_dir."' exists");
|
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | |
@@ -359,22 +359,22 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | if (!is_dir($main_data_dir)) {
|
| 362 | - print "<tr><td>" . $langs->trans("ErrorDirDoesNotExists", $main_data_dir);
|
|
| 363 | - print ' ' . $langs->trans("YouMustCreateItAndAllowServerToWrite");
|
|
| 362 | + print "<tr><td>".$langs->trans("ErrorDirDoesNotExists", $main_data_dir);
|
|
| 363 | + print ' '.$langs->trans("YouMustCreateItAndAllowServerToWrite");
|
|
| 364 | 364 | print '</td><td>'; |
| 365 | - print '<span class="error">' . $langs->trans("Error") . '</span>';
|
|
| 365 | + print '<span class="error">'.$langs->trans("Error").'</span>';
|
|
| 366 | 366 | print "</td></tr>"; |
| 367 | - print '<tr><td colspan="2"><br>' . $langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'] . '?testget=ok') . '</td></tr>';
|
|
| 367 | + print '<tr><td colspan="2"><br>'.$langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok').'</td></tr>';
|
|
| 368 | 368 | $error++; |
| 369 | 369 | } else {
|
| 370 | 370 | // Create .htaccess file in document directory |
| 371 | - $pathhtaccess = $main_data_dir . '/.htaccess'; |
|
| 371 | + $pathhtaccess = $main_data_dir.'/.htaccess'; |
|
| 372 | 372 | if (!file_exists($pathhtaccess)) {
|
| 373 | - dolibarr_install_syslog("step1: .htaccess file did not exist, we created it in '" . $main_data_dir . "'");
|
|
| 373 | + dolibarr_install_syslog("step1: .htaccess file did not exist, we created it in '".$main_data_dir."'");
|
|
| 374 | 374 | $handlehtaccess = @fopen($pathhtaccess, 'w'); |
| 375 | 375 | if ($handlehtaccess) {
|
| 376 | - fwrite($handlehtaccess, 'Order allow,deny' . "\n"); |
|
| 377 | - fwrite($handlehtaccess, 'Deny from all' . "\n"); |
|
| 376 | + fwrite($handlehtaccess, 'Order allow,deny'."\n"); |
|
| 377 | + fwrite($handlehtaccess, 'Deny from all'."\n"); |
|
| 378 | 378 | |
| 379 | 379 | fclose($handlehtaccess); |
| 380 | 380 | dolibarr_install_syslog("step1: .htaccess file created");
|
@@ -383,52 +383,52 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | // Documents are stored above the web pages root to prevent being downloaded without authentification |
| 385 | 385 | $dir = array(); |
| 386 | - $dir[] = $main_data_dir . "/mycompany"; |
|
| 387 | - $dir[] = $main_data_dir . "/medias"; |
|
| 388 | - $dir[] = $main_data_dir . "/users"; |
|
| 389 | - $dir[] = $main_data_dir . "/facture"; |
|
| 390 | - $dir[] = $main_data_dir . "/propale"; |
|
| 391 | - $dir[] = $main_data_dir . "/ficheinter"; |
|
| 392 | - $dir[] = $main_data_dir . "/produit"; |
|
| 393 | - $dir[] = $main_data_dir . "/doctemplates"; |
|
| 386 | + $dir[] = $main_data_dir."/mycompany"; |
|
| 387 | + $dir[] = $main_data_dir."/medias"; |
|
| 388 | + $dir[] = $main_data_dir."/users"; |
|
| 389 | + $dir[] = $main_data_dir."/facture"; |
|
| 390 | + $dir[] = $main_data_dir."/propale"; |
|
| 391 | + $dir[] = $main_data_dir."/ficheinter"; |
|
| 392 | + $dir[] = $main_data_dir."/produit"; |
|
| 393 | + $dir[] = $main_data_dir."/doctemplates"; |
|
| 394 | 394 | |
| 395 | 395 | // Loop on each directory of dir [] to create them if they do not exist |
| 396 | 396 | $num = count($dir); |
| 397 | 397 | for ($i = 0; $i < $num; $i++) {
|
| 398 | 398 | if (is_dir($dir[$i])) {
|
| 399 | - dolibarr_install_syslog("step1: directory '" . $dir[$i] . "' exists");
|
|
| 399 | + dolibarr_install_syslog("step1: directory '".$dir[$i]."' exists");
|
|
| 400 | 400 | } else {
|
| 401 | 401 | if (dol_mkdir($dir[$i]) < 0) {
|
| 402 | 402 | print "<tr><td>"; |
| 403 | - print "Failed to create directory: " . $dir[$i]; |
|
| 403 | + print "Failed to create directory: ".$dir[$i]; |
|
| 404 | 404 | print '</td><td>'; |
| 405 | 405 | print $langs->trans("Error");
|
| 406 | 406 | print "</td></tr>"; |
| 407 | 407 | $error++; |
| 408 | 408 | } else {
|
| 409 | - dolibarr_install_syslog("step1: directory '" . $dir[$i] . "' created");
|
|
| 409 | + dolibarr_install_syslog("step1: directory '".$dir[$i]."' created");
|
|
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | - require_once DOL_BASE_PATH . '/core/lib/files.lib.php'; |
|
| 414 | + require_once DOL_BASE_PATH.'/core/lib/files.lib.php'; |
|
| 415 | 415 | |
| 416 | 416 | // Copy directory medias |
| 417 | - $srcroot = $main_dir . '/install/medias'; |
|
| 418 | - $destroot = $main_data_dir . '/medias'; |
|
| 417 | + $srcroot = $main_dir.'/install/medias'; |
|
| 418 | + $destroot = $main_data_dir.'/medias'; |
|
| 419 | 419 | dolCopyDir($srcroot, $destroot, 0, 0); |
| 420 | 420 | |
| 421 | 421 | if ($error) {
|
| 422 | - print "<tr><td>" . $langs->trans("ErrorDirDoesNotExists", $main_data_dir);
|
|
| 423 | - print ' ' . $langs->trans("YouMustCreateItAndAllowServerToWrite");
|
|
| 422 | + print "<tr><td>".$langs->trans("ErrorDirDoesNotExists", $main_data_dir);
|
|
| 423 | + print ' '.$langs->trans("YouMustCreateItAndAllowServerToWrite");
|
|
| 424 | 424 | print '</td><td>'; |
| 425 | - print '<span class="error">' . $langs->trans("Error") . '</span>';
|
|
| 425 | + print '<span class="error">'.$langs->trans("Error").'</span>';
|
|
| 426 | 426 | print "</td></tr>"; |
| 427 | - print '<tr><td colspan="2"><br>' . $langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'] . '?testget=ok') . '</td></tr>';
|
|
| 427 | + print '<tr><td colspan="2"><br>'.$langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok').'</td></tr>';
|
|
| 428 | 428 | } else {
|
| 429 | 429 | //ODT templates |
| 430 | - $srcroot = $main_dir . '/install/doctemplates'; |
|
| 431 | - $destroot = $main_data_dir . '/doctemplates'; |
|
| 430 | + $srcroot = $main_dir.'/install/doctemplates'; |
|
| 431 | + $destroot = $main_data_dir.'/doctemplates'; |
|
| 432 | 432 | $docs = array( |
| 433 | 433 | 'contracts' => 'contract', |
| 434 | 434 | 'invoices' => 'invoice', |
@@ -444,14 +444,14 @@ discard block |
||
| 444 | 444 | 'users' => 'user', |
| 445 | 445 | ); |
| 446 | 446 | foreach ($docs as $cursordir => $cursorfile) {
|
| 447 | - $src = $srcroot . '/' . $cursordir . '/template_' . $cursorfile . '.odt'; |
|
| 448 | - $dirodt = $destroot . '/' . $cursordir; |
|
| 449 | - $dest = $dirodt . '/template_' . $cursorfile . '.odt'; |
|
| 447 | + $src = $srcroot.'/'.$cursordir.'/template_'.$cursorfile.'.odt'; |
|
| 448 | + $dirodt = $destroot.'/'.$cursordir; |
|
| 449 | + $dest = $dirodt.'/template_'.$cursorfile.'.odt'; |
|
| 450 | 450 | |
| 451 | 451 | dol_mkdir($dirodt); |
| 452 | 452 | $result = dol_copy($src, $dest, 0, 0); |
| 453 | 453 | if ($result < 0) {
|
| 454 | - print '<tr><td colspan="2"><br>' . $langs->trans('ErrorFailToCopyFile', $src, $dest) . '</td></tr>';
|
|
| 454 | + print '<tr><td colspan="2"><br>'.$langs->trans('ErrorFailToCopyFile', $src, $dest).'</td></tr>';
|
|
| 455 | 455 | } |
| 456 | 456 | } |
| 457 | 457 | } |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | // We must ignore errors as an existing old file may already exist and not be replaceable or |
| 469 | 469 | // the installer (like for ubuntu) may not have permission to create another file than conf.php. |
| 470 | 470 | // Also no other process must be able to read file or we expose the new file, so content with password. |
| 471 | - @dol_copy($conffile, $conffile . '.old', '0400'); |
|
| 471 | + @dol_copy($conffile, $conffile.'.old', '0400'); |
|
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | $error += write_conf_file($conffile); |
@@ -482,12 +482,12 @@ discard block |
||
| 482 | 482 | print '<tr><td>'; |
| 483 | 483 | print $langs->trans("ConfFileReload");
|
| 484 | 484 | print '</td>'; |
| 485 | - print '<td><img src="' . DOL_BASE_URI . '/theme/eldy/img/tick.png" alt="Ok"></td></tr>'; |
|
| 485 | + print '<td><img src="'.DOL_BASE_URI.'/theme/eldy/img/tick.png" alt="Ok"></td></tr>'; |
|
| 486 | 486 | |
| 487 | 487 | // Create database user if requested |
| 488 | 488 | // Notice: Undefined variable: dbtheme_create_user in \alixar\dolibarr\htdocs\install\step1.php on line 490 |
| 489 | 489 | if (isset($db_create_user) && (isset($dbtheme_create_user)) && ($dbtheme_create_user == "1" || $db_create_user == "on")) {
|
| 490 | - dolibarr_install_syslog("step1: create database user: " . $dolibarr_main_db_user);
|
|
| 490 | + dolibarr_install_syslog("step1: create database user: ".$dolibarr_main_db_user);
|
|
| 491 | 491 | |
| 492 | 492 | //print $conf->db->host." , ".$conf->db->name." , ".$conf->db->user." , ".$conf->db->port; |
| 493 | 493 | $databasefortest = $conf->db->name; |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | $db = getDoliDBInstance($conf->db->type, $conf->db->host, $userroot, $passroot, $databasefortest, $conf->db->port); |
| 505 | 505 | |
| 506 | 506 | if ($db->error) {
|
| 507 | - print '<div class="error">' . $db->error . '</div>'; |
|
| 507 | + print '<div class="error">'.$db->error.'</div>'; |
|
| 508 | 508 | $error++; |
| 509 | 509 | } |
| 510 | 510 | |
@@ -524,43 +524,43 @@ discard block |
||
| 524 | 524 | if ($result > 0 && $resultbis > 0) {
|
| 525 | 525 | |
| 526 | 526 | print '<tr><td>'; |
| 527 | - print $langs->trans("UserCreation") . ' : ';
|
|
| 527 | + print $langs->trans("UserCreation").' : ';
|
|
| 528 | 528 | print $dolibarr_main_db_user; |
| 529 | 529 | print '</td>'; |
| 530 | - print '<td><img src="' . DOL_BASE_URI . '/theme/eldy/img/tick.png" alt="Ok"></td></tr>'; |
|
| 530 | + print '<td><img src="'.DOL_BASE_URI.'/theme/eldy/img/tick.png" alt="Ok"></td></tr>'; |
|
| 531 | 531 | } else {
|
| 532 | 532 | if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS' || $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS' || $db->errno() == 'DB_ERROR_USER_ALREADY_EXISTS') {
|
| 533 | 533 | dolibarr_install_syslog("step1: user already exists");
|
| 534 | 534 | print '<tr><td>'; |
| 535 | - print $langs->trans("UserCreation") . ' : ';
|
|
| 535 | + print $langs->trans("UserCreation").' : ';
|
|
| 536 | 536 | print $dolibarr_main_db_user; |
| 537 | 537 | print '</td>'; |
| 538 | - print '<td>' . $langs->trans("LoginAlreadyExists") . '</td></tr>';
|
|
| 538 | + print '<td>'.$langs->trans("LoginAlreadyExists").'</td></tr>';
|
|
| 539 | 539 | } else {
|
| 540 | 540 | dolibarr_install_syslog("step1: failed to create user", LOG_ERR);
|
| 541 | 541 | print '<tr><td>'; |
| 542 | - print $langs->trans("UserCreation") . ' : ';
|
|
| 542 | + print $langs->trans("UserCreation").' : ';
|
|
| 543 | 543 | print $dolibarr_main_db_user; |
| 544 | 544 | print '</td>'; |
| 545 | - print '<td>' . $langs->trans("Error") . ': ' . $db->errno() . ' ' . $db->error() . "</td></tr>";
|
|
| 545 | + print '<td>'.$langs->trans("Error").': '.$db->errno().' '.$db->error()."</td></tr>";
|
|
| 546 | 546 | } |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | $db->close(); |
| 550 | 550 | } else {
|
| 551 | 551 | print '<tr><td>'; |
| 552 | - print $langs->trans("UserCreation") . ' : ';
|
|
| 552 | + print $langs->trans("UserCreation").' : ';
|
|
| 553 | 553 | print $dolibarr_main_db_user; |
| 554 | 554 | print '</td>'; |
| 555 | - print '<td><img src="' . DOL_BASE_URI . '/theme/eldy/img/error.png" alt="Error"></td>'; |
|
| 555 | + print '<td><img src="'.DOL_BASE_URI.'/theme/eldy/img/error.png" alt="Error"></td>'; |
|
| 556 | 556 | print '</tr>'; |
| 557 | 557 | |
| 558 | 558 | // warning message due to connection failure |
| 559 | 559 | print '<tr><td colspan="2"><br>'; |
| 560 | 560 | print $langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect", $dolibarr_main_db_user, $dolibarr_main_db_host, $userroot);
|
| 561 | 561 | print '<br>'; |
| 562 | - print $langs->trans("BecauseConnectionFailedParametersMayBeWrong") . '<br><br>';
|
|
| 563 | - print $langs->trans("ErrorGoBackAndCorrectParameters") . '<br><br>';
|
|
| 562 | + print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
|
|
| 563 | + print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
|
|
| 564 | 564 | print '</td></tr>'; |
| 565 | 565 | |
| 566 | 566 | $error++; |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | } // end of user account creation |
| 570 | 570 | // If database creation was asked, we create it |
| 571 | 571 | if (!$error && (isset($db_create_database) && ($db_create_database == "1" || $db_create_database == "on"))) {
|
| 572 | - dolibarr_install_syslog("step1: create database: " . $dolibarr_main_db_name . " " . $dolibarr_main_db_character_set . " " . $dolibarr_main_db_collation . " " . $dolibarr_main_db_user);
|
|
| 572 | + dolibarr_install_syslog("step1: create database: ".$dolibarr_main_db_name." ".$dolibarr_main_db_character_set." ".$dolibarr_main_db_collation." ".$dolibarr_main_db_user);
|
|
| 573 | 573 | $newdb = getDoliDBInstance($conf->db->type, $conf->db->host, $userroot, $passroot, '', $conf->db->port); |
| 574 | 574 | //print 'eee'.$conf->db->type." ".$conf->db->host." ".$userroot." ".$passroot." ".$conf->db->port." ".$newdb->connected." ".$newdb->forcecharset;exit; |
| 575 | 575 | |
@@ -578,15 +578,15 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | if ($result) {
|
| 580 | 580 | print '<tr><td>'; |
| 581 | - print $langs->trans("DatabaseCreation") . " (" . $langs->trans("User") . " " . $userroot . ") : ";
|
|
| 581 | + print $langs->trans("DatabaseCreation")." (".$langs->trans("User")." ".$userroot.") : ";
|
|
| 582 | 582 | print $dolibarr_main_db_name; |
| 583 | 583 | print '</td>'; |
| 584 | - print '<td><img src="' . DOL_BASE_URI . '/theme/eldy/img/tick.png" alt="Ok"></td></tr>'; |
|
| 584 | + print '<td><img src="'.DOL_BASE_URI.'/theme/eldy/img/tick.png" alt="Ok"></td></tr>'; |
|
| 585 | 585 | |
| 586 | 586 | $newdb->select_db($dolibarr_main_db_name); |
| 587 | 587 | $check1 = $newdb->getDefaultCharacterSetDatabase(); |
| 588 | 588 | $check2 = $newdb->getDefaultCollationDatabase(); |
| 589 | - dolibarr_install_syslog('step1: new database is using charset=' . $check1 . ' collation=' . $check2);
|
|
| 589 | + dolibarr_install_syslog('step1: new database is using charset='.$check1.' collation='.$check2);
|
|
| 590 | 590 | |
| 591 | 591 | // If values differs, we save conf file again |
| 592 | 592 | //if ($check1 != $dolibarr_main_db_character_set) dolibarr_install_syslog('step1: value for character_set is not the one asked for database creation', LOG_WARNING);
|
@@ -594,30 +594,30 @@ discard block |
||
| 594 | 594 | } else {
|
| 595 | 595 | // warning message |
| 596 | 596 | print '<tr><td colspan="2"><br>'; |
| 597 | - print $langs->trans("ErrorFailedToCreateDatabase", $dolibarr_main_db_name) . '<br>';
|
|
| 598 | - print $newdb->lasterror() . '<br>'; |
|
| 597 | + print $langs->trans("ErrorFailedToCreateDatabase", $dolibarr_main_db_name).'<br>';
|
|
| 598 | + print $newdb->lasterror().'<br>'; |
|
| 599 | 599 | print $langs->trans("IfDatabaseExistsGoBackAndCheckCreate");
|
| 600 | 600 | print '<br>'; |
| 601 | 601 | print '</td></tr>'; |
| 602 | 602 | |
| 603 | - dolibarr_install_syslog('step1: failed to create database ' . $dolibarr_main_db_name . ' ' . $newdb->lasterrno() . ' ' . $newdb->lasterror(), LOG_ERR);
|
|
| 603 | + dolibarr_install_syslog('step1: failed to create database '.$dolibarr_main_db_name.' '.$newdb->lasterrno().' '.$newdb->lasterror(), LOG_ERR);
|
|
| 604 | 604 | $error++; |
| 605 | 605 | } |
| 606 | 606 | $newdb->close(); |
| 607 | 607 | } else {
|
| 608 | 608 | print '<tr><td>'; |
| 609 | - print $langs->trans("DatabaseCreation") . " (" . $langs->trans("User") . " " . $userroot . ") : ";
|
|
| 609 | + print $langs->trans("DatabaseCreation")." (".$langs->trans("User")." ".$userroot.") : ";
|
|
| 610 | 610 | print $dolibarr_main_db_name; |
| 611 | 611 | print '</td>'; |
| 612 | - print '<td><img src="' . DOL_BASE_URI . '/theme/eldy/img/error.png" alt="Error"></td>'; |
|
| 612 | + print '<td><img src="'.DOL_BASE_URI.'/theme/eldy/img/error.png" alt="Error"></td>'; |
|
| 613 | 613 | print '</tr>'; |
| 614 | 614 | |
| 615 | 615 | // warning message |
| 616 | 616 | print '<tr><td colspan="2"><br>'; |
| 617 | 617 | print $langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect", $dolibarr_main_db_user, $dolibarr_main_db_host, $userroot);
|
| 618 | 618 | print '<br>'; |
| 619 | - print $langs->trans("BecauseConnectionFailedParametersMayBeWrong") . '<br><br>';
|
|
| 620 | - print $langs->trans("ErrorGoBackAndCorrectParameters") . '<br><br>';
|
|
| 619 | + print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
|
|
| 620 | + print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
|
|
| 621 | 621 | print '</td></tr>'; |
| 622 | 622 | |
| 623 | 623 | $error++; |
@@ -625,63 +625,63 @@ discard block |
||
| 625 | 625 | } // end of create database |
| 626 | 626 | // We test access with dolibarr database user (not admin) |
| 627 | 627 | if (!$error) {
|
| 628 | - dolibarr_install_syslog("step1: connection type=" . $conf->db->type . " on host=" . $conf->db->host . " port=" . $conf->db->port . " user=" . $conf->db->user . " name=" . $conf->db->name);
|
|
| 628 | + dolibarr_install_syslog("step1: connection type=".$conf->db->type." on host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name);
|
|
| 629 | 629 | //print "connexion de type=".$conf->db->type." sur host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name; |
| 630 | 630 | |
| 631 | 631 | $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port); |
| 632 | 632 | |
| 633 | 633 | if ($db->connected) {
|
| 634 | - dolibarr_install_syslog("step1: connection to server by user " . $conf->db->user . " ok");
|
|
| 634 | + dolibarr_install_syslog("step1: connection to server by user ".$conf->db->user." ok");
|
|
| 635 | 635 | print "<tr><td>"; |
| 636 | - print $langs->trans("ServerConnection") . " (" . $langs->trans("User") . " " . $conf->db->user . ") : ";
|
|
| 636 | + print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
|
|
| 637 | 637 | print $dolibarr_main_db_host; |
| 638 | 638 | print "</td><td>"; |
| 639 | - print '<img src="' . DOL_BASE_URI . '/theme/eldy/img/tick.png" alt="Ok">'; |
|
| 639 | + print '<img src="'.DOL_BASE_URI.'/theme/eldy/img/tick.png" alt="Ok">'; |
|
| 640 | 640 | print "</td></tr>"; |
| 641 | 641 | |
| 642 | 642 | // server access ok, basic access ok |
| 643 | 643 | if ($db->database_selected) {
|
| 644 | - dolibarr_install_syslog("step1: connection to database " . $conf->db->name . " by user " . $conf->db->user . " ok");
|
|
| 644 | + dolibarr_install_syslog("step1: connection to database ".$conf->db->name." by user ".$conf->db->user." ok");
|
|
| 645 | 645 | print "<tr><td>"; |
| 646 | - print $langs->trans("DatabaseConnection") . " (" . $langs->trans("User") . " " . $conf->db->user . ") : ";
|
|
| 646 | + print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
|
|
| 647 | 647 | print $dolibarr_main_db_name; |
| 648 | 648 | print "</td><td>"; |
| 649 | - print '<img src="' . DOL_BASE_URI . '/theme/eldy/img/tick.png" alt="Ok">'; |
|
| 649 | + print '<img src="'.DOL_BASE_URI.'/theme/eldy/img/tick.png" alt="Ok">'; |
|
| 650 | 650 | print "</td></tr>"; |
| 651 | 651 | |
| 652 | 652 | $error = 0; |
| 653 | 653 | } else {
|
| 654 | - dolibarr_install_syslog("step1: connection to database " . $conf->db->name . " by user " . $conf->db->user . " failed", LOG_ERR);
|
|
| 654 | + dolibarr_install_syslog("step1: connection to database ".$conf->db->name." by user ".$conf->db->user." failed", LOG_ERR);
|
|
| 655 | 655 | print "<tr><td>"; |
| 656 | - print $langs->trans("DatabaseConnection") . " (" . $langs->trans("User") . " " . $conf->db->user . ") : ";
|
|
| 656 | + print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
|
|
| 657 | 657 | print $dolibarr_main_db_name; |
| 658 | 658 | print '</td><td>'; |
| 659 | - print '<img src="' . DOL_BASE_URI . '/theme/eldy/img/error.png" alt="Error">'; |
|
| 659 | + print '<img src="'.DOL_BASE_URI.'/theme/eldy/img/error.png" alt="Error">'; |
|
| 660 | 660 | print "</td></tr>"; |
| 661 | 661 | |
| 662 | 662 | // warning message |
| 663 | 663 | print '<tr><td colspan="2"><br>'; |
| 664 | - print $langs->trans('CheckThatDatabasenameIsCorrect', $dolibarr_main_db_name) . '<br>';
|
|
| 665 | - print $langs->trans('IfAlreadyExistsCheckOption') . '<br>';
|
|
| 666 | - print $langs->trans("ErrorGoBackAndCorrectParameters") . '<br><br>';
|
|
| 664 | + print $langs->trans('CheckThatDatabasenameIsCorrect', $dolibarr_main_db_name).'<br>';
|
|
| 665 | + print $langs->trans('IfAlreadyExistsCheckOption').'<br>';
|
|
| 666 | + print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
|
|
| 667 | 667 | print '</td></tr>'; |
| 668 | 668 | |
| 669 | 669 | $error++; |
| 670 | 670 | } |
| 671 | 671 | } else {
|
| 672 | - dolibarr_install_syslog("step1: connection to server by user " . $conf->db->user . " failed", LOG_ERR);
|
|
| 672 | + dolibarr_install_syslog("step1: connection to server by user ".$conf->db->user." failed", LOG_ERR);
|
|
| 673 | 673 | print "<tr><td>"; |
| 674 | - print $langs->trans("ServerConnection") . " (" . $langs->trans("User") . " " . $conf->db->user . ") : ";
|
|
| 674 | + print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
|
|
| 675 | 675 | print $dolibarr_main_db_host; |
| 676 | 676 | print '</td><td>'; |
| 677 | - print '<img src="' . DOL_BASE_URI . '/theme/eldy/img/error.png" alt="Error">'; |
|
| 677 | + print '<img src="'.DOL_BASE_URI.'/theme/eldy/img/error.png" alt="Error">'; |
|
| 678 | 678 | print "</td></tr>"; |
| 679 | 679 | |
| 680 | 680 | // warning message |
| 681 | 681 | print '<tr><td colspan="2"><br>'; |
| 682 | 682 | print $langs->trans("ErrorConnection", $conf->db->host, $conf->db->name, $conf->db->user);
|
| 683 | - print $langs->trans('IfLoginDoesNotExistsCheckCreateUser') . '<br>';
|
|
| 684 | - print $langs->trans("ErrorGoBackAndCorrectParameters") . '<br><br>';
|
|
| 683 | + print $langs->trans('IfLoginDoesNotExistsCheckCreateUser').'<br>';
|
|
| 684 | + print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
|
|
| 685 | 685 | print '</td></tr>'; |
| 686 | 686 | |
| 687 | 687 | $error++; |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | $ret = 0; |
| 713 | 713 | if ($error && isset($argv[1])) |
| 714 | 714 | $ret = 1; |
| 715 | -dolibarr_install_syslog("Exit " . $ret);
|
|
| 715 | +dolibarr_install_syslog("Exit ".$ret);
|
|
| 716 | 716 | |
| 717 | 717 | dolibarr_install_syslog("--- step1: end");
|
| 718 | 718 | |
@@ -734,9 +734,9 @@ discard block |
||
| 734 | 734 | $fp = @fopen("$mainfile", "w");
|
| 735 | 735 | if ($fp) {
|
| 736 | 736 | clearstatcache(); |
| 737 | - fputs($fp, '<?php' . "\n"); |
|
| 737 | + fputs($fp, '<?php'."\n"); |
|
| 738 | 738 | fputs($fp, "// Wrapper to include main into htdocs\n"); |
| 739 | - fputs($fp, "include_once '" . $main_dir . "/main.inc.php';\n"); |
|
| 739 | + fputs($fp, "include_once '".$main_dir."/main.inc.php';\n"); |
|
| 740 | 740 | fclose($fp); |
| 741 | 741 | } |
| 742 | 742 | } |
@@ -753,9 +753,9 @@ discard block |
||
| 753 | 753 | $fp = @fopen("$masterfile", "w");
|
| 754 | 754 | if ($fp) {
|
| 755 | 755 | clearstatcache(); |
| 756 | - fputs($fp, '<?php' . "\n"); |
|
| 756 | + fputs($fp, '<?php'."\n"); |
|
| 757 | 757 | fputs($fp, "// Wrapper to include master into htdocs\n"); |
| 758 | - fputs($fp, "include_once '" . $main_dir . "/master.inc.php';\n"); |
|
| 758 | + fputs($fp, "include_once '".$main_dir."/master.inc.php';\n"); |
|
| 759 | 759 | fclose($fp); |
| 760 | 760 | } |
| 761 | 761 | } |
@@ -790,53 +790,53 @@ discard block |
||
| 790 | 790 | if ($fp) {
|
| 791 | 791 | clearstatcache(); |
| 792 | 792 | |
| 793 | - fputs($fp, '<?php' . "\n"); |
|
| 794 | - fputs($fp, '//' . "\n"); |
|
| 795 | - fputs($fp, '// File generated by Dolibarr installer ' . DOL_VERSION . ' on ' . dol_print_date(dol_now(), '') . "\n"); |
|
| 796 | - fputs($fp, '//' . "\n"); |
|
| 797 | - fputs($fp, '// Take a look at conf.php.example file for an example of ' . $conffiletoshowshort . ' file' . "\n"); |
|
| 798 | - fputs($fp, '// and explanations for all possibles parameters.' . "\n"); |
|
| 799 | - fputs($fp, '//' . "\n"); |
|
| 793 | + fputs($fp, '<?php'."\n"); |
|
| 794 | + fputs($fp, '//'."\n"); |
|
| 795 | + fputs($fp, '// File generated by Dolibarr installer '.DOL_VERSION.' on '.dol_print_date(dol_now(), '')."\n"); |
|
| 796 | + fputs($fp, '//'."\n"); |
|
| 797 | + fputs($fp, '// Take a look at conf.php.example file for an example of '.$conffiletoshowshort.' file'."\n"); |
|
| 798 | + fputs($fp, '// and explanations for all possibles parameters.'."\n"); |
|
| 799 | + fputs($fp, '//'."\n"); |
|
| 800 | 800 | |
| 801 | - fputs($fp, '$dolibarr_main_url_root=\'' . str_replace("'", "\'", trim($main_url)) . '\';');
|
|
| 801 | + fputs($fp, '$dolibarr_main_url_root=\''.str_replace("'", "\'", trim($main_url)).'\';');
|
|
| 802 | 802 | fputs($fp, "\n"); |
| 803 | 803 | |
| 804 | - fputs($fp, '$dolibarr_main_document_root=\'' . str_replace("'", "\'", trim($main_dir)) . '\';');
|
|
| 804 | + fputs($fp, '$dolibarr_main_document_root=\''.str_replace("'", "\'", trim($main_dir)).'\';');
|
|
| 805 | 805 | fputs($fp, "\n"); |
| 806 | 806 | |
| 807 | - fputs($fp, $main_use_alt_dir . '$dolibarr_main_url_root_alt=\'' . str_replace("'", "\'", trim("/" . $main_alt_dir_name)) . '\';');
|
|
| 807 | + fputs($fp, $main_use_alt_dir.'$dolibarr_main_url_root_alt=\''.str_replace("'", "\'", trim("/".$main_alt_dir_name)).'\';');
|
|
| 808 | 808 | fputs($fp, "\n"); |
| 809 | 809 | |
| 810 | - fputs($fp, $main_use_alt_dir . '$dolibarr_main_document_root_alt=\'' . str_replace("'", "\'", trim($main_dir . "/" . $main_alt_dir_name)) . '\';');
|
|
| 810 | + fputs($fp, $main_use_alt_dir.'$dolibarr_main_document_root_alt=\''.str_replace("'", "\'", trim($main_dir."/".$main_alt_dir_name)).'\';');
|
|
| 811 | 811 | fputs($fp, "\n"); |
| 812 | 812 | |
| 813 | - fputs($fp, '$dolibarr_main_data_root=\'' . str_replace("'", "\'", trim($main_data_dir)) . '\';');
|
|
| 813 | + fputs($fp, '$dolibarr_main_data_root=\''.str_replace("'", "\'", trim($main_data_dir)).'\';');
|
|
| 814 | 814 | fputs($fp, "\n"); |
| 815 | 815 | |
| 816 | - fputs($fp, '$dolibarr_main_db_host=\'' . str_replace("'", "\'", trim($db_host)) . '\';');
|
|
| 816 | + fputs($fp, '$dolibarr_main_db_host=\''.str_replace("'", "\'", trim($db_host)).'\';');
|
|
| 817 | 817 | fputs($fp, "\n"); |
| 818 | 818 | |
| 819 | - fputs($fp, '$dolibarr_main_db_port=\'' . str_replace("'", "\'", trim($db_port)) . '\';');
|
|
| 819 | + fputs($fp, '$dolibarr_main_db_port=\''.str_replace("'", "\'", trim($db_port)).'\';');
|
|
| 820 | 820 | fputs($fp, "\n"); |
| 821 | 821 | |
| 822 | - fputs($fp, '$dolibarr_main_db_name=\'' . str_replace("'", "\'", trim($db_name)) . '\';');
|
|
| 822 | + fputs($fp, '$dolibarr_main_db_name=\''.str_replace("'", "\'", trim($db_name)).'\';');
|
|
| 823 | 823 | fputs($fp, "\n"); |
| 824 | 824 | |
| 825 | - fputs($fp, '$dolibarr_main_db_prefix=\'' . str_replace("'", "\'", trim($main_db_prefix)) . '\';');
|
|
| 825 | + fputs($fp, '$dolibarr_main_db_prefix=\''.str_replace("'", "\'", trim($main_db_prefix)).'\';');
|
|
| 826 | 826 | fputs($fp, "\n"); |
| 827 | 827 | |
| 828 | - fputs($fp, '$dolibarr_main_db_user=\'' . str_replace("'", "\'", trim($db_user)) . '\';');
|
|
| 828 | + fputs($fp, '$dolibarr_main_db_user=\''.str_replace("'", "\'", trim($db_user)).'\';');
|
|
| 829 | 829 | fputs($fp, "\n"); |
| 830 | - fputs($fp, '$dolibarr_main_db_pass=\'' . str_replace("'", "\'", trim($db_pass)) . '\';');
|
|
| 830 | + fputs($fp, '$dolibarr_main_db_pass=\''.str_replace("'", "\'", trim($db_pass)).'\';');
|
|
| 831 | 831 | fputs($fp, "\n"); |
| 832 | 832 | |
| 833 | - fputs($fp, '$dolibarr_main_db_type=\'' . str_replace("'", "\'", trim($db_type)) . '\';');
|
|
| 833 | + fputs($fp, '$dolibarr_main_db_type=\''.str_replace("'", "\'", trim($db_type)).'\';');
|
|
| 834 | 834 | fputs($fp, "\n"); |
| 835 | 835 | |
| 836 | - fputs($fp, '$dolibarr_main_db_character_set=\'' . str_replace("'", "\'", trim($db_character_set)) . '\';');
|
|
| 836 | + fputs($fp, '$dolibarr_main_db_character_set=\''.str_replace("'", "\'", trim($db_character_set)).'\';');
|
|
| 837 | 837 | fputs($fp, "\n"); |
| 838 | 838 | |
| 839 | - fputs($fp, '$dolibarr_main_db_collation=\'' . str_replace("'", "\'", trim($db_collation)) . '\';');
|
|
| 839 | + fputs($fp, '$dolibarr_main_db_collation=\''.str_replace("'", "\'", trim($db_collation)).'\';');
|
|
| 840 | 840 | fputs($fp, "\n"); |
| 841 | 841 | |
| 842 | 842 | /* Authentication */ |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | fputs($fp, '$dolibarr_main_prod=\'0\';'); |
| 856 | 856 | fputs($fp, "\n"); |
| 857 | 857 | |
| 858 | - fputs($fp, '$dolibarr_main_force_https=\'' . $main_force_https . '\';'); |
|
| 858 | + fputs($fp, '$dolibarr_main_force_https=\''.$main_force_https.'\';'); |
|
| 859 | 859 | fputs($fp, "\n"); |
| 860 | 860 | |
| 861 | 861 | fputs($fp, '$dolibarr_main_restrict_os_commands=\'mysqldump, mysql, pg_dump, pgrestore\';'); |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | fputs($fp, '$dolibarr_nocsrfcheck=\'0\';'); |
| 865 | 865 | fputs($fp, "\n"); |
| 866 | 866 | |
| 867 | - fputs($fp, '$dolibarr_main_cookie_cryptkey=\'' . $key . '\';'); |
|
| 867 | + fputs($fp, '$dolibarr_main_cookie_cryptkey=\''.$key.'\';'); |
|
| 868 | 868 | fputs($fp, "\n"); |
| 869 | 869 | |
| 870 | 870 | fputs($fp, '$dolibarr_mailing_limit_sendbyweb=\'0\';'); |
@@ -876,85 +876,85 @@ discard block |
||
| 876 | 876 | fputs($fp, '//'); |
| 877 | 877 | $force_dolibarr_lib_FPDF_PATH = ''; |
| 878 | 878 | } |
| 879 | - fputs($fp, '$dolibarr_lib_FPDF_PATH=\'' . $force_dolibarr_lib_FPDF_PATH . '\';'); |
|
| 879 | + fputs($fp, '$dolibarr_lib_FPDF_PATH=\''.$force_dolibarr_lib_FPDF_PATH.'\';'); |
|
| 880 | 880 | fputs($fp, "\n"); |
| 881 | 881 | if (empty($force_dolibarr_lib_TCPDF_PATH)) {
|
| 882 | 882 | fputs($fp, '//'); |
| 883 | 883 | $force_dolibarr_lib_TCPDF_PATH = ''; |
| 884 | 884 | } |
| 885 | - fputs($fp, '$dolibarr_lib_TCPDF_PATH=\'' . $force_dolibarr_lib_TCPDF_PATH . '\';'); |
|
| 885 | + fputs($fp, '$dolibarr_lib_TCPDF_PATH=\''.$force_dolibarr_lib_TCPDF_PATH.'\';'); |
|
| 886 | 886 | fputs($fp, "\n"); |
| 887 | 887 | if (empty($force_dolibarr_lib_FPDI_PATH)) {
|
| 888 | 888 | fputs($fp, '//'); |
| 889 | 889 | $force_dolibarr_lib_FPDI_PATH = ''; |
| 890 | 890 | } |
| 891 | - fputs($fp, '$dolibarr_lib_FPDI_PATH=\'' . $force_dolibarr_lib_FPDI_PATH . '\';'); |
|
| 891 | + fputs($fp, '$dolibarr_lib_FPDI_PATH=\''.$force_dolibarr_lib_FPDI_PATH.'\';'); |
|
| 892 | 892 | fputs($fp, "\n"); |
| 893 | 893 | if (empty($force_dolibarr_lib_TCPDI_PATH)) {
|
| 894 | 894 | fputs($fp, '//'); |
| 895 | 895 | $force_dolibarr_lib_TCPDI_PATH = ''; |
| 896 | 896 | } |
| 897 | - fputs($fp, '$dolibarr_lib_TCPDI_PATH=\'' . $force_dolibarr_lib_TCPDI_PATH . '\';'); |
|
| 897 | + fputs($fp, '$dolibarr_lib_TCPDI_PATH=\''.$force_dolibarr_lib_TCPDI_PATH.'\';'); |
|
| 898 | 898 | fputs($fp, "\n"); |
| 899 | 899 | if (empty($force_dolibarr_lib_ADODB_PATH)) {
|
| 900 | 900 | fputs($fp, '//'); |
| 901 | 901 | $force_dolibarr_lib_ADODB_PATH = ''; |
| 902 | 902 | } |
| 903 | - fputs($fp, '$dolibarr_lib_ADODB_PATH=\'' . $force_dolibarr_lib_ADODB_PATH . '\';'); |
|
| 903 | + fputs($fp, '$dolibarr_lib_ADODB_PATH=\''.$force_dolibarr_lib_ADODB_PATH.'\';'); |
|
| 904 | 904 | fputs($fp, "\n"); |
| 905 | 905 | if (empty($force_dolibarr_lib_GEOIP_PATH)) {
|
| 906 | 906 | fputs($fp, '//'); |
| 907 | 907 | $force_dolibarr_lib_GEOIP_PATH = ''; |
| 908 | 908 | } |
| 909 | - fputs($fp, '$dolibarr_lib_GEOIP_PATH=\'' . $force_dolibarr_lib_GEOIP_PATH . '\';'); |
|
| 909 | + fputs($fp, '$dolibarr_lib_GEOIP_PATH=\''.$force_dolibarr_lib_GEOIP_PATH.'\';'); |
|
| 910 | 910 | fputs($fp, "\n"); |
| 911 | 911 | if (empty($force_dolibarr_lib_NUSOAP_PATH)) {
|
| 912 | 912 | fputs($fp, '//'); |
| 913 | 913 | $force_dolibarr_lib_NUSOAP_PATH = ''; |
| 914 | 914 | } |
| 915 | - fputs($fp, '$dolibarr_lib_NUSOAP_PATH=\'' . $force_dolibarr_lib_NUSOAP_PATH . '\';'); |
|
| 915 | + fputs($fp, '$dolibarr_lib_NUSOAP_PATH=\''.$force_dolibarr_lib_NUSOAP_PATH.'\';'); |
|
| 916 | 916 | fputs($fp, "\n"); |
| 917 | 917 | if (empty($force_dolibarr_lib_PHPEXCEL_PATH)) {
|
| 918 | 918 | fputs($fp, '//'); |
| 919 | 919 | $force_dolibarr_lib_PHPEXCEL_PATH = ''; |
| 920 | 920 | } |
| 921 | - fputs($fp, '$dolibarr_lib_PHPEXCEL_PATH=\'' . $force_dolibarr_lib_PHPEXCEL_PATH . '\';'); |
|
| 921 | + fputs($fp, '$dolibarr_lib_PHPEXCEL_PATH=\''.$force_dolibarr_lib_PHPEXCEL_PATH.'\';'); |
|
| 922 | 922 | fputs($fp, "\n"); |
| 923 | 923 | if (empty($force_dolibarr_lib_ODTPHP_PATH)) {
|
| 924 | 924 | fputs($fp, '//'); |
| 925 | 925 | $force_dolibarr_lib_ODTPHP_PATH = ''; |
| 926 | 926 | } |
| 927 | - fputs($fp, '$dolibarr_lib_ODTPHP_PATH=\'' . $force_dolibarr_lib_ODTPHP_PATH . '\';'); |
|
| 927 | + fputs($fp, '$dolibarr_lib_ODTPHP_PATH=\''.$force_dolibarr_lib_ODTPHP_PATH.'\';'); |
|
| 928 | 928 | fputs($fp, "\n"); |
| 929 | 929 | if (empty($force_dolibarr_lib_ODTPHP_PATHTOPCLZIP)) {
|
| 930 | 930 | fputs($fp, '//'); |
| 931 | 931 | $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP = ''; |
| 932 | 932 | } |
| 933 | - fputs($fp, '$dolibarr_lib_ODTPHP_PATHTOPCLZIP=\'' . $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP . '\';'); |
|
| 933 | + fputs($fp, '$dolibarr_lib_ODTPHP_PATHTOPCLZIP=\''.$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP.'\';'); |
|
| 934 | 934 | fputs($fp, "\n"); |
| 935 | 935 | if (empty($force_dolibarr_js_CKEDITOR)) {
|
| 936 | 936 | fputs($fp, '//'); |
| 937 | 937 | $force_dolibarr_js_CKEDITOR = ''; |
| 938 | 938 | } |
| 939 | - fputs($fp, '$dolibarr_js_CKEDITOR=\'' . $force_dolibarr_js_CKEDITOR . '\';'); |
|
| 939 | + fputs($fp, '$dolibarr_js_CKEDITOR=\''.$force_dolibarr_js_CKEDITOR.'\';'); |
|
| 940 | 940 | fputs($fp, "\n"); |
| 941 | 941 | if (empty($force_dolibarr_js_JQUERY)) {
|
| 942 | 942 | fputs($fp, '//'); |
| 943 | 943 | $force_dolibarr_js_JQUERY = ''; |
| 944 | 944 | } |
| 945 | - fputs($fp, '$dolibarr_js_JQUERY=\'' . $force_dolibarr_js_JQUERY . '\';'); |
|
| 945 | + fputs($fp, '$dolibarr_js_JQUERY=\''.$force_dolibarr_js_JQUERY.'\';'); |
|
| 946 | 946 | fputs($fp, "\n"); |
| 947 | 947 | if (empty($force_dolibarr_js_JQUERY_UI)) {
|
| 948 | 948 | fputs($fp, '//'); |
| 949 | 949 | $force_dolibarr_js_JQUERY_UI = ''; |
| 950 | 950 | } |
| 951 | - fputs($fp, '$dolibarr_js_JQUERY_UI=\'' . $force_dolibarr_js_JQUERY_UI . '\';'); |
|
| 951 | + fputs($fp, '$dolibarr_js_JQUERY_UI=\''.$force_dolibarr_js_JQUERY_UI.'\';'); |
|
| 952 | 952 | fputs($fp, "\n"); |
| 953 | 953 | if (empty($force_dolibarr_js_JQUERY_FLOT)) {
|
| 954 | 954 | fputs($fp, '//'); |
| 955 | 955 | $force_dolibarr_js_JQUERY_FLOT = ''; |
| 956 | 956 | } |
| 957 | - fputs($fp, '$dolibarr_js_JQUERY_FLOT=\'' . $force_dolibarr_js_JQUERY_FLOT . '\';'); |
|
| 957 | + fputs($fp, '$dolibarr_js_JQUERY_FLOT=\''.$force_dolibarr_js_JQUERY_FLOT.'\';'); |
|
| 958 | 958 | fputs($fp, "\n"); |
| 959 | 959 | |
| 960 | 960 | // Write params to overwrites default font path |
@@ -963,13 +963,13 @@ discard block |
||
| 963 | 963 | fputs($fp, '//'); |
| 964 | 964 | $force_dolibarr_font_DOL_DEFAULT_TTF = ''; |
| 965 | 965 | } |
| 966 | - fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF=\'' . $force_dolibarr_font_DOL_DEFAULT_TTF . '\';'); |
|
| 966 | + fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF=\''.$force_dolibarr_font_DOL_DEFAULT_TTF.'\';'); |
|
| 967 | 967 | fputs($fp, "\n"); |
| 968 | 968 | if (empty($force_dolibarr_font_DOL_DEFAULT_TTF_BOLD)) {
|
| 969 | 969 | fputs($fp, '//'); |
| 970 | 970 | $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD = ''; |
| 971 | 971 | } |
| 972 | - fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\'' . $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD . '\';'); |
|
| 972 | + fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\''.$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD.'\';'); |
|
| 973 | 973 | fputs($fp, "\n"); |
| 974 | 974 | |
| 975 | 975 | fclose($fp); |
@@ -980,9 +980,9 @@ discard block |
||
| 980 | 980 | |
| 981 | 981 | print "<tr><td>"; |
| 982 | 982 | print $langs->trans("SaveConfigurationFile");
|
| 983 | - print ' <strong>' . $conffile . '</strong>'; |
|
| 983 | + print ' <strong>'.$conffile.'</strong>'; |
|
| 984 | 984 | print "</td><td>"; |
| 985 | - print '<img src="' . DOL_BASE_URI . '/theme/eldy/img/tick.png" alt="Ok">'; |
|
| 985 | + print '<img src="'.DOL_BASE_URI.'/theme/eldy/img/tick.png" alt="Ok">'; |
|
| 986 | 986 | print "</td></tr>"; |
| 987 | 987 | } else {
|
| 988 | 988 | $error++; |
@@ -227,18 +227,21 @@ discard block |
||
| 227 | 227 | if (empty($db_create_database) && $db->connected && !$db->database_selected) {
|
| 228 | 228 | print '<div class="error">' . $langs->trans("ErrorConnectedButDatabaseNotFound", $db_name) . '</div>';
|
| 229 | 229 | print '<br>'; |
| 230 | - if (!$db->connected) |
|
| 231 | - print $langs->trans("IfDatabaseNotExistsGoBackAndUncheckCreate") . '<br><br>';
|
|
| 230 | + if (!$db->connected) { |
|
| 231 | + print $langs->trans("IfDatabaseNotExistsGoBackAndUncheckCreate") . '<br><br>'; |
|
| 232 | + } |
|
| 232 | 233 | print $langs->trans("ErrorGoBackAndCorrectParameters");
|
| 233 | 234 | $error++; |
| 234 | 235 | } elseif ($db->error && !(!empty($db_create_database) && $db->connected)) {
|
| 235 | 236 | // Note: you may experience error here with message "No such file or directory" when mysql was installed for the first time but not yet launched. |
| 236 | - if ($db->error == "No such file or directory") |
|
| 237 | - print '<div class="error">' . $langs->trans("ErrorToConnectToMysqlCheckInstance") . '</div>';
|
|
| 238 | - else |
|
| 239 | - print '<div class="error">' . $db->error . '</div>'; |
|
| 240 | - if (!$db->connected) |
|
| 241 | - print $langs->trans("BecauseConnectionFailedParametersMayBeWrong") . '<br><br>';
|
|
| 237 | + if ($db->error == "No such file or directory") { |
|
| 238 | + print '<div class="error">' . $langs->trans("ErrorToConnectToMysqlCheckInstance") . '</div>'; |
|
| 239 | + } else { |
|
| 240 | + print '<div class="error">' . $db->error . '</div>'; |
|
| 241 | + } |
|
| 242 | + if (!$db->connected) { |
|
| 243 | + print $langs->trans("BecauseConnectionFailedParametersMayBeWrong") . '<br><br>'; |
|
| 244 | + } |
|
| 242 | 245 | //print '<a href="#" onClick="javascript: history.back();">'; |
| 243 | 246 | print $langs->trans("ErrorGoBackAndCorrectParameters");
|
| 244 | 247 | //print '</a>'; |
@@ -251,16 +254,16 @@ discard block |
||
| 251 | 254 | |
| 252 | 255 | if ($db->error) {
|
| 253 | 256 | print '<div class="error">' . $db->error . '</div>'; |
| 254 | - if (!$db->connected) |
|
| 255 | - print $langs->trans("BecauseConnectionFailedParametersMayBeWrong") . '<br><br>';
|
|
| 257 | + if (!$db->connected) { |
|
| 258 | + print $langs->trans("BecauseConnectionFailedParametersMayBeWrong") . '<br><br>'; |
|
| 259 | + } |
|
| 256 | 260 | //print '<a href="#" onClick="javascript: history.back();">'; |
| 257 | 261 | print $langs->trans("ErrorGoBackAndCorrectParameters");
|
| 258 | 262 | //print '</a>'; |
| 259 | 263 | $error++; |
| 260 | 264 | } |
| 261 | 265 | } |
| 262 | - } |
|
| 263 | - else {
|
|
| 266 | + } else {
|
|
| 264 | 267 | print "<br>\nFailed to include_once(\"" . $main_dir . "/core/db/" . $db_type . ".class.php\")<br>\n"; |
| 265 | 268 | print '<div class="error">' . $langs->trans("ErrorWrongValueForParameter", $langs->transnoentities("WebPagesDirectory")) . '</div>';
|
| 266 | 269 | //print '<a href="#" onClick="javascript: history.back();">'; |
@@ -269,10 +272,12 @@ discard block |
||
| 269 | 272 | $error++; |
| 270 | 273 | } |
| 271 | 274 | } else {
|
| 272 | - if (isset($db)) |
|
| 273 | - print $db->lasterror(); |
|
| 274 | - if (isset($db) && !$db->connected) |
|
| 275 | - print '<br>' . $langs->trans("BecauseConnectionFailedParametersMayBeWrong") . '<br><br>';
|
|
| 275 | + if (isset($db)) { |
|
| 276 | + print $db->lasterror(); |
|
| 277 | + } |
|
| 278 | + if (isset($db) && !$db->connected) { |
|
| 279 | + print '<br>' . $langs->trans("BecauseConnectionFailedParametersMayBeWrong") . '<br><br>'; |
|
| 280 | + } |
|
| 276 | 281 | print $langs->trans("ErrorGoBackAndCorrectParameters");
|
| 277 | 282 | $error++; |
| 278 | 283 | } |
@@ -710,8 +715,9 @@ discard block |
||
| 710 | 715 | |
| 711 | 716 | <?php |
| 712 | 717 | $ret = 0; |
| 713 | -if ($error && isset($argv[1])) |
|
| 714 | - $ret = 1; |
|
| 718 | +if ($error && isset($argv[1])) { |
|
| 719 | + $ret = 1; |
|
| 720 | +} |
|
| 715 | 721 | dolibarr_install_syslog("Exit " . $ret);
|
| 716 | 722 | |
| 717 | 723 | dolibarr_install_syslog("--- step1: end");
|
@@ -719,8 +725,9 @@ discard block |
||
| 719 | 725 | pFooter($error ? 1 : 0, $setuplang, 'jsinfo', 1); |
| 720 | 726 | |
| 721 | 727 | // Return code if ran from command line |
| 722 | -if ($ret) |
|
| 723 | - exit($ret); |
|
| 728 | +if ($ret) { |
|
| 729 | + exit($ret); |
|
| 730 | +} |
|
| 724 | 731 | |
| 725 | 732 | /** |
| 726 | 733 | * Create main file. No particular permissions are set by installer. |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | if (file_exists($conffile)) {
|
| 31 | 31 | include_once $conffile; |
| 32 | 32 | } |
| 33 | -require_once $dolibarr_main_document_root . '/core/lib/admin.lib.php'; |
|
| 34 | -require_once $dolibarr_main_document_root . '/core/lib/security.lib.php'; // for dol_hash |
|
| 33 | +require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; |
|
| 34 | +require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; // for dol_hash |
|
| 35 | 35 | |
| 36 | 36 | global $langs; |
| 37 | 37 | |
@@ -43,14 +43,14 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | // Define targetversion used to update MAIN_VERSION_LAST_INSTALL for first install |
| 45 | 45 | // or MAIN_VERSION_LAST_UPGRADE for upgrade. |
| 46 | -$targetversion = DOL_VERSION; // If it's latest upgrade |
|
| 46 | +$targetversion = DOL_VERSION; // If it's latest upgrade |
|
| 47 | 47 | if (!empty($action) && preg_match('/upgrade/i', $action)) { // If it's an old upgrade
|
| 48 | 48 | $tmp = explode('_', $action, 2);
|
| 49 | 49 | if ($tmp[0] == 'upgrade') {
|
| 50 | 50 | if (!empty($tmp[1])) {
|
| 51 | - $targetversion = $tmp[1]; // if $action = 'upgrade_6.0.0-beta', we use '6.0.0-beta' |
|
| 51 | + $targetversion = $tmp[1]; // if $action = 'upgrade_6.0.0-beta', we use '6.0.0-beta' |
|
| 52 | 52 | } else {
|
| 53 | - $targetversion = DOL_VERSION; // if $action = 'upgrade', we use DOL_VERSION |
|
| 53 | + $targetversion = DOL_VERSION; // if $action = 'upgrade', we use DOL_VERSION |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | } |
@@ -91,17 +91,17 @@ discard block |
||
| 91 | 91 | // If install, check password and password_verification used to create admin account |
| 92 | 92 | if ($action == "set") {
|
| 93 | 93 | if ($pass <> $pass_verif) {
|
| 94 | - header("Location: ?controller=install&method=step4&error=1&selectlang=$setuplang" . (isset($login) ? '&login=' . $login : ''));
|
|
| 94 | + header("Location: ?controller=install&method=step4&error=1&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
|
|
| 95 | 95 | exit; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | if (dol_strlen(trim($pass)) == 0) {
|
| 99 | - header("Location: ?controller=install&method=step4&error=2&selectlang=$setuplang" . (isset($login) ? '&login=' . $login : ''));
|
|
| 99 | + header("Location: ?controller=install&method=step4&error=2&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
|
|
| 100 | 100 | exit; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | if (dol_strlen(trim($login)) == 0) {
|
| 104 | - header("Location: ?controller=install&method=step4&error=3&selectlang=$setuplang" . (isset($login) ? '&login=' . $login : ''));
|
|
| 104 | + header("Location: ?controller=install&method=step4&error=3&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
|
|
| 105 | 105 | exit; |
| 106 | 106 | } |
| 107 | 107 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | // If password is encoded, we decode it |
| 128 | 128 | if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass)) {
|
| 129 | - require_once $dolibarr_main_document_root . '/core/lib/security.lib.php'; |
|
| 129 | + require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; |
|
| 130 | 130 | if (preg_match('/crypted:/i', $dolibarr_main_db_pass)) {
|
| 131 | 131 | $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass);
|
| 132 | 132 | $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | // Create the global $hookmanager object |
| 150 | 150 | //include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; |
| 151 | - include_once DOL_BASE_PATH . '/core/class/hookmanager.class.php'; |
|
| 151 | + include_once DOL_BASE_PATH.'/core/class/hookmanager.class.php'; |
|
| 152 | 152 | $hookmanager = new HookManager($db); |
| 153 | 153 | |
| 154 | 154 | $ok = 0; |
@@ -157,15 +157,15 @@ discard block |
||
| 157 | 157 | if ($action == "set") {
|
| 158 | 158 | // Active module user |
| 159 | 159 | $modName = 'modUser'; |
| 160 | - $file = $modName . ".class.php"; |
|
| 161 | - dolibarr_install_syslog('step5: load module user ' . DOL_BASE_PATH . "/core/modules/" . $file, LOG_INFO);
|
|
| 160 | + $file = $modName.".class.php"; |
|
| 161 | + dolibarr_install_syslog('step5: load module user '.DOL_BASE_PATH."/core/modules/".$file, LOG_INFO);
|
|
| 162 | 162 | //include_once DOL_DOCUMENT_ROOT ."/core/modules/".$file; |
| 163 | - die(DOL_BASE_PATH . "/core/modules/" . $file); |
|
| 164 | - include_once DOL_BASE_PATH . "/core/modules/" . $file; |
|
| 163 | + die(DOL_BASE_PATH."/core/modules/".$file); |
|
| 164 | + include_once DOL_BASE_PATH."/core/modules/".$file; |
|
| 165 | 165 | $objMod = new $modName($db); |
| 166 | 166 | $result = $objMod->init(); |
| 167 | 167 | if (!$result) {
|
| 168 | - print 'ERROR in activating module file=' . $file; |
|
| 168 | + print 'ERROR in activating module file='.$file; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | if ($db->connected) {
|
@@ -178,25 +178,25 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | // Create admin user |
| 180 | 180 | //include_once DOL_DOCUMENT_ROOT .'/user/class/user.class.php'; |
| 181 | - include_once DOL_BASE_PATH . '/user/class/user.class.php'; |
|
| 181 | + include_once DOL_BASE_PATH.'/user/class/user.class.php'; |
|
| 182 | 182 | |
| 183 | 183 | // Set default encryption to yes, generate a salt and set default encryption algorythm (but only if there is no user yet into database) |
| 184 | 184 | $sql = "SELECT u.rowid, u.pass, u.pass_crypted"; |
| 185 | - $sql .= " FROM " . MAIN_DB_PREFIX . "user as u"; |
|
| 185 | + $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; |
|
| 186 | 186 | $resql = $db->query($sql); |
| 187 | 187 | if ($resql) {
|
| 188 | 188 | $numrows = $db->num_rows($resql); |
| 189 | 189 | if ($numrows == 0) {
|
| 190 | 190 | // Define default setup for password encryption |
| 191 | 191 | dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity); |
| 192 | - dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities |
|
| 192 | + dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities |
|
| 193 | 193 | if (function_exists('password_hash')) {
|
| 194 | - dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); // All entities |
|
| 194 | + dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); // All entities |
|
| 195 | 195 | } else {
|
| 196 | - dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities |
|
| 196 | + dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities |
|
| 197 | 197 | } |
| 198 | 198 | } |
| 199 | - dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = ' . $conf->global->DATABASE_PWD_ENCRYPTED . ' MAIN_SECURITY_HASH_ALGO = ' . $conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO);
|
|
| 199 | + dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = '.$conf->global->DATABASE_PWD_ENCRYPTED.' MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO);
|
|
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | // Create user used to create the admin user |
@@ -213,27 +213,27 @@ discard block |
||
| 213 | 213 | $newuser->admin = 1; |
| 214 | 214 | $newuser->entity = 0; |
| 215 | 215 | |
| 216 | - $conf->global->USER_MAIL_REQUIRED = 0; // Force global option to be sure to create a new user with no email |
|
| 216 | + $conf->global->USER_MAIL_REQUIRED = 0; // Force global option to be sure to create a new user with no email |
|
| 217 | 217 | $result = $newuser->create($createuser, 1); |
| 218 | 218 | if ($result > 0) {
|
| 219 | - print $langs->trans("AdminLoginCreatedSuccessfuly", $login) . "<br>";
|
|
| 219 | + print $langs->trans("AdminLoginCreatedSuccessfuly", $login)."<br>";
|
|
| 220 | 220 | $success = 1; |
| 221 | 221 | } else {
|
| 222 | 222 | if ($newuser->error == 'ErrorLoginAlreadyExists') {
|
| 223 | 223 | dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING);
|
| 224 | - print '<br><div class="warning">' . $langs->trans("AdminLoginAlreadyExists", $login) . "</div><br>";
|
|
| 224 | + print '<br><div class="warning">'.$langs->trans("AdminLoginAlreadyExists", $login)."</div><br>";
|
|
| 225 | 225 | $success = 1; |
| 226 | 226 | } else {
|
| 227 | - dolibarr_install_syslog('step5: FailedToCreateAdminLogin ' . $newuser->error, LOG_ERR);
|
|
| 228 | - print '<br><div class="error">' . $langs->trans("FailedToCreateAdminLogin") . ' ' . $newuser->error . '</div><br><br>';
|
|
| 227 | + dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR);
|
|
| 228 | + print '<br><div class="error">'.$langs->trans("FailedToCreateAdminLogin").' '.$newuser->error.'</div><br><br>';
|
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | if ($success) {
|
| 233 | 233 | // Insert MAIN_VERSION_FIRST_INSTALL in a dedicated transaction. So if it fails (when first install was already done), we can do other following requests. |
| 234 | 234 | $db->begin(); |
| 235 | - dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to ' . $targetversion, LOG_DEBUG);
|
|
| 236 | - $resql = $db->query("INSERT INTO " . MAIN_DB_PREFIX . "const(name,value,type,visible,note,entity) values(" . $db->encrypt('MAIN_VERSION_FIRST_INSTALL', 1) . "," . $db->encrypt($targetversion, 1) . ",'chaine',0,'Dolibarr version when first install',0)");
|
|
| 235 | + dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to '.$targetversion, LOG_DEBUG);
|
|
| 236 | + $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_FIRST_INSTALL', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version when first install',0)");
|
|
| 237 | 237 | if ($resql) {
|
| 238 | 238 | $conf->global->MAIN_VERSION_FIRST_INSTALL = $targetversion; |
| 239 | 239 | $db->commit(); |
@@ -244,12 +244,12 @@ discard block |
||
| 244 | 244 | |
| 245 | 245 | $db->begin(); |
| 246 | 246 | |
| 247 | - dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to ' . $targetversion, LOG_DEBUG);
|
|
| 248 | - $resql = $db->query("DELETE FROM " . MAIN_DB_PREFIX . "const WHERE " . $db->decrypt('name') . "='MAIN_VERSION_LAST_INSTALL'");
|
|
| 247 | + dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to '.$targetversion, LOG_DEBUG);
|
|
| 248 | + $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'");
|
|
| 249 | 249 | if (!$resql) {
|
| 250 | 250 | dol_print_error($db, 'Error in setup program'); |
| 251 | 251 | } |
| 252 | - $resql = $db->query("INSERT INTO " . MAIN_DB_PREFIX . "const(name,value,type,visible,note,entity) values(" . $db->encrypt('MAIN_VERSION_LAST_INSTALL', 1) . "," . $db->encrypt($targetversion, 1) . ",'chaine',0,'Dolibarr version when last install',0)");
|
|
| 252 | + $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version when last install',0)");
|
|
| 253 | 253 | if (!$resql) {
|
| 254 | 254 | dol_print_error($db, 'Error in setup program'); |
| 255 | 255 | } |
@@ -257,11 +257,11 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | if ($useforcedwizard) {
|
| 259 | 259 | dolibarr_install_syslog('step5: set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG);
|
| 260 | - $resql = $db->query("DELETE FROM " . MAIN_DB_PREFIX . "const WHERE " . $db->decrypt('name') . "='MAIN_REMOVE_INSTALL_WARNING'");
|
|
| 260 | + $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_REMOVE_INSTALL_WARNING'");
|
|
| 261 | 261 | if (!$resql) {
|
| 262 | 262 | dol_print_error($db, 'Error in setup program'); |
| 263 | 263 | } |
| 264 | - $resql = $db->query("INSERT INTO " . MAIN_DB_PREFIX . "const(name,value,type,visible,note,entity) values(" . $db->encrypt('MAIN_REMOVE_INSTALL_WARNING', 1) . "," . $db->encrypt(1, 1) . ",'chaine',1,'Disable install warnings',0)");
|
|
| 264 | + $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_REMOVE_INSTALL_WARNING', 1).",".$db->encrypt(1, 1).",'chaine',1,'Disable install warnings',0)");
|
|
| 265 | 265 | if (!$resql) {
|
| 266 | 266 | dol_print_error($db, 'Error in setup program'); |
| 267 | 267 | } |
@@ -278,20 +278,20 @@ discard block |
||
| 278 | 278 | $tmparray = explode(',', $force_install_module);
|
| 279 | 279 | foreach ($tmparray as $modtoactivate) {
|
| 280 | 280 | $modtoactivatenew = preg_replace('/\.class\.php$/i', '', $modtoactivate);
|
| 281 | - print $langs->trans("ActivateModule", $modtoactivatenew) . '<br>';
|
|
| 281 | + print $langs->trans("ActivateModule", $modtoactivatenew).'<br>';
|
|
| 282 | 282 | |
| 283 | - $file = $modtoactivatenew . '.class.php'; |
|
| 284 | - dolibarr_install_syslog('step5: activate module file=' . $file);
|
|
| 285 | - $res = dol_include_once("/core/modules/" . $file);
|
|
| 283 | + $file = $modtoactivatenew.'.class.php'; |
|
| 284 | + dolibarr_install_syslog('step5: activate module file='.$file);
|
|
| 285 | + $res = dol_include_once("/core/modules/".$file);
|
|
| 286 | 286 | |
| 287 | 287 | $res = activateModule($modtoactivatenew, 1); |
| 288 | 288 | if (!empty($res['errors'])) |
| 289 | - print 'ERROR in activating module file=' . $file; |
|
| 289 | + print 'ERROR in activating module file='.$file; |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | dolibarr_install_syslog('step5: remove MAIN_NOT_INSTALLED const');
|
| 294 | - $resql = $db->query("DELETE FROM " . MAIN_DB_PREFIX . "const WHERE " . $db->decrypt('name') . "='MAIN_NOT_INSTALLED'");
|
|
| 294 | + $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_NOT_INSTALLED'");
|
|
| 295 | 295 | if (!$resql) {
|
| 296 | 296 | dol_print_error($db, 'Error in setup program'); |
| 297 | 297 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | $db->commit(); |
| 300 | 300 | } |
| 301 | 301 | } else {
|
| 302 | - print $langs->trans("ErrorFailedToConnect") . "<br>";
|
|
| 302 | + print $langs->trans("ErrorFailedToConnect")."<br>";
|
|
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | // If upgrade |
@@ -325,28 +325,28 @@ discard block |
||
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | if ($tagdatabase) {
|
| 328 | - dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_UPGRADE const to value ' . $targetversion);
|
|
| 329 | - $resql = $db->query("DELETE FROM " . MAIN_DB_PREFIX . "const WHERE " . $db->decrypt('name') . "='MAIN_VERSION_LAST_UPGRADE'");
|
|
| 328 | + dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_UPGRADE const to value '.$targetversion);
|
|
| 329 | + $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_UPGRADE'");
|
|
| 330 | 330 | if (!$resql) {
|
| 331 | 331 | dol_print_error($db, 'Error in setup program'); |
| 332 | 332 | } |
| 333 | - $resql = $db->query("INSERT INTO " . MAIN_DB_PREFIX . "const(name,value,type,visible,note,entity) VALUES (" . $db->encrypt('MAIN_VERSION_LAST_UPGRADE', 1) . "," . $db->encrypt($targetversion, 1) . ",'chaine',0,'Dolibarr version for last upgrade',0)");
|
|
| 333 | + $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_VERSION_LAST_UPGRADE', 1).",".$db->encrypt($targetversion, 1).",'chaine',0,'Dolibarr version for last upgrade',0)");
|
|
| 334 | 334 | if (!$resql) {
|
| 335 | 335 | dol_print_error($db, 'Error in setup program'); |
| 336 | 336 | } |
| 337 | 337 | $conf->global->MAIN_VERSION_LAST_UPGRADE = $targetversion; |
| 338 | 338 | } else {
|
| 339 | - dolibarr_install_syslog('step5: we run an upgrade to version ' . $targetversion . ' but database was already upgraded to ' . $conf->global->MAIN_VERSION_LAST_UPGRADE . '. We keep MAIN_VERSION_LAST_UPGRADE as it is.');
|
|
| 339 | + dolibarr_install_syslog('step5: we run an upgrade to version '.$targetversion.' but database was already upgraded to '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'. We keep MAIN_VERSION_LAST_UPGRADE as it is.');
|
|
| 340 | 340 | } |
| 341 | 341 | } else {
|
| 342 | - print $langs->trans("ErrorFailedToConnect") . "<br>";
|
|
| 342 | + print $langs->trans("ErrorFailedToConnect")."<br>";
|
|
| 343 | 343 | } |
| 344 | 344 | } else {
|
| 345 | 345 | dol_print_error('', 'step5.php: unknown choice of action');
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | // May fail if parameter already defined |
| 349 | - $resql = $db->query("INSERT INTO " . MAIN_DB_PREFIX . "const(name,value,type,visible,note,entity) VALUES (" . $db->encrypt('MAIN_LANG_DEFAULT', 1) . "," . $db->encrypt($setuplang, 1) . ",'chaine',0,'Default language',1)");
|
|
| 349 | + $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_LANG_DEFAULT', 1).",".$db->encrypt($setuplang, 1).",'chaine',0,'Default language',1)");
|
|
| 350 | 350 | //if (! $resql) dol_print_error($db,'Error in setup program'); |
| 351 | 351 | |
| 352 | 352 | $db->close(); |
@@ -359,44 +359,44 @@ discard block |
||
| 359 | 359 | if ($action == "set" && $success) {
|
| 360 | 360 | if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
|
| 361 | 361 | // Install is finished |
| 362 | - print $langs->trans("SystemIsInstalled") . "<br>";
|
|
| 362 | + print $langs->trans("SystemIsInstalled")."<br>";
|
|
| 363 | 363 | |
| 364 | 364 | $createlock = 0; |
| 365 | 365 | |
| 366 | 366 | if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
|
| 367 | 367 | // Install is finished, we create the lock file |
| 368 | - $lockfile = DOL_DATA_ROOT . '/install.lock'; |
|
| 368 | + $lockfile = DOL_DATA_ROOT.'/install.lock'; |
|
| 369 | 369 | $fp = @fopen($lockfile, "w"); |
| 370 | 370 | if ($fp) {
|
| 371 | 371 | if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
|
| 372 | - $force_install_lockinstall = 444; // For backward compatibility |
|
| 372 | + $force_install_lockinstall = 444; // For backward compatibility |
|
| 373 | 373 | } |
| 374 | - fwrite($fp, "This is a lock file to prevent use of install pages (set with permission " . $force_install_lockinstall . ")"); |
|
| 374 | + fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); |
|
| 375 | 375 | fclose($fp); |
| 376 | 376 | @chmod($lockfile, octdec($force_install_lockinstall)); |
| 377 | 377 | $createlock = 1; |
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | 380 | if (empty($createlock)) {
|
| 381 | - print '<div class="warning">' . $langs->trans("WarningRemoveInstallDir") . "</div>";
|
|
| 381 | + print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
|
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | print "<br>"; |
| 385 | 385 | |
| 386 | - print $langs->trans("YouNeedToPersonalizeSetup") . "<br><br>";
|
|
| 386 | + print $langs->trans("YouNeedToPersonalizeSetup")."<br><br>";
|
|
| 387 | 387 | |
| 388 | 388 | //print '<div class="center"><a href="../admin/index.php?mainmenu=home&leftmenu=setup' . (isset($login) ? '&username=' . urlencode($login) : '') . '">'; |
| 389 | - print '<div class="center"><a href="' . BASE_URI . '?mainmenu=home&leftmenu=setup' . (isset($login) ? '&username=' . urlencode($login) : '') . '">'; |
|
| 389 | + print '<div class="center"><a href="'.BASE_URI.'?mainmenu=home&leftmenu=setup'.(isset($login) ? '&username='.urlencode($login) : '').'">'; |
|
| 390 | 390 | print $langs->trans("GoToSetupArea");
|
| 391 | 391 | print '</a></div>'; |
| 392 | 392 | } else {
|
| 393 | 393 | // If here MAIN_VERSION_LAST_UPGRADE is not empty |
| 394 | - print $langs->trans("VersionLastUpgrade") . ': <b><span class="ok">' . $conf->global->MAIN_VERSION_LAST_UPGRADE . '</span></b><br>';
|
|
| 395 | - print $langs->trans("VersionProgram") . ': <b><span class="ok">' . DOL_VERSION . '</span></b><br>';
|
|
| 396 | - print $langs->trans("MigrationNotFinished") . '<br>';
|
|
| 394 | + print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
|
|
| 395 | + print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b><br>';
|
|
| 396 | + print $langs->trans("MigrationNotFinished").'<br>';
|
|
| 397 | 397 | print "<br>"; |
| 398 | 398 | |
| 399 | - print '<div class="center"><a href="' . $dolibarr_main_url_root . '/install/index.php">'; |
|
| 399 | + print '<div class="center"><a href="'.$dolibarr_main_url_root.'/install/index.php">'; |
|
| 400 | 400 | print $langs->trans("GoToUpgradePage");
|
| 401 | 401 | print '</a></div>'; |
| 402 | 402 | } |
@@ -405,37 +405,37 @@ discard block |
||
| 405 | 405 | elseif (empty($action) || preg_match('/upgrade/i', $action)) {
|
| 406 | 406 | if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
|
| 407 | 407 | // Upgrade is finished |
| 408 | - print $langs->trans("SystemIsUpgraded") . "<br>";
|
|
| 408 | + print $langs->trans("SystemIsUpgraded")."<br>";
|
|
| 409 | 409 | |
| 410 | 410 | $createlock = 0; |
| 411 | 411 | |
| 412 | 412 | if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
|
| 413 | 413 | // Upgrade is finished, we create the lock file |
| 414 | - $lockfile = DOL_DATA_ROOT . '/install.lock'; |
|
| 414 | + $lockfile = DOL_DATA_ROOT.'/install.lock'; |
|
| 415 | 415 | $fp = @fopen($lockfile, "w"); |
| 416 | 416 | if ($fp) {
|
| 417 | 417 | if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
|
| 418 | - $force_install_lockinstall = 444; // For backward compatibility |
|
| 418 | + $force_install_lockinstall = 444; // For backward compatibility |
|
| 419 | 419 | } |
| 420 | - fwrite($fp, "This is a lock file to prevent use of install pages (set with permission " . $force_install_lockinstall . ")"); |
|
| 420 | + fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")"); |
|
| 421 | 421 | fclose($fp); |
| 422 | 422 | @chmod($lockfile, octdec($force_install_lockinstall)); |
| 423 | 423 | $createlock = 1; |
| 424 | 424 | } |
| 425 | 425 | } |
| 426 | 426 | if (empty($createlock)) {
|
| 427 | - print '<br><div class="warning">' . $langs->trans("WarningRemoveInstallDir") . "</div>";
|
|
| 427 | + print '<br><div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
|
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | print "<br><br>"; |
| 431 | 431 | |
| 432 | - print '<div class="center"><a href="' . BASE_URI . '/index.php?mainmenu=home' . (isset($login) ? '&username=' . urlencode($login) : '') . '">'; |
|
| 433 | - print $langs->trans("GoToDolibarr") . '...';
|
|
| 432 | + print '<div class="center"><a href="'.BASE_URI.'/index.php?mainmenu=home'.(isset($login) ? '&username='.urlencode($login) : '').'">'; |
|
| 433 | + print $langs->trans("GoToDolibarr").'...';
|
|
| 434 | 434 | print '</a></div><br>'; |
| 435 | 435 | } else {
|
| 436 | 436 | // If here MAIN_VERSION_LAST_UPGRADE is not empty |
| 437 | - print $langs->trans("VersionLastUpgrade") . ': <b><span class="ok">' . $conf->global->MAIN_VERSION_LAST_UPGRADE . '</span></b><br>';
|
|
| 438 | - print $langs->trans("VersionProgram") . ': <b><span class="ok">' . DOL_VERSION . '</span></b>';
|
|
| 437 | + print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
|
|
| 438 | + print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b>';
|
|
| 439 | 439 | |
| 440 | 440 | print "<br>"; |
| 441 | 441 | |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | if ($error && isset($argv[1])) {
|
| 455 | 455 | $ret = 1; |
| 456 | 456 | } |
| 457 | -dolibarr_install_syslog("Exit " . $ret);
|
|
| 457 | +dolibarr_install_syslog("Exit ".$ret);
|
|
| 458 | 458 | |
| 459 | 459 | dolibarr_install_syslog("- step5: Dolibarr setup finished");
|
| 460 | 460 | |
@@ -131,8 +131,9 @@ discard block |
||
| 131 | 131 | $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass);
|
| 132 | 132 | $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); |
| 133 | 133 | $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted |
| 134 | - } else |
|
| 135 | - $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); |
|
| 134 | + } else { |
|
| 135 | + $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); |
|
| 136 | + } |
|
| 136 | 137 | } |
| 137 | 138 | |
| 138 | 139 | $conf->db->type = $dolibarr_main_db_type; |
@@ -285,8 +286,9 @@ discard block |
||
| 285 | 286 | $res = dol_include_once("/core/modules/" . $file);
|
| 286 | 287 | |
| 287 | 288 | $res = activateModule($modtoactivatenew, 1); |
| 288 | - if (!empty($res['errors'])) |
|
| 289 | - print 'ERROR in activating module file=' . $file; |
|
| 289 | + if (!empty($res['errors'])) { |
|
| 290 | + print 'ERROR in activating module file=' . $file; |
|
| 291 | + } |
|
| 290 | 292 | } |
| 291 | 293 | } |
| 292 | 294 | |
@@ -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 | } |
@@ -146,14 +146,14 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | define('MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : '')); |
| 148 | 148 | |
| 149 | -define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir |
|
| 150 | -define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root : DOL_BASE_PATH . '../documents')); |
|
| 151 | -define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : '')); // URL relative root |
|
| 152 | -$uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* |
|
| 153 | -$suburi = strstr($uri, '/'); // $suburi contains url without domain |
|
| 149 | +define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir |
|
| 150 | +define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root : DOL_BASE_PATH.'../documents')); |
|
| 151 | +define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : '')); // URL relative root |
|
| 152 | +$uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* |
|
| 153 | +$suburi = strstr($uri, '/'); // $suburi contains url without domain |
|
| 154 | 154 | if ($suburi == '/') |
| 155 | - $suburi = ''; // If $suburi is /, it is now '' |
|
| 156 | -define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) |
|
| 155 | + $suburi = ''; // If $suburi is /, it is now '' |
|
| 156 | +define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) |
|
| 157 | 157 | |
| 158 | 158 | |
| 159 | 159 | if (empty($conf->file->character_set_client)) |
@@ -189,14 +189,14 @@ discard block |
||
| 189 | 189 | $langs->load("install"); |
| 190 | 190 | print $langs->trans("YouTryInstallDisabledByDirLock"); |
| 191 | 191 | if (!empty($dolibarr_main_url_root)) { |
| 192 | - 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 | + 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"]) : '').'">'; |
|
| 193 | 193 | print $langs->trans("ClickHereToGoToApp"); |
| 194 | 194 | print '</a>'; |
| 195 | 195 | } |
| 196 | 196 | exit; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | -$lockfile = DOL_DATA_ROOT . '/install.lock'; |
|
| 199 | +$lockfile = DOL_DATA_ROOT.'/install.lock'; |
|
| 200 | 200 | if (constant('DOL_DATA_ROOT') === null) { |
| 201 | 201 | // We don't have a configuration file yet |
| 202 | 202 | // Try to detect any lockfile in the default documents path |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | $langs->load("install"); |
| 211 | 211 | print $langs->trans("YouTryInstallDisabledByFileLock"); |
| 212 | 212 | if (!empty($dolibarr_main_url_root)) { |
| 213 | - print $langs->trans("ClickOnLinkOrRemoveManualy") . '<br>'; |
|
| 214 | - print '<a href="' . $dolibarr_main_url_root . '/admin/index.php?mainmenu=home&leftmenu=setup' . (isset($_POST["login"]) ? '&username=' . urlencode($_POST["login"]) : '') . '">'; |
|
| 213 | + print $langs->trans("ClickOnLinkOrRemoveManualy").'<br>'; |
|
| 214 | + print '<a href="'.$dolibarr_main_url_root.'/admin/index.php?mainmenu=home&leftmenu=setup'.(isset($_POST["login"]) ? '&username='.urlencode($_POST["login"]) : '').'">'; |
|
| 215 | 215 | print $langs->trans("ClickHereToGoToApp"); |
| 216 | 216 | print '</a>'; |
| 217 | 217 | } else { |
@@ -230,13 +230,13 @@ discard block |
||
| 230 | 230 | if (@is_writable('/tmp')) |
| 231 | 231 | define('SYSLOG_FILE', '/tmp/dolibarr_install.log'); |
| 232 | 232 | else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) |
| 233 | - define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log'); |
|
| 233 | + define('SYSLOG_FILE', $_ENV["TMP"].'/dolibarr_install.log'); |
|
| 234 | 234 | else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) |
| 235 | - define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log'); |
|
| 235 | + define('SYSLOG_FILE', $_ENV["TEMP"].'/dolibarr_install.log'); |
|
| 236 | 236 | else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) |
| 237 | 237 | define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp |
| 238 | 238 | else if (@is_writable('../../')) |
| 239 | - define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others |
|
| 239 | + define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others |
|
| 240 | 240 | |
| 241 | 241 | |
| 242 | 242 | |
@@ -261,9 +261,9 @@ discard block |
||
| 261 | 261 | // We init log handler for install |
| 262 | 262 | $handlers = array('mod_syslog_file'); |
| 263 | 263 | foreach ($handlers as $handler) { |
| 264 | - $file = DOL_BASE_PATH . '/core/modules/syslog/' . $handler . '.php'; |
|
| 264 | + $file = DOL_BASE_PATH.'/core/modules/syslog/'.$handler.'.php'; |
|
| 265 | 265 | if (!file_exists($file)) { |
| 266 | - throw new Exception('Missing log handler file ' . $handler . '.php'); |
|
| 266 | + throw new Exception('Missing log handler file '.$handler.'.php'); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | require_once $file; |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | global $dolibarr_main_db_pass; |
| 324 | 324 | global $character_set_client; |
| 325 | 325 | |
| 326 | - $return = include_once $dolibarr_main_document_root . '/core/class/conf.class.php'; |
|
| 326 | + $return = include_once $dolibarr_main_document_root.'/core/class/conf.class.php'; |
|
| 327 | 327 | if (!$return) |
| 328 | 328 | return -1; |
| 329 | 329 | |
@@ -363,13 +363,13 @@ discard block |
||
| 363 | 363 | if (@is_writable('/tmp')) |
| 364 | 364 | define('SYSLOG_FILE', '/tmp/dolibarr_install.log'); |
| 365 | 365 | else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) |
| 366 | - define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log'); |
|
| 366 | + define('SYSLOG_FILE', $_ENV["TMP"].'/dolibarr_install.log'); |
|
| 367 | 367 | else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) |
| 368 | - define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log'); |
|
| 368 | + define('SYSLOG_FILE', $_ENV["TEMP"].'/dolibarr_install.log'); |
|
| 369 | 369 | else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) |
| 370 | 370 | define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp |
| 371 | 371 | else if (@is_writable('../../')) |
| 372 | - define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others |
|
| 372 | + define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others |
|
| 373 | 373 | |
| 374 | 374 | |
| 375 | 375 | |
@@ -394,9 +394,9 @@ discard block |
||
| 394 | 394 | // We init log handler for install |
| 395 | 395 | $handlers = array('mod_syslog_file'); |
| 396 | 396 | foreach ($handlers as $handler) { |
| 397 | - $file = DOL_BASE_PATH . '/core/modules/syslog/' . $handler . '.php'; |
|
| 397 | + $file = DOL_BASE_PATH.'/core/modules/syslog/'.$handler.'.php'; |
|
| 398 | 398 | if (!file_exists($file)) { |
| 399 | - throw new Exception('Missing log handler file ' . $handler . '.php'); |
|
| 399 | + throw new Exception('Missing log handler file '.$handler.'.php'); |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | require_once $file; |
@@ -442,64 +442,64 @@ discard block |
||
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | // We force the content charset |
| 445 | - header("Content-type: text/html; charset=" . $conf->file->character_set_client); |
|
| 445 | + header("Content-type: text/html; charset=".$conf->file->character_set_client); |
|
| 446 | 446 | header("X-Content-Type-Options: nosniff"); |
| 447 | 447 | |
| 448 | - print '<!DOCTYPE HTML>' . "\n"; |
|
| 449 | - print '<html>' . "\n"; |
|
| 450 | - print '<head>' . "\n"; |
|
| 451 | - print '<meta charset="' . $conf->file->character_set_client . '">' . "\n"; |
|
| 452 | - print '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\n"; |
|
| 453 | - print '<meta name="generator" content="Dolibarr installer">' . "\n"; |
|
| 454 | - print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/install/default.css">' . "\n"; |
|
| 448 | + print '<!DOCTYPE HTML>'."\n"; |
|
| 449 | + print '<html>'."\n"; |
|
| 450 | + print '<head>'."\n"; |
|
| 451 | + print '<meta charset="'.$conf->file->character_set_client.'">'."\n"; |
|
| 452 | + print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n"; |
|
| 453 | + print '<meta name="generator" content="Dolibarr installer">'."\n"; |
|
| 454 | + print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/install/default.css">'."\n"; |
|
| 455 | 455 | |
| 456 | - print '<!-- Includes CSS for JQuery -->' . "\n"; |
|
| 456 | + print '<!-- Includes CSS for JQuery -->'."\n"; |
|
| 457 | 457 | if ($jQueryUiCustomPath) { |
| 458 | - print '<link rel="stylesheet" type="text/css" href="' . $jQueryUiCustomPath . 'css/' . $jquerytheme . '/jquery-ui.min.css" />' . "\n"; // JQuery |
|
| 458 | + print '<link rel="stylesheet" type="text/css" href="'.$jQueryUiCustomPath.'css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery |
|
| 459 | 459 | } else { |
| 460 | 460 | //print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.min.css" />' . "\n"; // JQuery |
| 461 | - print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.min.css" />' . "\n"; // JQuery |
|
| 461 | + print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui.min.css" />'."\n"; // JQuery |
|
| 462 | 462 | } |
| 463 | - print '<!-- Includes JS for JQuery -->' . "\n"; |
|
| 463 | + print '<!-- Includes JS for JQuery -->'."\n"; |
|
| 464 | 464 | if ($jQueryCustomPath) { |
| 465 | - print '<script type="text/javascript" src="' . $jQueryCustomPath . 'jquery.min.js"></script>' . "\n"; |
|
| 465 | + print '<script type="text/javascript" src="'.$jQueryCustomPath.'jquery.min.js"></script>'."\n"; |
|
| 466 | 466 | } else { |
| 467 | 467 | // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery.min.js"></script>' . "\n"; |
| 468 | - print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jquery/jquery.min.js"></script>' . "\n"; |
|
| 468 | + print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jquery/jquery.min.js"></script>'."\n"; |
|
| 469 | 469 | } |
| 470 | 470 | if ($jQueryUiCustomPath) { |
| 471 | - print '<script type="text/javascript" src="' . $jQueryUiCustomPath . 'jquery-ui.min.js"></script>' . "\n"; |
|
| 471 | + print '<script type="text/javascript" src="'.$jQueryUiCustomPath.'jquery-ui.min.js"></script>'."\n"; |
|
| 472 | 472 | } else { |
| 473 | 473 | // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-ui.min.js"></script>' . "\n"; |
| 474 | - print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jqueryui/jquery-ui.min.js"></script>' . "\n"; |
|
| 474 | + print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jqueryui/jquery-ui.min.js"></script>'."\n"; |
|
| 475 | 475 | } |
| 476 | - print '<title>' . $langs->trans("DolibarrSetup") . '</title>' . "\n"; |
|
| 476 | + print '<title>'.$langs->trans("DolibarrSetup").'</title>'."\n"; |
|
| 477 | 477 | print "<!-- Alixar debugBar header -->"; |
| 478 | 478 | print Debug::getRenderHeader(); // Includes Alixar debugBar header |
| 479 | - print '</head>' . "\n"; |
|
| 479 | + print '</head>'."\n"; |
|
| 480 | 480 | |
| 481 | - print '<body>' . "\n"; |
|
| 481 | + print '<body>'."\n"; |
|
| 482 | 482 | |
| 483 | 483 | print '<div class="divlogoinstall" style="text-align:center">'; |
| 484 | - print '<img class="imglogoinstall" src="' . DOL_BASE_URI . '/theme/dolibarr_logo.png" alt="Dolibarr logo"><br>'; |
|
| 484 | + print '<img class="imglogoinstall" src="'.DOL_BASE_URI.'/theme/dolibarr_logo.png" alt="Dolibarr logo"><br>'; |
|
| 485 | 485 | print DOL_VERSION; |
| 486 | 486 | print '</div><br>'; |
| 487 | 487 | |
| 488 | - print '<span class="titre">' . $langs->trans("DolibarrSetup"); |
|
| 488 | + print '<span class="titre">'.$langs->trans("DolibarrSetup"); |
|
| 489 | 489 | if ($subtitle) { |
| 490 | - print ' - ' . $subtitle; |
|
| 490 | + print ' - '.$subtitle; |
|
| 491 | 491 | } |
| 492 | - print '</span>' . "\n"; |
|
| 492 | + print '</span>'."\n"; |
|
| 493 | 493 | |
| 494 | 494 | //print '<form name="forminstall" style="width: 100%" action="' . $next . '.php' . ($param ? '?' . $param : '') . '" method="POST">' . "\n"; |
| 495 | - print '<form name="forminstall" style="width: 100%" href="' . BASE_URI . '?controller=install&method=' . $next . ($param ? '&' . $param : '') . '" method="POST">' . "\n"; |
|
| 496 | - print '<input type="hidden" name="next" value="' . $next . '">' . "\n"; |
|
| 497 | - print '<input type="hidden" name="testpost" value="ok">' . "\n"; |
|
| 498 | - print '<input type="hidden" name="action" value="' . $action . '">' . "\n"; |
|
| 495 | + print '<form name="forminstall" style="width: 100%" href="'.BASE_URI.'?controller=install&method='.$next.($param ? '&'.$param : '').'" method="POST">'."\n"; |
|
| 496 | + print '<input type="hidden" name="next" value="'.$next.'">'."\n"; |
|
| 497 | + print '<input type="hidden" name="testpost" value="ok">'."\n"; |
|
| 498 | + print '<input type="hidden" name="action" value="'.$action.'">'."\n"; |
|
| 499 | 499 | |
| 500 | - print '<table class="main" width="100%"><tr><td>' . "\n"; |
|
| 500 | + print '<table class="main" width="100%"><tr><td>'."\n"; |
|
| 501 | 501 | |
| 502 | - print '<table class="' . $csstable . '" width="100%"><tr><td>' . "\n"; |
|
| 502 | + print '<table class="'.$csstable.'" width="100%"><tr><td>'."\n"; |
|
| 503 | 503 | } |
| 504 | 504 | |
| 505 | 505 | /** |
@@ -519,29 +519,29 @@ discard block |
||
| 519 | 519 | $langs->load("other"); |
| 520 | 520 | $langs->load("admin"); |
| 521 | 521 | |
| 522 | - print '</td></tr></table>' . "\n"; |
|
| 523 | - print '</td></tr></table>' . "\n"; |
|
| 522 | + print '</td></tr></table>'."\n"; |
|
| 523 | + print '</td></tr></table>'."\n"; |
|
| 524 | 524 | |
| 525 | 525 | if (!$nonext || ($nonext == '2')) { |
| 526 | 526 | print '<div class="nextbutton" id="nextbutton">'; |
| 527 | 527 | if ($nonext == '2') { |
| 528 | - print $langs->trans("ErrorFoundDuringMigration", isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] . '&ignoreerrors=1' : '') . '<br><br>'; |
|
| 528 | + print $langs->trans("ErrorFoundDuringMigration", isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"].'&ignoreerrors=1' : '').'<br><br>'; |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | - print '<input type="submit" ' . ($nonext == '2' ? 'disabled="disabled" ' : '') . 'value="' . $langs->trans("NextStep") . ' ->"'; |
|
| 531 | + print '<input type="submit" '.($nonext == '2' ? 'disabled="disabled" ' : '').'value="'.$langs->trans("NextStep").' ->"'; |
|
| 532 | 532 | if ($jscheckfunction) { |
| 533 | - print ' onClick="return ' . $jscheckfunction . '();"'; |
|
| 533 | + print ' onClick="return '.$jscheckfunction.'();"'; |
|
| 534 | 534 | } |
| 535 | 535 | print '></div>'; |
| 536 | 536 | if ($withpleasewait) { |
| 537 | - print '<div style="visibility: hidden;" class="pleasewait" id="pleasewait"><br>' . $langs->trans("NextStepMightLastALongTime") . '<br><br><div class="blinkwait">' . $langs->trans("PleaseBePatient") . '</div></div>'; |
|
| 537 | + print '<div style="visibility: hidden;" class="pleasewait" id="pleasewait"><br>'.$langs->trans("NextStepMightLastALongTime").'<br><br><div class="blinkwait">'.$langs->trans("PleaseBePatient").'</div></div>'; |
|
| 538 | 538 | } |
| 539 | 539 | } |
| 540 | 540 | if ($setuplang) { |
| 541 | - print '<input type="hidden" name="selectlang" value="' . $setuplang . '">'; |
|
| 541 | + print '<input type="hidden" name="selectlang" value="'.$setuplang.'">'; |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | - print '</form>' . "\n"; |
|
| 544 | + print '</form>'."\n"; |
|
| 545 | 545 | |
| 546 | 546 | // If there is some logs in buffer to show |
| 547 | 547 | if (isset($conf->logbuffer) && count($conf->logbuffer)) { |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | print "<!-- Start of log output\n"; |
| 550 | 550 | //print '<div class="hidden">'."\n"; |
| 551 | 551 | foreach ($conf->logbuffer as $logline) { |
| 552 | - print $logline . "<br>\n"; |
|
| 552 | + print $logline."<br>\n"; |
|
| 553 | 553 | } |
| 554 | 554 | //print '</div>'."\n"; |
| 555 | 555 | print "End of log output -->\n"; |
@@ -558,8 +558,8 @@ discard block |
||
| 558 | 558 | |
| 559 | 559 | print "<!-- Alixar debugBar footer -->"; |
| 560 | 560 | print Debug::getRenderFooter(); // Includes Alixar debugBar footer |
| 561 | - print '</body>' . "\n"; |
|
| 562 | - print '</html>' . "\n"; |
|
| 561 | + print '</body>'."\n"; |
|
| 562 | + print '</html>'."\n"; |
|
| 563 | 563 | } |
| 564 | 564 | |
| 565 | 565 | /** |
@@ -624,16 +624,16 @@ discard block |
||
| 624 | 624 | $dolibarr_main_url_root = $_SERVER["SCRIPT_URI"]; |
| 625 | 625 | } // If defined (Ie: Apache with Caudium) |
| 626 | 626 | elseif (isset($_SERVER["SERVER_URL"]) && isset($_SERVER["DOCUMENT_URI"])) { |
| 627 | - $dolibarr_main_url_root = $_SERVER["SERVER_URL"] . $_SERVER["DOCUMENT_URI"]; |
|
| 627 | + $dolibarr_main_url_root = $_SERVER["SERVER_URL"].$_SERVER["DOCUMENT_URI"]; |
|
| 628 | 628 | } // If SCRIPT_URI, SERVER_URL, DOCUMENT_URI not defined (Ie: Apache 2.0.44 for Windows) |
| 629 | 629 | else { |
| 630 | - $proto = ( (!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') || $_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http'; |
|
| 630 | + $proto = ((!empty($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == 'on') || $_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http'; |
|
| 631 | 631 | if (!empty($_SERVER["HTTP_HOST"])) { |
| 632 | 632 | $serverport = $_SERVER["HTTP_HOST"]; |
| 633 | 633 | } else { |
| 634 | 634 | $serverport = $_SERVER["SERVER_NAME"]; |
| 635 | 635 | } |
| 636 | - $dolibarr_main_url_root = $proto . "://" . $serverport . $_SERVER["SCRIPT_NAME"]; |
|
| 636 | + $dolibarr_main_url_root = $proto."://".$serverport.$_SERVER["SCRIPT_NAME"]; |
|
| 637 | 637 | } |
| 638 | 638 | // Clean proposed URL |
| 639 | 639 | // 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'; |
@@ -151,23 +152,31 @@ discard block |
||
| 151 | 152 | define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : '')); // URL relative root |
| 152 | 153 | $uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* |
| 153 | 154 | $suburi = strstr($uri, '/'); // $suburi contains url without domain |
| 154 | -if ($suburi == '/') |
|
| 155 | - $suburi = ''; // If $suburi is /, it is now '' |
|
| 155 | +if ($suburi == '/') { |
|
| 156 | + $suburi = ''; |
|
| 157 | +} |
|
| 158 | +// If $suburi is /, it is now '' |
|
| 156 | 159 | define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) |
| 157 | 160 | |
| 158 | 161 | |
| 159 | -if (empty($conf->file->character_set_client)) |
|
| 162 | +if (empty($conf->file->character_set_client)) { |
|
| 160 | 163 | $conf->file->character_set_client = "utf-8"; |
| 161 | -if (empty($conf->db->character_set)) |
|
| 164 | +} |
|
| 165 | +if (empty($conf->db->character_set)) { |
|
| 162 | 166 | $conf->db->character_set = 'utf8'; |
| 163 | -if (empty($conf->db->dolibarr_main_db_collation)) |
|
| 167 | +} |
|
| 168 | +if (empty($conf->db->dolibarr_main_db_collation)) { |
|
| 164 | 169 | $conf->db->dolibarr_main_db_collation = 'utf8_unicode_ci'; |
| 165 | -if (empty($conf->db->dolibarr_main_db_encryption)) |
|
| 170 | +} |
|
| 171 | +if (empty($conf->db->dolibarr_main_db_encryption)) { |
|
| 166 | 172 | $conf->db->dolibarr_main_db_encryption = 0; |
| 167 | -if (empty($conf->db->dolibarr_main_db_cryptkey)) |
|
| 173 | +} |
|
| 174 | +if (empty($conf->db->dolibarr_main_db_cryptkey)) { |
|
| 168 | 175 | $conf->db->dolibarr_main_db_cryptkey = ''; |
| 169 | -if (empty($conf->db->user)) |
|
| 176 | +} |
|
| 177 | +if (empty($conf->db->user)) { |
|
| 170 | 178 | $conf->db->user = ''; |
| 179 | +} |
|
| 171 | 180 | |
| 172 | 181 | // Define array of document root directories |
| 173 | 182 | $conf->file->dol_document_root = array(DOL_DOCUMENT_ROOT); |
@@ -224,19 +233,24 @@ discard block |
||
| 224 | 233 | // Force usage of log file for install and upgrades |
| 225 | 234 | $conf->syslog->enabled = 1; |
| 226 | 235 | $conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG'); |
| 227 | -if (!defined('SYSLOG_HANDLERS')) |
|
| 236 | +if (!defined('SYSLOG_HANDLERS')) { |
|
| 228 | 237 | define('SYSLOG_HANDLERS', '["mod_syslog_file"]'); |
| 238 | +} |
|
| 229 | 239 | if (!defined('SYSLOG_FILE')) { // To avoid warning on systems with constant already defined |
| 230 | - if (@is_writable('/tmp')) |
|
| 231 | - define('SYSLOG_FILE', '/tmp/dolibarr_install.log'); |
|
| 232 | - else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) |
|
| 233 | - define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log'); |
|
| 234 | - else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) |
|
| 235 | - define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log'); |
|
| 236 | - else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) |
|
| 237 | - define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp |
|
| 238 | - else if (@is_writable('../../')) |
|
| 239 | - 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 |
|
| 240 | 254 | |
| 241 | 255 | |
| 242 | 256 | |
@@ -254,10 +268,12 @@ discard block |
||
| 254 | 268 | |
| 255 | 269 | //print 'SYSLOG_FILE='.SYSLOG_FILE;exit; |
| 256 | 270 | } |
| 257 | -if (defined('SYSLOG_FILE')) |
|
| 271 | +if (defined('SYSLOG_FILE')) { |
|
| 258 | 272 | $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
| 259 | -if (!defined('SYSLOG_FILE_NO_ERROR')) |
|
| 273 | +} |
|
| 274 | +if (!defined('SYSLOG_FILE_NO_ERROR')) { |
|
| 260 | 275 | define('SYSLOG_FILE_NO_ERROR', 1); |
| 276 | +} |
|
| 261 | 277 | // We init log handler for install |
| 262 | 278 | $handlers = array('mod_syslog_file'); |
| 263 | 279 | foreach ($handlers as $handler) { |
@@ -272,9 +288,10 @@ discard block |
||
| 272 | 288 | throw new Exception('Log handler does not extend LogHandlerInterface'); |
| 273 | 289 | } |
| 274 | 290 | |
| 275 | - if (empty($conf->loghandlers[$handler])) |
|
| 276 | - $conf->loghandlers[$handler] = $loghandlerinstance; |
|
| 277 | -} |
|
| 291 | + if (empty($conf->loghandlers[$handler])) { |
|
| 292 | + $conf->loghandlers[$handler] = $loghandlerinstance; |
|
| 293 | + } |
|
| 294 | + } |
|
| 278 | 295 | |
| 279 | 296 | // Removed magic_quotes |
| 280 | 297 | if (function_exists('get_magic_quotes_gpc')) { // magic_quotes_* removed in PHP 5.4 |
@@ -298,10 +315,11 @@ discard block |
||
| 298 | 315 | |
| 299 | 316 | // Defini objet langs |
| 300 | 317 | $langs = new Translate('..', $conf); |
| 301 | -if (GETPOST('lang', 'aZ09')) |
|
| 318 | +if (GETPOST('lang', 'aZ09')) { |
|
| 302 | 319 | $langs->setDefaultLang(GETPOST('lang', 'aZ09')); |
| 303 | -else |
|
| 320 | +} else { |
|
| 304 | 321 | $langs->setDefaultLang('auto'); |
| 322 | +} |
|
| 305 | 323 | |
| 306 | 324 | $bc[false] = ' class="bg1"'; |
| 307 | 325 | $bc[true] = ' class="bg2"'; |
@@ -324,8 +342,9 @@ discard block |
||
| 324 | 342 | global $character_set_client; |
| 325 | 343 | |
| 326 | 344 | $return = include_once $dolibarr_main_document_root . '/core/class/conf.class.php'; |
| 327 | - if (!$return) |
|
| 328 | - return -1; |
|
| 345 | + if (!$return) { |
|
| 346 | + return -1; |
|
| 347 | + } |
|
| 329 | 348 | |
| 330 | 349 | $conf = new Conf(); |
| 331 | 350 | $conf->db->type = trim($dolibarr_main_db_type); |
@@ -336,40 +355,51 @@ discard block |
||
| 336 | 355 | $conf->db->pass = trim($dolibarr_main_db_pass); |
| 337 | 356 | |
| 338 | 357 | // Mysql driver support has been removed in favor of mysqli |
| 339 | - if ($conf->db->type == 'mysql') |
|
| 340 | - $conf->db->type = 'mysqli'; |
|
| 341 | - if (empty($character_set_client)) |
|
| 342 | - $character_set_client = "UTF-8"; |
|
| 358 | + if ($conf->db->type == 'mysql') { |
|
| 359 | + $conf->db->type = 'mysqli'; |
|
| 360 | + } |
|
| 361 | + if (empty($character_set_client)) { |
|
| 362 | + $character_set_client = "UTF-8"; |
|
| 363 | + } |
|
| 343 | 364 | $conf->file->character_set_client = strtoupper($character_set_client); |
| 344 | - if (empty($dolibarr_main_db_character_set)) |
|
| 345 | - $dolibarr_main_db_character_set = ($conf->db->type == 'mysqli' ? 'utf8' : ''); |
|
| 365 | + if (empty($dolibarr_main_db_character_set)) { |
|
| 366 | + $dolibarr_main_db_character_set = ($conf->db->type == 'mysqli' ? 'utf8' : ''); |
|
| 367 | + } |
|
| 346 | 368 | $conf->db->character_set = $dolibarr_main_db_character_set; |
| 347 | - if (empty($dolibarr_main_db_collation)) |
|
| 348 | - $dolibarr_main_db_collation = ($conf->db->type == 'mysqli' ? 'utf8_unicode_ci' : ''); |
|
| 369 | + if (empty($dolibarr_main_db_collation)) { |
|
| 370 | + $dolibarr_main_db_collation = ($conf->db->type == 'mysqli' ? 'utf8_unicode_ci' : ''); |
|
| 371 | + } |
|
| 349 | 372 | $conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation; |
| 350 | - if (empty($dolibarr_main_db_encryption)) |
|
| 351 | - $dolibarr_main_db_encryption = 0; |
|
| 373 | + if (empty($dolibarr_main_db_encryption)) { |
|
| 374 | + $dolibarr_main_db_encryption = 0; |
|
| 375 | + } |
|
| 352 | 376 | $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption; |
| 353 | - if (empty($dolibarr_main_db_cryptkey)) |
|
| 354 | - $dolibarr_main_db_cryptkey = ''; |
|
| 377 | + if (empty($dolibarr_main_db_cryptkey)) { |
|
| 378 | + $dolibarr_main_db_cryptkey = ''; |
|
| 379 | + } |
|
| 355 | 380 | $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; |
| 356 | 381 | |
| 357 | 382 | // Force usage of log file for install and upgrades |
| 358 | 383 | $conf->syslog->enabled = 1; |
| 359 | 384 | $conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG'); |
| 360 | - if (!defined('SYSLOG_HANDLERS')) |
|
| 361 | - define('SYSLOG_HANDLERS', '["mod_syslog_file"]'); |
|
| 385 | + if (!defined('SYSLOG_HANDLERS')) { |
|
| 386 | + define('SYSLOG_HANDLERS', '["mod_syslog_file"]'); |
|
| 387 | + } |
|
| 362 | 388 | if (!defined('SYSLOG_FILE')) { // To avoid warning on systems with constant already defined |
| 363 | - if (@is_writable('/tmp')) |
|
| 364 | - define('SYSLOG_FILE', '/tmp/dolibarr_install.log'); |
|
| 365 | - else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) |
|
| 366 | - define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log'); |
|
| 367 | - else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) |
|
| 368 | - define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log'); |
|
| 369 | - else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) |
|
| 370 | - define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp |
|
| 371 | - else if (@is_writable('../../')) |
|
| 372 | - define('SYSLOG_FILE', '../../dolibarr_install.log'); // For others |
|
| 389 | + if (@is_writable('/tmp')) { |
|
| 390 | + define('SYSLOG_FILE', '/tmp/dolibarr_install.log'); |
|
| 391 | + } else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) { |
|
| 392 | + define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log'); |
|
| 393 | + } else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) { |
|
| 394 | + define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log'); |
|
| 395 | + } else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat')) { |
|
| 396 | + define('SYSLOG_FILE', '../../../../dolibarr_install.log'); |
|
| 397 | + } |
|
| 398 | + // For DoliWamp |
|
| 399 | + else if (@is_writable('../../')) { |
|
| 400 | + define('SYSLOG_FILE', '../../dolibarr_install.log'); |
|
| 401 | + } |
|
| 402 | + // For others |
|
| 373 | 403 | |
| 374 | 404 | |
| 375 | 405 | |
@@ -387,10 +417,12 @@ discard block |
||
| 387 | 417 | |
| 388 | 418 | //print 'SYSLOG_FILE='.SYSLOG_FILE;exit; |
| 389 | 419 | } |
| 390 | - if (defined('SYSLOG_FILE')) |
|
| 391 | - $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
|
| 392 | - if (!defined('SYSLOG_FILE_NO_ERROR')) |
|
| 393 | - define('SYSLOG_FILE_NO_ERROR', 1); |
|
| 420 | + if (defined('SYSLOG_FILE')) { |
|
| 421 | + $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); |
|
| 422 | + } |
|
| 423 | + if (!defined('SYSLOG_FILE_NO_ERROR')) { |
|
| 424 | + define('SYSLOG_FILE_NO_ERROR', 1); |
|
| 425 | + } |
|
| 394 | 426 | // We init log handler for install |
| 395 | 427 | $handlers = array('mod_syslog_file'); |
| 396 | 428 | foreach ($handlers as $handler) { |
@@ -405,8 +437,9 @@ discard block |
||
| 405 | 437 | throw new Exception('Log handler does not extend LogHandlerInterface'); |
| 406 | 438 | } |
| 407 | 439 | |
| 408 | - if (empty($conf->loghandlers[$handler])) |
|
| 409 | - $conf->loghandlers[$handler] = $loghandlerinstance; |
|
| 440 | + if (empty($conf->loghandlers[$handler])) { |
|
| 441 | + $conf->loghandlers[$handler] = $loghandlerinstance; |
|
| 442 | + } |
|
| 410 | 443 | } |
| 411 | 444 | |
| 412 | 445 | return 1; |
@@ -571,8 +604,9 @@ discard block |
||
| 571 | 604 | */ |
| 572 | 605 | function dolibarr_install_syslog($message, $level = LOG_DEBUG) |
| 573 | 606 | { |
| 574 | - if (!defined('LOG_DEBUG')) |
|
| 575 | - define('LOG_DEBUG', 6); |
|
| 607 | + if (!defined('LOG_DEBUG')) { |
|
| 608 | + define('LOG_DEBUG', 6); |
|
| 609 | + } |
|
| 576 | 610 | dol_syslog($message, $level); |
| 577 | 611 | } |
| 578 | 612 | |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | * \brief Create tables, primary keys, foreign keys, indexes and functions into database and then load reference data |
| 26 | 26 | */ |
| 27 | 27 | include 'inc.php'; |
| 28 | -require_once $dolibarr_main_document_root . '/core/class/conf.class.php'; |
|
| 29 | -require_once $dolibarr_main_document_root . '/core/lib/admin.lib.php'; |
|
| 28 | +require_once $dolibarr_main_document_root.'/core/class/conf.class.php'; |
|
| 29 | +require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; |
|
| 30 | 30 | |
| 31 | 31 | global $langs; |
| 32 | 32 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | // Cette page peut etre longue. On augmente le delai autorise. |
| 38 | 38 | // Ne fonctionne que si on est pas en safe_mode. |
| 39 | 39 | $err = error_reporting(); |
| 40 | -error_reporting(0); // Disable all errors |
|
| 40 | +error_reporting(0); // Disable all errors |
|
| 41 | 41 | //error_reporting(E_ALL); |
| 42 | 42 | @set_time_limit(900); // Need 900 on some OS like Windows 7/64 |
| 43 | 43 | error_reporting($err); |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | if ($action == "set") {
|
| 91 | - print '<h3><img class="valigntextbottom" src="' . DOL_BASE_URI . '/theme/common/octicons/build/svg/database.svg" width="20" alt="Database"> ' . $langs->trans("Database") . '</h3>';
|
|
| 91 | + print '<h3><img class="valigntextbottom" src="'.DOL_BASE_URI.'/theme/common/octicons/build/svg/database.svg" width="20" alt="Database"> '.$langs->trans("Database").'</h3>';
|
|
| 92 | 92 | |
| 93 | 93 | print '<table cellspacing="0" style="padding: 4px 4px 4px 0" border="0" width="100%">'; |
| 94 | 94 | $error = 0; |
@@ -97,18 +97,18 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | if ($db->connected) {
|
| 99 | 99 | print "<tr><td>"; |
| 100 | - print $langs->trans("ServerConnection") . " : " . $conf->db->host . '</td><td><img src="' . DOL_BASE_URI . '/theme/eldy/img/tick.png" alt="Ok"></td></tr>';
|
|
| 100 | + print $langs->trans("ServerConnection")." : ".$conf->db->host.'</td><td><img src="'.DOL_BASE_URI.'/theme/eldy/img/tick.png" alt="Ok"></td></tr>';
|
|
| 101 | 101 | $ok = 1; |
| 102 | 102 | } else {
|
| 103 | - print "<tr><td>Failed to connect to server : " . $conf->db->host . '</td><td><img src="' . DOL_BASE_URI . '/theme/eldy/img/error.png" alt="Error"></td></tr>'; |
|
| 103 | + print "<tr><td>Failed to connect to server : ".$conf->db->host.'</td><td><img src="'.DOL_BASE_URI.'/theme/eldy/img/error.png" alt="Error"></td></tr>'; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | if ($ok) {
|
| 107 | 107 | if ($db->database_selected) {
|
| 108 | - dolibarr_install_syslog("step2: successful connection to database: " . $conf->db->name);
|
|
| 108 | + dolibarr_install_syslog("step2: successful connection to database: ".$conf->db->name);
|
|
| 109 | 109 | } else {
|
| 110 | - dolibarr_install_syslog("step2: failed connection to database :" . $conf->db->name, LOG_ERR);
|
|
| 111 | - print "<tr><td>Failed to select database " . $conf->db->name . '</td><td><img src="' . DOL_BASE_URI . '/theme/eldy/img/error.png" alt="Error"></td></tr>'; |
|
| 110 | + dolibarr_install_syslog("step2: failed connection to database :".$conf->db->name, LOG_ERR);
|
|
| 111 | + print "<tr><td>Failed to select database ".$conf->db->name.'</td><td><img src="'.DOL_BASE_URI.'/theme/eldy/img/error.png" alt="Error"></td></tr>'; |
|
| 112 | 112 | $ok = 0; |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -118,12 +118,12 @@ discard block |
||
| 118 | 118 | if ($ok) {
|
| 119 | 119 | $version = $db->getVersion(); |
| 120 | 120 | $versionarray = $db->getVersionArray(); |
| 121 | - print '<tr><td>' . $langs->trans("DatabaseVersion") . '</td>';
|
|
| 122 | - print '<td>' . $version . '</td></tr>'; |
|
| 121 | + print '<tr><td>'.$langs->trans("DatabaseVersion").'</td>';
|
|
| 122 | + print '<td>'.$version.'</td></tr>'; |
|
| 123 | 123 | //print '<td align="right">'.join('.',$versionarray).'</td></tr>';
|
| 124 | 124 | |
| 125 | - print '<tr><td>' . $langs->trans("DatabaseName") . '</td>';
|
|
| 126 | - print '<td>' . $db->database_name . '</td></tr>'; |
|
| 125 | + print '<tr><td>'.$langs->trans("DatabaseName").'</td>';
|
|
| 126 | + print '<td>'.$db->database_name.'</td></tr>'; |
|
| 127 | 127 | //print '<td align="right">'.join('.',$versionarray).'</td></tr>';
|
| 128 | 128 | } |
| 129 | 129 | |
@@ -150,12 +150,12 @@ discard block |
||
| 150 | 150 | if ($ok && $createtables) {
|
| 151 | 151 | // We always choose in mysql directory (Conversion is done by driver to translate SQL syntax) |
| 152 | 152 | //$dir = "mysql/tables/"; |
| 153 | - $dir = DOL_BASE_PATH . "/install/mysql/tables/"; |
|
| 153 | + $dir = DOL_BASE_PATH."/install/mysql/tables/"; |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | $ok = 0; |
| 157 | 157 | $handle = opendir($dir); |
| 158 | - dolibarr_install_syslog("step2: open tables directory " . $dir . " handle=" . $handle);
|
|
| 158 | + dolibarr_install_syslog("step2: open tables directory ".$dir." handle=".$handle);
|
|
| 159 | 159 | $tablefound = 0; |
| 160 | 160 | $tabledata = array(); |
| 161 | 161 | if (is_resource($handle)) {
|
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | foreach ($tabledata as $file) {
|
| 174 | 174 | $name = substr($file, 0, dol_strlen($file) - 4); |
| 175 | 175 | $buffer = ''; |
| 176 | - $fp = fopen($dir . $file, "r"); |
|
| 176 | + $fp = fopen($dir.$file, "r"); |
|
| 177 | 177 | if ($fp) {
|
| 178 | 178 | while (!feof($fp)) {
|
| 179 | 179 | $buf = fgets($fp, 4096); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | //print "<tr><td>Creation de la table $name/td>"; |
| 203 | 203 | $requestnb++; |
| 204 | 204 | |
| 205 | - dolibarr_install_syslog("step2: request: " . $buffer);
|
|
| 205 | + dolibarr_install_syslog("step2: request: ".$buffer);
|
|
| 206 | 206 | $resql = $db->query($buffer, 0, 'dml'); |
| 207 | 207 | if ($resql) {
|
| 208 | 208 | // print "<td>OK requete ==== $buffer</td></tr>"; |
@@ -212,31 +212,31 @@ discard block |
||
| 212 | 212 | $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') {
|
| 213 | 213 | //print "<td>Deja existante</td></tr>"; |
| 214 | 214 | } else {
|
| 215 | - print "<tr><td>" . $langs->trans("CreateTableAndPrimaryKey", $name);
|
|
| 216 | - print "<br>\n" . $langs->trans("Request") . ' ' . $requestnb . ' : ' . $buffer . ' <br>Executed query : ' . $db->lastquery;
|
|
| 215 | + print "<tr><td>".$langs->trans("CreateTableAndPrimaryKey", $name);
|
|
| 216 | + print "<br>\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer.' <br>Executed query : '.$db->lastquery;
|
|
| 217 | 217 | print "\n</td>"; |
| 218 | - print '<td><span class="error">' . $langs->trans("ErrorSQL") . " " . $db->errno() . " " . $db->error() . '</span></td></tr>';
|
|
| 218 | + print '<td><span class="error">'.$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error().'</span></td></tr>';
|
|
| 219 | 219 | $error++; |
| 220 | 220 | } |
| 221 | 221 | } |
| 222 | 222 | } else {
|
| 223 | - print "<tr><td>" . $langs->trans("CreateTableAndPrimaryKey", $name);
|
|
| 223 | + print "<tr><td>".$langs->trans("CreateTableAndPrimaryKey", $name);
|
|
| 224 | 224 | print "</td>"; |
| 225 | - print '<td><span class="error">' . $langs->trans("Error") . ' Failed to open file ' . $dir . $file . '</span></td></tr>';
|
|
| 225 | + print '<td><span class="error">'.$langs->trans("Error").' Failed to open file '.$dir.$file.'</span></td></tr>';
|
|
| 226 | 226 | $error++; |
| 227 | - dolibarr_install_syslog("step2: failed to open file " . $dir . $file, LOG_ERR);
|
|
| 227 | + dolibarr_install_syslog("step2: failed to open file ".$dir.$file, LOG_ERR);
|
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | if ($tablefound) {
|
| 232 | 232 | if ($error == 0) {
|
| 233 | 233 | print '<tr><td>'; |
| 234 | - print $langs->trans("TablesAndPrimaryKeysCreation") . '</td><td><img src="' . DOL_BASE_URI . '/theme/eldy/img/tick.png" alt="Ok"></td></tr>';
|
|
| 234 | + print $langs->trans("TablesAndPrimaryKeysCreation").'</td><td><img src="'.DOL_BASE_URI.'/theme/eldy/img/tick.png" alt="Ok"></td></tr>';
|
|
| 235 | 235 | $ok = 1; |
| 236 | 236 | } |
| 237 | 237 | } else {
|
| 238 | - print '<tr><td>' . $langs->trans("ErrorFailedToFindSomeFiles", $dir) . '</td><td><img src="' . DOL_BASE_URI . '/theme/eldy/img/error.png" alt="Error"></td></tr>';
|
|
| 239 | - dolibarr_install_syslog("step2: failed to find files to create database in directory " . $dir, LOG_ERR);
|
|
| 238 | + print '<tr><td>'.$langs->trans("ErrorFailedToFindSomeFiles", $dir).'</td><td><img src="'.DOL_BASE_URI.'/theme/eldy/img/error.png" alt="Error"></td></tr>';
|
|
| 239 | + dolibarr_install_syslog("step2: failed to find files to create database in directory ".$dir, LOG_ERR);
|
|
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
@@ -250,11 +250,11 @@ discard block |
||
| 250 | 250 | if ($ok && $createkeys) {
|
| 251 | 251 | // We always choose in mysql directory (Conversion is done by driver to translate SQL syntax) |
| 252 | 252 | //$dir = "mysql/tables/"; |
| 253 | - $dir = DOL_BASE_PATH . "/install/mysql/tables/"; |
|
| 253 | + $dir = DOL_BASE_PATH."/install/mysql/tables/"; |
|
| 254 | 254 | |
| 255 | 255 | $okkeys = 0; |
| 256 | 256 | $handle = opendir($dir); |
| 257 | - dolibarr_install_syslog("step2: open keys directory " . $dir . " handle=" . $handle);
|
|
| 257 | + dolibarr_install_syslog("step2: open keys directory ".$dir." handle=".$handle);
|
|
| 258 | 258 | $tablefound = 0; |
| 259 | 259 | $tabledata = array(); |
| 260 | 260 | if (is_resource($handle)) {
|
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $name = substr($file, 0, dol_strlen($file) - 4); |
| 274 | 274 | //print "<tr><td>Creation de la table $name</td>"; |
| 275 | 275 | $buffer = ''; |
| 276 | - $fp = fopen($dir . $file, "r"); |
|
| 276 | + $fp = fopen($dir.$file, "r"); |
|
| 277 | 277 | if ($fp) {
|
| 278 | 278 | while (!feof($fp)) {
|
| 279 | 279 | $buf = fgets($fp, 4096); |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | //print "<tr><td>Creation des cles et index de la table $name: '$buffer'</td>"; |
| 320 | 320 | $requestnb++; |
| 321 | 321 | |
| 322 | - dolibarr_install_syslog("step2: request: " . $buffer);
|
|
| 322 | + dolibarr_install_syslog("step2: request: ".$buffer);
|
|
| 323 | 323 | $resql = $db->query($buffer, 0, 'dml'); |
| 324 | 324 | if ($resql) {
|
| 325 | 325 | //print "<td>OK requete ==== $buffer</td></tr>"; |
@@ -333,27 +333,27 @@ discard block |
||
| 333 | 333 | //print "<td>Deja existante</td></tr>"; |
| 334 | 334 | $key_exists = 1; |
| 335 | 335 | } else {
|
| 336 | - print "<tr><td>" . $langs->trans("CreateOtherKeysForTable", $name);
|
|
| 337 | - print "<br>\n" . $langs->trans("Request") . ' ' . $requestnb . ' : ' . $db->lastqueryerror();
|
|
| 336 | + print "<tr><td>".$langs->trans("CreateOtherKeysForTable", $name);
|
|
| 337 | + print "<br>\n".$langs->trans("Request").' '.$requestnb.' : '.$db->lastqueryerror();
|
|
| 338 | 338 | print "\n</td>"; |
| 339 | - print '<td><span class="error">' . $langs->trans("ErrorSQL") . " " . $db->errno() . " " . $db->error() . '</span></td></tr>';
|
|
| 339 | + print '<td><span class="error">'.$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error().'</span></td></tr>';
|
|
| 340 | 340 | $error++; |
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | } else {
|
| 346 | - print "<tr><td>" . $langs->trans("CreateOtherKeysForTable", $name);
|
|
| 346 | + print "<tr><td>".$langs->trans("CreateOtherKeysForTable", $name);
|
|
| 347 | 347 | print "</td>"; |
| 348 | - print '<td><span class="error">' . $langs->trans("Error") . " Failed to open file " . $dir . $file . "</span></td></tr>";
|
|
| 348 | + print '<td><span class="error">'.$langs->trans("Error")." Failed to open file ".$dir.$file."</span></td></tr>";
|
|
| 349 | 349 | $error++; |
| 350 | - dolibarr_install_syslog("step2: failed to open file " . $dir . $file, LOG_ERR);
|
|
| 350 | + dolibarr_install_syslog("step2: failed to open file ".$dir.$file, LOG_ERR);
|
|
| 351 | 351 | } |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | if ($tablefound && $error == 0) {
|
| 355 | 355 | print '<tr><td>'; |
| 356 | - print $langs->trans("OtherKeysCreation") . '</td><td><img src="' . DOL_BASE_URI . '/theme/eldy/img/tick.png" alt="Ok"></td></tr>';
|
|
| 356 | + print $langs->trans("OtherKeysCreation").'</td><td><img src="'.DOL_BASE_URI.'/theme/eldy/img/tick.png" alt="Ok"></td></tr>';
|
|
| 357 | 357 | $okkeys = 1; |
| 358 | 358 | } |
| 359 | 359 | } |
@@ -368,29 +368,29 @@ discard block |
||
| 368 | 368 | // For this file, we use a directory according to database type |
| 369 | 369 | if ($choix == 1) |
| 370 | 370 | //$dir = "mysql/functions/"; |
| 371 | - $dir = DOL_BASE_PATH . "/install/mysql/functions/"; |
|
| 371 | + $dir = DOL_BASE_PATH."/install/mysql/functions/"; |
|
| 372 | 372 | elseif ($choix == 2) |
| 373 | 373 | //$dir = "pgsql/functions/"; |
| 374 | - $dir = DOL_BASE_PATH . "/install/pgsql/functions/"; |
|
| 374 | + $dir = DOL_BASE_PATH."/install/pgsql/functions/"; |
|
| 375 | 375 | elseif ($choix == 3) |
| 376 | 376 | //$dir = "mssql/functions/"; |
| 377 | - $dir = DOL_BASE_PATH . "/install/mssql/functions/"; |
|
| 377 | + $dir = DOL_BASE_PATH."/install/mssql/functions/"; |
|
| 378 | 378 | elseif ($choix == 4) {
|
| 379 | 379 | //$dir = "sqlite3/functions/"; |
| 380 | - $dir = DOL_BASE_PATH . "/install/sqlite3/functions/"; |
|
| 380 | + $dir = DOL_BASE_PATH."/install/sqlite3/functions/"; |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | // Creation donnees |
| 384 | 384 | $file = "functions.sql"; |
| 385 | - if (file_exists($dir . $file)) {
|
|
| 386 | - $fp = fopen($dir . $file, "r"); |
|
| 387 | - dolibarr_install_syslog("step2: open function file " . $dir . $file . " handle=" . $fp);
|
|
| 385 | + if (file_exists($dir.$file)) {
|
|
| 386 | + $fp = fopen($dir.$file, "r"); |
|
| 387 | + dolibarr_install_syslog("step2: open function file ".$dir.$file." handle=".$fp);
|
|
| 388 | 388 | if ($fp) {
|
| 389 | 389 | $buffer = ''; |
| 390 | 390 | while (!feof($fp)) {
|
| 391 | 391 | $buf = fgets($fp, 4096); |
| 392 | 392 | if (substr($buf, 0, 2) <> '--') {
|
| 393 | - $buffer .= $buf . "§"; |
|
| 393 | + $buffer .= $buf."§"; |
|
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | fclose($fp); |
@@ -401,8 +401,8 @@ discard block |
||
| 401 | 401 | foreach ($listesql as $buffer) {
|
| 402 | 402 | $buffer = trim($buffer); |
| 403 | 403 | if ($buffer) {
|
| 404 | - dolibarr_install_syslog("step2: request: " . $buffer);
|
|
| 405 | - print "<!-- Insert line : " . $buffer . "<br>-->\n"; |
|
| 404 | + dolibarr_install_syslog("step2: request: ".$buffer);
|
|
| 405 | + print "<!-- Insert line : ".$buffer."<br>-->\n"; |
|
| 406 | 406 | $resql = $db->query($buffer, 0, 'dml'); |
| 407 | 407 | if ($resql) {
|
| 408 | 408 | $ok = 1; |
@@ -413,21 +413,21 @@ discard block |
||
| 413 | 413 | } else {
|
| 414 | 414 | $ok = 0; |
| 415 | 415 | |
| 416 | - print "<tr><td>" . $langs->trans("FunctionsCreation");
|
|
| 417 | - print "<br>\n" . $langs->trans("Request") . ' ' . $requestnb . ' : ' . $buffer;
|
|
| 416 | + print "<tr><td>".$langs->trans("FunctionsCreation");
|
|
| 417 | + print "<br>\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer;
|
|
| 418 | 418 | print "\n</td>"; |
| 419 | - print '<td><span class="error">' . $langs->trans("ErrorSQL") . " " . $db->errno() . " " . $db->error() . '</span></td></tr>';
|
|
| 419 | + print '<td><span class="error">'.$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error().'</span></td></tr>';
|
|
| 420 | 420 | $error++; |
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | } |
| 425 | 425 | |
| 426 | - print "<tr><td>" . $langs->trans("FunctionsCreation") . "</td>";
|
|
| 426 | + print "<tr><td>".$langs->trans("FunctionsCreation")."</td>";
|
|
| 427 | 427 | if ($ok) {
|
| 428 | - print '<td><img src="' . DOL_BASE_URI . '/theme/eldy/img/tick.png" alt="Ok"></td></tr>'; |
|
| 428 | + print '<td><img src="'.DOL_BASE_URI.'/theme/eldy/img/tick.png" alt="Ok"></td></tr>'; |
|
| 429 | 429 | } else {
|
| 430 | - print '<td><img src="' . DOL_BASE_URI . '/theme/eldy/img/error.png" alt="Error"></td></tr>'; |
|
| 430 | + print '<td><img src="'.DOL_BASE_URI.'/theme/eldy/img/error.png" alt="Error"></td></tr>'; |
|
| 431 | 431 | $ok = 1; |
| 432 | 432 | } |
| 433 | 433 | } |
@@ -442,11 +442,11 @@ discard block |
||
| 442 | 442 | if ($ok && $createdata) {
|
| 443 | 443 | // We always choose in mysql directory (Conversion is done by driver to translate SQL syntax) |
| 444 | 444 | //$dir = "mysql/data/"; |
| 445 | - $dir = DOL_BASE_PATH . "/install/mysql/data/"; |
|
| 445 | + $dir = DOL_BASE_PATH."/install/mysql/data/"; |
|
| 446 | 446 | |
| 447 | 447 | // Insert data |
| 448 | 448 | $handle = opendir($dir); |
| 449 | - dolibarr_install_syslog("step2: open directory data " . $dir . " handle=" . $handle);
|
|
| 449 | + dolibarr_install_syslog("step2: open directory data ".$dir." handle=".$handle);
|
|
| 450 | 450 | $tablefound = 0; |
| 451 | 451 | $tabledata = array(); |
| 452 | 452 | if (is_resource($handle)) {
|
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | |
| 460 | 460 | //print 'x'.$file.'-'.$createdata.'<br>'; |
| 461 | - if (is_numeric($createdata) || preg_match('/' . preg_quote($createdata) . '/i', $file)) {
|
|
| 461 | + if (is_numeric($createdata) || preg_match('/'.preg_quote($createdata).'/i', $file)) {
|
|
| 462 | 462 | $tablefound++; |
| 463 | 463 | $tabledata[] = $file; |
| 464 | 464 | } |
@@ -471,8 +471,8 @@ discard block |
||
| 471 | 471 | sort($tabledata); |
| 472 | 472 | foreach ($tabledata as $file) {
|
| 473 | 473 | $name = substr($file, 0, dol_strlen($file) - 4); |
| 474 | - $fp = fopen($dir . $file, "r"); |
|
| 475 | - dolibarr_install_syslog("step2: open data file " . $dir . $file . " handle=" . $fp);
|
|
| 474 | + $fp = fopen($dir.$file, "r"); |
|
| 475 | + dolibarr_install_syslog("step2: open data file ".$dir.$file." handle=".$fp);
|
|
| 476 | 476 | if ($fp) {
|
| 477 | 477 | $arrayofrequests = array(); |
| 478 | 478 | $linefound = 0; |
@@ -492,14 +492,14 @@ discard block |
||
| 492 | 492 | if (empty($arrayofrequests[$linegroup])) |
| 493 | 493 | $arrayofrequests[$linegroup] = $buffer; |
| 494 | 494 | else |
| 495 | - $arrayofrequests[$linegroup] .= " " . $buffer; |
|
| 495 | + $arrayofrequests[$linegroup] .= " ".$buffer; |
|
| 496 | 496 | |
| 497 | 497 | $linefound++; |
| 498 | 498 | } |
| 499 | 499 | } |
| 500 | 500 | fclose($fp); |
| 501 | 501 | |
| 502 | - dolibarr_install_syslog("step2: found " . $linefound . " records, defined " . count($arrayofrequests) . " group(s).");
|
|
| 502 | + dolibarr_install_syslog("step2: found ".$linefound." records, defined ".count($arrayofrequests)." group(s).");
|
|
| 503 | 503 | |
| 504 | 504 | $okallfile = 1; |
| 505 | 505 | $db->begin(); |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | } else {
|
| 522 | 522 | $ok = 0; |
| 523 | 523 | $okallfile = 0; |
| 524 | - print '<span class="error">' . $langs->trans("ErrorSQL") . " : " . $db->lasterrno() . " - " . $db->lastqueryerror() . " - " . $db->lasterror() . "</span><br>";
|
|
| 524 | + print '<span class="error">'.$langs->trans("ErrorSQL")." : ".$db->lasterrno()." - ".$db->lastqueryerror()." - ".$db->lasterror()."</span><br>";
|
|
| 525 | 525 | } |
| 526 | 526 | } |
| 527 | 527 | } |
@@ -533,12 +533,12 @@ discard block |
||
| 533 | 533 | } |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | - print "<tr><td>" . $langs->trans("ReferenceDataLoading") . "</td>";
|
|
| 536 | + print "<tr><td>".$langs->trans("ReferenceDataLoading")."</td>";
|
|
| 537 | 537 | if ($ok) {
|
| 538 | - print '<td><img src="' . DOL_BASE_URI . '/theme/eldy/img/tick.png" alt="Ok"></td></tr>'; |
|
| 538 | + print '<td><img src="'.DOL_BASE_URI.'/theme/eldy/img/tick.png" alt="Ok"></td></tr>'; |
|
| 539 | 539 | } else {
|
| 540 | - print '<td><img src="' . DOL_BASE_URI . '/theme/eldy/img/error.png" alt="Error"></td></tr>'; |
|
| 541 | - $ok = 1; // Data loading are not blocking errors |
|
| 540 | + print '<td><img src="'.DOL_BASE_URI.'/theme/eldy/img/error.png" alt="Error"></td></tr>'; |
|
| 541 | + $ok = 1; // Data loading are not blocking errors |
|
| 542 | 542 | } |
| 543 | 543 | } |
| 544 | 544 | print '</table>'; |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | $ret = 0; |
| 551 | 551 | if (!$ok && isset($argv[1])) |
| 552 | 552 | $ret = 1; |
| 553 | -dolibarr_install_syslog("Exit " . $ret);
|
|
| 553 | +dolibarr_install_syslog("Exit ".$ret);
|
|
| 554 | 554 | |
| 555 | 555 | dolibarr_install_syslog("- step2: end");
|
| 556 | 556 | |
@@ -49,23 +49,29 @@ discard block |
||
| 49 | 49 | $langs->loadLangs(array("admin", "install"));
|
| 50 | 50 | |
| 51 | 51 | $choix = 0; |
| 52 | -if ($dolibarr_main_db_type == "mysqli") |
|
| 53 | - $choix = 1; |
|
| 54 | -if ($dolibarr_main_db_type == "pgsql") |
|
| 55 | - $choix = 2; |
|
| 56 | -if ($dolibarr_main_db_type == "mssql") |
|
| 57 | - $choix = 3; |
|
| 58 | -if ($dolibarr_main_db_type == "sqlite") |
|
| 59 | - $choix = 4; |
|
| 60 | -if ($dolibarr_main_db_type == "sqlite3") |
|
| 61 | - $choix = 5; |
|
| 52 | +if ($dolibarr_main_db_type == "mysqli") { |
|
| 53 | + $choix = 1; |
|
| 54 | +} |
|
| 55 | +if ($dolibarr_main_db_type == "pgsql") { |
|
| 56 | + $choix = 2; |
|
| 57 | +} |
|
| 58 | +if ($dolibarr_main_db_type == "mssql") { |
|
| 59 | + $choix = 3; |
|
| 60 | +} |
|
| 61 | +if ($dolibarr_main_db_type == "sqlite") { |
|
| 62 | + $choix = 4; |
|
| 63 | +} |
|
| 64 | +if ($dolibarr_main_db_type == "sqlite3") { |
|
| 65 | + $choix = 5; |
|
| 66 | +} |
|
| 62 | 67 | |
| 63 | 68 | //if (empty($choix)) dol_print_error('','Database type '.$dolibarr_main_db_type.' not supported into step2.php page');
|
| 64 | 69 | // Now we load forced values from install.forced.php file. |
| 65 | 70 | $useforcedwizard = false; |
| 66 | 71 | $forcedfile = "./install.forced.php"; |
| 67 | -if ($conffile == "/etc/dolibarr/conf.php") |
|
| 68 | - $forcedfile = "/etc/dolibarr/install.forced.php"; |
|
| 72 | +if ($conffile == "/etc/dolibarr/conf.php") { |
|
| 73 | + $forcedfile = "/etc/dolibarr/install.forced.php"; |
|
| 74 | +} |
|
| 69 | 75 | if (@file_exists($forcedfile)) {
|
| 70 | 76 | $useforcedwizard = true; |
| 71 | 77 | include_once $forcedfile; |
@@ -301,8 +307,9 @@ discard block |
||
| 301 | 307 | } |
| 302 | 308 | |
| 303 | 309 | // Ajout ligne si non commentaire |
| 304 | - if (!preg_match('/^--/i', $buf))
|
|
| 305 | - $buffer .= $buf; |
|
| 310 | + if (!preg_match('/^--/i', $buf)) { |
|
| 311 | + $buffer .= $buf; |
|
| 312 | + } |
|
| 306 | 313 | } |
| 307 | 314 | fclose($fp); |
| 308 | 315 | |
@@ -366,16 +373,16 @@ discard block |
||
| 366 | 373 | * ************************************************************************************* */ |
| 367 | 374 | if ($ok && $createfunctions) {
|
| 368 | 375 | // For this file, we use a directory according to database type |
| 369 | - if ($choix == 1) |
|
| 370 | - //$dir = "mysql/functions/"; |
|
| 371 | - $dir = DOL_BASE_PATH . "/install/mysql/functions/"; |
|
| 372 | - elseif ($choix == 2) |
|
| 373 | - //$dir = "pgsql/functions/"; |
|
| 374 | - $dir = DOL_BASE_PATH . "/install/pgsql/functions/"; |
|
| 375 | - elseif ($choix == 3) |
|
| 376 | - //$dir = "mssql/functions/"; |
|
| 377 | - $dir = DOL_BASE_PATH . "/install/mssql/functions/"; |
|
| 378 | - elseif ($choix == 4) {
|
|
| 376 | + if ($choix == 1) { |
|
| 377 | + //$dir = "mysql/functions/"; |
|
| 378 | + $dir = DOL_BASE_PATH . "/install/mysql/functions/"; |
|
| 379 | + } elseif ($choix == 2) { |
|
| 380 | + //$dir = "pgsql/functions/"; |
|
| 381 | + $dir = DOL_BASE_PATH . "/install/pgsql/functions/"; |
|
| 382 | + } elseif ($choix == 3) { |
|
| 383 | + //$dir = "mssql/functions/"; |
|
| 384 | + $dir = DOL_BASE_PATH . "/install/mssql/functions/"; |
|
| 385 | + } elseif ($choix == 4) {
|
|
| 379 | 386 | //$dir = "sqlite3/functions/"; |
| 380 | 387 | $dir = DOL_BASE_PATH . "/install/sqlite3/functions/"; |
| 381 | 388 | } |
@@ -452,8 +459,10 @@ discard block |
||
| 452 | 459 | if (is_resource($handle)) {
|
| 453 | 460 | while (($file = readdir($handle)) !== false) {
|
| 454 | 461 | if (preg_match('/\.sql$/i', $file) && preg_match('/^llx_/i', $file)) {
|
| 455 | - if (preg_match('/^llx_accounting_account_/', $file))
|
|
| 456 | - continue; // We discard data file of chart of account. Will be loaded when a chart is selected. |
|
| 462 | + if (preg_match('/^llx_accounting_account_/', $file)) { |
|
| 463 | + continue; |
|
| 464 | + } |
|
| 465 | + // We discard data file of chart of account. Will be loaded when a chart is selected. |
|
| 457 | 466 | |
| 458 | 467 | |
| 459 | 468 | |
@@ -483,16 +492,18 @@ discard block |
||
| 483 | 492 | $buffer = fgets($fp, 4096); |
| 484 | 493 | $buffer = trim($buffer); |
| 485 | 494 | if ($buffer) {
|
| 486 | - if (substr($buffer, 0, 2) == '--') |
|
| 487 | - continue; |
|
| 495 | + if (substr($buffer, 0, 2) == '--') { |
|
| 496 | + continue; |
|
| 497 | + } |
|
| 488 | 498 | |
| 489 | 499 | if ($linefound && ($linefound % $sizeofgroup) == 0) {
|
| 490 | 500 | $linegroup++; |
| 491 | 501 | } |
| 492 | - if (empty($arrayofrequests[$linegroup])) |
|
| 493 | - $arrayofrequests[$linegroup] = $buffer; |
|
| 494 | - else |
|
| 495 | - $arrayofrequests[$linegroup] .= " " . $buffer; |
|
| 502 | + if (empty($arrayofrequests[$linegroup])) { |
|
| 503 | + $arrayofrequests[$linegroup] = $buffer; |
|
| 504 | + } else { |
|
| 505 | + $arrayofrequests[$linegroup] .= " " . $buffer; |
|
| 506 | + } |
|
| 496 | 507 | |
| 497 | 508 | $linefound++; |
| 498 | 509 | } |
@@ -526,10 +537,11 @@ discard block |
||
| 526 | 537 | } |
| 527 | 538 | } |
| 528 | 539 | |
| 529 | - if ($okallfile) |
|
| 530 | - $db->commit(); |
|
| 531 | - else |
|
| 532 | - $db->rollback(); |
|
| 540 | + if ($okallfile) { |
|
| 541 | + $db->commit(); |
|
| 542 | + } else { |
|
| 543 | + $db->rollback(); |
|
| 544 | + } |
|
| 533 | 545 | } |
| 534 | 546 | } |
| 535 | 547 | |
@@ -548,17 +560,20 @@ discard block |
||
| 548 | 560 | |
| 549 | 561 | |
| 550 | 562 | $ret = 0; |
| 551 | -if (!$ok && isset($argv[1])) |
|
| 552 | - $ret = 1; |
|
| 563 | +if (!$ok && isset($argv[1])) { |
|
| 564 | + $ret = 1; |
|
| 565 | +} |
|
| 553 | 566 | dolibarr_install_syslog("Exit " . $ret);
|
| 554 | 567 | |
| 555 | 568 | dolibarr_install_syslog("- step2: end");
|
| 556 | 569 | |
| 557 | 570 | pFooter($ok ? 0 : 1, $setuplang); |
| 558 | 571 | |
| 559 | -if (isset($db) && is_object($db)) |
|
| 560 | - $db->close(); |
|
| 572 | +if (isset($db) && is_object($db)) { |
|
| 573 | + $db->close(); |
|
| 574 | +} |
|
| 561 | 575 | |
| 562 | 576 | // Return code if ran from command line |
| 563 | -if ($ret) |
|
| 564 | - exit($ret); |
|
| 577 | +if ($ret) { |
|
| 578 | + exit($ret); |
|
| 579 | +} |
|
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | * \brief Ask login and password of Dolibarr admin user |
| 27 | 27 | */ |
| 28 | 28 | include_once 'inc.php'; |
| 29 | -require_once $dolibarr_main_document_root . '/core/class/conf.class.php'; |
|
| 30 | -require_once $dolibarr_main_document_root . '/core/lib/admin.lib.php'; |
|
| 29 | +require_once $dolibarr_main_document_root.'/core/class/conf.class.php'; |
|
| 30 | +require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; |
|
| 31 | 31 | |
| 32 | 32 | global $langs; |
| 33 | 33 | |
@@ -66,26 +66,26 @@ discard block |
||
| 66 | 66 | exit; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | -print '<h3><img class="valigntextbottom" src="' . DOL_BASE_URI . '/theme/common/octicons/build/svg/key.svg" width="20" alt="Database"> ' . $langs->trans("DolibarrAdminLogin") . '</h3>';
|
|
| 69 | +print '<h3><img class="valigntextbottom" src="'.DOL_BASE_URI.'/theme/common/octicons/build/svg/key.svg" width="20" alt="Database"> '.$langs->trans("DolibarrAdminLogin").'</h3>';
|
|
| 70 | 70 | |
| 71 | -print $langs->trans("LastStepDesc") . '<br><br>';
|
|
| 71 | +print $langs->trans("LastStepDesc").'<br><br>';
|
|
| 72 | 72 | |
| 73 | 73 | print '<table cellspacing="0" cellpadding="2">'; |
| 74 | 74 | |
| 75 | 75 | $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port); |
| 76 | 76 | |
| 77 | 77 | if ($db->ok) {
|
| 78 | - print '<tr><td><label for="login">' . $langs->trans("Login") . ' :</label></td><td>';
|
|
| 79 | - print '<input id="login" name="login" type="text" value="' . (!empty($_GET["login"]) ? GETPOST("login") : (isset($force_install_dolibarrlogin) ? $force_install_dolibarrlogin : '')) . '"' . (@$force_install_noedit == 2 && $force_install_dolibarrlogin !== null ? ' disabled' : '') . '></td></tr>';
|
|
| 80 | - print '<tr><td><label for="pass">' . $langs->trans("Password") . ' :</label></td><td>';
|
|
| 78 | + print '<tr><td><label for="login">'.$langs->trans("Login").' :</label></td><td>';
|
|
| 79 | + print '<input id="login" name="login" type="text" value="'.(!empty($_GET["login"]) ? GETPOST("login") : (isset($force_install_dolibarrlogin) ? $force_install_dolibarrlogin : '')).'"'.(@$force_install_noedit == 2 && $force_install_dolibarrlogin !== null ? ' disabled' : '').'></td></tr>';
|
|
| 80 | + print '<tr><td><label for="pass">'.$langs->trans("Password").' :</label></td><td>';
|
|
| 81 | 81 | print '<input type="password" id="pass" name="pass"></td></tr>'; |
| 82 | - print '<tr><td><label for="pass_verif">' . $langs->trans("PasswordAgain") . ' :</label></td><td>';
|
|
| 82 | + print '<tr><td><label for="pass_verif">'.$langs->trans("PasswordAgain").' :</label></td><td>';
|
|
| 83 | 83 | print '<input type="password" id="pass_verif" name="pass_verif"></td></tr>'; |
| 84 | 84 | print '</table>'; |
| 85 | 85 | |
| 86 | 86 | if (isset($_GET["error"]) && $_GET["error"] == 1) {
|
| 87 | 87 | print '<br>'; |
| 88 | - print '<div class="error">' . $langs->trans("PasswordsMismatch") . '</div>';
|
|
| 88 | + print '<div class="error">'.$langs->trans("PasswordsMismatch").'</div>';
|
|
| 89 | 89 | $error = 0; // We show button |
| 90 | 90 | } |
| 91 | 91 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | if (isset($_GET["error"]) && $_GET["error"] == 3) {
|
| 101 | 101 | print '<br>'; |
| 102 | - print '<div class="error">' . $langs->trans("PleaseTypeALogin") . '</div>';
|
|
| 102 | + print '<div class="error">'.$langs->trans("PleaseTypeALogin").'</div>';
|
|
| 103 | 103 | $error = 0; // We show button |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $ret = 1; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | -dolibarr_install_syslog("Exit " . $ret);
|
|
| 112 | +dolibarr_install_syslog("Exit ".$ret);
|
|
| 113 | 113 | dolibarr_install_syslog("- step4: end");
|
| 114 | 114 | pFooter($error, $setuplang); |
| 115 | 115 | |
@@ -39,8 +39,9 @@ |
||
| 39 | 39 | // Now we load forced value from install.forced.php file. |
| 40 | 40 | $useforcedwizard = false; |
| 41 | 41 | $forcedfile = "./install.forced.php"; |
| 42 | -if ($conffile == "/etc/dolibarr/conf.php") |
|
| 43 | - $forcedfile = "/etc/dolibarr/install.forced.php"; |
|
| 42 | +if ($conffile == "/etc/dolibarr/conf.php") { |
|
| 43 | + $forcedfile = "/etc/dolibarr/install.forced.php"; |
|
| 44 | +} |
|
| 44 | 45 | if (@file_exists($forcedfile)) {
|
| 45 | 46 | $useforcedwizard = true; |
| 46 | 47 | include_once $forcedfile; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | { |
| 41 | 41 | $t = '?'; |
| 42 | 42 | if ($mode == 'user') |
| 43 | - $t = getenv('APACHE_RUN_USER'); // $_ENV['APACHE_RUN_USER'] is empty |
|
| 43 | + $t = getenv('APACHE_RUN_USER'); // $_ENV['APACHE_RUN_USER'] is empty |
|
| 44 | 44 | if ($mode == 'group') |
| 45 | 45 | $t = getenv('APACHE_RUN_GROUP'); |
| 46 | 46 | return $t; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $entitytotest = 1; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - AlDolUtils::dol_syslog("checkLoginPassEntity usertotest=" . $usertotest . " entitytotest=" . $entitytotest . " authmode=" . join(',', $authmode)); |
|
| 67 | + AlDolUtils::dol_syslog("checkLoginPassEntity usertotest=".$usertotest." entitytotest=".$entitytotest." authmode=".join(',', $authmode)); |
|
| 68 | 68 | $login = ''; |
| 69 | 69 | |
| 70 | 70 | // Validation of login/pass/entity with standard modules |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | if ($test && $mode && !$login) { |
| 75 | 75 | // Validation of login/pass/entity for mode $mode |
| 76 | 76 | $mode = trim($mode); |
| 77 | - $authfile = 'functions_' . $mode . '.php'; |
|
| 77 | + $authfile = 'functions_'.$mode.'.php'; |
|
| 78 | 78 | $fullauthfile = ''; |
| 79 | 79 | |
| 80 | 80 | /* |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $dirlogin = array_merge(array("/Helpers/login"), (array) Globals::$conf->modules_parts['login']); |
| 94 | 94 | foreach ($dirlogin as $reldir) { |
| 95 | 95 | // Check if file found (do not use dol_is_file to avoid loading files.lib.php) |
| 96 | - $tmpnewauthfile = BASE_PATH . $reldir . '/' . $authfile; |
|
| 96 | + $tmpnewauthfile = BASE_PATH.$reldir.'/'.$authfile; |
|
| 97 | 97 | if (is_file($tmpnewauthfile)) { |
| 98 | 98 | $fullauthfile = $tmpnewauthfile; |
| 99 | 99 | } |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | if ($fullauthfile && $result) { |
| 107 | 107 | // Call function to check user/password |
| 108 | - $function = 'check_user_password_' . $mode; |
|
| 108 | + $function = 'check_user_password_'.$mode; |
|
| 109 | 109 | $login = \call_user_func($function, $usertotest, $passwordtotest, $entitytotest); |
| 110 | 110 | if ($login) { // Login is successfull |
| 111 | - $test = false; // To stop once at first login success |
|
| 111 | + $test = false; // To stop once at first login success |
|
| 112 | 112 | Globals::$conf->authmode = $mode; // This properties is defined only when logged to say what mode was successfully used |
| 113 | 113 | $dol_tz = AlDolUtils::GETPOST('tz'); |
| 114 | 114 | $dol_dst = AlDolUtils::GETPOST('dst'); |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $dol_screenheight = AlDolUtils::GETPOST('screenheight'); |
| 117 | 117 | } |
| 118 | 118 | } else { |
| 119 | - AlDolUtils::dol_syslog("Authentification ko - failed to load file '" . $authfile . "'", LOG_ERR); |
|
| 119 | + AlDolUtils::dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR); |
|
| 120 | 120 | sleep(1); |
| 121 | 121 | // Load translation files required by the page |
| 122 | 122 | Globals::$langs->loadLangs(array('other', 'main', 'errors')); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | // Title |
| 157 | 157 | $appli = constant('DOL_APPLICATION_TITLE'); |
| 158 | - $title = $appli . ' ' . constant('DOL_VERSION'); |
|
| 158 | + $title = $appli.' '.constant('DOL_VERSION'); |
|
| 159 | 159 | if (!empty(Globals::$conf->global->MAIN_APPLICATION_TITLE)) { |
| 160 | 160 | $title = Globals::$conf->global->MAIN_APPLICATION_TITLE; |
| 161 | 161 | } |
@@ -182,19 +182,19 @@ discard block |
||
| 182 | 182 | if (!empty(Globals::$conf->modules_parts['tpl'])) { // Using this feature slow down application |
| 183 | 183 | $dirtpls = array_merge(Globals::$conf->modules_parts['tpl'], array('/core/tpl/')); |
| 184 | 184 | foreach ($dirtpls as $reldir) { |
| 185 | - $tmp = AlDolUtils::dol_buildpath($reldir . 'login.tpl.php'); |
|
| 185 | + $tmp = AlDolUtils::dol_buildpath($reldir.'login.tpl.php'); |
|
| 186 | 186 | if (file_exists($tmp)) { |
| 187 | 187 | $template_dir = preg_replace('/login\.tpl\.php$/', '', $tmp); |
| 188 | 188 | break; |
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | } else { |
| 192 | - $template_dir = DOL_DOCUMENT_ROOT . "/core/tpl/"; |
|
| 192 | + $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/"; |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | // Set cookie for timeout management |
| 196 | 196 | $prefix = AlDolUtils::dol_getprefix(''); |
| 197 | - $sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix; |
|
| 197 | + $sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix; |
|
| 198 | 198 | if (!empty(Globals::$conf->global->MAIN_SESSION_TIMEOUT)) { |
| 199 | 199 | setcookie($sessiontimeout, Globals::$conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true); |
| 200 | 200 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | // Execute hook getLoginPageOptions (for table) |
| 223 | 223 | $parameters = array('entity' => AlDolUtils::GETPOST('entity', 'int')); |
| 224 | - $reshook = Globals::$hookManager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks. |
|
| 224 | + $reshook = Globals::$hookManager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks. |
|
| 225 | 225 | if (is_array(Globals::$hookManager->resArray) && !empty(Globals::$hookManager->resArray)) { |
| 226 | 226 | $morelogincontent = Globals::$hookManager->resArray; // (deprecated) For compatibility |
| 227 | 227 | } else { |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | // Execute hook getLoginPageExtraOptions (eg for js) |
| 232 | 232 | $parameters = array('entity' => AlDolUtils::GETPOST('entity', 'int')); |
| 233 | - $reshook = Globals::$hookManager->executeHooks('getLoginPageExtraOptions', $parameters); // Note that $action and $object may have been modified by some hooks. |
|
| 233 | + $reshook = Globals::$hookManager->executeHooks('getLoginPageExtraOptions', $parameters); // Note that $action and $object may have been modified by some hooks. |
|
| 234 | 234 | $moreloginextracontent = Globals::$hookManager->resPrint; |
| 235 | 235 | |
| 236 | 236 | // Login |
@@ -239,23 +239,23 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | // Show logo (search in order: small company logo, large company logo, theme logo, common logo) |
| 241 | 241 | $width = 0; |
| 242 | - $urllogo = DOL_BASE_URI . '/theme/login_logo.png'; |
|
| 242 | + $urllogo = DOL_BASE_URI.'/theme/login_logo.png'; |
|
| 243 | 243 | |
| 244 | - if (!empty($mysoc->logo_small) && is_readable(Globals::$conf->mycompany->dir_output . '/logos/thumbs/' . $mysoc->logo_small)) { |
|
| 245 | - $urllogo = DOL_BASE_URI . '/viewimage.php?cache=1&modulepart=mycompany&file=' . urlencode('logos/thumbs/' . $mysoc->logo_small); |
|
| 246 | - } elseif (!empty($mysoc->logo) && is_readable(Globals::$conf->mycompany->dir_output . '/logos/' . $mysoc->logo)) { |
|
| 247 | - $urllogo = DOL_BASE_URI . '/viewimage.php?cache=1&modulepart=mycompany&file=' . urlencode('logos/' . $mysoc->logo); |
|
| 244 | + if (!empty($mysoc->logo_small) && is_readable(Globals::$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { |
|
| 245 | + $urllogo = DOL_BASE_URI.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); |
|
| 246 | + } elseif (!empty($mysoc->logo) && is_readable(Globals::$conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { |
|
| 247 | + $urllogo = DOL_BASE_URI.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); |
|
| 248 | 248 | $width = 128; |
| 249 | - } elseif (is_readable(DOL_BASE_URI . '/theme/' . Globals::$conf->theme . '/img/dolibarr_logo.png')) { |
|
| 250 | - $urllogo = DOL_BASE_URI . '/theme/' . Globals::$conf->theme . '/img/dolibarr_logo.png'; |
|
| 251 | - } elseif (is_readable(DOL_BASE_URI . '/theme/dolibarr_logo.png')) { |
|
| 252 | - $urllogo = DOL_BASE_URI . '/theme/dolibarr_logo.png'; |
|
| 249 | + } elseif (is_readable(DOL_BASE_URI.'/theme/'.Globals::$conf->theme.'/img/dolibarr_logo.png')) { |
|
| 250 | + $urllogo = DOL_BASE_URI.'/theme/'.Globals::$conf->theme.'/img/dolibarr_logo.png'; |
|
| 251 | + } elseif (is_readable(DOL_BASE_URI.'/theme/dolibarr_logo.png')) { |
|
| 252 | + $urllogo = DOL_BASE_URI.'/theme/dolibarr_logo.png'; |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | // Security graphical code |
| 256 | 256 | $captcha = 0; |
| 257 | 257 | $captcha_refresh = ''; |
| 258 | - if (function_exists("imagecreatefrompng") &&!empty(Globals::$conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { |
|
| 258 | + if (function_exists("imagecreatefrompng") && !empty(Globals::$conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { |
|
| 259 | 259 | $captcha = 1; |
| 260 | 260 | $captcha_refresh = img_picto(Globals::$langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"'); |
| 261 | 261 | } |
@@ -284,11 +284,11 @@ discard block |
||
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // Google AD |
| 287 | - $main_google_ad_client = ((!empty(Globals::$conf->global->MAIN_GOOGLE_AD_CLIENT) &&!empty(Globals::$conf->global->MAIN_GOOGLE_AD_SLOT)) ? 1 : 0); |
|
| 287 | + $main_google_ad_client = ((!empty(Globals::$conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty(Globals::$conf->global->MAIN_GOOGLE_AD_SLOT)) ? 1 : 0); |
|
| 288 | 288 | |
| 289 | 289 | // Set jquery theme |
| 290 | 290 | $dol_loginmesg = (!empty($_SESSION["dol_loginmesg"]) ? $_SESSION["dol_loginmesg"] : ''); |
| 291 | - $favicon = AlDolUtils::dol_buildpath('/theme/' . Globals::$conf->theme . '/img/favicon.ico', 1); |
|
| 291 | + $favicon = AlDolUtils::dol_buildpath('/theme/'.Globals::$conf->theme.'/img/favicon.ico', 1); |
|
| 292 | 292 | if (!empty(Globals::$conf->global->MAIN_FAVICON_URL)) { |
| 293 | 293 | $favicon = Globals::$conf->global->MAIN_FAVICON_URL; |
| 294 | 294 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | function makesalt($type = CRYPT_SALT_LENGTH) |
| 323 | 323 | { |
| 324 | - AlDolUtils::dol_syslog("makesalt type=" . $type); |
|
| 324 | + AlDolUtils::dol_syslog("makesalt type=".$type); |
|
| 325 | 325 | switch ($type) { |
| 326 | 326 | case 12: // 8 + 4 |
| 327 | 327 | $saltlen = 8; |
@@ -344,8 +344,8 @@ discard block |
||
| 344 | 344 | while (dol_strlen($salt) < $saltlen) |
| 345 | 345 | $salt .= chr(mt_rand(64, 126)); |
| 346 | 346 | |
| 347 | - $result = $saltprefix . $salt . $saltsuffix; |
|
| 348 | - AlDolUtils::dol_syslog("makesalt return=" . $result); |
|
| 347 | + $result = $saltprefix.$salt.$saltsuffix; |
|
| 348 | + AlDolUtils::dol_syslog("makesalt return=".$result); |
|
| 349 | 349 | return $result; |
| 350 | 350 | } |
| 351 | 351 | |
@@ -357,12 +357,12 @@ discard block |
||
| 357 | 357 | */ |
| 358 | 358 | function encodedecode_dbpassconf($level = 0) |
| 359 | 359 | { |
| 360 | - AlDolUtils::dol_syslog("encodedecode_dbpassconf level=" . $level, LOG_DEBUG); |
|
| 360 | + AlDolUtils::dol_syslog("encodedecode_dbpassconf level=".$level, LOG_DEBUG); |
|
| 361 | 361 | Globals::$config = ''; |
| 362 | 362 | $passwd = ''; |
| 363 | 363 | $passwd_crypted = ''; |
| 364 | 364 | |
| 365 | - if ($fp = fopen(DOL_DOCUMENT_ROOT . '/conf/conf.php', 'r')) { |
|
| 365 | + if ($fp = fopen(DOL_DOCUMENT_ROOT.'/conf/conf.php', 'r')) { |
|
| 366 | 366 | while (!feof($fp)) { |
| 367 | 367 | $buffer = fgets($fp, 4096); |
| 368 | 368 | |
@@ -399,10 +399,10 @@ discard block |
||
| 399 | 399 | if ($lineofpass) { |
| 400 | 400 | // Add value at end of file |
| 401 | 401 | if ($level == 0) { |
| 402 | - Globals::$config .= '$dolibarr_main_db_pass=\'' . $passwd . '\';' . "\n"; |
|
| 402 | + Globals::$config .= '$dolibarr_main_db_pass=\''.$passwd.'\';'."\n"; |
|
| 403 | 403 | } |
| 404 | 404 | if ($level == 1) { |
| 405 | - Globals::$config .= '$dolibarr_main_db_pass=\'crypted:' . $passwd_crypted . '\';' . "\n"; |
|
| 405 | + Globals::$config .= '$dolibarr_main_db_pass=\'crypted:'.$passwd_crypted.'\';'."\n"; |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | //print 'passwd = '.$passwd.' - passwd_crypted = '.$passwd_crypted; |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | fclose($fp); |
| 415 | 415 | |
| 416 | 416 | // Write new conf file |
| 417 | - $file = DOL_DOCUMENT_ROOT . '/conf/conf.php'; |
|
| 417 | + $file = DOL_DOCUMENT_ROOT.'/conf/conf.php'; |
|
| 418 | 418 | if ($fp = @fopen($file, 'w')) { |
| 419 | 419 | fputs($fp, Globals::$config); |
| 420 | 420 | fflush($fp); |
@@ -491,10 +491,10 @@ discard block |
||
| 491 | 491 | } |
| 492 | 492 | } else |
| 493 | 493 | if (!empty (Globals::$conf->global->USER_PASSWORD_GENERATED)) { |
| 494 | - $nomclass = "modGeneratePass" . ucfirst(Globals::$conf->global->USER_PASSWORD_GENERATED); |
|
| 495 | - $nomfichier = $nomclass . ".class.php"; |
|
| 494 | + $nomclass = "modGeneratePass".ucfirst(Globals::$conf->global->USER_PASSWORD_GENERATED); |
|
| 495 | + $nomfichier = $nomclass.".class.php"; |
|
| 496 | 496 | //print DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomclass; |
| 497 | - require_once DOL_DOCUMENT_ROOT . "/core/modules/security/generate/" . $nomfichier; |
|
| 497 | + require_once DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomfichier; |
|
| 498 | 498 | $genhandler = new $nomclass($db, Globals::$conf, Globals::$langs, $user); |
| 499 | 499 | $generated_password = $genhandler->getNewGeneratedPassword(); |
| 500 | 500 | unset($genhandler); |
@@ -39,10 +39,13 @@ discard block |
||
| 39 | 39 | function dol_getwebuser($mode) |
| 40 | 40 | { |
| 41 | 41 | $t = '?'; |
| 42 | - if ($mode == 'user') |
|
| 43 | - $t = getenv('APACHE_RUN_USER'); // $_ENV['APACHE_RUN_USER'] is empty |
|
| 44 | - if ($mode == 'group') |
|
| 45 | - $t = getenv('APACHE_RUN_GROUP'); |
|
| 42 | + if ($mode == 'user') { |
|
| 43 | + $t = getenv('APACHE_RUN_USER'); |
|
| 44 | + } |
|
| 45 | + // $_ENV['APACHE_RUN_USER'] is empty |
|
| 46 | + if ($mode == 'group') { |
|
| 47 | + $t = getenv('APACHE_RUN_GROUP'); |
|
| 48 | + } |
|
| 46 | 49 | return $t; |
| 47 | 50 | } |
| 48 | 51 | |
@@ -341,8 +344,9 @@ discard block |
||
| 341 | 344 | break; |
| 342 | 345 | } |
| 343 | 346 | $salt = ''; |
| 344 | - while (dol_strlen($salt) < $saltlen) |
|
| 345 | - $salt .= chr(mt_rand(64, 126)); |
|
| 347 | + while (dol_strlen($salt) < $saltlen) { |
|
| 348 | + $salt .= chr(mt_rand(64, 126)); |
|
| 349 | + } |
|
| 346 | 350 | |
| 347 | 351 | $result = $saltprefix . $salt . $saltsuffix; |
| 348 | 352 | AlDolUtils::dol_syslog("makesalt return=" . $result); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | static function getStaticMember($class, $member) |
| 54 | 54 | {
|
| 55 | - AlDolUtils::dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); |
|
| 55 | + AlDolUtils::dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING); |
|
| 56 | 56 | |
| 57 | 57 | // This part is deprecated. Uncomment if for php 5.2.*, and comment next isset class::member |
| 58 | 58 | /* if (version_compare(phpversion(), '5.3.0', '<')) |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | if (isset($class::$member)) |
| 79 | 79 | return $class::$member; |
| 80 | - dol_print_error('', 'Try to get a static member "' . $member . '" in class "' . $class . '" that does not exists or is not static.');
|
|
| 80 | + dol_print_error('', 'Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.');
|
|
| 81 | 81 | return null; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | static function getDoliDBInstance($type, $host, $user, $pass, $name, $port) |
| 96 | 96 | {
|
| 97 | - require_once DOL_BASE_PATH . "/core/db/" . $type . '.class.php'; |
|
| 97 | + require_once DOL_BASE_PATH."/core/db/".$type.'.class.php'; |
|
| 98 | 98 | |
| 99 | - $class = 'DoliDB' . ucfirst($type); |
|
| 99 | + $class = 'DoliDB'.ucfirst($type); |
|
| 100 | 100 | $dolidb = new $class($type, $host, $user, $pass, $name, $port); |
| 101 | 101 | return $dolidb; |
| 102 | 102 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $depth = $db->transaction_opened; |
| 266 | 266 | $disconnectdone = $db->close(); |
| 267 | 267 | } |
| 268 | - AlDolUtils::dol_syslog("--- End access to " . $_SERVER["PHP_SELF"] . (($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was ' . $depth . ')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO));
|
|
| 268 | + AlDolUtils::dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO));
|
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | /** |
@@ -311,7 +311,7 @@ discard block |
||
| 311 | 311 | return 'BadFirstParameterForDolUtils::GETPOST'; |
| 312 | 312 | } |
| 313 | 313 | if (empty($check)) {
|
| 314 | - AlDolUtils::dol_syslog("Deprecated use of AlDolUtils::GETPOST, called with 1st param = " . $paramname . " and 2nd param is '', when calling page " . $_SERVER["PHP_SELF"], LOG_WARNING);
|
|
| 314 | + AlDolUtils::dol_syslog("Deprecated use of AlDolUtils::GETPOST, called with 1st param = ".$paramname." and 2nd param is '', when calling page ".$_SERVER["PHP_SELF"], LOG_WARNING);
|
|
| 315 | 315 | // Enable this line to know who call the AlDolUtils::GETPOST with '' $check parameter. |
| 316 | 316 | //var_dump(debug_backtrace()[0]); |
| 317 | 317 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | $relativepathstring = $_SERVER["PHP_SELF"]; |
| 341 | 341 | // Clean $relativepathstring |
| 342 | 342 | if (constant('DOL_BASE_URI')) {
|
| 343 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
|
|
| 343 | + $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring);
|
|
| 344 | 344 | } |
| 345 | 345 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
|
| 346 | 346 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
|
@@ -349,8 +349,8 @@ discard block |
||
| 349 | 349 | // Code for search criteria persistence. |
| 350 | 350 | // Retrieve values if restore_lastsearch_values |
| 351 | 351 | if (!empty($_GET['restore_lastsearch_values'])) { // Use $_GET here and not AlDolUtils::GETPOST
|
| 352 | - if (!empty($_SESSION['lastsearch_values_' . $relativepathstring])) { // If there is saved values
|
|
| 353 | - $tmp = json_decode($_SESSION['lastsearch_values_' . $relativepathstring], true); |
|
| 352 | + if (!empty($_SESSION['lastsearch_values_'.$relativepathstring])) { // If there is saved values
|
|
| 353 | + $tmp = json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true); |
|
| 354 | 354 | if (is_array($tmp)) {
|
| 355 | 355 | foreach ($tmp as $key => $val) {
|
| 356 | 356 | if ($key == $paramname) { // We are on the requested parameter
|
@@ -361,12 +361,12 @@ discard block |
||
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | 363 | // If there is saved contextpage, page or limit |
| 364 | - if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_' . $relativepathstring])) {
|
|
| 365 | - $out = $_SESSION['lastsearch_contextpage_' . $relativepathstring]; |
|
| 366 | - } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_' . $relativepathstring])) {
|
|
| 367 | - $out = $_SESSION['lastsearch_page_' . $relativepathstring]; |
|
| 368 | - } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_' . $relativepathstring])) {
|
|
| 369 | - $out = $_SESSION['lastsearch_limit_' . $relativepathstring]; |
|
| 364 | + if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) {
|
|
| 365 | + $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring]; |
|
| 366 | + } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_'.$relativepathstring])) {
|
|
| 367 | + $out = $_SESSION['lastsearch_page_'.$relativepathstring]; |
|
| 368 | + } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring])) {
|
|
| 369 | + $out = $_SESSION['lastsearch_limit_'.$relativepathstring]; |
|
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | // Else, retreive default values if we are not doing a sort |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | $qualified = 1; |
| 436 | 436 | |
| 437 | 437 | if ($qualified) {
|
| 438 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
|
|
| 438 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
|
|
| 439 | 439 | foreach ($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val) {
|
| 440 | 440 | if ($out) |
| 441 | 441 | $out .= ', '; |
@@ -471,11 +471,11 @@ discard block |
||
| 471 | 471 | if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all'])) {
|
| 472 | 472 | // We made a search from quick search menu, do we still use default filter ? |
| 473 | 473 | if (empty(Globals::$conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH)) {
|
| 474 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
|
|
| 474 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
|
|
| 475 | 475 | $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace); |
| 476 | 476 | } |
| 477 | 477 | } else {
|
| 478 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
|
|
| 478 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
|
|
| 479 | 479 | $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace); |
| 480 | 480 | } |
| 481 | 481 | break; |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | // We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text. |
| 495 | 495 | if (!is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) {
|
| 496 | 496 | $maxloop = 20; |
| 497 | - $loopnb = 0; // Protection against infinite loop |
|
| 497 | + $loopnb = 0; // Protection against infinite loop |
|
| 498 | 498 | while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) { // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side.
|
| 499 | 499 | $loopnb++; |
| 500 | 500 | $newout = ''; |
@@ -539,10 +539,10 @@ discard block |
||
| 539 | 539 | } elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID') {
|
| 540 | 540 | $newout = Globals::$conf->entity; |
| 541 | 541 | } else {
|
| 542 | - $newout = ''; // Key not found, we replace with empty string |
|
| 542 | + $newout = ''; // Key not found, we replace with empty string |
|
| 543 | 543 | } |
| 544 | 544 | //var_dump('__'.$reg[1].'__ -> '.$newout);
|
| 545 | - $out = preg_replace('/__' . preg_quote($reg[1], '/') . '__/', $newout, $out);
|
|
| 545 | + $out = preg_replace('/__'.preg_quote($reg[1], '/').'__/', $newout, $out);
|
|
| 546 | 546 | } |
| 547 | 547 | } |
| 548 | 548 | |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | // If prefix is for email |
| 653 | 653 | if ($mode == 'email') {
|
| 654 | 654 | if (empty(Globals::$conf->global->MAIL_PREFIX_FOR_EMAIL_ID)) {
|
| 655 | - return AlSecurity::dol_hash(DOL_DOCUMENT_ROOT . DOL_BASE_URI); |
|
| 655 | + return AlSecurity::dol_hash(DOL_DOCUMENT_ROOT.DOL_BASE_URI); |
|
| 656 | 656 | } |
| 657 | 657 | // If MAIL_PREFIX_FOR_EMAIL_ID is set (a value initialized with a random value is recommended) |
| 658 | 658 | if (Globals::$conf->global->MAIL_PREFIX_FOR_EMAIL_ID != 'SERVER_NAME') {
|
@@ -662,16 +662,16 @@ discard block |
||
| 662 | 662 | return $_SERVER["SERVER_NAME"]; |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | - return AlSecurity::dol_hash(DOL_DOCUMENT_ROOT . DOL_BASE_URI); |
|
| 665 | + return AlSecurity::dol_hash(DOL_DOCUMENT_ROOT.DOL_BASE_URI); |
|
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) {
|
| 669 | - return AlSecurity::dol_hash($_SERVER["SERVER_NAME"] . $_SERVER["DOCUMENT_ROOT"] . DOL_DOCUMENT_ROOT . DOL_BASE_URI); |
|
| 669 | + return AlSecurity::dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_BASE_URI); |
|
| 670 | 670 | |
| 671 | 671 | // Use this for a "readable" cookie name |
| 672 | 672 | //return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_BASE_URI); |
| 673 | 673 | } |
| 674 | - return AlSecurity::dol_hash(DOL_DOCUMENT_ROOT . DOL_BASE_URI); |
|
| 674 | + return AlSecurity::dol_hash(DOL_DOCUMENT_ROOT.DOL_BASE_URI); |
|
| 675 | 675 | } |
| 676 | 676 | |
| 677 | 677 | /** |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | $fullpath = dol_buildpath($relpath); |
| 692 | 692 | |
| 693 | 693 | if (!file_exists($fullpath)) {
|
| 694 | - AlDolUtils::dol_syslog('functions::dol_include_once Tried to load unexisting file: ' . $relpath, LOG_ERR);
|
|
| 694 | + AlDolUtils::dol_syslog('functions::dol_include_once Tried to load unexisting file: '.$relpath, LOG_ERR);
|
|
| 695 | 695 | return false; |
| 696 | 696 | } |
| 697 | 697 | |
@@ -720,14 +720,14 @@ discard block |
||
| 720 | 720 | |
| 721 | 721 | if ($type == 0 /* empty($type) */) { // For a filesystem path
|
| 722 | 722 | //$res = DOL_BASE_PATH . '' . $path; // Standard default path |
| 723 | - $res = DOL_BASE_PATH . '/' . $path; // Standard default path |
|
| 723 | + $res = DOL_BASE_PATH.'/'.$path; // Standard default path |
|
| 724 | 724 | if (isset(Globals::$conf->file->dol_document_root)) {
|
| 725 | 725 | foreach (Globals::$conf->file->dol_document_root as $key => $dirroot) { // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
|
| 726 | 726 | if ($key == 'main') {
|
| 727 | 727 | continue; |
| 728 | 728 | } |
| 729 | - if (file_exists($dirroot . '/' . $path)) {
|
|
| 730 | - $res = $dirroot . '/' . $path; |
|
| 729 | + if (file_exists($dirroot.'/'.$path)) {
|
|
| 730 | + $res = $dirroot.'/'.$path; |
|
| 731 | 731 | return $res; |
| 732 | 732 | } |
| 733 | 733 | } |
@@ -744,13 +744,13 @@ discard block |
||
| 744 | 744 | // using proxy, rewriting, virtual path, etc... |
| 745 | 745 | $res = ''; |
| 746 | 746 | if ($type == 1) {
|
| 747 | - $res = /* DOL_BASE_URI */ DOL_BASE_URI . '/' . $path; // Standard value |
|
| 747 | + $res = /* DOL_BASE_URI */ DOL_BASE_URI.'/'.$path; // Standard value |
|
| 748 | 748 | } |
| 749 | 749 | if ($type == 2) {
|
| 750 | - $res = /* DOL_MAIN_URL_ROOT */ DOL_BASE_PATH . '/' . $path; // Standard value |
|
| 750 | + $res = /* DOL_MAIN_URL_ROOT */ DOL_BASE_PATH.'/'.$path; // Standard value |
|
| 751 | 751 | } |
| 752 | 752 | if ($type == 3) {
|
| 753 | - $res = DOL_BASE_URI . '/' . $path; |
|
| 753 | + $res = DOL_BASE_URI.'/'.$path; |
|
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | foreach (Globals::$conf->file->dol_document_root as $key => $dirroot) { // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
|
@@ -759,33 +759,33 @@ discard block |
||
| 759 | 759 | // global $dolibarr_main_url_root; |
| 760 | 760 | // Define $urlwithroot |
| 761 | 761 | // $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_BASE_URI, '/') . '$/i', '', trim($dolibarr_main_url_root));
|
| 762 | - $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_BASE_URI, '/') . '$/i', '', trim(DOL_BASE_URI));
|
|
| 762 | + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_BASE_URI, '/').'$/i', '', trim(DOL_BASE_URI));
|
|
| 763 | 763 | |
| 764 | - $urlwithroot = $urlwithouturlroot . DOL_BASE_URI; // This is to use external domain name found into config file |
|
| 764 | + $urlwithroot = $urlwithouturlroot.DOL_BASE_URI; // This is to use external domain name found into config file |
|
| 765 | 765 | //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current |
| 766 | 766 | |
| 767 | - $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : $urlwithroot) . '/' . $path; // Test on start with http is for old conf syntax
|
|
| 767 | + $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : $urlwithroot).'/'.$path; // Test on start with http is for old conf syntax
|
|
| 768 | 768 | } |
| 769 | 769 | continue; |
| 770 | 770 | } |
| 771 | - preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i', $path, $regs); // Take part before '?'
|
|
| 771 | + preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i', $path, $regs); // Take part before '?'
|
|
| 772 | 772 | if (!empty($regs[1])) {
|
| 773 | 773 | //print $key.'-'.$dirroot.'/'.$path.'-'.Globals::$conf->file->dol_url_root[$type].'<br>'."\n"; |
| 774 | - if (file_exists($dirroot . '/' . $regs[1])) {
|
|
| 774 | + if (file_exists($dirroot.'/'.$regs[1])) {
|
|
| 775 | 775 | if ($type == 1) {
|
| 776 | - $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : DOL_BASE_URI) . Globals::$conf->file->dol_url_root[$key] . '/' . $path;
|
|
| 776 | + $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : DOL_BASE_URI).Globals::$conf->file->dol_url_root[$key].'/'.$path;
|
|
| 777 | 777 | } |
| 778 | 778 | if ($type == 2) {
|
| 779 | - $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : DOL_MAIN_URL_ROOT) . Globals::$conf->file->dol_url_root[$key] . '/' . $path;
|
|
| 779 | + $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : DOL_MAIN_URL_ROOT).Globals::$conf->file->dol_url_root[$key].'/'.$path;
|
|
| 780 | 780 | } |
| 781 | 781 | if ($type == 3) {
|
| 782 | 782 | // global $dolibarr_main_url_root; |
| 783 | 783 | // Define $urlwithroot |
| 784 | - $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_BASE_URI, '/') . '$/i', '', trim($dolibarr_main_url_root));
|
|
| 785 | - $urlwithroot = $urlwithouturlroot . DOL_BASE_URI; // This is to use external domain name found into config file |
|
| 784 | + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_BASE_URI, '/').'$/i', '', trim($dolibarr_main_url_root));
|
|
| 785 | + $urlwithroot = $urlwithouturlroot.DOL_BASE_URI; // This is to use external domain name found into config file |
|
| 786 | 786 | //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current |
| 787 | 787 | |
| 788 | - $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : $urlwithroot) . Globals::$conf->file->dol_url_root[$key] . '/' . $path; // Test on start with http is for old conf syntax
|
|
| 788 | + $res = (preg_match('/^http/i', Globals::$conf->file->dol_url_root[$key]) ? '' : $urlwithroot).Globals::$conf->file->dol_url_root[$key].'/'.$path; // Test on start with http is for old conf syntax
|
|
| 789 | 789 | } |
| 790 | 790 | break; |
| 791 | 791 | } |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | if (empty($native)) {
|
| 814 | 814 | $myclone = unserialize(serialize($object)); |
| 815 | 815 | } else {
|
| 816 | - $myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep references (refer to the same target/variable) |
|
| 816 | + $myclone = clone $object; // PHP clone is a shallow copy only, not a real clone, so properties of references will keep references (refer to the same target/variable) |
|
| 817 | 817 | } |
| 818 | 818 | |
| 819 | 819 | return $myclone; |
@@ -934,7 +934,7 @@ discard block |
||
| 934 | 934 | */ |
| 935 | 935 | static function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '') |
| 936 | 936 | {
|
| 937 | - $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName
|
|
| 937 | + $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName
|
|
| 938 | 938 | $forbidden_chars_to_remove = array(); |
| 939 | 939 | if (is_array($badcharstoreplace)) |
| 940 | 940 | $forbidden_chars_to_replace = $badcharstoreplace; |
@@ -997,12 +997,12 @@ discard block |
||
| 997 | 997 | static function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0) |
| 998 | 998 | {
|
| 999 | 999 | // escape quotes and backslashes, newlines, etc. |
| 1000 | - $tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags |
|
| 1000 | + $tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags |
|
| 1001 | 1001 | if (!$keepb) |
| 1002 | 1002 | $tmp = strtr($tmp, array("<b>" => '', '</b>' => ''));
|
| 1003 | 1003 | if (!$keepn) |
| 1004 | 1004 | $tmp = strtr($tmp, array("\r" => '\\r', "\n" => '\\n'));
|
| 1005 | - return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html tags |
|
| 1005 | + return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html tags |
|
| 1006 | 1006 | } |
| 1007 | 1007 | |
| 1008 | 1008 | /** |
@@ -1072,14 +1072,14 @@ discard block |
||
| 1072 | 1072 | $message = preg_replace('/password=\'[^\']*\'/', 'password=\'hidden\'', $message); // protection to avoid to have value of password in log
|
| 1073 | 1073 | // If adding log inside HTML page is required |
| 1074 | 1074 | if (!empty($_REQUEST['logtohtml']) && (!empty(Globals::$conf->global->MAIN_ENABLE_LOG_TO_HTML) || !empty(Globals::$conf->global->MAIN_LOGTOHTML))) { // MAIN_LOGTOHTML kept for backward compatibility
|
| 1075 | - Globals::$conf->logbuffer[] = AlDolUtils::dol_print_date(time(), "%Y-%m-%d %H:%M:%S") . " " . $message; |
|
| 1075 | + Globals::$conf->logbuffer[] = AlDolUtils::dol_print_date(time(), "%Y-%m-%d %H:%M:%S")." ".$message; |
|
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | //TODO: Remove this. MAIN_ENABLE_LOG_INLINE_HTML should be deprecated and use a log handler dedicated to HTML output |
| 1079 | 1079 | // If html log tag enabled and url parameter log defined, we show output log on HTML comments |
| 1080 | 1080 | if (!empty(Globals::$conf->global->MAIN_ENABLE_LOG_INLINE_HTML) && !empty($_GET["log"])) {
|
| 1081 | 1081 | print "\n\n<!-- Log start\n"; |
| 1082 | - print $message . "\n"; |
|
| 1082 | + print $message."\n"; |
|
| 1083 | 1083 | print "Log end -->\n"; |
| 1084 | 1084 | } |
| 1085 | 1085 | |
@@ -1093,7 +1093,7 @@ discard block |
||
| 1093 | 1093 | |
| 1094 | 1094 | // This is when server run behind a reverse proxy |
| 1095 | 1095 | if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) |
| 1096 | - $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'] . (empty($_SERVER["REMOTE_ADDR"]) ? '' : '->' . $_SERVER['REMOTE_ADDR']); |
|
| 1096 | + $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'].(empty($_SERVER["REMOTE_ADDR"]) ? '' : '->'.$_SERVER['REMOTE_ADDR']); |
|
| 1097 | 1097 | // This is when server run normally on a server |
| 1098 | 1098 | else if (!empty($_SERVER["REMOTE_ADDR"])) |
| 1099 | 1099 | $data['ip'] = $_SERVER['REMOTE_ADDR']; |
@@ -1102,10 +1102,10 @@ discard block |
||
| 1102 | 1102 | $data['ip'] = $_SERVER['SERVER_ADDR']; |
| 1103 | 1103 | // This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it). |
| 1104 | 1104 | else if (!empty($_SERVER['COMPUTERNAME'])) |
| 1105 | - $data['ip'] = $_SERVER['COMPUTERNAME'] . (empty($_SERVER['USERNAME']) ? '' : '@' . $_SERVER['USERNAME']); |
|
| 1105 | + $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME']) ? '' : '@'.$_SERVER['USERNAME']); |
|
| 1106 | 1106 | // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). |
| 1107 | 1107 | else if (!empty($_SERVER['LOGNAME'])) |
| 1108 | - $data['ip'] = '???@' . $_SERVER['LOGNAME']; |
|
| 1108 | + $data['ip'] = '???@'.$_SERVER['LOGNAME']; |
|
| 1109 | 1109 | // Loop on each log handler and send output |
| 1110 | 1110 | foreach (Globals::$conf->loghandlers as $loghandlerinstance) {
|
| 1111 | 1111 | if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) |
@@ -1157,10 +1157,10 @@ discard block |
||
| 1157 | 1157 | {
|
| 1158 | 1158 | // global Globals::$conf, Globals::$langs, Globals::$hookManager; |
| 1159 | 1159 | |
| 1160 | - $out = "\n" . '<div class="tabs" data-role="controlgroup" data-type="horizontal">' . "\n"; |
|
| 1160 | + $out = "\n".'<div class="tabs" data-role="controlgroup" data-type="horizontal">'."\n"; |
|
| 1161 | 1161 | |
| 1162 | 1162 | if ($morehtmlright) {
|
| 1163 | - $out .= '<div class="inline-block floatright tabsElem">' . $morehtmlright . '</div>'; // Output right area first so when space is missing, text is in front of tabs and not under. |
|
| 1163 | + $out .= '<div class="inline-block floatright tabsElem">'.$morehtmlright.'</div>'; // Output right area first so when space is missing, text is in front of tabs and not under. |
|
| 1164 | 1164 | } |
| 1165 | 1165 | |
| 1166 | 1166 | // Show title |
@@ -1171,8 +1171,8 @@ discard block |
||
| 1171 | 1171 | $limittitle = 30; |
| 1172 | 1172 | $out .= '<a class="tabTitle">'; |
| 1173 | 1173 | if ($picto) |
| 1174 | - $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_') . $picto, '', $pictoisfullpath) . ' '; |
|
| 1175 | - $out .= '<span class="tabTitleText">' . dol_trunc($title, $limittitle) . '</span>'; |
|
| 1174 | + $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath).' '; |
|
| 1175 | + $out .= '<span class="tabTitleText">'.dol_trunc($title, $limittitle).'</span>'; |
|
| 1176 | 1176 | $out .= '</a>'; |
| 1177 | 1177 | } |
| 1178 | 1178 | |
@@ -1212,23 +1212,23 @@ discard block |
||
| 1212 | 1212 | } |
| 1213 | 1213 | |
| 1214 | 1214 | if ($i < $limittoshow || $isactive) {
|
| 1215 | - $out .= '<div class="inline-block tabsElem' . ($isactive ? ' tabsElemActive' : '') . ((!$isactive && !empty(Globals::$conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT)) ? ' hideonprint' : '') . '"><!-- id tab = ' . (empty($links[$i][2]) ? '' : $links[$i][2]) . ' -->'; |
|
| 1215 | + $out .= '<div class="inline-block tabsElem'.($isactive ? ' tabsElemActive' : '').((!$isactive && !empty(Globals::$conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT)) ? ' hideonprint' : '').'"><!-- id tab = '.(empty($links[$i][2]) ? '' : $links[$i][2]).' -->'; |
|
| 1216 | 1216 | if (isset($links[$i][2]) && $links[$i][2] == 'image') {
|
| 1217 | 1217 | if (!empty($links[$i][0])) {
|
| 1218 | - $out .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n"; |
|
| 1218 | + $out .= '<a class="tabimage'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; |
|
| 1219 | 1219 | } else {
|
| 1220 | - $out .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n"; |
|
| 1220 | + $out .= '<span class="tabspan">'.$links[$i][1].'</span>'."\n"; |
|
| 1221 | 1221 | } |
| 1222 | 1222 | } else if (!empty($links[$i][1])) {
|
| 1223 | 1223 | //print "x $i $active ".$links[$i][2]." z"; |
| 1224 | 1224 | if ($isactive) {
|
| 1225 | - $out .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="tabactive tab inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">'; |
|
| 1225 | + $out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tabactive tab inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'; |
|
| 1226 | 1226 | $out .= $links[$i][1]; |
| 1227 | - $out .= '</a>' . "\n"; |
|
| 1227 | + $out .= '</a>'."\n"; |
|
| 1228 | 1228 | } else {
|
| 1229 | - $out .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="tabunactive tab inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">'; |
|
| 1229 | + $out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tabunactive tab inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'; |
|
| 1230 | 1230 | $out .= $links[$i][1]; |
| 1231 | - $out .= '</a>' . "\n"; |
|
| 1231 | + $out .= '</a>'."\n"; |
|
| 1232 | 1232 | } |
| 1233 | 1233 | } |
| 1234 | 1234 | $out .= '</div>'; |
@@ -1241,14 +1241,14 @@ discard block |
||
| 1241 | 1241 | $outmore .= '<div class="popuptab wordwrap" style="display:inherit;">'; |
| 1242 | 1242 | if (isset($links[$i][2]) && $links[$i][2] == 'image') {
|
| 1243 | 1243 | if (!empty($links[$i][0])) |
| 1244 | - $outmore .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n"; |
|
| 1244 | + $outmore .= '<a class="tabimage'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n"; |
|
| 1245 | 1245 | else |
| 1246 | - $outmore .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n"; |
|
| 1246 | + $outmore .= '<span class="tabspan">'.$links[$i][1].'</span>'."\n"; |
|
| 1247 | 1247 | } |
| 1248 | 1248 | else if (!empty($links[$i][1])) {
|
| 1249 | - $outmore .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="wordwrap inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">'; |
|
| 1249 | + $outmore .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="wordwrap inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'; |
|
| 1250 | 1250 | $outmore .= preg_replace('/([a-z])\/([a-z])/i', '\\1 / \\2', $links[$i][1]); // Replace x/y with x / y to allow wrap on long composed texts.
|
| 1251 | - $outmore .= '</a>' . "\n"; |
|
| 1251 | + $outmore .= '</a>'."\n"; |
|
| 1252 | 1252 | } |
| 1253 | 1253 | $outmore .= '</div>'; |
| 1254 | 1254 | |
@@ -1264,24 +1264,24 @@ discard block |
||
| 1264 | 1264 | $right = (Globals::$langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
|
| 1265 | 1265 | |
| 1266 | 1266 | $tabsname = str_replace("@", "", $picto);
|
| 1267 | - $out .= '<div id="moretabs' . $tabsname . '" class="inline-block tabsElem">'; |
|
| 1268 | - $out .= '<a href="#" class="tab moretab inline-block tabunactive reposition">' . Globals::$langs->trans("More") . '... (' . $nbintab . ')</a>';
|
|
| 1269 | - $out .= '<div id="moretabsList' . $tabsname . '" style="position: absolute; ' . $left . ': -999em; text-align: ' . $left . '; margin:0px; padding:2px">'; |
|
| 1267 | + $out .= '<div id="moretabs'.$tabsname.'" class="inline-block tabsElem">'; |
|
| 1268 | + $out .= '<a href="#" class="tab moretab inline-block tabunactive reposition">'.Globals::$langs->trans("More").'... ('.$nbintab.')</a>';
|
|
| 1269 | + $out .= '<div id="moretabsList'.$tabsname.'" style="position: absolute; '.$left.': -999em; text-align: '.$left.'; margin:0px; padding:2px">'; |
|
| 1270 | 1270 | $out .= $outmore; |
| 1271 | 1271 | $out .= '</div>'; |
| 1272 | 1272 | $out .= '<div></div>'; |
| 1273 | 1273 | $out .= "</div>\n"; |
| 1274 | 1274 | |
| 1275 | 1275 | $out .= "<script>"; |
| 1276 | - $out .= "$('#moretabs" . $tabsname . "').mouseenter( function() { console.log('mouseenter " . $left . "'); $('#moretabsList" . $tabsname . "').css('" . $left . "','auto');});";
|
|
| 1277 | - $out .= "$('#moretabs" . $tabsname . "').mouseleave( function() { console.log('mouseleave " . $left . "'); $('#moretabsList" . $tabsname . "').css('" . $left . "','-999em');});";
|
|
| 1276 | + $out .= "$('#moretabs".$tabsname."').mouseenter( function() { console.log('mouseenter ".$left."'); $('#moretabsList".$tabsname."').css('".$left."','auto');});";
|
|
| 1277 | + $out .= "$('#moretabs".$tabsname."').mouseleave( function() { console.log('mouseleave ".$left."'); $('#moretabsList".$tabsname."').css('".$left."','-999em');});";
|
|
| 1278 | 1278 | $out .= "</script>"; |
| 1279 | 1279 | } |
| 1280 | 1280 | |
| 1281 | 1281 | $out .= "</div>\n"; |
| 1282 | 1282 | |
| 1283 | 1283 | if (!$notab || $notab == -1) |
| 1284 | - $out .= "\n" . '<div class="tabBar' . ($notab == -1 ? '' : ' tabBarWithBottom') . '">' . "\n"; |
|
| 1284 | + $out .= "\n".'<div class="tabBar'.($notab == -1 ? '' : ' tabBarWithBottom').'">'."\n"; |
|
| 1285 | 1285 | |
| 1286 | 1286 | $parameters = array('tabname' => $active, 'out' => $out);
|
| 1287 | 1287 | $reshook = Globals::$hookManager->executeHooks('printTabsHead', $parameters); // This hook usage is called just before output the head of tabs. Take also a look at "completeTabsHead"
|
@@ -1405,7 +1405,7 @@ discard block |
||
| 1405 | 1405 | $maxvisiblephotos = 1; |
| 1406 | 1406 | } |
| 1407 | 1407 | if ($showimage) {
|
| 1408 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('product', Globals::$conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>';
|
|
| 1408 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', Globals::$conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>';
|
|
| 1409 | 1409 | } else {
|
| 1410 | 1410 | if (!empty(Globals::$conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
|
| 1411 | 1411 | $nophoto = ''; |
@@ -1414,19 +1414,19 @@ discard block |
||
| 1414 | 1414 | //elseif (Globals::$conf->browser->layout != 'phone') { // Show no photo link
|
| 1415 | 1415 | $nophoto = '/public/theme/common/nophoto.png'; |
| 1416 | 1416 | // $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '"></div>'; |
| 1417 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '"></div>'; |
|
| 1417 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" border="0"'.($width ? ' width="'.$width.'"' : '').' src="'.DOL_BASE_URI.$nophoto.'"></div>'; |
|
| 1418 | 1418 | //} |
| 1419 | 1419 | } |
| 1420 | 1420 | } elseif ($object->element == 'ticket') {
|
| 1421 | 1421 | $width = 80; |
| 1422 | 1422 | $cssclass = 'photoref'; |
| 1423 | - $showimage = $object->is_photo_available(Globals::$conf->ticket->multidir_output[$entity] . '/' . $object->track_id); |
|
| 1423 | + $showimage = $object->is_photo_available(Globals::$conf->ticket->multidir_output[$entity].'/'.$object->track_id); |
|
| 1424 | 1424 | $maxvisiblephotos = (isset(Globals::$conf->global->TICKETSUP_MAX_VISIBLE_PHOTO) ? Globals::$conf->global->TICKETSUP_MAX_VISIBLE_PHOTO : 2); |
| 1425 | 1425 | if (Globals::$conf->browser->layout == 'phone') {
|
| 1426 | 1426 | $maxvisiblephotos = 1; |
| 1427 | 1427 | } |
| 1428 | 1428 | if ($showimage) {
|
| 1429 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('ticket', Globals::$conf->ticket->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>';
|
|
| 1429 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('ticket', Globals::$conf->ticket->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>';
|
|
| 1430 | 1430 | } else {
|
| 1431 | 1431 | if (!empty(Globals::$conf->global->TICKETSUP_NODISPLAYIFNOPHOTO)) {
|
| 1432 | 1432 | $nophoto = ''; |
@@ -1435,7 +1435,7 @@ discard block |
||
| 1435 | 1435 | //elseif (Globals::$conf->browser->layout != 'phone') { // Show no photo link
|
| 1436 | 1436 | $nophoto = '/public/theme/common/nophoto.png'; |
| 1437 | 1437 | //$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '"></div>'; |
| 1438 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_BASE_URI . $nophoto . '"></div>'; |
|
| 1438 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" border="0"'.($width ? ' width="'.$width.'"' : '').' src="'.DOL_BASE_URI.$nophoto.'"></div>'; |
|
| 1439 | 1439 | //} |
| 1440 | 1440 | } |
| 1441 | 1441 | } else {
|
@@ -1445,25 +1445,25 @@ discard block |
||
| 1445 | 1445 | // Check if a preview file is available |
| 1446 | 1446 | if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice', 'expensereport')) && class_exists("Imagick")) {
|
| 1447 | 1447 | $objectref = dol_sanitizeFileName($object->ref); |
| 1448 | - $dir_output = (empty(Globals::$conf->$modulepart->multidir_output[$entity]) ? Globals::$conf->$modulepart->dir_output : Globals::$conf->$modulepart->multidir_output[$entity]) . "/"; |
|
| 1448 | + $dir_output = (empty(Globals::$conf->$modulepart->multidir_output[$entity]) ? Globals::$conf->$modulepart->dir_output : Globals::$conf->$modulepart->multidir_output[$entity])."/"; |
|
| 1449 | 1449 | if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice'))) {
|
| 1450 | 1450 | $subdir = get_exdir($object->id, 2, 0, 1, $object, $modulepart); |
| 1451 | - $subdir .= ((!empty($subdir) && !preg_match('/\/$/', $subdir)) ? '/' : '') . $objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it at end
|
|
| 1451 | + $subdir .= ((!empty($subdir) && !preg_match('/\/$/', $subdir)) ? '/' : '').$objectref; // the objectref dir is not included into get_exdir when used with level=2, so we add it at end
|
|
| 1452 | 1452 | } else {
|
| 1453 | 1453 | $subdir = get_exdir($object->id, 0, 0, 1, $object, $modulepart); |
| 1454 | 1454 | } |
| 1455 | 1455 | if (empty($subdir)) |
| 1456 | 1456 | $subdir = 'errorgettingsubdirofobject'; // Protection to avoid to return empty path |
| 1457 | 1457 | |
| 1458 | - $filepath = $dir_output . $subdir . "/"; |
|
| 1458 | + $filepath = $dir_output.$subdir."/"; |
|
| 1459 | 1459 | |
| 1460 | - $file = $filepath . $objectref . ".pdf"; |
|
| 1461 | - $relativepath = $subdir . '/' . $objectref . '.pdf'; |
|
| 1460 | + $file = $filepath.$objectref.".pdf"; |
|
| 1461 | + $relativepath = $subdir.'/'.$objectref.'.pdf'; |
|
| 1462 | 1462 | |
| 1463 | 1463 | // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") |
| 1464 | - $fileimage = $file . '_preview.png'; // If PDF has 1 page |
|
| 1465 | - $fileimagebis = $file . '_preview-0.png'; // If PDF has more than one page |
|
| 1466 | - $relativepathimage = $relativepath . '_preview.png'; |
|
| 1464 | + $fileimage = $file.'_preview.png'; // If PDF has 1 page |
|
| 1465 | + $fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page |
|
| 1466 | + $relativepathimage = $relativepath.'_preview.png'; |
|
| 1467 | 1467 | |
| 1468 | 1468 | // Si fichier PDF existe |
| 1469 | 1469 | if (file_exists($file)) {
|
@@ -1472,7 +1472,7 @@ discard block |
||
| 1472 | 1472 | if ((!file_exists($fileimage) || (filemtime($fileimage) < filemtime($file))) && (!file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file))) |
| 1473 | 1473 | ) {
|
| 1474 | 1474 | if (empty(Globals::$conf->global->MAIN_DISABLE_PDF_THUMBS)) { // If you experienc trouble with pdf thumb generation and imagick, you can disable here.
|
| 1475 | - include_once DOL_BASE_PATH . '/core/lib/files.lib.php'; |
|
| 1475 | + include_once DOL_BASE_PATH.'/core/lib/files.lib.php'; |
|
| 1476 | 1476 | $ret = dol_convert_file($file, 'png', $fileimage); |
| 1477 | 1477 | if ($ret < 0) |
| 1478 | 1478 | $error++; |
@@ -1485,14 +1485,14 @@ discard block |
||
| 1485 | 1485 | // Si fichier png PDF d'1 page trouve |
| 1486 | 1486 | if (file_exists($fileimage)) {
|
| 1487 | 1487 | $phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">'; |
| 1488 | - $phototoshow .= '<img height="' . $heightforphotref . '" class="photo photowithmargin photowithborder" src="' . DOL_BASE_URI . '/viewimage.php?modulepart=apercu' . $modulepart . '&file=' . urlencode($relativepathimage) . '">'; |
|
| 1488 | + $phototoshow .= '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_BASE_URI.'/viewimage.php?modulepart=apercu'.$modulepart.'&file='.urlencode($relativepathimage).'">'; |
|
| 1489 | 1489 | $phototoshow .= '</div></div>'; |
| 1490 | 1490 | } |
| 1491 | 1491 | // Si fichier png PDF de plus d'1 page trouve |
| 1492 | 1492 | elseif (file_exists($fileimagebis)) {
|
| 1493 | - $preview = preg_replace('/\.png/', '', $relativepathimage) . "-0.png";
|
|
| 1493 | + $preview = preg_replace('/\.png/', '', $relativepathimage)."-0.png";
|
|
| 1494 | 1494 | $phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">'; |
| 1495 | - $phototoshow .= '<img height="' . $heightforphotref . '" class="photo photowithmargin photowithborder" src="' . DOL_BASE_URI . '/viewimage.php?modulepart=apercu' . $modulepart . '&file=' . urlencode($preview) . '"><p>'; |
|
| 1495 | + $phototoshow .= '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_BASE_URI.'/viewimage.php?modulepart=apercu'.$modulepart.'&file='.urlencode($preview).'"><p>'; |
|
| 1496 | 1496 | $phototoshow .= '</div></div>'; |
| 1497 | 1497 | } |
| 1498 | 1498 | } |
@@ -1519,10 +1519,10 @@ discard block |
||
| 1519 | 1519 | $picto = $object->picto; |
| 1520 | 1520 | if ($object->element == 'project' && !$object->public) |
| 1521 | 1521 | $picto = 'project'; // instead of projectpub |
| 1522 | - $nophoto = img_picto('', 'object_' . $picto, '', false, 1);
|
|
| 1522 | + $nophoto = img_picto('', 'object_'.$picto, '', false, 1);
|
|
| 1523 | 1523 | } |
| 1524 | 1524 | $morehtmlleft .= '<!-- No photo to show -->'; |
| 1525 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . $nophoto . '"></div></div>'; |
|
| 1525 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$modulepart.($cssclass ? ' '.$cssclass : '').'" alt="No photo" border="0"'.($width ? ' width="'.$width.'"' : '').' src="'.$nophoto.'"></div></div>'; |
|
| 1526 | 1526 | |
| 1527 | 1527 | $morehtmlleft .= '</div>'; |
| 1528 | 1528 | } |
@@ -1530,7 +1530,7 @@ discard block |
||
| 1530 | 1530 | } |
| 1531 | 1531 | |
| 1532 | 1532 | if ($showbarcode) |
| 1533 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $form->showbarcode($object) . '</div>'; |
|
| 1533 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>'; |
|
| 1534 | 1534 | |
| 1535 | 1535 | if ($object->element == 'societe') {
|
| 1536 | 1536 | if (!empty(Globals::$conf->use_javascript_ajax) && $user->rights->societe->creer && !empty(Globals::$conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
@@ -1543,14 +1543,14 @@ discard block |
||
| 1543 | 1543 | if (!empty(Globals::$conf->use_javascript_ajax) && $user->rights->produit->creer && !empty(Globals::$conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
| 1544 | 1544 | $morehtmlstatus .= ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell'); |
| 1545 | 1545 | } else {
|
| 1546 | - $morehtmlstatus .= '<span class="statusrefsell">' . $object->getLibStatut(5, 0) . '</span>'; |
|
| 1546 | + $morehtmlstatus .= '<span class="statusrefsell">'.$object->getLibStatut(5, 0).'</span>'; |
|
| 1547 | 1547 | } |
| 1548 | 1548 | $morehtmlstatus .= ' '; |
| 1549 | 1549 | //$morehtmlstatus.=Globals::$langs->trans("Status").' ('.Globals::$langs->trans("Buy").') ';
|
| 1550 | 1550 | if (!empty(Globals::$conf->use_javascript_ajax) && $user->rights->produit->creer && !empty(Globals::$conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
| 1551 | 1551 | $morehtmlstatus .= ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy'); |
| 1552 | 1552 | } else {
|
| 1553 | - $morehtmlstatus .= '<span class="statusrefbuy">' . $object->getLibStatut(5, 1) . '</span>'; |
|
| 1553 | + $morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(5, 1).'</span>'; |
|
| 1554 | 1554 | } |
| 1555 | 1555 | } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan'))) {
|
| 1556 | 1556 | $tmptxt = $object->getLibStatut(6, $object->totalpaye); |
@@ -1577,7 +1577,7 @@ discard block |
||
| 1577 | 1577 | if ($object->progress >= 100) |
| 1578 | 1578 | $object->fk_statut = 3; |
| 1579 | 1579 | $tmptxt = $object->getLibStatut(5); |
| 1580 | - $morehtmlstatus .= $tmptxt; // No status on task |
|
| 1580 | + $morehtmlstatus .= $tmptxt; // No status on task |
|
| 1581 | 1581 | } |
| 1582 | 1582 | else { // Generic case
|
| 1583 | 1583 | $tmptxt = $object->getLibStatut(6); |
@@ -1591,18 +1591,18 @@ discard block |
||
| 1591 | 1591 | if (method_exists($object, 'getVentilExportCompta')) {
|
| 1592 | 1592 | $accounted = $object->getVentilExportCompta(); |
| 1593 | 1593 | Globals::$langs->load("accountancy");
|
| 1594 | - $morehtmlstatus .= '</div><div class="statusref statusrefbis">' . ($accounted > 0 ? Globals::$langs->trans("Accounted") : Globals::$langs->trans("NotYetAccounted"));
|
|
| 1594 | + $morehtmlstatus .= '</div><div class="statusref statusrefbis">'.($accounted > 0 ? Globals::$langs->trans("Accounted") : Globals::$langs->trans("NotYetAccounted"));
|
|
| 1595 | 1595 | } |
| 1596 | 1596 | } |
| 1597 | 1597 | |
| 1598 | 1598 | // Add alias for thirdparty |
| 1599 | 1599 | if (!empty($object->name_alias)) |
| 1600 | - $morehtmlref .= '<div class="refidno">' . $object->name_alias . '</div>'; |
|
| 1600 | + $morehtmlref .= '<div class="refidno">'.$object->name_alias.'</div>'; |
|
| 1601 | 1601 | |
| 1602 | 1602 | // Add label |
| 1603 | 1603 | if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task') {
|
| 1604 | 1604 | if (!empty($object->label)) |
| 1605 | - $morehtmlref .= '<div class="refidno">' . $object->label . '</div>'; |
|
| 1605 | + $morehtmlref .= '<div class="refidno">'.$object->label.'</div>'; |
|
| 1606 | 1606 | } |
| 1607 | 1607 | |
| 1608 | 1608 | if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files') {
|
@@ -1612,11 +1612,11 @@ discard block |
||
| 1612 | 1612 | } |
| 1613 | 1613 | if (!empty(Globals::$conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product'))) {
|
| 1614 | 1614 | $morehtmlref .= '<div style="clear: both;"></div><div class="refidno">'; |
| 1615 | - $morehtmlref .= Globals::$langs->trans("TechnicalID") . ': ' . $object->id;
|
|
| 1615 | + $morehtmlref .= Globals::$langs->trans("TechnicalID").': '.$object->id;
|
|
| 1616 | 1616 | $morehtmlref .= '</div>'; |
| 1617 | 1617 | } |
| 1618 | 1618 | |
| 1619 | - print '<div class="' . ($onlybanner ? 'arearefnobottom ' : 'arearef ') . 'heightref valignmiddle" width="100%">'; |
|
| 1619 | + print '<div class="'.($onlybanner ? 'arearefnobottom ' : 'arearef ').'heightref valignmiddle" width="100%">'; |
|
| 1620 | 1620 | print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright); |
| 1621 | 1621 | print '</div>'; |
| 1622 | 1622 | print '<div class="underrefbanner clearboth"></div>'; |
@@ -1638,7 +1638,7 @@ discard block |
||
| 1638 | 1638 | if ($fieldrequired) |
| 1639 | 1639 | $ret .= '<span class="fieldrequired">'; |
| 1640 | 1640 | if ((Globals::$conf->dol_use_jmobile != 4)) |
| 1641 | - $ret .= '<label for="' . $fieldkey . '">'; |
|
| 1641 | + $ret .= '<label for="'.$fieldkey.'">'; |
|
| 1642 | 1642 | $ret .= Globals::$langs->trans($langkey); |
| 1643 | 1643 | if ((Globals::$conf->dol_use_jmobile != 4)) |
| 1644 | 1644 | $ret .= '</label>'; |
@@ -1657,9 +1657,9 @@ discard block |
||
| 1657 | 1657 | static function dol_bc($var, $moreclass = '') |
| 1658 | 1658 | {
|
| 1659 | 1659 | // global $bc; |
| 1660 | - $ret = ' ' . $bc[$var]; |
|
| 1660 | + $ret = ' '.$bc[$var]; |
|
| 1661 | 1661 | if ($moreclass) |
| 1662 | - $ret = preg_replace('/class=\"/', 'class="' . $moreclass . ' ', $ret);
|
|
| 1662 | + $ret = preg_replace('/class=\"/', 'class="'.$moreclass.' ', $ret);
|
|
| 1663 | 1663 | return $ret; |
| 1664 | 1664 | } |
| 1665 | 1665 | |
@@ -1679,50 +1679,50 @@ discard block |
||
| 1679 | 1679 | // global Globals::$conf, Globals::$langs; |
| 1680 | 1680 | |
| 1681 | 1681 | $ret = ''; |
| 1682 | - $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
|
|
| 1682 | + $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
|
|
| 1683 | 1683 | // Address |
| 1684 | 1684 | if (empty($mode)) {
|
| 1685 | 1685 | $ret .= $object->address; |
| 1686 | 1686 | } |
| 1687 | 1687 | // Zip/Town/State |
| 1688 | 1688 | if (in_array($object->country_code, array('AU', 'CA', 'US')) || !empty(Globals::$conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) { // US: title firstname name \n address lines \n town, state, zip \n country
|
| 1689 | - $ret .= ($ret ? $sep : '' ) . $object->town; |
|
| 1689 | + $ret .= ($ret ? $sep : '').$object->town; |
|
| 1690 | 1690 | if ($object->state) {
|
| 1691 | - $ret .= ($ret ? ", " : '') . $object->state; |
|
| 1691 | + $ret .= ($ret ? ", " : '').$object->state; |
|
| 1692 | 1692 | } |
| 1693 | 1693 | if ($object->zip) |
| 1694 | - $ret .= ($ret ? ", " : '') . $object->zip; |
|
| 1694 | + $ret .= ($ret ? ", " : '').$object->zip; |
|
| 1695 | 1695 | } |
| 1696 | 1696 | else if (in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country
|
| 1697 | - $ret .= ($ret ? $sep : '' ) . $object->town; |
|
| 1697 | + $ret .= ($ret ? $sep : '').$object->town; |
|
| 1698 | 1698 | if ($object->state) {
|
| 1699 | - $ret .= ($ret ? ", " : '') . $object->state; |
|
| 1699 | + $ret .= ($ret ? ", " : '').$object->state; |
|
| 1700 | 1700 | } |
| 1701 | 1701 | if ($object->zip) |
| 1702 | - $ret .= ($ret ? $sep : '' ) . $object->zip; |
|
| 1702 | + $ret .= ($ret ? $sep : '').$object->zip; |
|
| 1703 | 1703 | } |
| 1704 | 1704 | else if (in_array($object->country_code, array('ES', 'TR'))) { // ES: title firstname name \n address lines \n zip town \n state \n country
|
| 1705 | - $ret .= ($ret ? $sep : '' ) . $object->zip; |
|
| 1706 | - $ret .= ($object->town ? (($object->zip ? ' ' : '') . $object->town) : ''); |
|
| 1705 | + $ret .= ($ret ? $sep : '').$object->zip; |
|
| 1706 | + $ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : ''); |
|
| 1707 | 1707 | if ($object->state) {
|
| 1708 | - $ret .= "\n" . $object->state; |
|
| 1708 | + $ret .= "\n".$object->state; |
|
| 1709 | 1709 | } |
| 1710 | 1710 | } else if (in_array($object->country_code, array('IT'))) { // IT: tile firstname name\n address lines \n zip (Code Departement) \n country
|
| 1711 | - $ret .= ($ret ? $sep : '' ) . $object->zip; |
|
| 1712 | - $ret .= ($object->town ? (($object->zip ? ' ' : '') . $object->town) : ''); |
|
| 1713 | - $ret .= ($object->departement_id ? (' (' . ($object->departement_id) . ')') : '');
|
|
| 1711 | + $ret .= ($ret ? $sep : '').$object->zip; |
|
| 1712 | + $ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : ''); |
|
| 1713 | + $ret .= ($object->departement_id ? (' ('.($object->departement_id).')') : '');
|
|
| 1714 | 1714 | } else { // Other: title firstname name \n address lines \n zip town \n country
|
| 1715 | - $ret .= $object->zip ? (($ret ? $sep : '' ) . $object->zip) : ''; |
|
| 1716 | - $ret .= ($object->town ? (($object->zip ? ' ' : ($ret ? $sep : '' )) . $object->town) : ''); |
|
| 1715 | + $ret .= $object->zip ? (($ret ? $sep : '').$object->zip) : ''; |
|
| 1716 | + $ret .= ($object->town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$object->town) : ''); |
|
| 1717 | 1717 | if ($object->state && in_array($object->country_code, $countriesusingstate)) {
|
| 1718 | - $ret .= ($ret ? ", " : '') . $object->state; |
|
| 1718 | + $ret .= ($ret ? ", " : '').$object->state; |
|
| 1719 | 1719 | } |
| 1720 | 1720 | } |
| 1721 | 1721 | if (!is_object($outputlangs)) |
| 1722 | 1722 | $outputlangs = Globals::$langs; |
| 1723 | 1723 | if ($withcountry) {
|
| 1724 | 1724 | Globals::$langs->load("dict");
|
| 1725 | - $ret .= ($object->country_code ? ($ret ? $sep : '') . $outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country" . $object->country_code)) : '');
|
|
| 1725 | + $ret .= ($object->country_code ? ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)) : '');
|
|
| 1726 | 1726 | } |
| 1727 | 1727 | |
| 1728 | 1728 | return $ret; |
@@ -1776,13 +1776,13 @@ discard block |
||
| 1776 | 1776 | if (is_string($tzoutput)) {
|
| 1777 | 1777 | if ($tzoutput == 'tzserver') {
|
| 1778 | 1778 | $to_gmt = false; |
| 1779 | - $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion' |
|
| 1779 | + $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion' |
|
| 1780 | 1780 | $offsettz = 0; |
| 1781 | 1781 | $offsetdst = 0; |
| 1782 | 1782 | } elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') {
|
| 1783 | 1783 | $to_gmt = true; |
| 1784 | 1784 | $offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion' |
| 1785 | - $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore |
|
| 1785 | + $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore |
|
| 1786 | 1786 | $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; // Will not be used anymore |
| 1787 | 1787 | } |
| 1788 | 1788 | } |
@@ -1828,9 +1828,9 @@ discard block |
||
| 1828 | 1828 | else if ($format == 'dayxcard') |
| 1829 | 1829 | $format = '%Y%m%d'; |
| 1830 | 1830 | else if ($format == 'dayrfc') |
| 1831 | - $format = '%Y-%m-%d'; // DATE_RFC3339 |
|
| 1831 | + $format = '%Y-%m-%d'; // DATE_RFC3339 |
|
| 1832 | 1832 | else if ($format == 'dayhourrfc') |
| 1833 | - $format = '%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339 |
|
| 1833 | + $format = '%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339 |
|
| 1834 | 1834 | else if ($format == 'standard') |
| 1835 | 1835 | $format = '%Y-%m-%d %H:%M:%S'; |
| 1836 | 1836 | |
@@ -1841,7 +1841,7 @@ discard block |
||
| 1841 | 1841 | |
| 1842 | 1842 | // If date undefined or "", we return "" |
| 1843 | 1843 | if (AlDolUtils::dol_strlen($time) == 0) |
| 1844 | - return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) |
|
| 1844 | + return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) |
|
| 1845 | 1845 | |
| 1846 | 1846 | |
| 1847 | 1847 | |
@@ -1911,7 +1911,7 @@ discard block |
||
| 1911 | 1911 | if (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg) || preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) { // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
|
| 1912 | 1912 | // TODO Remove this. |
| 1913 | 1913 | // This part of code should not be used. |
| 1914 | - AlDolUtils::dol_syslog("Functions.lib::DolUtils::dol_print_date static function call with deprecated value of time in page " . $_SERVER["PHP_SELF"], LOG_ERR);
|
|
| 1914 | + AlDolUtils::dol_syslog("Functions.lib::DolUtils::dol_print_date static function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_ERR);
|
|
| 1915 | 1915 | // Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS' |
| 1916 | 1916 | $syear = (!empty($reg[1]) ? $reg[1] : ''); |
| 1917 | 1917 | $smonth = (!empty($reg[2]) ? $reg[2] : ''); |
@@ -1929,7 +1929,7 @@ discard block |
||
| 1929 | 1929 | |
| 1930 | 1930 | $ret = adodb_strftime($format, $timetouse, $to_gmt); |
| 1931 | 1931 | } else |
| 1932 | - $ret = 'Bad value ' . $time . ' for date'; |
|
| 1932 | + $ret = 'Bad value '.$time.' for date'; |
|
| 1933 | 1933 | } |
| 1934 | 1934 | |
| 1935 | 1935 | if (preg_match('/__b__/i', $format)) {
|
@@ -1938,11 +1938,11 @@ discard block |
||
| 1938 | 1938 | $month = adodb_strftime('%m', $timetouse);
|
| 1939 | 1939 | $month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
|
| 1940 | 1940 | if ($encodetooutput) {
|
| 1941 | - $monthtext = $outputlangs->transnoentities('Month' . $month);
|
|
| 1942 | - $monthtextshort = $outputlangs->transnoentities('MonthShort' . $month);
|
|
| 1941 | + $monthtext = $outputlangs->transnoentities('Month'.$month);
|
|
| 1942 | + $monthtextshort = $outputlangs->transnoentities('MonthShort'.$month);
|
|
| 1943 | 1943 | } else {
|
| 1944 | - $monthtext = $outputlangs->transnoentitiesnoconv('Month' . $month);
|
|
| 1945 | - $monthtextshort = $outputlangs->transnoentitiesnoconv('MonthShort' . $month);
|
|
| 1944 | + $monthtext = $outputlangs->transnoentitiesnoconv('Month'.$month);
|
|
| 1945 | + $monthtextshort = $outputlangs->transnoentitiesnoconv('MonthShort'.$month);
|
|
| 1946 | 1946 | } |
| 1947 | 1947 | //print 'monthtext='.$monthtext.' monthtextshort='.$monthtextshort; |
| 1948 | 1948 | $ret = str_replace('__b__', $monthtextshort, $ret);
|
@@ -1953,8 +1953,8 @@ discard block |
||
| 1953 | 1953 | if (preg_match('/__a__/i', $format)) {
|
| 1954 | 1954 | $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with static function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. |
| 1955 | 1955 | |
| 1956 | - $w = adodb_strftime('%w', $timetouse); // TODO Replace this with static function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
|
| 1957 | - $dayweek = $outputlangs->transnoentitiesnoconv('Day' . $w);
|
|
| 1956 | + $w = adodb_strftime('%w', $timetouse); // TODO Replace this with static function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
|
|
| 1957 | + $dayweek = $outputlangs->transnoentitiesnoconv('Day'.$w);
|
|
| 1958 | 1958 | $ret = str_replace('__A__', $dayweek, $ret);
|
| 1959 | 1959 | $ret = str_replace('__a__', dol_substr($dayweek, 0, 3), $ret);
|
| 1960 | 1960 | } |
@@ -2001,9 +2001,9 @@ discard block |
||
| 2001 | 2001 | |
| 2002 | 2002 | $usealternatemethod = false; |
| 2003 | 2003 | if ($timestamp <= 0) |
| 2004 | - $usealternatemethod = true; // <= 1970 |
|
| 2004 | + $usealternatemethod = true; // <= 1970 |
|
| 2005 | 2005 | if ($timestamp >= 2145913200) |
| 2006 | - $usealternatemethod = true; // >= 2038 |
|
| 2006 | + $usealternatemethod = true; // >= 2038 |
|
| 2007 | 2007 | |
| 2008 | 2008 | if ($usealternatemethod) {
|
| 2009 | 2009 | $arrayinfo = adodb_getdate($timestamp, $fast); |
@@ -2063,23 +2063,23 @@ discard block |
||
| 2063 | 2063 | |
| 2064 | 2064 | if (method_exists('DateTime', 'getTimestamp')) {
|
| 2065 | 2065 | if (empty($gm) || $gm === 'server') {
|
| 2066 | - $default_timezone = @date_default_timezone_get(); // Example 'Europe/Berlin' |
|
| 2066 | + $default_timezone = @date_default_timezone_get(); // Example 'Europe/Berlin' |
|
| 2067 | 2067 | $localtz = new \DateTimeZone($default_timezone); |
| 2068 | 2068 | } else if ($gm === 'user') {
|
| 2069 | 2069 | // We use dol_tz_string first because it is more reliable. |
| 2070 | - $default_timezone = (empty($_SESSION["dol_tz_string"]) ? @date_default_timezone_get() : $_SESSION["dol_tz_string"]); // Example 'Europe/Berlin' |
|
| 2070 | + $default_timezone = (empty($_SESSION["dol_tz_string"]) ? @date_default_timezone_get() : $_SESSION["dol_tz_string"]); // Example 'Europe/Berlin' |
|
| 2071 | 2071 | try {
|
| 2072 | 2072 | $localtz = new \DateTimeZone($default_timezone); |
| 2073 | 2073 | } catch (Exception $e) {
|
| 2074 | - AlDolUtils::dol_syslog("Warning dol_tz_string contains an invalid value " . $_SESSION["dol_tz_string"], LOG_WARNING);
|
|
| 2074 | + AlDolUtils::dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING);
|
|
| 2075 | 2075 | $default_timezone = @date_default_timezone_get(); |
| 2076 | 2076 | } |
| 2077 | 2077 | } else if (strrpos($gm, "tz,") !== false) {
|
| 2078 | - $timezone = str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin'
|
|
| 2078 | + $timezone = str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin'
|
|
| 2079 | 2079 | try {
|
| 2080 | 2080 | $localtz = new \DateTimeZone($timezone); |
| 2081 | 2081 | } catch (Exception $e) {
|
| 2082 | - AlDolUtils::dol_syslog("Warning passed timezone contains an invalid value " . $timezone, LOG_WARNING);
|
|
| 2082 | + AlDolUtils::dol_syslog("Warning passed timezone contains an invalid value ".$timezone, LOG_WARNING);
|
|
| 2083 | 2083 | } |
| 2084 | 2084 | } |
| 2085 | 2085 | |
@@ -2118,8 +2118,8 @@ discard block |
||
| 2118 | 2118 | if ($mode == 'gmt') |
| 2119 | 2119 | $ret = time(); // Time for now at greenwich. |
| 2120 | 2120 | else if ($mode == 'tzserver') { // Time for now with PHP server timezone added
|
| 2121 | - require_once DOL_BASE_PATH . '/core/lib/date.lib.php'; |
|
| 2122 | - $tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time
|
|
| 2121 | + require_once DOL_BASE_PATH.'/core/lib/date.lib.php'; |
|
| 2122 | + $tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time
|
|
| 2123 | 2123 | $ret = (int) (dol_now('gmt') + ($tzsecond * 3600));
|
| 2124 | 2124 | } |
| 2125 | 2125 | /* else if ($mode == 'tzref') // Time for now with parent company timezone is added |
@@ -2165,9 +2165,9 @@ discard block |
||
| 2165 | 2165 | } |
| 2166 | 2166 | // Use long or short text unit |
| 2167 | 2167 | if (empty($shortunit)) {
|
| 2168 | - $ret .= ' ' . $textunitlong; |
|
| 2168 | + $ret .= ' '.$textunitlong; |
|
| 2169 | 2169 | } else {
|
| 2170 | - $ret .= ' ' . $textunitshort; |
|
| 2170 | + $ret .= ' '.$textunitshort; |
|
| 2171 | 2171 | } |
| 2172 | 2172 | |
| 2173 | 2173 | return $ret; |
@@ -2195,13 +2195,13 @@ discard block |
||
| 2195 | 2195 | $link .= $url; |
| 2196 | 2196 | $link .= '"'; |
| 2197 | 2197 | if ($target) |
| 2198 | - $link .= ' target="' . $target . '"'; |
|
| 2198 | + $link .= ' target="'.$target.'"'; |
|
| 2199 | 2199 | $link .= '>'; |
| 2200 | 2200 | if (!preg_match('/^http/i', $url))
|
| 2201 | 2201 | $link .= 'http://'; |
| 2202 | 2202 | $link .= dol_trunc($url, $max); |
| 2203 | 2203 | $link .= '</a>'; |
| 2204 | - return '<div class="nospan float" style="margin-right: 10px">' . ($withpicto ? img_picto(Globals::$langs->trans("Url"), 'object_globe.png') . ' ' : '') . $link . '</div>';
|
|
| 2204 | + return '<div class="nospan float" style="margin-right: 10px">'.($withpicto ? img_picto(Globals::$langs->trans("Url"), 'object_globe.png').' ' : '').$link.'</div>';
|
|
| 2205 | 2205 | } |
| 2206 | 2206 | |
| 2207 | 2207 | /** |
@@ -2242,9 +2242,9 @@ discard block |
||
| 2242 | 2242 | $type = 'AC_EMAIL'; |
| 2243 | 2243 | $link = ''; |
| 2244 | 2244 | if (!empty(Globals::$conf->global->AGENDA_ADDACTIONFOREMAIL)) |
| 2245 | - $link = '<a href="' . DOL_BASE_URI . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object(Globals::$langs->trans("AddAction"), "calendar") . '</a>';
|
|
| 2245 | + $link = '<a href="'.DOL_BASE_URI.'/comm/action/card.php?action=create&backtopage=1&actioncode='.$type.'&contactid='.$cid.'&socid='.$socid.'">'.img_object(Globals::$langs->trans("AddAction"), "calendar").'</a>';
|
|
| 2246 | 2246 | if ($link) |
| 2247 | - $newemail = '<div>' . $newemail . ' ' . $link . '</div>'; |
|
| 2247 | + $newemail = '<div>'.$newemail.' '.$link.'</div>'; |
|
| 2248 | 2248 | } |
| 2249 | 2249 | } |
| 2250 | 2250 | else {
|
@@ -2254,7 +2254,7 @@ discard block |
||
| 2254 | 2254 | } |
| 2255 | 2255 | } |
| 2256 | 2256 | |
| 2257 | - $rep = '<div class="nospan float" style="margin-right: 10px">' . ($withpicto ? img_picto(Globals::$langs->trans("EMail"), 'object_email.png') . ' ' : '') . $newemail . '</div>';
|
|
| 2257 | + $rep = '<div class="nospan float" style="margin-right: 10px">'.($withpicto ? img_picto(Globals::$langs->trans("EMail"), 'object_email.png').' ' : '').$newemail.'</div>';
|
|
| 2258 | 2258 | if (Globals::$hookManager) {
|
| 2259 | 2259 | $parameters = array('cid' => $cid, 'socid' => $socid, 'addlink' => $addlink, 'picto' => $withpicto);
|
| 2260 | 2260 | $reshook = Globals::$hookManager->executeHooks('printEmail', $parameters, $email);
|
@@ -2284,26 +2284,26 @@ discard block |
||
| 2284 | 2284 | |
| 2285 | 2285 | if (!empty($type)) {
|
| 2286 | 2286 | $newskype = '<div class="divsocialnetwork inline-block valignmiddle">'; |
| 2287 | - $newskype .= img_picto(Globals::$langs->trans(strtoupper($type)), $type . '.png', '', false, 0, 0, '', 'paddingright'); |
|
| 2287 | + $newskype .= img_picto(Globals::$langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright'); |
|
| 2288 | 2288 | $newskype .= $value; |
| 2289 | 2289 | if ($type == 'skype') {
|
| 2290 | 2290 | $newskype .= ' '; |
| 2291 | 2291 | $newskype .= '<a href="skype:'; |
| 2292 | 2292 | $newskype .= $value; |
| 2293 | - $newskype .= '?call" alt="' . Globals::$langs->trans("Call") . ' ' . $value . '" title="' . Globals::$langs->trans("Call") . ' ' . $value . '">';
|
|
| 2294 | - $newskype .= '<img src="' . DOL_BASE_URI . '/theme/common/skype_callbutton.png" border="0">'; |
|
| 2293 | + $newskype .= '?call" alt="'.Globals::$langs->trans("Call").' '.$value.'" title="'.Globals::$langs->trans("Call").' '.$value.'">';
|
|
| 2294 | + $newskype .= '<img src="'.DOL_BASE_URI.'/theme/common/skype_callbutton.png" border="0">'; |
|
| 2295 | 2295 | $newskype .= '</a><a href="skype:'; |
| 2296 | 2296 | $newskype .= $value; |
| 2297 | - $newskype .= '?chat" alt="' . Globals::$langs->trans("Chat") . ' ' . $value . '" title="' . Globals::$langs->trans("Chat") . ' ' . $value . '">';
|
|
| 2298 | - $newskype .= '<img class="paddingleft" src="' . DOL_BASE_URI . '/theme/common/skype_chatbutton.png" border="0">'; |
|
| 2297 | + $newskype .= '?chat" alt="'.Globals::$langs->trans("Chat").' '.$value.'" title="'.Globals::$langs->trans("Chat").' '.$value.'">';
|
|
| 2298 | + $newskype .= '<img class="paddingleft" src="'.DOL_BASE_URI.'/theme/common/skype_chatbutton.png" border="0">'; |
|
| 2299 | 2299 | $newskype .= '</a>'; |
| 2300 | 2300 | } |
| 2301 | 2301 | if (($cid || $socid) && !empty(Globals::$conf->agenda->enabled) && $user->rights->agenda->myactions->create && $type == 'skype') {
|
| 2302 | 2302 | $addlink = 'AC_SKYPE'; |
| 2303 | 2303 | $link = ''; |
| 2304 | 2304 | if (!empty(Globals::$conf->global->AGENDA_ADDACTIONFORSKYPE)) |
| 2305 | - $link = '<a href="' . DOL_BASE_URI . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $addlink . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object(Globals::$langs->trans("AddAction"), "calendar") . '</a>';
|
|
| 2306 | - $newskype .= ($link ? ' ' . $link : ''); |
|
| 2305 | + $link = '<a href="'.DOL_BASE_URI.'/comm/action/card.php?action=create&backtopage=1&actioncode='.$addlink.'&contactid='.$cid.'&socid='.$socid.'">'.img_object(Globals::$langs->trans("AddAction"), "calendar").'</a>';
|
|
| 2306 | + $newskype .= ($link ? ' '.$link : ''); |
|
| 2307 | 2307 | } |
| 2308 | 2308 | $newskype .= '</div>'; |
| 2309 | 2309 | } |
@@ -2347,165 +2347,165 @@ discard block |
||
| 2347 | 2347 | if (strtoupper($countrycode) == "FR") {
|
| 2348 | 2348 | // France |
| 2349 | 2349 | if (AlDolUtils::dol_strlen($phone) == 10) {
|
| 2350 | - $newphone = substr($newphone, 0, 2) . $separ . substr($newphone, 2, 2) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2); |
|
| 2350 | + $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 2).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2); |
|
| 2351 | 2351 | } elseif (AlDolUtils::dol_strlen($phone) == 7) {
|
| 2352 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 2); |
|
| 2352 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2); |
|
| 2353 | 2353 | } elseif (AlDolUtils::dol_strlen($phone) == 9) {
|
| 2354 | - $newphone = substr($newphone, 0, 2) . $separ . substr($newphone, 2, 3) . $separ . substr($newphone, 5, 2) . $separ . substr($newphone, 7, 2); |
|
| 2354 | + $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 3).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2); |
|
| 2355 | 2355 | } elseif (AlDolUtils::dol_strlen($phone) == 11) {
|
| 2356 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 2) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2); |
|
| 2356 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2); |
|
| 2357 | 2357 | } elseif (AlDolUtils::dol_strlen($phone) == 12) {
|
| 2358 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
| 2358 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
| 2359 | 2359 | } |
| 2360 | 2360 | } elseif (strtoupper($countrycode) == "CA") {
|
| 2361 | 2361 | if (AlDolUtils::dol_strlen($phone) == 10) {
|
| 2362 | - $newphone = ($separ != '' ? '(' : '') . substr($newphone, 0, 3) . ($separ != '' ? ')' : '') . $separ . substr($newphone, 3, 3) . ($separ != '' ? '-' : '') . substr($newphone, 6, 4);
|
|
| 2362 | + $newphone = ($separ != '' ? '(' : '').substr($newphone, 0, 3).($separ != '' ? ')' : '').$separ.substr($newphone, 3, 3).($separ != '' ? '-' : '').substr($newphone, 6, 4);
|
|
| 2363 | 2363 | } |
| 2364 | 2364 | } elseif (strtoupper($countrycode) == "PT") {//Portugal
|
| 2365 | 2365 | if (AlDolUtils::dol_strlen($phone) == 13) {//ex: +351_ABC_DEF_GHI
|
| 2366 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3); |
|
| 2366 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3); |
|
| 2367 | 2367 | } |
| 2368 | 2368 | } elseif (strtoupper($countrycode) == "SR") {//Suriname
|
| 2369 | 2369 | if (AlDolUtils::dol_strlen($phone) == 10) {//ex: +597_ABC_DEF
|
| 2370 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3); |
|
| 2370 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3); |
|
| 2371 | 2371 | } elseif (AlDolUtils::dol_strlen($phone) == 11) {//ex: +597_ABC_DEFG
|
| 2372 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 4); |
|
| 2372 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 4); |
|
| 2373 | 2373 | } |
| 2374 | 2374 | } elseif (strtoupper($countrycode) == "DE") {//Allemagne
|
| 2375 | 2375 | if (AlDolUtils::dol_strlen($phone) == 14) {//ex: +49_ABCD_EFGH_IJK
|
| 2376 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 4) . $separ . substr($newphone, 7, 4) . $separ . substr($newphone, 11, 3); |
|
| 2376 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 4).$separ.substr($newphone, 11, 3); |
|
| 2377 | 2377 | } elseif (AlDolUtils::dol_strlen($phone) == 13) {//ex: +49_ABC_DEFG_HIJ
|
| 2378 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 4) . $separ . substr($newphone, 10, 3); |
|
| 2378 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 4).$separ.substr($newphone, 10, 3); |
|
| 2379 | 2379 | } |
| 2380 | 2380 | } elseif (strtoupper($countrycode) == "ES") {//Espagne
|
| 2381 | 2381 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex: +34_ABC_DEF_GHI
|
| 2382 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3); |
|
| 2382 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3); |
|
| 2383 | 2383 | } |
| 2384 | 2384 | } elseif (strtoupper($countrycode) == "BF") {// Burkina Faso
|
| 2385 | 2385 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex : +22 A BC_DE_FG_HI
|
| 2386 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 1) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
| 2386 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
| 2387 | 2387 | } |
| 2388 | 2388 | } elseif (strtoupper($countrycode) == "RO") {// Roumanie
|
| 2389 | 2389 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex : +40 AB_CDE_FG_HI
|
| 2390 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
| 2390 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
| 2391 | 2391 | } |
| 2392 | 2392 | } elseif (strtoupper($countrycode) == "TR") {//Turquie
|
| 2393 | 2393 | if (AlDolUtils::dol_strlen($phone) == 13) {//ex : +90 ABC_DEF_GHIJ
|
| 2394 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 4); |
|
| 2394 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 4); |
|
| 2395 | 2395 | } |
| 2396 | 2396 | } elseif (strtoupper($countrycode) == "US") {//Etat-Unis
|
| 2397 | 2397 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex: +1 ABC_DEF_GHIJ
|
| 2398 | - $newphone = substr($newphone, 0, 2) . $separ . substr($newphone, 2, 3) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 4); |
|
| 2398 | + $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 3).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 4); |
|
| 2399 | 2399 | } |
| 2400 | 2400 | } elseif (strtoupper($countrycode) == "MX") {//Mexique
|
| 2401 | 2401 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex: +52 ABCD_EFG_HI
|
| 2402 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 4) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 2); |
|
| 2402 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 2); |
|
| 2403 | 2403 | } elseif (AlDolUtils::dol_strlen($phone) == 11) {//ex: +52 AB_CD_EF_GH
|
| 2404 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 2) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2); |
|
| 2404 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2); |
|
| 2405 | 2405 | } elseif (AlDolUtils::dol_strlen($phone) == 13) {//ex: +52 ABC_DEF_GHIJ
|
| 2406 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 4); |
|
| 2406 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 4); |
|
| 2407 | 2407 | } |
| 2408 | 2408 | } elseif (strtoupper($countrycode) == "ML") {//Mali
|
| 2409 | 2409 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex: +223 AB_CD_EF_GH
|
| 2410 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
| 2410 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
| 2411 | 2411 | } |
| 2412 | 2412 | } elseif (strtoupper($countrycode) == "TH") {//Thaïlande
|
| 2413 | 2413 | if (AlDolUtils::dol_strlen($phone) == 11) {//ex: +66_ABC_DE_FGH
|
| 2414 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 3); |
|
| 2414 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3); |
|
| 2415 | 2415 | } elseif (AlDolUtils::dol_strlen($phone) == 12) {//ex: +66_A_BCD_EF_GHI
|
| 2416 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 1) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 3); |
|
| 2416 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 3); |
|
| 2417 | 2417 | } |
| 2418 | 2418 | } elseif (strtoupper($countrycode) == "MU") {//Maurice
|
| 2419 | 2419 | if (AlDolUtils::dol_strlen($phone) == 11) {//ex: +230_ABC_DE_FG
|
| 2420 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2); |
|
| 2420 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2); |
|
| 2421 | 2421 | } elseif (AlDolUtils::dol_strlen($phone) == 12) {//ex: +230_ABCD_EF_GH
|
| 2422 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 4) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
| 2422 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
| 2423 | 2423 | } |
| 2424 | 2424 | } elseif (strtoupper($countrycode) == "ZA") {//Afrique du sud
|
| 2425 | 2425 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex: +27_AB_CDE_FG_HI
|
| 2426 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
| 2426 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
| 2427 | 2427 | } |
| 2428 | 2428 | } elseif (strtoupper($countrycode) == "SY") {//Syrie
|
| 2429 | 2429 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex: +963_AB_CD_EF_GH
|
| 2430 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
| 2430 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
| 2431 | 2431 | } elseif (AlDolUtils::dol_strlen($phone) == 13) {//ex: +963_AB_CD_EF_GHI
|
| 2432 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 3); |
|
| 2432 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 3); |
|
| 2433 | 2433 | } |
| 2434 | 2434 | } elseif (strtoupper($countrycode) == "AE") {//Emirats Arabes Unis
|
| 2435 | 2435 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex: +971_ABC_DEF_GH
|
| 2436 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 2); |
|
| 2436 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 2); |
|
| 2437 | 2437 | } elseif (AlDolUtils::dol_strlen($phone) == 13) {//ex: +971_ABC_DEF_GHI
|
| 2438 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3); |
|
| 2438 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3); |
|
| 2439 | 2439 | } elseif (AlDolUtils::dol_strlen($phone) == 14) {//ex: +971_ABC_DEF_GHIK
|
| 2440 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 4); |
|
| 2440 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 4); |
|
| 2441 | 2441 | } |
| 2442 | 2442 | } elseif (strtoupper($countrycode) == "DZ") {//Algérie
|
| 2443 | 2443 | if (AlDolUtils::dol_strlen($phone) == 13) {//ex: +213_ABC_DEF_GHI
|
| 2444 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3); |
|
| 2444 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3); |
|
| 2445 | 2445 | } |
| 2446 | 2446 | } elseif (strtoupper($countrycode) == "BE") {//Belgique
|
| 2447 | 2447 | if (AlDolUtils::dol_strlen($phone) == 11) {//ex: +32_ABC_DE_FGH
|
| 2448 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 3); |
|
| 2448 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3); |
|
| 2449 | 2449 | } elseif (AlDolUtils::dol_strlen($phone) == 12) {//ex: +32_ABC_DEF_GHI
|
| 2450 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3); |
|
| 2450 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3); |
|
| 2451 | 2451 | } |
| 2452 | 2452 | } elseif (strtoupper($countrycode) == "PF") {//Polynésie française
|
| 2453 | 2453 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex: +689_AB_CD_EF_GH
|
| 2454 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
| 2454 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
| 2455 | 2455 | } |
| 2456 | 2456 | } elseif (strtoupper($countrycode) == "CO") {//Colombie
|
| 2457 | 2457 | if (AlDolUtils::dol_strlen($phone) == 13) {//ex: +57_ABC_DEF_GH_IJ
|
| 2458 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
| 2458 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
| 2459 | 2459 | } |
| 2460 | 2460 | } elseif (strtoupper($countrycode) == "JO") {//Jordanie
|
| 2461 | 2461 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex: +962_A_BCD_EF_GH
|
| 2462 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 1) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2); |
|
| 2462 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 1).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2); |
|
| 2463 | 2463 | } |
| 2464 | 2464 | } elseif (strtoupper($countrycode) == "MG") {//Madagascar
|
| 2465 | 2465 | if (AlDolUtils::dol_strlen($phone) == 13) {//ex: +261_AB_CD_EF_GHI
|
| 2466 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 3); |
|
| 2466 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 3); |
|
| 2467 | 2467 | } |
| 2468 | 2468 | } elseif (strtoupper($countrycode) == "GB") {//Royaume uni
|
| 2469 | 2469 | if (AlDolUtils::dol_strlen($phone) == 13) {//ex: +44_ABCD_EFG_HIJ
|
| 2470 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 4) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3); |
|
| 2470 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3); |
|
| 2471 | 2471 | } |
| 2472 | 2472 | } elseif (strtoupper($countrycode) == "CH") {//Suisse
|
| 2473 | 2473 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex: +41_AB_CDE_FG_HI
|
| 2474 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2); |
|
| 2474 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2); |
|
| 2475 | 2475 | } elseif (AlDolUtils::dol_strlen($phone) == 15) {// +41_AB_CDE_FGH_IJKL
|
| 2476 | - $newphone = $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 3) . $separ . substr($newphone, 11, 4); |
|
| 2476 | + $newphone = $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 3).$separ.substr($newphone, 11, 4); |
|
| 2477 | 2477 | } |
| 2478 | 2478 | } elseif (strtoupper($countrycode) == "TN") {//Tunisie
|
| 2479 | 2479 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex: +216_AB_CDE_FGH
|
| 2480 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3); |
|
| 2480 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3); |
|
| 2481 | 2481 | } |
| 2482 | 2482 | } elseif (strtoupper($countrycode) == "GF") {//Guyane francaise
|
| 2483 | 2483 | if (AlDolUtils::dol_strlen($phone) == 13) {//ex: +594_ABC_DE_FG_HI (ABC=594 de nouveau)
|
| 2484 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
| 2484 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
| 2485 | 2485 | } |
| 2486 | 2486 | } elseif (strtoupper($countrycode) == "GP") {//Guadeloupe
|
| 2487 | 2487 | if (AlDolUtils::dol_strlen($phone) == 13) {//ex: +590_ABC_DE_FG_HI (ABC=590 de nouveau)
|
| 2488 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
| 2488 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
| 2489 | 2489 | } |
| 2490 | 2490 | } elseif (strtoupper($countrycode) == "MQ") {//Martinique
|
| 2491 | 2491 | if (AlDolUtils::dol_strlen($phone) == 13) {//ex: +596_ABC_DE_FG_HI (ABC=596 de nouveau)
|
| 2492 | - $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
| 2492 | + $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
| 2493 | 2493 | } |
| 2494 | 2494 | } elseif (strtoupper($countrycode) == "IT") {//Italie
|
| 2495 | 2495 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex: +39_ABC_DEF_GHI
|
| 2496 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3); |
|
| 2496 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3); |
|
| 2497 | 2497 | } elseif (AlDolUtils::dol_strlen($phone) == 13) {//ex: +39_ABC_DEF_GH_IJ
|
| 2498 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 2) . $separ . substr($newphone, 11, 2); |
|
| 2498 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 2).$separ.substr($newphone, 11, 2); |
|
| 2499 | 2499 | } |
| 2500 | 2500 | } elseif (strtoupper($countrycode) == "AU") {//Australie
|
| 2501 | 2501 | if (AlDolUtils::dol_strlen($phone) == 12) {//ex: +61_A_BCDE_FGHI
|
| 2502 | - $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 1) . $separ . substr($newphone, 4, 4) . $separ . substr($newphone, 8, 4); |
|
| 2502 | + $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 4); |
|
| 2503 | 2503 | } |
| 2504 | 2504 | } |
| 2505 | 2505 | if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set)
|
| 2506 | 2506 | if (Globals::$conf->browser->layout == 'phone' || (!empty(Globals::$conf->clicktodial->enabled) && !empty(Globals::$conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone
|
| 2507 | - $newphone = '<a href="tel:' . $phone . '"'; |
|
| 2508 | - $newphone .= '>' . $phone . '</a>'; |
|
| 2507 | + $newphone = '<a href="tel:'.$phone.'"'; |
|
| 2508 | + $newphone .= '>'.$phone.'</a>'; |
|
| 2509 | 2509 | } else if (!empty(Globals::$conf->clicktodial->enabled) && $addlink == 'AC_TEL') { // If click to dial, we use click to dial url
|
| 2510 | 2510 | if (empty($user->clicktodial_loaded)) |
| 2511 | 2511 | $user->fetch_clicktodial(); |
@@ -2529,10 +2529,10 @@ discard block |
||
| 2529 | 2529 | '__PASS__' => $clicktodial_password); |
| 2530 | 2530 | $url = make_substitutions($url, $substitarray); |
| 2531 | 2531 | $newphonesav = $newphone; |
| 2532 | - $newphone = '<a href="' . $url . '"'; |
|
| 2532 | + $newphone = '<a href="'.$url.'"'; |
|
| 2533 | 2533 | if (!empty(Globals::$conf->global->CLICKTODIAL_FORCENEWTARGET)) |
| 2534 | 2534 | $newphone .= ' target="_blank"'; |
| 2535 | - $newphone .= '>' . $newphonesav . '</a>'; |
|
| 2535 | + $newphone .= '>'.$newphonesav.'</a>'; |
|
| 2536 | 2536 | } |
| 2537 | 2537 | |
| 2538 | 2538 | //if (($cid || $socid) && ! empty(Globals::$conf->agenda->enabled) && $user->rights->agenda->myactions->create) |
@@ -2542,9 +2542,9 @@ discard block |
||
| 2542 | 2542 | if ($addlink == 'AC_FAX') |
| 2543 | 2543 | $type = 'AC_FAX'; |
| 2544 | 2544 | if (!empty(Globals::$conf->global->AGENDA_ADDACTIONFORPHONE)) |
| 2545 | - $link = '<a href="' . DOL_BASE_URI . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . ($cid ? '&contactid=' . $cid : '') . ($socid ? '&socid=' . $socid : '') . '">' . img_object(Globals::$langs->trans("AddAction"), "calendar") . '</a>';
|
|
| 2545 | + $link = '<a href="'.DOL_BASE_URI.'/comm/action/card.php?action=create&backtopage=1&actioncode='.$type.($cid ? '&contactid='.$cid : '').($socid ? '&socid='.$socid : '').'">'.img_object(Globals::$langs->trans("AddAction"), "calendar").'</a>';
|
|
| 2546 | 2546 | if ($link) |
| 2547 | - $newphone = '<div>' . $newphone . ' ' . $link . '</div>'; |
|
| 2547 | + $newphone = '<div>'.$newphone.' '.$link.'</div>'; |
|
| 2548 | 2548 | } |
| 2549 | 2549 | } |
| 2550 | 2550 | |
@@ -2575,7 +2575,7 @@ discard block |
||
| 2575 | 2575 | $rep .= '<div class="nospan float" style="margin-right: 10px">'; |
| 2576 | 2576 | else |
| 2577 | 2577 | $rep .= '<span style="margin-right: 10px;">'; |
| 2578 | - $rep .= ($withpicto ? img_picto($titlealt, 'object_' . $picto . '.png') . ' ' : '') . $newphone; |
|
| 2578 | + $rep .= ($withpicto ? img_picto($titlealt, 'object_'.$picto.'.png').' ' : '').$newphone; |
|
| 2579 | 2579 | if ($adddivfloat) |
| 2580 | 2580 | $rep .= '</div>'; |
| 2581 | 2581 | else |
@@ -2602,15 +2602,15 @@ discard block |
||
| 2602 | 2602 | $ret .= $ip; |
| 2603 | 2603 | } |
| 2604 | 2604 | |
| 2605 | - echo ('<p>DOL_BASE_PATH: ' . DOL_BASE_PATH . '/DOL_BASE_URI: ' . DOL_BASE_URI . '</p>');
|
|
| 2605 | + echo ('<p>DOL_BASE_PATH: '.DOL_BASE_PATH.'/DOL_BASE_URI: '.DOL_BASE_URI.'</p>');
|
|
| 2606 | 2606 | |
| 2607 | 2607 | if ($mode != 2) {
|
| 2608 | 2608 | $countrycode = dolGetCountryCodeFromIp($ip); |
| 2609 | 2609 | if ($countrycode) { // If success, countrycode is us, fr, ...
|
| 2610 | - if (file_exists(DOL_BASE_PATH . '/theme/common/flags/' . $countrycode . '.png')) {
|
|
| 2611 | - $ret .= ' ' . img_picto($countrycode . ' ' . Globals::$langs->trans("AccordingToGeoIPDatabase"), DOL_BASE_URI . '/theme/common/flags/' . $countrycode . '.png', '', 1);
|
|
| 2610 | + if (file_exists(DOL_BASE_PATH.'/theme/common/flags/'.$countrycode.'.png')) {
|
|
| 2611 | + $ret .= ' '.img_picto($countrycode.' '.Globals::$langs->trans("AccordingToGeoIPDatabase"), DOL_BASE_URI.'/theme/common/flags/'.$countrycode.'.png', '', 1);
|
|
| 2612 | 2612 | } else |
| 2613 | - $ret .= ' (' . $countrycode . ')';
|
|
| 2613 | + $ret .= ' ('.$countrycode.')';
|
|
| 2614 | 2614 | } |
| 2615 | 2615 | } |
| 2616 | 2616 | |
@@ -2648,7 +2648,7 @@ discard block |
||
| 2648 | 2648 | //$ip='24.24.24.24'; |
| 2649 | 2649 | //$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat'; Note that this must be downloaded datafile (not same than datafile provided with ubuntu packages) |
| 2650 | 2650 | |
| 2651 | - include_once DOL_BASE_PATH . '/core/class/dolgeoip.class.php'; |
|
| 2651 | + include_once DOL_BASE_PATH.'/core/class/dolgeoip.class.php'; |
|
| 2652 | 2652 | $geoip = new DolGeoIP('country', $datafile);
|
| 2653 | 2653 | //print 'ip='.$ip.' databaseType='.$geoip->gi->databaseType." GEOIP_CITY_EDITION_REV1=".GEOIP_CITY_EDITION_REV1."\n"; |
| 2654 | 2654 | //print "geoip_country_id_by_addr=".geoip_country_id_by_addr($geoip->gi,$ip)."\n"; |
@@ -2674,7 +2674,7 @@ discard block |
||
| 2674 | 2674 | $datafile = Globals::$conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE; |
| 2675 | 2675 | //$ip='24.24.24.24'; |
| 2676 | 2676 | //$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat'; |
| 2677 | - include_once DOL_BASE_PATH . '/core/class/dolgeoip.class.php'; |
|
| 2677 | + include_once DOL_BASE_PATH.'/core/class/dolgeoip.class.php'; |
|
| 2678 | 2678 | $geoip = new DolGeoIP('country', $datafile);
|
| 2679 | 2679 | $countrycode = $geoip->getCountryCodeFromIP($ip); |
| 2680 | 2680 | $ret = $countrycode; |
@@ -2729,12 +2729,12 @@ discard block |
||
| 2729 | 2729 | $showomap = 1; |
| 2730 | 2730 | |
| 2731 | 2731 | if ($showgmap) {
|
| 2732 | - $url = dol_buildpath('/google/gmaps.php?mode=' . $mode . '&id=' . $id, 1);
|
|
| 2733 | - $out .= ' <a href="' . $url . '" target="_gmaps"><img id="' . $htmlid . '" class="valigntextbottom" src="' . DOL_BASE_URI . '/theme/common/gmap.png"></a>'; |
|
| 2732 | + $url = dol_buildpath('/google/gmaps.php?mode='.$mode.'&id='.$id, 1);
|
|
| 2733 | + $out .= ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'" class="valigntextbottom" src="'.DOL_BASE_URI.'/theme/common/gmap.png"></a>'; |
|
| 2734 | 2734 | } |
| 2735 | 2735 | if ($showomap) {
|
| 2736 | - $url = dol_buildpath('/openstreetmap/maps.php?mode=' . $mode . '&id=' . $id, 1);
|
|
| 2737 | - $out .= ' <a href="' . $url . '" target="_gmaps"><img id="' . $htmlid . '_openstreetmap" class="valigntextbottom" src="' . DOL_BASE_URI . '/theme/common/gmap.png"></a>'; |
|
| 2736 | + $url = dol_buildpath('/openstreetmap/maps.php?mode='.$mode.'&id='.$id, 1);
|
|
| 2737 | + $out .= ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'_openstreetmap" class="valigntextbottom" src="'.DOL_BASE_URI.'/theme/common/gmap.png"></a>'; |
|
| 2738 | 2738 | } |
| 2739 | 2739 | } |
| 2740 | 2740 | } |
@@ -2880,7 +2880,7 @@ discard block |
||
| 2880 | 2880 | if ($trunc == 'right') {
|
| 2881 | 2881 | $newstring = AlDolUtils::dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
| 2882 | 2882 | if (AlDolUtils::dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
| 2883 | - return dol_substr($newstring, 0, $size, $stringencoding) . ($nodot ? '' : '...'); |
|
| 2883 | + return dol_substr($newstring, 0, $size, $stringencoding).($nodot ? '' : '...'); |
|
| 2884 | 2884 | else |
| 2885 | 2885 | //return 'u'.$size.'-'.$newstring.'-'.DolUtils::dol_strlen($newstring,$stringencoding).'-'.$string; |
| 2886 | 2886 | return $string; |
@@ -2890,21 +2890,21 @@ discard block |
||
| 2890 | 2890 | if (AlDolUtils::dol_strlen($newstring, $stringencoding) > 2 && AlDolUtils::dol_strlen($newstring, $stringencoding) > ($size + 1)) {
|
| 2891 | 2891 | $size1 = round($size / 2); |
| 2892 | 2892 | $size2 = round($size / 2); |
| 2893 | - return dol_substr($newstring, 0, $size1, $stringencoding) . '...' . dol_substr($newstring, AlDolUtils::dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding); |
|
| 2893 | + return dol_substr($newstring, 0, $size1, $stringencoding).'...'.dol_substr($newstring, AlDolUtils::dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding); |
|
| 2894 | 2894 | } else |
| 2895 | 2895 | return $string; |
| 2896 | 2896 | } |
| 2897 | 2897 | elseif ($trunc == 'left') {
|
| 2898 | 2898 | $newstring = AlDolUtils::dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
| 2899 | 2899 | if (AlDolUtils::dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
| 2900 | - return '...' . dol_substr($newstring, AlDolUtils::dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding); |
|
| 2900 | + return '...'.dol_substr($newstring, AlDolUtils::dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding); |
|
| 2901 | 2901 | else |
| 2902 | 2902 | return $string; |
| 2903 | 2903 | } |
| 2904 | 2904 | elseif ($trunc == 'wrap') {
|
| 2905 | 2905 | $newstring = AlDolUtils::dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
| 2906 | 2906 | if (AlDolUtils::dol_strlen($newstring, $stringencoding) > ($size + 1)) |
| 2907 | - return dol_substr($newstring, 0, $size, $stringencoding) . "\n" . dol_trunc(dol_substr($newstring, $size, AlDolUtils::dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc); |
|
| 2907 | + return dol_substr($newstring, 0, $size, $stringencoding)."\n".dol_trunc(dol_substr($newstring, $size, AlDolUtils::dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc); |
|
| 2908 | 2908 | else |
| 2909 | 2909 | return $string; |
| 2910 | 2910 | } else |
@@ -2937,7 +2937,7 @@ discard block |
||
| 2937 | 2937 | $url = DOL_BASE_URI; |
| 2938 | 2938 | |
| 2939 | 2939 | $theme = Globals::$conf->theme; |
| 2940 | - $path = 'theme/' . $theme; |
|
| 2940 | + $path = 'theme/'.$theme; |
|
| 2941 | 2941 | |
| 2942 | 2942 | // Define fullpathpicto to use into src |
| 2943 | 2943 | if ($pictoisfullpath) {
|
@@ -2986,7 +2986,7 @@ discard block |
||
| 2986 | 2986 | $fakey = 'fa-pencil'; |
| 2987 | 2987 | $facolor = '#444'; |
| 2988 | 2988 | } elseif ($pictowithoutext == 'filter') {
|
| 2989 | - $fakey = 'fa-' . $pictowithoutext; |
|
| 2989 | + $fakey = 'fa-'.$pictowithoutext; |
|
| 2990 | 2990 | } elseif ($pictowithoutext == 'grip_title' || $pictowithoutext == 'grip') {
|
| 2991 | 2991 | $fakey = 'fa-arrows'; |
| 2992 | 2992 | } elseif ($pictowithoutext == 'listlight') {
|
@@ -3025,15 +3025,15 @@ discard block |
||
| 3025 | 3025 | } elseif ($pictowithoutext == 'jabber') {
|
| 3026 | 3026 | $fakey = 'fa-comment-o'; |
| 3027 | 3027 | } else {
|
| 3028 | - $fakey = 'fa-' . $pictowithoutext; |
|
| 3028 | + $fakey = 'fa-'.$pictowithoutext; |
|
| 3029 | 3029 | $facolor = '#444'; |
| 3030 | 3030 | $marginleftonlyshort = 0; |
| 3031 | 3031 | } |
| 3032 | 3032 | |
| 3033 | 3033 | if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) {
|
| 3034 | - $morecss .= ($morecss ? ' ' : '') . $reg[1]; |
|
| 3034 | + $morecss .= ($morecss ? ' ' : '').$reg[1]; |
|
| 3035 | 3035 | } |
| 3036 | - $enabledisablehtml = '<span class="fa ' . $fakey . ' ' . ($marginleftonlyshort ? ($marginleftonlyshort == 1 ? 'marginleftonlyshort' : 'marginleftonly') : '') . ' valignmiddle' . ($morecss ? ' ' . $morecss : '') . '" style="' . ($fasize ? ('font-size: ' . $fasize . ';') : '') . ($facolor ? (' color: ' . $facolor . ';') : '') . '" alt="' . AlDolUtils::dol_escape_htmltag($titlealt) . '"' . (($notitle || empty($title)) ? '' : ' title="' . AlDolUtils::dol_escape_htmltag($title) . '"') . ($moreatt ? ' ' . $moreatt : '') . '>';
|
|
| 3036 | + $enabledisablehtml = '<span class="fa '.$fakey.' '.($marginleftonlyshort ? ($marginleftonlyshort == 1 ? 'marginleftonlyshort' : 'marginleftonly') : '').' valignmiddle'.($morecss ? ' '.$morecss : '').'" style="'.($fasize ? ('font-size: '.$fasize.';') : '').($facolor ? (' color: '.$facolor.';') : '').'" alt="'.AlDolUtils::dol_escape_htmltag($titlealt).'"'.(($notitle || empty($title)) ? '' : ' title="'.AlDolUtils::dol_escape_htmltag($title).'"').($moreatt ? ' '.$moreatt : '').'>';
|
|
| 3037 | 3037 | if (!empty(Globals::$conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
|
| 3038 | 3038 | $enabledisablehtml .= $titlealt; |
| 3039 | 3039 | } |
@@ -3043,11 +3043,11 @@ discard block |
||
| 3043 | 3043 | } |
| 3044 | 3044 | |
| 3045 | 3045 | if (!empty(Globals::$conf->global->MAIN_OVERWRITE_THEME_PATH)) {
|
| 3046 | - $path = Globals::$conf->global->MAIN_OVERWRITE_THEME_PATH . '/theme/' . $theme; // If the theme does not have the same name as the module |
|
| 3046 | + $path = Globals::$conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module |
|
| 3047 | 3047 | } else if (!empty(Globals::$conf->global->MAIN_OVERWRITE_THEME_RES)) {
|
| 3048 | - $path = Globals::$conf->global->MAIN_OVERWRITE_THEME_RES . '/theme/' . Globals::$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme |
|
| 3048 | + $path = Globals::$conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.Globals::$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme |
|
| 3049 | 3049 | } else if (!empty(Globals::$conf->modules_parts['theme']) && array_key_exists($theme, Globals::$conf->modules_parts['theme'])) {
|
| 3050 | - $path = $theme . '/theme/' . $theme; // If the theme have the same name as the module |
|
| 3050 | + $path = $theme.'/theme/'.$theme; // If the theme have the same name as the module |
|
| 3051 | 3051 | } |
| 3052 | 3052 | |
| 3053 | 3053 | // If we ask an image into $url/$mymodule/img (instead of default path) |
@@ -3067,15 +3067,15 @@ discard block |
||
| 3067 | 3067 | continue; |
| 3068 | 3068 | } |
| 3069 | 3069 | // This need a lot of time, that's why enabling alternative dir like "custom" dir is not recommanded |
| 3070 | - if (file_exists($dirroot . '/' . $path . '/img/' . $picto)) {
|
|
| 3070 | + if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) {
|
|
| 3071 | 3071 | //$url = DOL_BASE_URI . Globals::$conf->file->dol_url_root[$type]; |
| 3072 | - $url = DOL_BASE_URI . Globals::$conf->file->dol_url_root[$type]; |
|
| 3072 | + $url = DOL_BASE_URI.Globals::$conf->file->dol_url_root[$type]; |
|
| 3073 | 3073 | break; |
| 3074 | 3074 | } |
| 3075 | 3075 | } |
| 3076 | 3076 | |
| 3077 | 3077 | // $url is '' or '/custom', $path is current theme or |
| 3078 | - $fullpathpicto = $url . '/' . $path . '/img/' . $picto; |
|
| 3078 | + $fullpathpicto = $url.'/'.$path.'/img/'.$picto; |
|
| 3079 | 3079 | } |
| 3080 | 3080 | |
| 3081 | 3081 | if ($srconly) {
|
@@ -3083,7 +3083,7 @@ discard block |
||
| 3083 | 3083 | } |
| 3084 | 3084 | |
| 3085 | 3085 | // tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for bind people |
| 3086 | - return '<img src="' . $fullpathpicto . '" alt="' . AlDolUtils::dol_escape_htmltag($alt) . '"' . (($notitle || empty($titlealt)) ? '' : ' title="' . AlDolUtils::dol_escape_htmltag($titlealt) . '"') . ($moreatt ? ' ' . $moreatt : ' class="inline-block' . ($morecss ? ' ' . $morecss : '') . '"') . '>'; // Alt is used for accessibility, title for popup |
|
| 3086 | + return '<img src="'.$fullpathpicto.'" alt="'.AlDolUtils::dol_escape_htmltag($alt).'"'.(($notitle || empty($titlealt)) ? '' : ' title="'.AlDolUtils::dol_escape_htmltag($titlealt).'"').($moreatt ? ' '.$moreatt : ' class="inline-block'.($morecss ? ' '.$morecss : '').'"').'>'; // Alt is used for accessibility, title for popup |
|
| 3087 | 3087 | } |
| 3088 | 3088 | |
| 3089 | 3089 | /** |
@@ -3101,7 +3101,7 @@ discard block |
||
| 3101 | 3101 | */ |
| 3102 | 3102 | static function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0) |
| 3103 | 3103 | {
|
| 3104 | - return img_picto($titlealt, 'object_' . $picto, $moreatt, $pictoisfullpath, $srconly, $notitle); |
|
| 3104 | + return img_picto($titlealt, 'object_'.$picto, $moreatt, $pictoisfullpath, $srconly, $notitle); |
|
| 3105 | 3105 | } |
| 3106 | 3106 | |
| 3107 | 3107 | /** |
@@ -3122,7 +3122,7 @@ discard block |
||
| 3122 | 3122 | $picto .= '.png'; |
| 3123 | 3123 | |
| 3124 | 3124 | //$path = DOL_BASE_URI . '/theme/' . Globals::$conf->theme . '/img/weather/' . $picto; |
| 3125 | - $path = DOL_BASE_URI . '/theme/' . Globals::$conf->theme . '/img/weather/' . $picto; |
|
| 3125 | + $path = DOL_BASE_URI.'/theme/'.Globals::$conf->theme.'/img/weather/'.$picto; |
|
| 3126 | 3126 | |
| 3127 | 3127 | return img_picto($titlealt, $path, $moreatt, 1); |
| 3128 | 3128 | } |
@@ -3149,10 +3149,10 @@ discard block |
||
| 3149 | 3149 | $path = $picto; |
| 3150 | 3150 | } else {
|
| 3151 | 3151 | //$path = DOL_BASE_URI . '/theme/common/' . $picto; |
| 3152 | - $path = DOL_BASE_URI . '/theme/common/' . $picto; |
|
| 3152 | + $path = DOL_BASE_URI.'/theme/common/'.$picto; |
|
| 3153 | 3153 | |
| 3154 | 3154 | if (!empty(Globals::$conf->global->MAIN_MODULE_CAN_OVERWRITE_COMMONICONS)) {
|
| 3155 | - $themepath = DOL_BASE_PATH . 'theme/' . Globals::$conf->theme . '/img/' . $picto; |
|
| 3155 | + $themepath = DOL_BASE_PATH.'theme/'.Globals::$conf->theme.'/img/'.$picto; |
|
| 3156 | 3156 | |
| 3157 | 3157 | if (file_exists($themepath)) {
|
| 3158 | 3158 | $path = $themepath; |
@@ -3191,14 +3191,14 @@ discard block |
||
| 3191 | 3191 | $numaction = 3; |
| 3192 | 3192 | $titlealt = Globals::$langs->transnoentitiesnoconv('ChangeContactDone');
|
| 3193 | 3193 | } else {
|
| 3194 | - $titlealt = Globals::$langs->transnoentitiesnoconv('ChangeStatus ' . $numaction);
|
|
| 3194 | + $titlealt = Globals::$langs->transnoentitiesnoconv('ChangeStatus '.$numaction);
|
|
| 3195 | 3195 | $numaction = 0; |
| 3196 | 3196 | } |
| 3197 | 3197 | } |
| 3198 | 3198 | if (!is_numeric($numaction)) |
| 3199 | 3199 | $numaction = 0; |
| 3200 | 3200 | |
| 3201 | - return img_picto($titlealt, 'stcomm' . $numaction . '.png'); |
|
| 3201 | + return img_picto($titlealt, 'stcomm'.$numaction.'.png'); |
|
| 3202 | 3202 | } |
| 3203 | 3203 | |
| 3204 | 3204 | /** |
@@ -3215,7 +3215,7 @@ discard block |
||
| 3215 | 3215 | if ($titlealt == 'default') |
| 3216 | 3216 | $titlealt = Globals::$langs->trans('Show');
|
| 3217 | 3217 | |
| 3218 | - return img_picto($titlealt, 'pdf' . $size . '.png'); |
|
| 3218 | + return img_picto($titlealt, 'pdf'.$size.'.png'); |
|
| 3219 | 3219 | } |
| 3220 | 3220 | |
| 3221 | 3221 | /** |
@@ -3267,7 +3267,7 @@ discard block |
||
| 3267 | 3267 | if ($titlealt == 'default') |
| 3268 | 3268 | $titlealt = Globals::$langs->trans('Modify');
|
| 3269 | 3269 | |
| 3270 | - return img_picto($titlealt, 'edit.png', ($float ? 'style="float: ' . (Globals::$langs->tab_translate["DIRECTION"] == 'rtl' ? 'left' : 'right') . '"' : "") . ($other ? ' ' . $other : '')); |
|
| 3270 | + return img_picto($titlealt, 'edit.png', ($float ? 'style="float: '.(Globals::$langs->tab_translate["DIRECTION"] == 'rtl' ? 'left' : 'right').'"' : "").($other ? ' '.$other : '')); |
|
| 3271 | 3271 | } |
| 3272 | 3272 | |
| 3273 | 3273 | /** |
@@ -3285,7 +3285,7 @@ discard block |
||
| 3285 | 3285 | if ($titlealt == 'default') |
| 3286 | 3286 | $titlealt = Globals::$langs->trans('View');
|
| 3287 | 3287 | |
| 3288 | - $moreatt = ($float ? 'style="float: right" ' : '') . $other; |
|
| 3288 | + $moreatt = ($float ? 'style="float: right" ' : '').$other; |
|
| 3289 | 3289 | |
| 3290 | 3290 | return img_picto($titlealt, 'view.png', $moreatt); |
| 3291 | 3291 | } |
@@ -3358,7 +3358,7 @@ discard block |
||
| 3358 | 3358 | $usealttitle = Globals::$langs->trans('Info');
|
| 3359 | 3359 | } |
| 3360 | 3360 | |
| 3361 | - return img_picto($usealttitle, 'info.png', 'style="vertical-align: middle;' . ($usehelpcursor == 1 ? ' cursor: help' : ($usehelpcursor == 2 ? ' cursor: pointer' : '')) . '"'); |
|
| 3361 | + return img_picto($usealttitle, 'info.png', 'style="vertical-align: middle;'.($usehelpcursor == 1 ? ' cursor: help' : ($usehelpcursor == 2 ? ' cursor: pointer' : '')).'"'); |
|
| 3362 | 3362 | } |
| 3363 | 3363 | |
| 3364 | 3364 | /** |
@@ -3392,7 +3392,7 @@ discard block |
||
| 3392 | 3392 | $titlealt = Globals::$langs->trans('Warning');
|
| 3393 | 3393 | |
| 3394 | 3394 | //return '<div class="imglatecoin">'.img_picto($titlealt, 'warning_white.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')).'</div>'; |
| 3395 | - return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"' . ($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' ' . $moreatt) : '')); |
|
| 3395 | + return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt) : '')); |
|
| 3396 | 3396 | } |
| 3397 | 3397 | |
| 3398 | 3398 | /** |
@@ -3426,7 +3426,7 @@ discard block |
||
| 3426 | 3426 | $titlealt = Globals::$langs->trans('Next');
|
| 3427 | 3427 | |
| 3428 | 3428 | //return img_picto($titlealt, 'next.png', $moreatt); |
| 3429 | - return '<span class="fa fa-chevron-right paddingright paddingleft" title="' . AlDolUtils::dol_escape_htmltag($titlealt) . '"></span>'; |
|
| 3429 | + return '<span class="fa fa-chevron-right paddingright paddingleft" title="'.AlDolUtils::dol_escape_htmltag($titlealt).'"></span>'; |
|
| 3430 | 3430 | } |
| 3431 | 3431 | |
| 3432 | 3432 | /** |
@@ -3444,7 +3444,7 @@ discard block |
||
| 3444 | 3444 | $titlealt = Globals::$langs->trans('Previous');
|
| 3445 | 3445 | |
| 3446 | 3446 | //return img_picto($titlealt, 'previous.png', $moreatt); |
| 3447 | - return '<span class="fa fa-chevron-left paddingright paddingleft" title="' . AlDolUtils::dol_escape_htmltag($titlealt) . '"></span>'; |
|
| 3447 | + return '<span class="fa fa-chevron-left paddingright paddingleft" title="'.AlDolUtils::dol_escape_htmltag($titlealt).'"></span>'; |
|
| 3448 | 3448 | } |
| 3449 | 3449 | |
| 3450 | 3450 | /** |
@@ -3462,7 +3462,7 @@ discard block |
||
| 3462 | 3462 | if ($titlealt == 'default') |
| 3463 | 3463 | $titlealt = Globals::$langs->trans('Down');
|
| 3464 | 3464 | |
| 3465 | - return img_picto($titlealt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown' . ($moreclass ? " " . $moreclass : "") . '"'); |
|
| 3465 | + return img_picto($titlealt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown'.($moreclass ? " ".$moreclass : "").'"'); |
|
| 3466 | 3466 | } |
| 3467 | 3467 | |
| 3468 | 3468 | /** |
@@ -3480,7 +3480,7 @@ discard block |
||
| 3480 | 3480 | if ($titlealt == 'default') |
| 3481 | 3481 | $titlealt = Globals::$langs->trans('Up');
|
| 3482 | 3482 | |
| 3483 | - return img_picto($titlealt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup' . ($moreclass ? " " . $moreclass : "") . '"'); |
|
| 3483 | + return img_picto($titlealt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup'.($moreclass ? " ".$moreclass : "").'"'); |
|
| 3484 | 3484 | } |
| 3485 | 3485 | |
| 3486 | 3486 | /** |
@@ -3563,7 +3563,7 @@ discard block |
||
| 3563 | 3563 | $brand = 'credit-card'; |
| 3564 | 3564 | } |
| 3565 | 3565 | |
| 3566 | - return '<span class="fa fa-' . $brand . ' fa-2x fa-fw"></span>'; |
|
| 3566 | + return '<span class="fa fa-'.$brand.' fa-2x fa-fw"></span>'; |
|
| 3567 | 3567 | } |
| 3568 | 3568 | |
| 3569 | 3569 | /** |
@@ -3576,17 +3576,17 @@ discard block |
||
| 3576 | 3576 | */ |
| 3577 | 3577 | static function img_mime($file, $titlealt = '', $morecss = '') |
| 3578 | 3578 | {
|
| 3579 | - require_once DOL_BASE_PATH . '/core/lib/files.lib.php'; |
|
| 3579 | + require_once DOL_BASE_PATH.'/core/lib/files.lib.php'; |
|
| 3580 | 3580 | |
| 3581 | 3581 | $mimetype = dol_mimetype($file, '', 1); |
| 3582 | 3582 | $mimeimg = dol_mimetype($file, '', 2); |
| 3583 | 3583 | $mimefa = dol_mimetype($file, '', 4); |
| 3584 | 3584 | |
| 3585 | 3585 | if (empty($titlealt)) |
| 3586 | - $titlealt = 'Mime type: ' . $mimetype; |
|
| 3586 | + $titlealt = 'Mime type: '.$mimetype; |
|
| 3587 | 3587 | |
| 3588 | 3588 | //return img_picto_common($titlealt, 'mime/'.$mimeimg, 'class="'.$morecss.'"'); |
| 3589 | - return '<i class="fa fa-' . $mimefa . ' paddingright"></i>'; |
|
| 3589 | + return '<i class="fa fa-'.$mimefa.' paddingright"></i>'; |
|
| 3590 | 3590 | } |
| 3591 | 3591 | |
| 3592 | 3592 | /** |
@@ -3601,7 +3601,7 @@ discard block |
||
| 3601 | 3601 | */ |
| 3602 | 3602 | static function img_phone($titlealt = 'default', $option = 0) |
| 3603 | 3603 | {
|
| 3604 | - AlDolUtils::dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); |
|
| 3604 | + AlDolUtils::dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING); |
|
| 3605 | 3605 | |
| 3606 | 3606 | // global Globals::$conf, Globals::$langs; |
| 3607 | 3607 | |
@@ -3632,8 +3632,8 @@ discard block |
||
| 3632 | 3632 | |
| 3633 | 3633 | $img = img_picto($titlealt, 'search.png', $other, false, 1); |
| 3634 | 3634 | |
| 3635 | - $input = '<input type="image" class="liste_titre" name="button_search" src="' . $img . '" '; |
|
| 3636 | - $input .= 'value="' . AlDolUtils::dol_escape_htmltag($titlealt) . '" title="' . AlDolUtils::dol_escape_htmltag($titlealt) . '" >'; |
|
| 3635 | + $input = '<input type="image" class="liste_titre" name="button_search" src="'.$img.'" '; |
|
| 3636 | + $input .= 'value="'.AlDolUtils::dol_escape_htmltag($titlealt).'" title="'.AlDolUtils::dol_escape_htmltag($titlealt).'" >'; |
|
| 3637 | 3637 | |
| 3638 | 3638 | return $input; |
| 3639 | 3639 | } |
@@ -3654,8 +3654,8 @@ discard block |
||
| 3654 | 3654 | |
| 3655 | 3655 | $img = img_picto($titlealt, 'searchclear.png', $other, false, 1); |
| 3656 | 3656 | |
| 3657 | - $input = '<input type="image" class="liste_titre" name="button_removefilter" src="' . $img . '" '; |
|
| 3658 | - $input .= 'value="' . AlDolUtils::dol_escape_htmltag($titlealt) . '" title="' . AlDolUtils::dol_escape_htmltag($titlealt) . '" >'; |
|
| 3657 | + $input = '<input type="image" class="liste_titre" name="button_removefilter" src="'.$img.'" '; |
|
| 3658 | + $input .= 'value="'.AlDolUtils::dol_escape_htmltag($titlealt).'" title="'.AlDolUtils::dol_escape_htmltag($titlealt).'" >'; |
|
| 3659 | 3659 | |
| 3660 | 3660 | return $input; |
| 3661 | 3661 | } |
@@ -3675,10 +3675,10 @@ discard block |
||
| 3675 | 3675 | // global Globals::$conf, Globals::$langs; |
| 3676 | 3676 | |
| 3677 | 3677 | if ($infoonimgalt) {
|
| 3678 | - return img_picto($text, 'info', 'class="hideonsmartphone' . ($morecss ? ' ' . $morecss : '') . '"'); |
|
| 3678 | + return img_picto($text, 'info', 'class="hideonsmartphone'.($morecss ? ' '.$morecss : '').'"'); |
|
| 3679 | 3679 | } |
| 3680 | 3680 | |
| 3681 | - return ($nodiv ? '' : '<div class="' . (empty($admin) ? '' : ($admin == '1' ? 'info' : $admin)) . ' hideonsmartphone' . ($morecss ? ' ' . $morecss : '') . '">') . '<span class="fa fa-info-circle" title="' . AlDolUtils::dol_escape_htmltag($admin ? Globals::$langs->trans('InfoAdmin') : Globals::$langs->trans('Note')) . '"></span> ' . $text . ($nodiv ? '' : '</div>');
|
|
| 3681 | + return ($nodiv ? '' : '<div class="'.(empty($admin) ? '' : ($admin == '1' ? 'info' : $admin)).' hideonsmartphone'.($morecss ? ' '.$morecss : '').'">').'<span class="fa fa-info-circle" title="'.AlDolUtils::dol_escape_htmltag($admin ? Globals::$langs->trans('InfoAdmin') : Globals::$langs->trans('Note')).'"></span> '.$text.($nodiv ? '' : '</div>');
|
|
| 3682 | 3682 | } |
| 3683 | 3683 | |
| 3684 | 3684 | /** |
@@ -3712,39 +3712,39 @@ discard block |
||
| 3712 | 3712 | Globals::$langs->loadLangs(array('main', 'errors'));
|
| 3713 | 3713 | |
| 3714 | 3714 | if ($_SERVER['DOCUMENT_ROOT']) { // Mode web
|
| 3715 | - $out .= Globals::$langs->trans("DolibarrHasDetectedError") . ".<br>\n";
|
|
| 3715 | + $out .= Globals::$langs->trans("DolibarrHasDetectedError").".<br>\n";
|
|
| 3716 | 3716 | if (!empty(Globals::$conf->global->MAIN_FEATURES_LEVEL)) {
|
| 3717 | 3717 | $out .= "You use an experimental or develop level of features, so please do NOT report any bugs, except if problem is confirmed moving option MAIN_FEATURES_LEVEL back to 0.<br>\n"; |
| 3718 | 3718 | } |
| 3719 | - $out .= Globals::$langs->trans("InformationToHelpDiagnose") . ":<br>\n";
|
|
| 3719 | + $out .= Globals::$langs->trans("InformationToHelpDiagnose").":<br>\n";
|
|
| 3720 | 3720 | |
| 3721 | - $out .= "<b>" . Globals::$langs->trans("Date") . ":</b> " . AlDolUtils::dol_print_date(time(), 'dayhourlog') . "<br>\n";
|
|
| 3722 | - $out .= "<b>" . Globals::$langs->trans("Dolibarr") . ":</b> " . DOL_VERSION . "<br>\n";
|
|
| 3721 | + $out .= "<b>".Globals::$langs->trans("Date").":</b> ".AlDolUtils::dol_print_date(time(), 'dayhourlog')."<br>\n";
|
|
| 3722 | + $out .= "<b>".Globals::$langs->trans("Dolibarr").":</b> ".DOL_VERSION."<br>\n";
|
|
| 3723 | 3723 | if (isset(Globals::$conf->global->MAIN_FEATURES_LEVEL)) {
|
| 3724 | - $out .= "<b>" . Globals::$langs->trans("LevelOfFeature") . ":</b> " . Globals::$conf->global->MAIN_FEATURES_LEVEL . "<br>\n";
|
|
| 3724 | + $out .= "<b>".Globals::$langs->trans("LevelOfFeature").":</b> ".Globals::$conf->global->MAIN_FEATURES_LEVEL."<br>\n";
|
|
| 3725 | 3725 | } |
| 3726 | 3726 | if (function_exists("phpversion")) {
|
| 3727 | - $out .= "<b>" . Globals::$langs->trans("PHP") . ":</b> " . phpversion() . "<br>\n";
|
|
| 3727 | + $out .= "<b>".Globals::$langs->trans("PHP").":</b> ".phpversion()."<br>\n";
|
|
| 3728 | 3728 | } |
| 3729 | - $out .= "<b>" . Globals::$langs->trans("Server") . ":</b> " . $_SERVER["SERVER_SOFTWARE"] . "<br>\n";
|
|
| 3729 | + $out .= "<b>".Globals::$langs->trans("Server").":</b> ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";
|
|
| 3730 | 3730 | if (function_exists("php_uname")) {
|
| 3731 | - $out .= "<b>" . Globals::$langs->trans("OS") . ":</b> " . php_uname() . "<br>\n";
|
|
| 3731 | + $out .= "<b>".Globals::$langs->trans("OS").":</b> ".php_uname()."<br>\n";
|
|
| 3732 | 3732 | } |
| 3733 | - $out .= "<b>" . Globals::$langs->trans("UserAgent") . ":</b> " . $_SERVER["HTTP_USER_AGENT"] . "<br>\n";
|
|
| 3733 | + $out .= "<b>".Globals::$langs->trans("UserAgent").":</b> ".$_SERVER["HTTP_USER_AGENT"]."<br>\n";
|
|
| 3734 | 3734 | $out .= "<br>\n"; |
| 3735 | - $out .= "<b>" . Globals::$langs->trans("RequestedUrl") . ":</b> " . AlDolUtils::dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT, 'UTF-8') . "<br>\n";
|
|
| 3736 | - $out .= "<b>" . Globals::$langs->trans("Referer") . ":</b> " . (isset($_SERVER["HTTP_REFERER"]) ? AlDolUtils::dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT, 'UTF-8') : '') . "<br>\n";
|
|
| 3737 | - $out .= "<b>" . Globals::$langs->trans("MenuManager") . ":</b> " . (isset(Globals::$conf->standard_menu) ? Globals::$conf->standard_menu : '') . "<br>\n";
|
|
| 3735 | + $out .= "<b>".Globals::$langs->trans("RequestedUrl").":</b> ".AlDolUtils::dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT, 'UTF-8')."<br>\n";
|
|
| 3736 | + $out .= "<b>".Globals::$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"]) ? AlDolUtils::dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT, 'UTF-8') : '')."<br>\n";
|
|
| 3737 | + $out .= "<b>".Globals::$langs->trans("MenuManager").":</b> ".(isset(Globals::$conf->standard_menu) ? Globals::$conf->standard_menu : '')."<br>\n";
|
|
| 3738 | 3738 | $out .= "<br>\n"; |
| 3739 | - $syslog .= "url=" . AlDolUtils::dol_escape_htmltag($_SERVER["REQUEST_URI"]); |
|
| 3740 | - $syslog .= ", query_string=" . AlDolUtils::dol_escape_htmltag($_SERVER["QUERY_STRING"]); |
|
| 3739 | + $syslog .= "url=".AlDolUtils::dol_escape_htmltag($_SERVER["REQUEST_URI"]); |
|
| 3740 | + $syslog .= ", query_string=".AlDolUtils::dol_escape_htmltag($_SERVER["QUERY_STRING"]); |
|
| 3741 | 3741 | } else { // Mode CLI
|
| 3742 | - $out .= '> ' . Globals::$langs->transnoentities("ErrorInternalErrorDetected") . ":\n" . $argv[0] . "\n";
|
|
| 3743 | - $syslog .= "pid=" . dol_getmypid(); |
|
| 3742 | + $out .= '> '.Globals::$langs->transnoentities("ErrorInternalErrorDetected").":\n".$argv[0]."\n";
|
|
| 3743 | + $syslog .= "pid=".dol_getmypid(); |
|
| 3744 | 3744 | } |
| 3745 | 3745 | |
| 3746 | 3746 | if (is_object($dbError)) {
|
| 3747 | - $out .= '<pre>' . print_r($dbError, true) . '</pre>'; |
|
| 3747 | + $out .= '<pre>'.print_r($dbError, true).'</pre>'; |
|
| 3748 | 3748 | /* |
| 3749 | 3749 | if ($_SERVER['DOCUMENT_ROOT']) { // Mode web
|
| 3750 | 3750 | $out .= "<b>" . Globals::$langs->trans("DatabaseTypeManager") . ":</b> " . $dbError->type . "<br>\n";
|
@@ -3783,31 +3783,31 @@ discard block |
||
| 3783 | 3783 | continue; |
| 3784 | 3784 | } |
| 3785 | 3785 | if ($_SERVER['DOCUMENT_ROOT']) { // Mode web
|
| 3786 | - $out .= "<b>" . Globals::$langs->trans("Message") . ":</b> " . AlDolUtils::dol_escape_htmltag($msg) . "<br>\n";
|
|
| 3786 | + $out .= "<b>".Globals::$langs->trans("Message").":</b> ".AlDolUtils::dol_escape_htmltag($msg)."<br>\n";
|
|
| 3787 | 3787 | } else { // Mode CLI
|
| 3788 | - $out .= '> ' . Globals::$langs->transnoentities("Message") . ":\n" . $msg . "\n";
|
|
| 3788 | + $out .= '> '.Globals::$langs->transnoentities("Message").":\n".$msg."\n";
|
|
| 3789 | 3789 | } |
| 3790 | - $syslog .= ", msg=" . $msg; |
|
| 3790 | + $syslog .= ", msg=".$msg; |
|
| 3791 | 3791 | } |
| 3792 | 3792 | } |
| 3793 | 3793 | if (empty($dolibarr_main_prod) && $_SERVER['DOCUMENT_ROOT'] && function_exists('xdebug_print_function_stack') && function_exists('xdebug_call_file')) {
|
| 3794 | 3794 | xdebug_print_function_stack(); |
| 3795 | - $out .= '<b>XDebug informations:</b>' . "<br>\n"; |
|
| 3796 | - $out .= 'File: ' . xdebug_call_file() . "<br>\n"; |
|
| 3797 | - $out .= 'Line: ' . xdebug_call_line() . "<br>\n"; |
|
| 3798 | - $out .= 'Function: ' . xdebug_call_function() . "<br>\n"; |
|
| 3795 | + $out .= '<b>XDebug informations:</b>'."<br>\n"; |
|
| 3796 | + $out .= 'File: '.xdebug_call_file()."<br>\n"; |
|
| 3797 | + $out .= 'Line: '.xdebug_call_line()."<br>\n"; |
|
| 3798 | + $out .= 'Function: '.xdebug_call_function()."<br>\n"; |
|
| 3799 | 3799 | $out .= "<br>\n"; |
| 3800 | 3800 | } |
| 3801 | 3801 | |
| 3802 | 3802 | if (empty($dolibarr_main_prod)) {
|
| 3803 | 3803 | print $out; |
| 3804 | 3804 | } else {
|
| 3805 | - print Globals::$langs->trans("DolibarrHasDetectedError") . '. ';
|
|
| 3805 | + print Globals::$langs->trans("DolibarrHasDetectedError").'. ';
|
|
| 3806 | 3806 | print Globals::$langs->trans("YouCanSetOptionDolibarrMainProdToZero");
|
| 3807 | 3807 | define("MAIN_CORE_ERROR", 1);
|
| 3808 | 3808 | } |
| 3809 | 3809 | //else print 'Sorry, an error occured but the parameter $dolibarr_main_prod is defined in conf file so no message is reported to your browser. Please read the log file for error message.'; |
| 3810 | - AlDolUtils::dol_syslog("Error " . $syslog, LOG_ERR);
|
|
| 3810 | + AlDolUtils::dol_syslog("Error ".$syslog, LOG_ERR);
|
|
| 3811 | 3811 | } |
| 3812 | 3812 | |
| 3813 | 3813 | /** |
@@ -3831,14 +3831,14 @@ discard block |
||
| 3831 | 3831 | Globals::$langs->load("errors");
|
| 3832 | 3832 | $now = dol_now(); |
| 3833 | 3833 | |
| 3834 | - print '<br><div class="center login_main_message"><div class="' . $morecss . '">'; |
|
| 3835 | - print Globals::$langs->trans("ErrorContactEMail", $email, $prefixcode . AlDolUtils::dol_print_date($now, '%Y%m%d'));
|
|
| 3834 | + print '<br><div class="center login_main_message"><div class="'.$morecss.'">'; |
|
| 3835 | + print Globals::$langs->trans("ErrorContactEMail", $email, $prefixcode.AlDolUtils::dol_print_date($now, '%Y%m%d'));
|
|
| 3836 | 3836 | if ($errormessage) {
|
| 3837 | - print '<br><br>' . $errormessage; |
|
| 3837 | + print '<br><br>'.$errormessage; |
|
| 3838 | 3838 | } |
| 3839 | 3839 | if (is_array($errormessages) && count($errormessages)) {
|
| 3840 | 3840 | foreach ($errormessages as $mesgtoshow) {
|
| 3841 | - print '<br><br>' . $mesgtoshow; |
|
| 3841 | + print '<br><br>'.$mesgtoshow; |
|
| 3842 | 3842 | } |
| 3843 | 3843 | } |
| 3844 | 3844 | print '</div></div>'; |
@@ -3896,16 +3896,16 @@ discard block |
||
| 3896 | 3896 | } |
| 3897 | 3897 | |
| 3898 | 3898 | $tmpsortfield = explode(',', $sortfield);
|
| 3899 | - $sortfield1 = trim($tmpsortfield[0]); // If $sortfield is 'd.datep,d.id', it becomes 'd.datep' |
|
| 3899 | + $sortfield1 = trim($tmpsortfield[0]); // If $sortfield is 'd.datep,d.id', it becomes 'd.datep' |
|
| 3900 | 3900 | $tmpfield = explode(',', $field);
|
| 3901 | - $field1 = trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep' |
|
| 3901 | + $field1 = trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep' |
|
| 3902 | 3902 | //var_dump('field='.$field.' field1='.$field1.' sortfield='.$sortfield.' sortfield1='.$sortfield1);
|
| 3903 | 3903 | // If field is used as sort criteria we use a specific css class liste_titre_sel |
| 3904 | 3904 | // Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom")
|
| 3905 | 3905 | if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./", "", $field1))) {
|
| 3906 | - $out .= '<' . $tag . ' class="' . $prefix . 'liste_titre_sel" ' . $moreattrib . '>'; |
|
| 3906 | + $out .= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '.$moreattrib.'>'; |
|
| 3907 | 3907 | } else {
|
| 3908 | - $out .= '<' . $tag . ' class="' . $prefix . 'liste_titre" ' . $moreattrib . '>'; |
|
| 3908 | + $out .= '<'.$tag.' class="'.$prefix.'liste_titre" '.$moreattrib.'>'; |
|
| 3909 | 3909 | } |
| 3910 | 3910 | |
| 3911 | 3911 | if (empty($thead) && $field && empty($disablesortlink)) { // If this is a sort field
|
@@ -3913,7 +3913,7 @@ discard block |
||
| 3913 | 3913 | $options = preg_replace('/sortorder=([a-zA-Z0-9,\s\.]+)/i', '', $options);
|
| 3914 | 3914 | $options = preg_replace('/&+/i', '&', $options);
|
| 3915 | 3915 | if (!preg_match('/^&/', $options)) {
|
| 3916 | - $options = '&' . $options; |
|
| 3916 | + $options = '&'.$options; |
|
| 3917 | 3917 | } |
| 3918 | 3918 | |
| 3919 | 3919 | $sortordertouseinlink = ''; |
@@ -3931,7 +3931,7 @@ discard block |
||
| 3931 | 3931 | } |
| 3932 | 3932 | } |
| 3933 | 3933 | $sortordertouseinlink = preg_replace('/,$/', '', $sortordertouseinlink);
|
| 3934 | - $out .= '<a class="reposition" href="' . $file . '?sortfield=' . $field . '&sortorder=' . $sortordertouseinlink . '&begin=' . $begin . $options . '">'; |
|
| 3934 | + $out .= '<a class="reposition" href="'.$file.'?sortfield='.$field.'&sortorder='.$sortordertouseinlink.'&begin='.$begin.$options.'">'; |
|
| 3935 | 3935 | } |
| 3936 | 3936 | |
| 3937 | 3937 | if ($tooltip) {
|
@@ -3949,7 +3949,7 @@ discard block |
||
| 3949 | 3949 | $options = preg_replace('/sortorder=([a-zA-Z0-9,\s\.]+)/i', '', $options);
|
| 3950 | 3950 | $options = preg_replace('/&+/i', '&', $options);
|
| 3951 | 3951 | if (!preg_match('/^&/', $options)) {
|
| 3952 | - $options = '&' . $options; |
|
| 3952 | + $options = '&'.$options; |
|
| 3953 | 3953 | } |
| 3954 | 3954 | |
| 3955 | 3955 | if (!$sortorder || $field1 != $sortfield1) {
|
@@ -3959,19 +3959,19 @@ discard block |
||
| 3959 | 3959 | if (preg_match('/^DESC/', $sortorder)) {
|
| 3960 | 3960 | //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",0).'</a>';
|
| 3961 | 3961 | //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'.img_up("Z-A",1).'</a>';
|
| 3962 | - $sortimg .= '<span class="nowrap">' . img_up("Z-A", 0) . '</span>';
|
|
| 3962 | + $sortimg .= '<span class="nowrap">'.img_up("Z-A", 0).'</span>';
|
|
| 3963 | 3963 | } |
| 3964 | 3964 | if (preg_match('/^ASC/', $sortorder)) {
|
| 3965 | 3965 | //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",1).'</a>';
|
| 3966 | 3966 | //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'.img_up("Z-A",0).'</a>';
|
| 3967 | - $sortimg .= '<span class="nowrap">' . img_down("A-Z", 0) . '</span>';
|
|
| 3967 | + $sortimg .= '<span class="nowrap">'.img_down("A-Z", 0).'</span>';
|
|
| 3968 | 3968 | } |
| 3969 | 3969 | } |
| 3970 | 3970 | } |
| 3971 | 3971 | |
| 3972 | 3972 | $out .= $sortimg; |
| 3973 | 3973 | |
| 3974 | - $out .= '</' . $tag . '>'; |
|
| 3974 | + $out .= '</'.$tag.'>'; |
|
| 3975 | 3975 | |
| 3976 | 3976 | return $out; |
| 3977 | 3977 | } |
@@ -3986,9 +3986,9 @@ discard block |
||
| 3986 | 3986 | */ |
| 3987 | 3987 | static function print_titre($title) |
| 3988 | 3988 | {
|
| 3989 | - AlDolUtils::dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); |
|
| 3989 | + AlDolUtils::dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING); |
|
| 3990 | 3990 | |
| 3991 | - print '<div class="titre">' . $title . '</div>'; |
|
| 3991 | + print '<div class="titre">'.$title.'</div>'; |
|
| 3992 | 3992 | } |
| 3993 | 3993 | |
| 3994 | 3994 | /** |
@@ -4031,20 +4031,20 @@ discard block |
||
| 4031 | 4031 | } |
| 4032 | 4032 | |
| 4033 | 4033 | $return .= "\n"; |
| 4034 | - $return .= '<table ' . ($id ? 'id="' . $id . '" ' : '') . 'summary="" class="centpercent notopnoleftnoright' . ($morecssontable ? ' ' . $morecssontable : '') . '" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into print_barre_list |
|
| 4034 | + $return .= '<table '.($id ? 'id="'.$id.'" ' : '').'summary="" class="centpercent notopnoleftnoright'.($morecssontable ? ' '.$morecssontable : '').'" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into print_barre_list |
|
| 4035 | 4035 | if ($picto) {
|
| 4036 | - $return .= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">' . AlDolUtils::img_picto('', $picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath) . '</td>';
|
|
| 4036 | + $return .= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">'.AlDolUtils::img_picto('', $picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).'</td>';
|
|
| 4037 | 4037 | } |
| 4038 | 4038 | $return .= '<td class="nobordernopadding valignmiddle">'; |
| 4039 | - $return .= '<div class="titre inline-block">' . $titre . '</div>'; |
|
| 4039 | + $return .= '<div class="titre inline-block">'.$titre.'</div>'; |
|
| 4040 | 4040 | $return .= '</td>'; |
| 4041 | 4041 | if (AlDolUtils::dol_strlen($morehtmlcenter)) {
|
| 4042 | - $return .= '<td class="nobordernopadding" align="center" valign="middle">' . $morehtmlcenter . '</td>'; |
|
| 4042 | + $return .= '<td class="nobordernopadding" align="center" valign="middle">'.$morehtmlcenter.'</td>'; |
|
| 4043 | 4043 | } |
| 4044 | 4044 | if (AlDolUtils::dol_strlen($morehtmlright)) {
|
| 4045 | - $return .= '<td class="nobordernopadding titre_right wordbreak" align="right" valign="middle">' . $morehtmlright . '</td>'; |
|
| 4045 | + $return .= '<td class="nobordernopadding titre_right wordbreak" align="right" valign="middle">'.$morehtmlright.'</td>'; |
|
| 4046 | 4046 | } |
| 4047 | - $return .= '</tr></table>' . "\n"; |
|
| 4047 | + $return .= '</tr></table>'."\n"; |
|
| 4048 | 4048 | |
| 4049 | 4049 | return $return; |
| 4050 | 4050 | } |
@@ -4092,29 +4092,29 @@ discard block |
||
| 4092 | 4092 | //print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage; |
| 4093 | 4093 | |
| 4094 | 4094 | print "\n"; |
| 4095 | - print "<!-- Begin title '" . $titre . "' -->\n"; |
|
| 4096 | - print '<table border="0" class="centpercent notopnoleftnoright' . ($morecss ? ' ' . $morecss : '') . '" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into load_fiche_tire |
|
| 4095 | + print "<!-- Begin title '".$titre."' -->\n"; |
|
| 4096 | + print '<table border="0" class="centpercent notopnoleftnoright'.($morecss ? ' '.$morecss : '').'" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into load_fiche_tire |
|
| 4097 | 4097 | // Left |
| 4098 | 4098 | //if ($picto && $titre) print '<td class="nobordernopadding hideonsmartphone" width="40" align="left" valign="middle">'.img_picto('', $picto, 'id="pictotitle"', $pictoisfullpath).'</td>';
|
| 4099 | 4099 | print '<td class="nobordernopadding valignmiddle">'; |
| 4100 | 4100 | if ($picto && $titre) |
| 4101 | 4101 | print img_picto('', $picto, 'class="hideonsmartphone valignmiddle opacityhigh pictotitle widthpictotitle"', $pictoisfullpath);
|
| 4102 | - print '<div class="titre inline-block">' . $titre; |
|
| 4102 | + print '<div class="titre inline-block">'.$titre; |
|
| 4103 | 4103 | if (!empty($titre) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') |
| 4104 | - print ' (' . $totalnboflines . ')';
|
|
| 4104 | + print ' ('.$totalnboflines.')';
|
|
| 4105 | 4105 | print '</div></td>'; |
| 4106 | 4106 | |
| 4107 | 4107 | // Center |
| 4108 | 4108 | if ($morehtmlcenter) {
|
| 4109 | - print '<td class="nobordernopadding center valignmiddle">' . $morehtmlcenter . '</td>'; |
|
| 4109 | + print '<td class="nobordernopadding center valignmiddle">'.$morehtmlcenter.'</td>'; |
|
| 4110 | 4110 | } |
| 4111 | 4111 | |
| 4112 | 4112 | // Right |
| 4113 | 4113 | print '<td class="nobordernopadding valignmiddle" align="right">'; |
| 4114 | 4114 | if ($sortfield) |
| 4115 | - $options .= "&sortfield=" . urlencode($sortfield); |
|
| 4115 | + $options .= "&sortfield=".urlencode($sortfield); |
|
| 4116 | 4116 | if ($sortorder) |
| 4117 | - $options .= "&sortorder=" . urlencode($sortorder); |
|
| 4117 | + $options .= "&sortorder=".urlencode($sortorder); |
|
| 4118 | 4118 | // Show navigation bar |
| 4119 | 4119 | $pagelist = ''; |
| 4120 | 4120 | if ($savlimit != 0 && ($page > 0 || $num > $limit)) {
|
@@ -4132,40 +4132,40 @@ discard block |
||
| 4132 | 4132 | } |
| 4133 | 4133 | |
| 4134 | 4134 | if ($cpt >= 1) {
|
| 4135 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=0' . $options . '">1</a></li>'; |
|
| 4135 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page=0'.$options.'">1</a></li>'; |
|
| 4136 | 4136 | if ($cpt > 2) |
| 4137 | - $pagelist .= '<li' . ( (Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . ((Globals::$conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
| 4137 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.((Globals::$conf->dol_use_jmobile != 4) ? 'class="inactive"' : '').'>...</span></li>'; |
|
| 4138 | 4138 | else if ($cpt == 2) |
| 4139 | - $pagelist .= '<li' . ( (Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=1' . $options . '">2</a></li>'; |
|
| 4139 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page=1'.$options.'">2</a></li>'; |
|
| 4140 | 4140 | } |
| 4141 | 4141 | |
| 4142 | 4142 | do {
|
| 4143 | 4143 | if ($cpt == $page) {
|
| 4144 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . ((Globals::$conf->dol_use_jmobile != 4) ? 'class="active"' : '') . '>' . ($page + 1) . '</span></li>'; |
|
| 4144 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.((Globals::$conf->dol_use_jmobile != 4) ? 'class="active"' : '').'>'.($page + 1).'</span></li>'; |
|
| 4145 | 4145 | } else {
|
| 4146 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . $cpt . $options . '">' . ($cpt + 1) . '</a></li>'; |
|
| 4146 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page='.$cpt.$options.'">'.($cpt + 1).'</a></li>'; |
|
| 4147 | 4147 | } |
| 4148 | 4148 | $cpt++; |
| 4149 | 4149 | } while ($cpt < $nbpages && $cpt <= $page + $maxnbofpage); |
| 4150 | 4150 | |
| 4151 | 4151 | if ($cpt < $nbpages) {
|
| 4152 | 4152 | if ($cpt < $nbpages - 2) |
| 4153 | - $pagelist .= '<li' . ( (Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . ((Globals::$conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
| 4153 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.((Globals::$conf->dol_use_jmobile != 4) ? 'class="inactive"' : '').'>...</span></li>'; |
|
| 4154 | 4154 | else if ($cpt == $nbpages - 2) |
| 4155 | - $pagelist .= '<li' . ( (Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 2) . $options . '">' . ($nbpages - 1) . '</a></li>'; |
|
| 4156 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 1) . $options . '">' . $nbpages . '</a></li>'; |
|
| 4155 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page='.($nbpages - 2).$options.'">'.($nbpages - 1).'</a></li>'; |
|
| 4156 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page='.($nbpages - 1).$options.'">'.$nbpages.'</a></li>'; |
|
| 4157 | 4157 | } |
| 4158 | 4158 | } |
| 4159 | 4159 | else {
|
| 4160 | - $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . ((Globals::$conf->dol_use_jmobile != 4) ? 'class="active"' : '') . '>' . ($page + 1) . "</li>"; |
|
| 4160 | + $pagelist .= '<li'.((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.((Globals::$conf->dol_use_jmobile != 4) ? 'class="active"' : '').'>'.($page + 1)."</li>"; |
|
| 4161 | 4161 | } |
| 4162 | 4162 | } |
| 4163 | 4163 | |
| 4164 | - print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist |
|
| 4164 | + print_fleche_navigation($page, $file, $options, $nextpage, $pagelist, $morehtmlright, $savlimit, $totalnboflines, $hideselectlimit); // output the div and ul for previous/last completed with page numbers into $pagelist |
|
| 4165 | 4165 | |
| 4166 | 4166 | print '</td>'; |
| 4167 | 4167 | |
| 4168 | - print '</tr></table>' . "\n"; |
|
| 4168 | + print '</tr></table>'."\n"; |
|
| 4169 | 4169 | print "<!-- End title -->\n\n"; |
| 4170 | 4170 | } |
| 4171 | 4171 | |
@@ -4196,12 +4196,12 @@ discard block |
||
| 4196 | 4196 | $pagesizechoices = Globals::$conf->global->MAIN_PAGESIZE_CHOICES; |
| 4197 | 4197 | |
| 4198 | 4198 | print '<li class="pagination">'; |
| 4199 | - print '<select class="flat selectlimit" name="limit" title="' . AlDolUtils::dol_escape_htmltag(Globals::$langs->trans("MaxNbOfRecordPerPage")) . '">';
|
|
| 4199 | + print '<select class="flat selectlimit" name="limit" title="'.AlDolUtils::dol_escape_htmltag(Globals::$langs->trans("MaxNbOfRecordPerPage")).'">';
|
|
| 4200 | 4200 | $tmpchoice = explode(',', $pagesizechoices);
|
| 4201 | - $tmpkey = $limit . ':' . $limit; |
|
| 4201 | + $tmpkey = $limit.':'.$limit; |
|
| 4202 | 4202 | if (!in_array($tmpkey, $tmpchoice)) |
| 4203 | 4203 | $tmpchoice[] = $tmpkey; |
| 4204 | - $tmpkey = Globals::$conf->liste_limit . ':' . Globals::$conf->liste_limit; |
|
| 4204 | + $tmpkey = Globals::$conf->liste_limit.':'.Globals::$conf->liste_limit; |
|
| 4205 | 4205 | if (!in_array($tmpkey, $tmpchoice)) |
| 4206 | 4206 | $tmpchoice[] = $tmpkey; |
| 4207 | 4207 | asort($tmpchoice, SORT_NUMERIC); |
@@ -4216,7 +4216,7 @@ discard block |
||
| 4216 | 4216 | $selected = ' selected="selected"'; |
| 4217 | 4217 | $found = true; |
| 4218 | 4218 | } |
| 4219 | - print '<option name="' . $key . '"' . $selected . '>' . AlDolUtils::dol_escape_htmltag($val) . '</option>' . "\n"; |
|
| 4219 | + print '<option name="'.$key.'"'.$selected.'>'.AlDolUtils::dol_escape_htmltag($val).'</option>'."\n"; |
|
| 4220 | 4220 | } |
| 4221 | 4221 | } |
| 4222 | 4222 | print '</select>'; |
@@ -4235,20 +4235,20 @@ discard block |
||
| 4235 | 4235 | print '</li>'; |
| 4236 | 4236 | } |
| 4237 | 4237 | if ($page > 0) {
|
| 4238 | - print '<li class="pagination"><a class="paginationprevious" href="' . $file . '?page=' . ($page - 1) . $options . '"><i class="fa fa-chevron-left" title="' . AlDolUtils::dol_escape_htmltag(Globals::$langs->trans("Previous")) . '"></i></a></li>';
|
|
| 4238 | + print '<li class="pagination"><a class="paginationprevious" href="'.$file.'?page='.($page - 1).$options.'"><i class="fa fa-chevron-left" title="'.AlDolUtils::dol_escape_htmltag(Globals::$langs->trans("Previous")).'"></i></a></li>';
|
|
| 4239 | 4239 | } |
| 4240 | 4240 | if ($betweenarrows) {
|
| 4241 | 4241 | print $betweenarrows; |
| 4242 | 4242 | } |
| 4243 | 4243 | if ($nextpage > 0) {
|
| 4244 | - print '<li class="pagination"><a class="paginationnext" href="' . $file . '?page=' . ($page + 1) . $options . '"><i class="fa fa-chevron-right" title="' . AlDolUtils::dol_escape_htmltag(Globals::$langs->trans("Next")) . '"></i></a></li>';
|
|
| 4244 | + print '<li class="pagination"><a class="paginationnext" href="'.$file.'?page='.($page + 1).$options.'"><i class="fa fa-chevron-right" title="'.AlDolUtils::dol_escape_htmltag(Globals::$langs->trans("Next")).'"></i></a></li>';
|
|
| 4245 | 4245 | } |
| 4246 | 4246 | if ($afterarrows) {
|
| 4247 | 4247 | print '<li class="paginationafterarrows">'; |
| 4248 | 4248 | print $afterarrows; |
| 4249 | 4249 | print '</li>'; |
| 4250 | 4250 | } |
| 4251 | - print '</ul></div>' . "\n"; |
|
| 4251 | + print '</ul></div>'."\n"; |
|
| 4252 | 4252 | } |
| 4253 | 4253 | |
| 4254 | 4254 | /** |
@@ -4270,8 +4270,8 @@ discard block |
||
| 4270 | 4270 | $addpercent = true; |
| 4271 | 4271 | } |
| 4272 | 4272 | if (preg_match('/\((.*)\)/', $rate, $reg)) {
|
| 4273 | - $morelabel = ' (' . $reg[1] . ')';
|
|
| 4274 | - $rate = preg_replace('/\s*' . preg_quote($morelabel, '/') . '/', '', $rate);
|
|
| 4273 | + $morelabel = ' ('.$reg[1].')';
|
|
| 4274 | + $rate = preg_replace('/\s*'.preg_quote($morelabel, '/').'/', '', $rate);
|
|
| 4275 | 4275 | } |
| 4276 | 4276 | if (preg_match('/\*/', $rate)) {
|
| 4277 | 4277 | $rate = str_replace('*', '', $rate);
|
@@ -4280,10 +4280,10 @@ discard block |
||
| 4280 | 4280 | |
| 4281 | 4281 | // If rate is '9/9/9' we don't change it. If rate is '9.000' we apply price() |
| 4282 | 4282 | if (!preg_match('/\//', $rate))
|
| 4283 | - $ret = price($rate, 0, '', 0, 0) . ($addpercent ? '%' : ''); |
|
| 4283 | + $ret = price($rate, 0, '', 0, 0).($addpercent ? '%' : ''); |
|
| 4284 | 4284 | else {
|
| 4285 | 4285 | // TODO Split on / and output with a price2num to have clean numbers without ton of 000. |
| 4286 | - $ret = $rate . ($addpercent ? '%' : ''); |
|
| 4286 | + $ret = $rate.($addpercent ? '%' : ''); |
|
| 4287 | 4287 | } |
| 4288 | 4288 | if (($info_bits & 1) && $usestarfornpr >= 0) |
| 4289 | 4289 | $ret .= ' *'; |
@@ -4376,10 +4376,10 @@ discard block |
||
| 4376 | 4376 | $cursymbolbefore .= $outlangs->getCurrencySymbol($currency_code); |
| 4377 | 4377 | else {
|
| 4378 | 4378 | $tmpcur = $outlangs->getCurrencySymbol($currency_code); |
| 4379 | - $cursymbolafter .= ($tmpcur == $currency_code ? ' ' . $tmpcur : $tmpcur); |
|
| 4379 | + $cursymbolafter .= ($tmpcur == $currency_code ? ' '.$tmpcur : $tmpcur); |
|
| 4380 | 4380 | } |
| 4381 | 4381 | } |
| 4382 | - $output = $cursymbolbefore . $output . $end . ($cursymbolafter ? ' ' : '') . $cursymbolafter; |
|
| 4382 | + $output = $cursymbolbefore.$output.$end.($cursymbolafter ? ' ' : '').$cursymbolafter; |
|
| 4383 | 4383 | |
| 4384 | 4384 | return $output; |
| 4385 | 4385 | } |
@@ -4432,7 +4432,7 @@ discard block |
||
| 4432 | 4432 | // Now make replace (the main goal of function) |
| 4433 | 4433 | if ($thousand != ',' && $thousand != '.') |
| 4434 | 4434 | $amount = str_replace(',', '.', $amount); // To accept 2 notations for french users
|
| 4435 | - $amount = str_replace(' ', '', $amount); // To avoid spaces
|
|
| 4435 | + $amount = str_replace(' ', '', $amount); // To avoid spaces
|
|
| 4436 | 4436 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
| 4437 | 4437 | $amount = str_replace($dec, '.', $amount); |
| 4438 | 4438 | } |
@@ -4461,14 +4461,14 @@ discard block |
||
| 4461 | 4461 | $temps = sprintf("%0.10F", $amount - intval($amount)); // temps=0.0000000000 or 0.0000200000 or 9999.1000000000
|
| 4462 | 4462 | $temps = preg_replace('/([\.1-9])0+$/', '\\1', $temps); // temps=0. or 0.00002 or 9999.1
|
| 4463 | 4463 | $nbofdec = max(0, AlDolUtils::dol_strlen($temps) - 2); // -2 to remove "0." |
| 4464 | - $amount = number_format($amount, min($nbofdec, $nbofdectoround), $dec, $thousand); // Convert amount to format with dolibarr dec and thousand |
|
| 4464 | + $amount = number_format($amount, min($nbofdec, $nbofdectoround), $dec, $thousand); // Convert amount to format with dolibarr dec and thousand |
|
| 4465 | 4465 | } |
| 4466 | 4466 | //print "TT".$amount.'<br>'; |
| 4467 | 4467 | // Always make replace because each math static function (like round) replace |
| 4468 | 4468 | // with local values and we want a number that has a SQL string format x.y |
| 4469 | 4469 | if ($thousand != ',' && $thousand != '.') |
| 4470 | 4470 | $amount = str_replace(',', '.', $amount); // To accept 2 notations for french users
|
| 4471 | - $amount = str_replace(' ', '', $amount); // To avoid spaces
|
|
| 4471 | + $amount = str_replace(' ', '', $amount); // To avoid spaces
|
|
| 4472 | 4472 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
| 4473 | 4473 | $amount = str_replace($dec, '.', $amount); |
| 4474 | 4474 | } |
@@ -4489,7 +4489,7 @@ discard block |
||
| 4489 | 4489 | */ |
| 4490 | 4490 | static function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round = -1, $forceunitoutput = 'no') |
| 4491 | 4491 | {
|
| 4492 | - require_once DOL_BASE_PATH . '/core/lib/product.lib.php'; |
|
| 4492 | + require_once DOL_BASE_PATH.'/core/lib/product.lib.php'; |
|
| 4493 | 4493 | |
| 4494 | 4494 | if (($forceunitoutput == 'no' && $dimension < 1 / 10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6)) {
|
| 4495 | 4495 | $dimension = $dimension * 1000000; |
@@ -4505,7 +4505,7 @@ discard block |
||
| 4505 | 4505 | $unit = $unit + 3; |
| 4506 | 4506 | } |
| 4507 | 4507 | |
| 4508 | - $ret = price($dimension, 0, $outputlangs, 0, 0, $round) . ' ' . measuring_units_string($unit, $type); |
|
| 4508 | + $ret = price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type); |
|
| 4509 | 4509 | |
| 4510 | 4510 | return $ret; |
| 4511 | 4511 | } |
@@ -4529,7 +4529,7 @@ discard block |
||
| 4529 | 4529 | if (empty($thirdparty_seller) || !is_object($thirdparty_seller)) |
| 4530 | 4530 | $thirdparty_seller = $mysoc; |
| 4531 | 4531 | |
| 4532 | - AlDolUtils::dol_syslog("get_localtax tva=" . $vatrate . " local=" . $local . " thirdparty_buyer id=" . (is_object($thirdparty_buyer) ? $thirdparty_buyer->id : '') . "/country_code=" . (is_object($thirdparty_buyer) ? $thirdparty_buyer->country_code : '') . " thirdparty_seller id=" . $thirdparty_seller->id . "/country_code=" . $thirdparty_seller->country_code . " thirdparty_seller localtax1_assuj=" . $thirdparty_seller->localtax1_assuj . " thirdparty_seller localtax2_assuj=" . $thirdparty_seller->localtax2_assuj);
|
|
| 4532 | + AlDolUtils::dol_syslog("get_localtax tva=".$vatrate." local=".$local." thirdparty_buyer id=".(is_object($thirdparty_buyer) ? $thirdparty_buyer->id : '')."/country_code=".(is_object($thirdparty_buyer) ? $thirdparty_buyer->country_code : '')." thirdparty_seller id=".$thirdparty_seller->id."/country_code=".$thirdparty_seller->country_code." thirdparty_seller localtax1_assuj=".$thirdparty_seller->localtax1_assuj." thirdparty_seller localtax2_assuj=".$thirdparty_seller->localtax2_assuj);
|
|
| 4533 | 4533 | |
| 4534 | 4534 | $vatratecleaned = $vatrate; |
| 4535 | 4535 | if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) { // If vat is "xx (yy)"
|
@@ -4560,7 +4560,7 @@ discard block |
||
| 4560 | 4560 | if ($local == 2) {
|
| 4561 | 4561 | //if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0; |
| 4562 | 4562 | if (!$mysoc->localtax2_assuj) |
| 4563 | - return 0; // If main vat is 0, IRPF may be different than 0. |
|
| 4563 | + return 0; // If main vat is 0, IRPF may be different than 0. |
|
| 4564 | 4564 | if ($thirdparty_seller->id == $mysoc->id) {
|
| 4565 | 4565 | if (!$thirdparty_buyer->localtax2_assuj) |
| 4566 | 4566 | return 0; |
@@ -4614,13 +4614,13 @@ discard block |
||
| 4614 | 4614 | |
| 4615 | 4615 | // By default, search value of local tax on line of common tax |
| 4616 | 4616 | $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type"; |
| 4617 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c"; |
|
| 4618 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $thirdparty_seller->country_code . "'"; |
|
| 4619 | - $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
|
| 4617 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; |
|
| 4618 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$thirdparty_seller->country_code."'"; |
|
| 4619 | + $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; |
|
| 4620 | 4620 | if ($vatratecode) |
| 4621 | - $sql .= " AND t.code ='" . $vatratecode . "'"; // If we have the code, we use it in priority |
|
| 4621 | + $sql .= " AND t.code ='".$vatratecode."'"; // If we have the code, we use it in priority |
|
| 4622 | 4622 | else |
| 4623 | - $sql .= " AND t.recuperableonly ='" . $vatnpr . "'"; |
|
| 4623 | + $sql .= " AND t.recuperableonly ='".$vatnpr."'"; |
|
| 4624 | 4624 | AlDolUtils::dol_syslog("get_localtax", LOG_DEBUG);
|
| 4625 | 4625 | $resql = $db->query($sql); |
| 4626 | 4626 | |
@@ -4666,10 +4666,10 @@ discard block |
||
| 4666 | 4666 | {
|
| 4667 | 4667 | // global $db, $mysoc; |
| 4668 | 4668 | $sql = "SELECT t.localtax1, t.localtax2 "; |
| 4669 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t inner join " . MAIN_DB_PREFIX . "c_country as c ON c.rowid=t.fk_pays"; |
|
| 4670 | - $sql .= " WHERE c.code = '" . $mysoc->country_code . "' AND t.active = 1 AND t.taux=(";
|
|
| 4671 | - $sql .= " SELECT max(tt.taux) FROM " . MAIN_DB_PREFIX . "c_tva as tt inner join " . MAIN_DB_PREFIX . "c_country as c ON c.rowid=tt.fk_pays"; |
|
| 4672 | - $sql .= " WHERE c.code = '" . $mysoc->country_code . "' AND tt.active = 1"; |
|
| 4669 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=t.fk_pays"; |
|
| 4670 | + $sql .= " WHERE c.code = '".$mysoc->country_code."' AND t.active = 1 AND t.taux=(";
|
|
| 4671 | + $sql .= " SELECT max(tt.taux) FROM ".MAIN_DB_PREFIX."c_tva as tt inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=tt.fk_pays"; |
|
| 4672 | + $sql .= " WHERE c.code = '".$mysoc->country_code."' AND tt.active = 1"; |
|
| 4673 | 4673 | $sql .= " )"; |
| 4674 | 4674 | |
| 4675 | 4675 | $resql = $db->query($sql); |
@@ -4699,13 +4699,13 @@ discard block |
||
| 4699 | 4699 | {
|
| 4700 | 4700 | // global $db, $mysoc; |
| 4701 | 4701 | |
| 4702 | - AlDolUtils::dol_syslog("getTaxesFromId vat id or rate = " . $vatrate);
|
|
| 4702 | + AlDolUtils::dol_syslog("getTaxesFromId vat id or rate = ".$vatrate);
|
|
| 4703 | 4703 | |
| 4704 | 4704 | // Search local taxes |
| 4705 | 4705 | $sql = "SELECT t.rowid, t.code, t.taux as rate, t.recuperableonly as npr, t.accountancy_code_sell, t.accountancy_code_buy"; |
| 4706 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t"; |
|
| 4706 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t"; |
|
| 4707 | 4707 | if ($firstparamisid) |
| 4708 | - $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
| 4708 | + $sql .= " WHERE t.rowid = ".(int) $vatrate; |
|
| 4709 | 4709 | else {
|
| 4710 | 4710 | $vatratecleaned = $vatrate; |
| 4711 | 4711 | $vatratecode = ''; |
@@ -4714,13 +4714,13 @@ discard block |
||
| 4714 | 4714 | $vatratecode = $reg[2]; |
| 4715 | 4715 | } |
| 4716 | 4716 | |
| 4717 | - $sql .= ", " . MAIN_DB_PREFIX . "c_country as c"; |
|
| 4717 | + $sql .= ", ".MAIN_DB_PREFIX."c_country as c"; |
|
| 4718 | 4718 | /* if ($mysoc->country_code == 'ES') $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; // vat in spain use the buyer country ?? |
| 4719 | 4719 | else $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; */ |
| 4720 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'"; |
|
| 4721 | - $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
|
| 4720 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; |
|
| 4721 | + $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; |
|
| 4722 | 4722 | if ($vatratecode) |
| 4723 | - $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
| 4723 | + $sql .= " AND t.code = '".$vatratecode."'"; |
|
| 4724 | 4724 | } |
| 4725 | 4725 | |
| 4726 | 4726 | $resql = $db->query($sql); |
@@ -4756,13 +4756,13 @@ discard block |
||
| 4756 | 4756 | {
|
| 4757 | 4757 | // global $db, $mysoc; |
| 4758 | 4758 | |
| 4759 | - AlDolUtils::dol_syslog("getLocalTaxesFromRate vatrate=" . $vatrate . " local=" . $local);
|
|
| 4759 | + AlDolUtils::dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local);
|
|
| 4760 | 4760 | |
| 4761 | 4761 | // Search local taxes |
| 4762 | 4762 | $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; |
| 4763 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t"; |
|
| 4763 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t"; |
|
| 4764 | 4764 | if ($firstparamisid) |
| 4765 | - $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
| 4765 | + $sql .= " WHERE t.rowid = ".(int) $vatrate; |
|
| 4766 | 4766 | else {
|
| 4767 | 4767 | $vatratecleaned = $vatrate; |
| 4768 | 4768 | $vatratecode = ''; |
@@ -4771,14 +4771,14 @@ discard block |
||
| 4771 | 4771 | $vatratecode = $reg[2]; |
| 4772 | 4772 | } |
| 4773 | 4773 | |
| 4774 | - $sql .= ", " . MAIN_DB_PREFIX . "c_country as c"; |
|
| 4774 | + $sql .= ", ".MAIN_DB_PREFIX."c_country as c"; |
|
| 4775 | 4775 | if ($mysoc->country_code == 'ES') |
| 4776 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $buyer->country_code . "'"; // local tax in spain use the buyer country ?? |
|
| 4776 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; // local tax in spain use the buyer country ?? |
|
| 4777 | 4777 | else |
| 4778 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'"; |
|
| 4779 | - $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
|
| 4778 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; |
|
| 4779 | + $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1"; |
|
| 4780 | 4780 | if ($vatratecode) |
| 4781 | - $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
| 4781 | + $sql .= " AND t.code = '".$vatratecode."'"; |
|
| 4782 | 4782 | } |
| 4783 | 4783 | |
| 4784 | 4784 | $resql = $db->query($sql); |
@@ -4810,7 +4810,7 @@ discard block |
||
| 4810 | 4810 | {
|
| 4811 | 4811 | // global $db, Globals::$conf, $mysoc; |
| 4812 | 4812 | |
| 4813 | - require_once DOL_BASE_PATH . '/product/class/product.class.php'; |
|
| 4813 | + require_once DOL_BASE_PATH.'/product/class/product.class.php'; |
|
| 4814 | 4814 | |
| 4815 | 4815 | $ret = 0; |
| 4816 | 4816 | $found = 0; |
@@ -4825,12 +4825,12 @@ discard block |
||
| 4825 | 4825 | $product->get_buyprice($idprodfournprice, 0, 0, 0); |
| 4826 | 4826 | $ret = $product->vatrate_supplier; |
| 4827 | 4827 | if ($product->default_vat_code) |
| 4828 | - $ret .= ' (' . $product->default_vat_code . ')';
|
|
| 4828 | + $ret .= ' ('.$product->default_vat_code.')';
|
|
| 4829 | 4829 | } |
| 4830 | 4830 | else {
|
| 4831 | - $ret = $product->tva_tx; // Default vat of product we defined |
|
| 4831 | + $ret = $product->tva_tx; // Default vat of product we defined |
|
| 4832 | 4832 | if ($product->default_vat_code) |
| 4833 | - $ret .= ' (' . $product->default_vat_code . ')';
|
|
| 4833 | + $ret .= ' ('.$product->default_vat_code.')';
|
|
| 4834 | 4834 | } |
| 4835 | 4835 | $found = 1; |
| 4836 | 4836 | } |
@@ -4844,8 +4844,8 @@ discard block |
||
| 4844 | 4844 | if (empty(Globals::$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS)) {
|
| 4845 | 4845 | // If vat of product for the country not found or not defined, we return the first higher vat of country. |
| 4846 | 4846 | $sql = "SELECT t.taux as vat_rate, t.code as default_vat_code"; |
| 4847 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c"; |
|
| 4848 | - $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='" . $thirdparty_seller->country_code . "'"; |
|
| 4847 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; |
|
| 4848 | + $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'"; |
|
| 4849 | 4849 | $sql .= " ORDER BY t.taux DESC, t.code ASC, t.recuperableonly ASC"; |
| 4850 | 4850 | $sql .= $db->plimit(1); |
| 4851 | 4851 | |
@@ -4855,16 +4855,16 @@ discard block |
||
| 4855 | 4855 | if ($obj) {
|
| 4856 | 4856 | $ret = $obj->vat_rate; |
| 4857 | 4857 | if ($obj->default_vat_code) |
| 4858 | - $ret .= ' (' . $obj->default_vat_code . ')';
|
|
| 4858 | + $ret .= ' ('.$obj->default_vat_code.')';
|
|
| 4859 | 4859 | } |
| 4860 | 4860 | $db->free($sql); |
| 4861 | 4861 | } else |
| 4862 | 4862 | dol_print_error($db); |
| 4863 | 4863 | } else |
| 4864 | - $ret = Globals::$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; // Forced value if autodetect fails |
|
| 4864 | + $ret = Globals::$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; // Forced value if autodetect fails |
|
| 4865 | 4865 | } |
| 4866 | 4866 | |
| 4867 | - AlDolUtils::dol_syslog("get_product_vat_for_country: ret=" . $ret);
|
|
| 4867 | + AlDolUtils::dol_syslog("get_product_vat_for_country: ret=".$ret);
|
|
| 4868 | 4868 | return $ret; |
| 4869 | 4869 | } |
| 4870 | 4870 | |
@@ -4882,7 +4882,7 @@ discard block |
||
| 4882 | 4882 | // global $db, $mysoc; |
| 4883 | 4883 | |
| 4884 | 4884 | if (!class_exists('Product')) {
|
| 4885 | - require_once DOL_BASE_PATH . 'product/class/product.class.php'; |
|
| 4885 | + require_once DOL_BASE_PATH.'product/class/product.class.php'; |
|
| 4886 | 4886 | } |
| 4887 | 4887 | |
| 4888 | 4888 | $ret = 0; |
@@ -4907,8 +4907,8 @@ discard block |
||
| 4907 | 4907 | if (!$found) {
|
| 4908 | 4908 | // If vat of product for the country not found or not defined, we return higher vat of country. |
| 4909 | 4909 | $sql = "SELECT taux as vat_rate, localtax1, localtax2"; |
| 4910 | - $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c"; |
|
| 4911 | - $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='" . $thirdparty_seller->country_code . "'"; |
|
| 4910 | + $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c"; |
|
| 4911 | + $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'"; |
|
| 4912 | 4912 | $sql .= " ORDER BY t.taux DESC, t.recuperableonly ASC"; |
| 4913 | 4913 | $sql .= $db->plimit(1); |
| 4914 | 4914 | |
@@ -4925,7 +4925,7 @@ discard block |
||
| 4925 | 4925 | dol_print_error($db); |
| 4926 | 4926 | } |
| 4927 | 4927 | |
| 4928 | - AlDolUtils::dol_syslog("get_product_localtax_for_country: ret=" . $ret);
|
|
| 4928 | + AlDolUtils::dol_syslog("get_product_localtax_for_country: ret=".$ret);
|
|
| 4929 | 4929 | return $ret; |
| 4930 | 4930 | } |
| 4931 | 4931 | |
@@ -4949,7 +4949,7 @@ discard block |
||
| 4949 | 4949 | {
|
| 4950 | 4950 | // global Globals::$conf; |
| 4951 | 4951 | |
| 4952 | - require_once DOL_BASE_PATH . '/core/lib/company.lib.php'; |
|
| 4952 | + require_once DOL_BASE_PATH.'/core/lib/company.lib.php'; |
|
| 4953 | 4953 | |
| 4954 | 4954 | // Note: possible values for tva_assuj are 0/1 or franchise/reel |
| 4955 | 4955 | $seller_use_vat = ((is_numeric($thirdparty_seller->tva_assuj) && !$thirdparty_seller->tva_assuj) || (!is_numeric($thirdparty_seller->tva_assuj) && $thirdparty_seller->tva_assuj == 'franchise')) ? 0 : 1; |
@@ -4960,7 +4960,7 @@ discard block |
||
| 4960 | 4960 | $buyer_country_code = $thirdparty_buyer->country_code; |
| 4961 | 4961 | $buyer_in_cee = isInEEC($thirdparty_buyer); |
| 4962 | 4962 | |
| 4963 | - AlDolUtils::dol_syslog("get_default_tva: seller use vat=" . $seller_use_vat . ", seller country=" . $seller_country_code . ", seller in cee=" . $seller_in_cee . ", buyer vat number=" . $thirdparty_buyer->tva_intra . " buyer country=" . $buyer_country_code . ", buyer in cee=" . $buyer_in_cee . ", idprod=" . $idprod . ", idprodfournprice=" . $idprodfournprice . ", SERVICE_ARE_ECOMMERCE_200238EC=" . (!empty(Globals::$conf->global->SERVICES_ARE_ECOMMERCE_200238EC) ? Globals::$conf->global->SERVICES_ARE_ECOMMERCE_200238EC : ''));
|
|
| 4963 | + AlDolUtils::dol_syslog("get_default_tva: seller use vat=".$seller_use_vat.", seller country=".$seller_country_code.", seller in cee=".$seller_in_cee.", buyer vat number=".$thirdparty_buyer->tva_intra." buyer country=".$buyer_country_code.", buyer in cee=".$buyer_in_cee.", idprod=".$idprod.", idprodfournprice=".$idprodfournprice.", SERVICE_ARE_ECOMMERCE_200238EC=".(!empty(Globals::$conf->global->SERVICES_ARE_ECOMMERCE_200238EC) ? Globals::$conf->global->SERVICES_ARE_ECOMMERCE_200238EC : ''));
|
|
| 4964 | 4964 | |
| 4965 | 4965 | // If services are eServices according to EU Council Directive 2002/38/EC (http://ec.europa.eu/taxation_customs/taxation/vat/traders/e-commerce/article_1610_en.htm) |
| 4966 | 4966 | // we use the buyer VAT. |
@@ -5026,14 +5026,14 @@ discard block |
||
| 5026 | 5026 | |
| 5027 | 5027 | if ($idprodfournprice > 0) {
|
| 5028 | 5028 | if (!class_exists('ProductFournisseur'))
|
| 5029 | - require_once DOL_BASE_PATH . '/fourn/class/fournisseur.product.class.php'; |
|
| 5029 | + require_once DOL_BASE_PATH.'/fourn/class/fournisseur.product.class.php'; |
|
| 5030 | 5030 | $prodprice = new ProductFournisseur($db); |
| 5031 | 5031 | $prodprice->fetch_product_fournisseur_price($idprodfournprice); |
| 5032 | 5032 | return $prodprice->fourn_tva_npr; |
| 5033 | 5033 | } |
| 5034 | 5034 | elseif ($idprod > 0) {
|
| 5035 | 5035 | if (!class_exists('Product'))
|
| 5036 | - require_once DOL_BASE_PATH . 'product/class/product.class.php'; |
|
| 5036 | + require_once DOL_BASE_PATH.'product/class/product.class.php'; |
|
| 5037 | 5037 | $prod = new Product($db); |
| 5038 | 5038 | $prod->fetch($idprod); |
| 5039 | 5039 | return $prod->tva_npr; |
@@ -5112,7 +5112,7 @@ discard block |
||
| 5112 | 5112 | if ($case == 2) |
| 5113 | 5113 | $result = '<input type="checkbox" value="1" checked disabled>'; |
| 5114 | 5114 | if ($case == 3) |
| 5115 | - $result = '<input type="checkbox" value="1" checked disabled> ' . $result; |
|
| 5115 | + $result = '<input type="checkbox" value="1" checked disabled> '.$result; |
|
| 5116 | 5116 | |
| 5117 | 5117 | $classname = 'ok'; |
| 5118 | 5118 | } |
@@ -5123,7 +5123,7 @@ discard block |
||
| 5123 | 5123 | if ($case == 2) |
| 5124 | 5124 | $result = '<input type="checkbox" value="0" disabled>'; |
| 5125 | 5125 | if ($case == 3) |
| 5126 | - $result = '<input type="checkbox" value="0" disabled> ' . $result; |
|
| 5126 | + $result = '<input type="checkbox" value="0" disabled> '.$result; |
|
| 5127 | 5127 | |
| 5128 | 5128 | if ($color == 2) |
| 5129 | 5129 | $classname = 'ok'; |
@@ -5131,7 +5131,7 @@ discard block |
||
| 5131 | 5131 | $classname = 'error'; |
| 5132 | 5132 | } |
| 5133 | 5133 | if ($color) |
| 5134 | - return '<font class="' . $classname . '">' . $result . '</font>'; |
|
| 5134 | + return '<font class="'.$classname.'">'.$result.'</font>'; |
|
| 5135 | 5135 | return $result; |
| 5136 | 5136 | } |
| 5137 | 5137 | |
@@ -5165,13 +5165,13 @@ discard block |
||
| 5165 | 5165 | $num = preg_replace('/([^0-9])/i', '', $num);
|
| 5166 | 5166 | else |
| 5167 | 5167 | $num = preg_replace('/^.*\-/i', '', $num);
|
| 5168 | - $num = substr("000" . $num, -$level);
|
|
| 5168 | + $num = substr("000".$num, -$level);
|
|
| 5169 | 5169 | if ($level == 1) |
| 5170 | 5170 | $path = substr($num, 0, 1); |
| 5171 | 5171 | if ($level == 2) |
| 5172 | - $path = substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
| 5172 | + $path = substr($num, 1, 1).'/'.substr($num, 0, 1); |
|
| 5173 | 5173 | if ($level == 3) |
| 5174 | - $path = substr($num, 2, 1) . '/' . substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
| 5174 | + $path = substr($num, 2, 1).'/'.substr($num, 1, 1).'/'.substr($num, 0, 1); |
|
| 5175 | 5175 | } |
| 5176 | 5176 | else {
|
| 5177 | 5177 | // TODO |
@@ -5202,7 +5202,7 @@ discard block |
||
| 5202 | 5202 | {
|
| 5203 | 5203 | // global Globals::$conf; |
| 5204 | 5204 | |
| 5205 | - AlDolUtils::dol_syslog("functions.lib::dol_mkdir: dir=" . $dir, LOG_INFO);
|
|
| 5205 | + AlDolUtils::dol_syslog("functions.lib::dol_mkdir: dir=".$dir, LOG_INFO);
|
|
| 5206 | 5206 | |
| 5207 | 5207 | $dir_osencoded = dol_osencode($dir); |
| 5208 | 5208 | if (@is_dir($dir_osencoded)) |
@@ -5214,15 +5214,15 @@ discard block |
||
| 5214 | 5214 | $ccdir = ''; |
| 5215 | 5215 | if (!empty($dataroot)) {
|
| 5216 | 5216 | // Remove data root from loop |
| 5217 | - $dir = str_replace($dataroot . '/', '', $dir); |
|
| 5218 | - $ccdir = $dataroot . '/'; |
|
| 5217 | + $dir = str_replace($dataroot.'/', '', $dir); |
|
| 5218 | + $ccdir = $dataroot.'/'; |
|
| 5219 | 5219 | } |
| 5220 | 5220 | |
| 5221 | 5221 | $cdir = explode("/", $dir);
|
| 5222 | 5222 | $num = count($cdir); |
| 5223 | 5223 | for ($i = 0; $i < $num; $i++) {
|
| 5224 | 5224 | if ($i > 0) |
| 5225 | - $ccdir .= '/' . $cdir[$i]; |
|
| 5225 | + $ccdir .= '/'.$cdir[$i]; |
|
| 5226 | 5226 | else |
| 5227 | 5227 | $ccdir .= $cdir[$i]; |
| 5228 | 5228 | if (preg_match("/^.:$/", $ccdir, $regs))
|
@@ -5285,20 +5285,20 @@ discard block |
||
| 5285 | 5285 | if ($ccdir) {
|
| 5286 | 5286 | $ccdir_osencoded = dol_osencode($ccdir); |
| 5287 | 5287 | if (!@is_dir($ccdir_osencoded)) {
|
| 5288 | - AlDolUtils::dol_syslog("functions.lib::dol_mkdir: Directory '" . $ccdir . "' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG);
|
|
| 5288 | + AlDolUtils::dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG);
|
|
| 5289 | 5289 | |
| 5290 | 5290 | umask(0); |
| 5291 | 5291 | $dirmaskdec = octdec($newmask); |
| 5292 | 5292 | if (empty($newmask)) {
|
| 5293 | 5293 | $dirmaskdec = empty(Globals::$conf->global->MAIN_UMASK) ? octdec('0755') : octdec(Globals::$conf->global->MAIN_UMASK);
|
| 5294 | 5294 | } |
| 5295 | - $dirmaskdec |= octdec('0111'); // Set x bit required for directories
|
|
| 5295 | + $dirmaskdec |= octdec('0111'); // Set x bit required for directories
|
|
| 5296 | 5296 | if (!@mkdir($ccdir_osencoded, $dirmaskdec)) {
|
| 5297 | 5297 | // Si le is_dir a renvoye une fausse info, alors on passe ici. |
| 5298 | - AlDolUtils::dol_syslog("functions.lib::dol_mkdir: Fails to create directory '" . $ccdir . "' or directory already exists.", LOG_WARNING);
|
|
| 5298 | + AlDolUtils::dol_syslog("functions.lib::dol_mkdir: Fails to create directory '".$ccdir."' or directory already exists.", LOG_WARNING);
|
|
| 5299 | 5299 | $nberr++; |
| 5300 | 5300 | } else {
|
| 5301 | - AlDolUtils::dol_syslog("functions.lib::dol_mkdir: Directory '" . $ccdir . "' created", LOG_DEBUG);
|
|
| 5301 | + AlDolUtils::dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' created", LOG_DEBUG);
|
|
| 5302 | 5302 | $nberr = 0; // On remet a zero car si on arrive ici, cela veut dire que les echecs precedents peuvent etre ignore |
| 5303 | 5303 | $nbcreated++; |
| 5304 | 5304 | } |
@@ -5346,9 +5346,9 @@ discard block |
||
| 5346 | 5346 | } else {
|
| 5347 | 5347 | $pattern = "/<[^<>]+>/"; |
| 5348 | 5348 | // Exemple of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a> |
| 5349 | - $temp = preg_replace($pattern, "", $temp); // pass 1 |
|
| 5349 | + $temp = preg_replace($pattern, "", $temp); // pass 1 |
|
| 5350 | 5350 | // $temp after pass 1: <a href="/myurl" title="A title">0000-021 |
| 5351 | - $temp = preg_replace($pattern, "", $temp); // pass 2 |
|
| 5351 | + $temp = preg_replace($pattern, "", $temp); // pass 2 |
|
| 5352 | 5352 | // $temp after pass 2: 0000-021 |
| 5353 | 5353 | } |
| 5354 | 5354 | |
@@ -5404,8 +5404,8 @@ discard block |
||
| 5404 | 5404 | {
|
| 5405 | 5405 | $temp = $stringtoclean; |
| 5406 | 5406 | foreach ($disallowed_tags as $tagtoremove) {
|
| 5407 | - $temp = preg_replace('/<\/?' . $tagtoremove . '>/', '', $temp);
|
|
| 5408 | - $temp = preg_replace('/<\/?' . $tagtoremove . '\s+[^>]*>/', '', $temp);
|
|
| 5407 | + $temp = preg_replace('/<\/?'.$tagtoremove.'>/', '', $temp);
|
|
| 5408 | + $temp = preg_replace('/<\/?'.$tagtoremove.'\s+[^>]*>/', '', $temp);
|
|
| 5409 | 5409 | } |
| 5410 | 5410 | return $temp; |
| 5411 | 5411 | } |
@@ -5422,12 +5422,12 @@ discard block |
||
| 5422 | 5422 | {
|
| 5423 | 5423 | if ($nboflines == 1) {
|
| 5424 | 5424 | if (AlDolUtils::dol_textishtml($text)) {
|
| 5425 | - $firstline = preg_replace('/<br[^>]*>.*$/s', '', $text); // The s pattern modifier means the . can match newline characters
|
|
| 5425 | + $firstline = preg_replace('/<br[^>]*>.*$/s', '', $text); // The s pattern modifier means the . can match newline characters
|
|
| 5426 | 5426 | $firstline = preg_replace('/<div[^>]*>.*$/s', '', $firstline); // The s pattern modifier means the . can match newline characters
|
| 5427 | 5427 | } else {
|
| 5428 | 5428 | $firstline = preg_replace('/[\n\r].*/', '', $text);
|
| 5429 | 5429 | } |
| 5430 | - return $firstline . ((strlen($firstline) != strlen($text)) ? '...' : ''); |
|
| 5430 | + return $firstline.((strlen($firstline) != strlen($text)) ? '...' : ''); |
|
| 5431 | 5431 | } else {
|
| 5432 | 5432 | $ishtml = 0; |
| 5433 | 5433 | if (AlDolUtils::dol_textishtml($text)) {
|
@@ -5443,7 +5443,7 @@ discard block |
||
| 5443 | 5443 | $pattern = '/(<br[^>]*>)/Uu'; |
| 5444 | 5444 | } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support |
| 5445 | 5445 | else |
| 5446 | - $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
| 5446 | + $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
| 5447 | 5447 | $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
| 5448 | 5448 | |
| 5449 | 5449 | $firstline = ''; |
@@ -5457,7 +5457,7 @@ discard block |
||
| 5457 | 5457 | $i++; |
| 5458 | 5458 | } |
| 5459 | 5459 | unset($a); |
| 5460 | - return $firstline . (($i < $nba) ? '...' : ''); |
|
| 5460 | + return $firstline.(($i < $nba) ? '...' : ''); |
|
| 5461 | 5461 | } |
| 5462 | 5462 | } |
| 5463 | 5463 | |
@@ -5528,9 +5528,9 @@ discard block |
||
| 5528 | 5528 | static function dol_htmlentitiesbr_decode($stringtodecode, $pagecodeto = 'UTF-8') |
| 5529 | 5529 | {
|
| 5530 | 5530 | $ret = dol_html_entity_decode($stringtodecode, ENT_COMPAT, $pagecodeto); |
| 5531 | - $ret = preg_replace('/' . "\r\n" . '<br(\s[\sa-zA-Z_="]*)?\/?>/i', "<br>", $ret);
|
|
| 5532 | - $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>' . "\r\n" . '/i', "\r\n", $ret);
|
|
| 5533 | - $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>' . "\n" . '/i', "\n", $ret);
|
|
| 5531 | + $ret = preg_replace('/'."\r\n".'<br(\s[\sa-zA-Z_="]*)?\/?>/i', "<br>", $ret);
|
|
| 5532 | + $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>'."\r\n".'/i', "\r\n", $ret);
|
|
| 5533 | + $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>'."\n".'/i', "\n", $ret);
|
|
| 5534 | 5534 | $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', "\n", $ret);
|
| 5535 | 5535 | return $ret; |
| 5536 | 5536 | } |
@@ -5543,7 +5543,7 @@ discard block |
||
| 5543 | 5543 | */ |
| 5544 | 5544 | static function dol_htmlcleanlastbr($stringtodecode) |
| 5545 | 5545 | {
|
| 5546 | - $ret = preg_replace('/(<br>|<br(\s[\sa-zA-Z_="]*)?\/?>|' . "\n" . '|' . "\r" . ')+$/i', "", $stringtodecode);
|
|
| 5546 | + $ret = preg_replace('/(<br>|<br(\s[\sa-zA-Z_="]*)?\/?>|'."\n".'|'."\r".')+$/i', "", $stringtodecode);
|
|
| 5547 | 5547 | return $ret; |
| 5548 | 5548 | } |
| 5549 | 5549 | |
@@ -5640,7 +5640,7 @@ discard block |
||
| 5640 | 5640 | $pattern = '/(<br[^>]*>)/Uu'; |
| 5641 | 5641 | } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support |
| 5642 | 5642 | else |
| 5643 | - $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
| 5643 | + $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
| 5644 | 5644 | $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
| 5645 | 5645 | |
| 5646 | 5646 | $nblines = (int) floor((count($a) + 1) / 2); |
@@ -5671,7 +5671,7 @@ discard block |
||
| 5671 | 5671 | */ |
| 5672 | 5672 | static function dol_microtime_float() |
| 5673 | 5673 | {
|
| 5674 | - AlDolUtils::dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); |
|
| 5674 | + AlDolUtils::dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING); |
|
| 5675 | 5675 | |
| 5676 | 5676 | return microtime(true); |
| 5677 | 5677 | } |
@@ -5717,9 +5717,9 @@ discard block |
||
| 5717 | 5717 | elseif (preg_match('/<h[0-9]>/i', $msg))
|
| 5718 | 5718 | return true; |
| 5719 | 5719 | elseif (preg_match('/&[A-Z0-9]{1,6};/i', $msg))
|
| 5720 | - return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) |
|
| 5720 | + return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) |
|
| 5721 | 5721 | elseif (preg_match('/&#[0-9]{2,3};/i', $msg))
|
| 5722 | - return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) |
|
| 5722 | + return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) |
|
| 5723 | 5723 | |
| 5724 | 5724 | return false; |
| 5725 | 5725 | } |
@@ -5944,7 +5944,7 @@ discard block |
||
| 5944 | 5944 | if ($object->fetch_optionals() > 0) {
|
| 5945 | 5945 | if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
|
| 5946 | 5946 | foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) {
|
| 5947 | - $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key]; |
|
| 5947 | + $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = $object->array_options['options_'.$key]; |
|
| 5948 | 5948 | } |
| 5949 | 5949 | } |
| 5950 | 5950 | } |
@@ -5956,7 +5956,7 @@ discard block |
||
| 5956 | 5956 | $paymenturl = ''; |
| 5957 | 5957 | } else {
|
| 5958 | 5958 | // Set the online payment url link into __ONLINE_PAYMENT_URL__ key |
| 5959 | - require_once DOL_BASE_PATH . '/core/lib/payments.lib.php'; |
|
| 5959 | + require_once DOL_BASE_PATH.'/core/lib/payments.lib.php'; |
|
| 5960 | 5960 | $outputlangs->loadLangs(array('paypal', 'other'));
|
| 5961 | 5961 | $typeforonlinepayment = 'free'; |
| 5962 | 5962 | if (is_object($object) && $object->element == 'commande') |
@@ -6017,7 +6017,7 @@ discard block |
||
| 6017 | 6017 | |
| 6018 | 6018 | //var_dump($substitutionarray['__AMOUNT_FORMATED__']); |
| 6019 | 6019 | if (empty($exclude) || !in_array('date', $exclude)) {
|
| 6020 | - include_once DOL_BASE_PATH . '/core/lib/date.lib.php'; |
|
| 6020 | + include_once DOL_BASE_PATH.'/core/lib/date.lib.php'; |
|
| 6021 | 6021 | |
| 6022 | 6022 | $tmp = dol_getdate(dol_now(), true); |
| 6023 | 6023 | $tmp2 = dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']); |
@@ -6027,13 +6027,13 @@ discard block |
||
| 6027 | 6027 | |
| 6028 | 6028 | $substitutionarray = array_merge($substitutionarray, array( |
| 6029 | 6029 | '__DAY__' => (string) $tmp['mday'], |
| 6030 | - '__DAY_TEXT__' => $outputlangs->trans('Day' . $tmp['wday']), // Monday
|
|
| 6031 | - '__DAY_TEXT_SHORT__' => $outputlangs->trans($tmp['weekday'] . 'Min'), // Mon |
|
| 6032 | - '__DAY_TEXT_MIN__' => $outputlangs->trans('Short' . $tmp['weekday']), // M
|
|
| 6030 | + '__DAY_TEXT__' => $outputlangs->trans('Day'.$tmp['wday']), // Monday
|
|
| 6031 | + '__DAY_TEXT_SHORT__' => $outputlangs->trans($tmp['weekday'].'Min'), // Mon |
|
| 6032 | + '__DAY_TEXT_MIN__' => $outputlangs->trans('Short'.$tmp['weekday']), // M
|
|
| 6033 | 6033 | '__MONTH__' => (string) $tmp['mon'], |
| 6034 | - '__MONTH_TEXT__' => $outputlangs->trans('Month' . sprintf("%02d", $tmp['mon'])),
|
|
| 6035 | - '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort' . sprintf("%02d", $tmp['mon'])),
|
|
| 6036 | - '__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort' . sprintf("%02d", $tmp['mon'])),
|
|
| 6034 | + '__MONTH_TEXT__' => $outputlangs->trans('Month'.sprintf("%02d", $tmp['mon'])),
|
|
| 6035 | + '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort'.sprintf("%02d", $tmp['mon'])),
|
|
| 6036 | + '__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort'.sprintf("%02d", $tmp['mon'])),
|
|
| 6037 | 6037 | '__YEAR__' => (string) $tmp['year'], |
| 6038 | 6038 | '__PREVIOUS_DAY__' => (string) $tmp2['day'], |
| 6039 | 6039 | '__PREVIOUS_MONTH__' => (string) $tmp3['month'], |
@@ -6092,7 +6092,7 @@ discard block |
||
| 6092 | 6092 | if (!empty($tmp[1])) |
| 6093 | 6093 | $outputlangs->load($tmp[1]); |
| 6094 | 6094 | |
| 6095 | - $text = preg_replace('/__\(' . preg_quote($reg[1], '/') . '\)__/', $msgishtml ? AlDolUtils::dol_htmlentitiesbr($outputlangs->transnoentitiesnoconv($reg[1])) : $outputlangs->transnoentitiesnoconv($reg[1]), $text);
|
|
| 6095 | + $text = preg_replace('/__\('.preg_quote($reg[1], '/').'\)__/', $msgishtml ? AlDolUtils::dol_htmlentitiesbr($outputlangs->transnoentitiesnoconv($reg[1])) : $outputlangs->transnoentitiesnoconv($reg[1]), $text);
|
|
| 6096 | 6096 | } |
| 6097 | 6097 | } |
| 6098 | 6098 | |
@@ -6108,13 +6108,13 @@ discard block |
||
| 6108 | 6108 | $newval = '*****forbidden*****'; |
| 6109 | 6109 | else |
| 6110 | 6110 | $newval = empty(Globals::$conf->global->$keyfound) ? '' : Globals::$conf->global->$keyfound; |
| 6111 | - $text = preg_replace('/__\[' . preg_quote($keyfound, '/') . '\]__/', $msgishtml ? AlDolUtils::dol_htmlentitiesbr($newval) : $newval, $text);
|
|
| 6111 | + $text = preg_replace('/__\['.preg_quote($keyfound, '/').'\]__/', $msgishtml ? AlDolUtils::dol_htmlentitiesbr($newval) : $newval, $text);
|
|
| 6112 | 6112 | } |
| 6113 | 6113 | |
| 6114 | 6114 | // Make substitition for array $substitutionarray |
| 6115 | 6115 | foreach ($substitutionarray as $key => $value) {
|
| 6116 | 6116 | if ($key == '__SIGNATURE__' && (!empty(Globals::$conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) |
| 6117 | - $value = ''; // Protection |
|
| 6117 | + $value = ''; // Protection |
|
| 6118 | 6118 | if ($key == '__USER_SIGNATURE__' && (!empty(Globals::$conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) |
| 6119 | 6119 | $value = ''; // Protection |
| 6120 | 6120 | |
@@ -6140,7 +6140,7 @@ discard block |
||
| 6140 | 6140 | {
|
| 6141 | 6141 | // global Globals::$conf, $user; |
| 6142 | 6142 | |
| 6143 | - require_once DOL_BASE_PATH . '/core/lib/files.lib.php'; |
|
| 6143 | + require_once DOL_BASE_PATH.'/core/lib/files.lib.php'; |
|
| 6144 | 6144 | |
| 6145 | 6145 | // Add a substitution key for each extrafields, using key __EXTRA_XXX__ |
| 6146 | 6146 | // TODO Remove this. Already available into the getCommonSubstitutionArray used to build the substitution array. |
@@ -6170,11 +6170,11 @@ discard block |
||
| 6170 | 6170 | if (preg_match('/functions_(.*)\.lib\.php/i', $substitfile['name'], $reg)) {
|
| 6171 | 6171 | $module = $reg[1]; |
| 6172 | 6172 | |
| 6173 | - AlDolUtils::dol_syslog("Library " . $substitfile['name'] . " found into " . $dir);
|
|
| 6173 | + AlDolUtils::dol_syslog("Library ".$substitfile['name']." found into ".$dir);
|
|
| 6174 | 6174 | // Include the user's functions file |
| 6175 | - require_once $dir . $substitfile['name']; |
|
| 6175 | + require_once $dir.$substitfile['name']; |
|
| 6176 | 6176 | // Call the user's function, and only if it is defined |
| 6177 | - $function_name = $module . "_" . $callfunc; |
|
| 6177 | + $function_name = $module."_".$callfunc; |
|
| 6178 | 6178 | if (function_exists($function_name)) |
| 6179 | 6179 | $function_name($substitutionarray, $outputlangs, $object, $parameters); |
| 6180 | 6180 | } |
@@ -6216,13 +6216,13 @@ discard block |
||
| 6216 | 6216 | $outputlangs = Globals::$langs; |
| 6217 | 6217 | |
| 6218 | 6218 | if ($date_start && $date_end) {
|
| 6219 | - $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateFromTo', AlDolUtils::dol_print_date($date_start, $format, false, $outputlangs), AlDolUtils::dol_print_date($date_end, $format, false, $outputlangs)) . ($withparenthesis ? ')' : '');
|
|
| 6219 | + $out .= ($withparenthesis ? ' (' : '').$outputlangs->transnoentitiesnoconv('DateFromTo', AlDolUtils::dol_print_date($date_start, $format, false, $outputlangs), AlDolUtils::dol_print_date($date_end, $format, false, $outputlangs)).($withparenthesis ? ')' : '');
|
|
| 6220 | 6220 | } |
| 6221 | 6221 | if ($date_start && !$date_end) {
|
| 6222 | - $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateFrom', AlDolUtils::dol_print_date($date_start, $format, false, $outputlangs)) . ($withparenthesis ? ')' : '');
|
|
| 6222 | + $out .= ($withparenthesis ? ' (' : '').$outputlangs->transnoentitiesnoconv('DateFrom', AlDolUtils::dol_print_date($date_start, $format, false, $outputlangs)).($withparenthesis ? ')' : '');
|
|
| 6223 | 6223 | } |
| 6224 | 6224 | if (!$date_start && $date_end) {
|
| 6225 | - $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateUntil', AlDolUtils::dol_print_date($date_end, $format, false, $outputlangs)) . ($withparenthesis ? ')' : '');
|
|
| 6225 | + $out .= ($withparenthesis ? ' (' : '').$outputlangs->transnoentitiesnoconv('DateUntil', AlDolUtils::dol_print_date($date_end, $format, false, $outputlangs)).($withparenthesis ? ')' : '');
|
|
| 6226 | 6226 | } |
| 6227 | 6227 | |
| 6228 | 6228 | return $out; |
@@ -6302,7 +6302,7 @@ discard block |
||
| 6302 | 6302 | AlDolUtils::dol_syslog("Try to add a message in stack with empty message", LOG_WARNING);
|
| 6303 | 6303 | } else {
|
| 6304 | 6304 | if (!in_array((string) $style, array('mesgs', 'warnings', 'errors')))
|
| 6305 | - dol_print_error('', 'Bad parameter style=' . $style . ' for setEventMessages');
|
|
| 6305 | + dol_print_error('', 'Bad parameter style='.$style.' for setEventMessages');
|
|
| 6306 | 6306 | if (empty($mesgs)) |
| 6307 | 6307 | setEventMessage($mesg, $style); |
| 6308 | 6308 | else {
|
@@ -6371,7 +6371,7 @@ discard block |
||
| 6371 | 6371 | |
| 6372 | 6372 | // If inline message with no format, we add it. |
| 6373 | 6373 | if ((empty(Globals::$conf->use_javascript_ajax) || !empty(Globals::$conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) || $keepembedded) && !preg_match('/<div class=".*">/i', $out)) {
|
| 6374 | - $divstart = '<div class="' . $style . ' clearboth">'; |
|
| 6374 | + $divstart = '<div class="'.$style.' clearboth">'; |
|
| 6375 | 6375 | $divend = '</div>'; |
| 6376 | 6376 | } |
| 6377 | 6377 | |
@@ -6398,14 +6398,14 @@ discard block |
||
| 6398 | 6398 | if (!empty(Globals::$conf->use_javascript_ajax) && empty(Globals::$conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded)) {
|
| 6399 | 6399 | $return = '<script type="text/javascript"> |
| 6400 | 6400 | $(document).ready(function() {
|
| 6401 | - var block = ' . (!empty(Globals::$conf->global->MAIN_USE_JQUERY_BLOCKUI) ? "true" : "false") . ' |
|
| 6401 | + var block = ' . (!empty(Globals::$conf->global->MAIN_USE_JQUERY_BLOCKUI) ? "true" : "false").' |
|
| 6402 | 6402 | if (block) {
|
| 6403 | - $.dolEventValid("","' . dol_escape_js($out) . '");
|
|
| 6403 | + $.dolEventValid("","' . dol_escape_js($out).'");
|
|
| 6404 | 6404 | } else {
|
| 6405 | 6405 | /* jnotify(message, preset of message type, keepmessage) */ |
| 6406 | - $.jnotify("' . dol_escape_js($out) . '",
|
|
| 6407 | - "' . ($style == "ok" ? 3000 : $style) . '", |
|
| 6408 | - ' . ($style == "ok" ? "false" : "true") . ', |
|
| 6406 | + $.jnotify("' . dol_escape_js($out).'",
|
|
| 6407 | + "' . ($style == "ok" ? 3000 : $style).'", |
|
| 6408 | + ' . ($style == "ok" ? "false" : "true").', |
|
| 6409 | 6409 | { remove: static function (){} } );
|
| 6410 | 6410 | } |
| 6411 | 6411 | }); |
@@ -6600,11 +6600,11 @@ discard block |
||
| 6600 | 6600 | {
|
| 6601 | 6601 | // global Globals::$conf; |
| 6602 | 6602 | |
| 6603 | - $tmp = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
|
|
| 6603 | + $tmp = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
|
|
| 6604 | 6604 | if (empty($tmp) && !empty($_SERVER["WINDIR"])) |
| 6605 | 6605 | $tmp = 'iso-8859-1'; // By default for windows |
| 6606 | 6606 | if (empty($tmp)) |
| 6607 | - $tmp = 'utf-8'; // By default for other |
|
| 6607 | + $tmp = 'utf-8'; // By default for other |
|
| 6608 | 6608 | if (!empty(Globals::$conf->global->MAIN_FILESYSTEM_ENCODING)) |
| 6609 | 6609 | $tmp = Globals::$conf->global->MAIN_FILESYSTEM_ENCODING; |
| 6610 | 6610 | |
@@ -6635,16 +6635,16 @@ discard block |
||
| 6635 | 6635 | |
| 6636 | 6636 | // Check in cache |
| 6637 | 6637 | if (isset($cache_codes[$tablename][$key][$fieldid])) { // Can be defined to 0 or ''
|
| 6638 | - return $cache_codes[$tablename][$key][$fieldid]; // Found in cache |
|
| 6638 | + return $cache_codes[$tablename][$key][$fieldid]; // Found in cache |
|
| 6639 | 6639 | } |
| 6640 | 6640 | |
| 6641 | 6641 | AlDolUtils::dol_syslog('dol_getIdFromCode (value not found into cache)', LOG_DEBUG);
|
| 6642 | 6642 | |
| 6643 | - $sql = "SELECT " . $fieldid . " as valuetoget"; |
|
| 6644 | - $sql .= " FROM " . MAIN_DB_PREFIX . $tablename; |
|
| 6645 | - $sql .= " WHERE " . $fieldkey . " = '" . $db->escape($key) . "'"; |
|
| 6643 | + $sql = "SELECT ".$fieldid." as valuetoget"; |
|
| 6644 | + $sql .= " FROM ".MAIN_DB_PREFIX.$tablename; |
|
| 6645 | + $sql .= " WHERE ".$fieldkey." = '".$db->escape($key)."'"; |
|
| 6646 | 6646 | if (!empty($entityfilter)) |
| 6647 | - $sql .= " AND entity IN (" . getEntity($tablename) . ")";
|
|
| 6647 | + $sql .= " AND entity IN (".getEntity($tablename).")";
|
|
| 6648 | 6648 | |
| 6649 | 6649 | $resql = $db->query($sql); |
| 6650 | 6650 | if ($resql) {
|
@@ -6675,8 +6675,8 @@ discard block |
||
| 6675 | 6675 | //print $strRights."<br>\n"; |
| 6676 | 6676 | $rights = true; |
| 6677 | 6677 | if ($strRights != '') {
|
| 6678 | - $str = 'if(!(' . $strRights . ')) { $rights = false; }';
|
|
| 6679 | - self::dol_eval($str); // The dol_eval must contains all the// global $xxx used into a condition |
|
| 6678 | + $str = 'if(!('.$strRights.')) { $rights = false; }';
|
|
| 6679 | + self::dol_eval($str); // The dol_eval must contains all the// global $xxx used into a condition |
|
| 6680 | 6680 | } |
| 6681 | 6681 | return $rights; |
| 6682 | 6682 | } |
@@ -6703,9 +6703,9 @@ discard block |
||
| 6703 | 6703 | //print $s."<br>\n"; |
| 6704 | 6704 | if ($returnvalue) {
|
| 6705 | 6705 | if ($hideerrors) |
| 6706 | - return @eval('return ' . $s . ';');
|
|
| 6706 | + return @eval('return '.$s.';');
|
|
| 6707 | 6707 | else |
| 6708 | - return eval('return ' . $s . ';');
|
|
| 6708 | + return eval('return '.$s.';');
|
|
| 6709 | 6709 | } |
| 6710 | 6710 | else {
|
| 6711 | 6711 | if ($hideerrors) |
@@ -6759,7 +6759,7 @@ discard block |
||
| 6759 | 6759 | $flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1]; |
| 6760 | 6760 | } |
| 6761 | 6761 | |
| 6762 | - return img_picto_common($codelang, 'flags/' . strtolower($flagImage) . '.png', $moreatt); |
|
| 6762 | + return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt); |
|
| 6763 | 6763 | } |
| 6764 | 6764 | |
| 6765 | 6765 | /** |
@@ -6957,16 +6957,16 @@ discard block |
||
| 6957 | 6957 | 'zu-ZA', |
| 6958 | 6958 | ); |
| 6959 | 6959 | |
| 6960 | - $buildprimarykeytotest = strtolower($countrycode) . '-' . strtoupper($countrycode); |
|
| 6960 | + $buildprimarykeytotest = strtolower($countrycode).'-'.strtoupper($countrycode); |
|
| 6961 | 6961 | if (in_array($buildprimarykeytotest, $locales)) |
| 6962 | - return strtolower($countrycode) . '_' . strtoupper($countrycode); |
|
| 6962 | + return strtolower($countrycode).'_'.strtoupper($countrycode); |
|
| 6963 | 6963 | |
| 6964 | 6964 | foreach ($locales as $locale) {
|
| 6965 | 6965 | $locale_language = locale_get_primary_language($locale); |
| 6966 | 6966 | $locale_region = locale_get_region($locale); |
| 6967 | 6967 | if (strtoupper($countrycode) == $locale_region) {
|
| 6968 | 6968 | //var_dump($locale.'-'.$locale_language.'-'.$locale_region); |
| 6969 | - return strtolower($locale_language) . '_' . strtoupper($locale_region); |
|
| 6969 | + return strtolower($locale_language).'_'.strtoupper($locale_region); |
|
| 6970 | 6970 | } |
| 6971 | 6971 | } |
| 6972 | 6972 | |
@@ -7027,7 +7027,7 @@ discard block |
||
| 7027 | 7027 | $label = Globals::$langs->trans($values[2]); |
| 7028 | 7028 | |
| 7029 | 7029 | //$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]), 1);
|
| 7030 | - $head[$h][0] = BASE_URI . preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]);
|
|
| 7030 | + $head[$h][0] = BASE_URI.preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]);
|
|
| 7031 | 7031 | $head[$h][1] = $label; |
| 7032 | 7032 | $head[$h][2] = str_replace('+', '', $values[1]);
|
| 7033 | 7033 | $h++; |
@@ -7098,43 +7098,43 @@ discard block |
||
| 7098 | 7098 | // global $micro_start_time; |
| 7099 | 7099 | |
| 7100 | 7100 | if ($zone == 'private') |
| 7101 | - print "\n" . '<!-- Common footer for private page -->' . "\n"; |
|
| 7101 | + print "\n".'<!-- Common footer for private page -->'."\n"; |
|
| 7102 | 7102 | else |
| 7103 | - print "\n" . '<!-- Common footer for public page -->' . "\n"; |
|
| 7103 | + print "\n".'<!-- Common footer for public page -->'."\n"; |
|
| 7104 | 7104 | |
| 7105 | 7105 | // A div to store page_y POST parameter so we can read it using javascript |
| 7106 | 7106 | print "\n<!-- A div to store page_y POST paramater -->\n"; |
| 7107 | - print '<div id="page_y" style="display: none;">' . filter_input(INPUT_POST, 'page_y') . '</div>' . "\n"; |
|
| 7107 | + print '<div id="page_y" style="display: none;">'.filter_input(INPUT_POST, 'page_y').'</div>'."\n"; |
|
| 7108 | 7108 | |
| 7109 | 7109 | $parameters = array(); |
| 7110 | - $reshook = Globals::$hookManager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks
|
|
| 7110 | + $reshook = Globals::$hookManager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks
|
|
| 7111 | 7111 | if (empty($reshook)) {
|
| 7112 | 7112 | if (!empty(Globals::$conf->global->MAIN_HTML_FOOTER)) |
| 7113 | - print Globals::$conf->global->MAIN_HTML_FOOTER . "\n"; |
|
| 7113 | + print Globals::$conf->global->MAIN_HTML_FOOTER."\n"; |
|
| 7114 | 7114 | |
| 7115 | 7115 | print "\n"; |
| 7116 | 7116 | if (!empty(Globals::$conf->use_javascript_ajax)) {
|
| 7117 | - print '<script type="text/javascript" language="javascript">' . "\n"; |
|
| 7118 | - print 'jQuery(document).ready(function() {' . "\n";
|
|
| 7117 | + print '<script type="text/javascript" language="javascript">'."\n"; |
|
| 7118 | + print 'jQuery(document).ready(function() {'."\n";
|
|
| 7119 | 7119 | |
| 7120 | 7120 | if ($zone == 'private' && empty(Globals::$conf->dol_use_jmobile)) {
|
| 7121 | 7121 | print "\n"; |
| 7122 | - print '/* JS CODE TO ENABLE to manage handler to switch left menu page (menuhider) */' . "\n"; |
|
| 7122 | + print '/* JS CODE TO ENABLE to manage handler to switch left menu page (menuhider) */'."\n"; |
|
| 7123 | 7123 | print 'jQuery(".menuhider").click(function() {';
|
| 7124 | - print ' console.log("We click on .menuhider");' . "\n";
|
|
| 7124 | + print ' console.log("We click on .menuhider");'."\n";
|
|
| 7125 | 7125 | //print " $('.side-nav').animate({width:'toggle'},200);\n"; // OK with eldy theme but not with md
|
| 7126 | 7126 | print " $('.side-nav').toggle()\n";
|
| 7127 | 7127 | print " $('.login_block').toggle()\n";
|
| 7128 | - print '});' . "\n"; |
|
| 7128 | + print '});'."\n"; |
|
| 7129 | 7129 | } |
| 7130 | 7130 | |
| 7131 | 7131 | // Management of focus and mandatory for fields |
| 7132 | 7132 | if ($action == 'create' || $action == 'edit' || (empty($action) && (preg_match('/new\.php/', $_SERVER["PHP_SELF"])))) {
|
| 7133 | - print '/* JS CODE TO ENABLE to manage focus and mandatory form fields */' . "\n"; |
|
| 7133 | + print '/* JS CODE TO ENABLE to manage focus and mandatory form fields */'."\n"; |
|
| 7134 | 7134 | $relativepathstring = $_SERVER["PHP_SELF"]; |
| 7135 | 7135 | // Clean $relativepathstring |
| 7136 | 7136 | if (constant('DOL_BASE_URI'))
|
| 7137 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
|
|
| 7137 | + $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring);
|
|
| 7138 | 7138 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
|
| 7139 | 7139 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
|
| 7140 | 7140 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
@@ -7157,9 +7157,9 @@ discard block |
||
| 7157 | 7157 | if ($qualified) {
|
| 7158 | 7158 | foreach ($defval as $paramkey => $paramval) {
|
| 7159 | 7159 | // Set focus on field |
| 7160 | - print 'jQuery("input[name=\'' . $paramkey . '\']").focus();' . "\n";
|
|
| 7161 | - print 'jQuery("textarea[name=\'' . $paramkey . '\']").focus();' . "\n";
|
|
| 7162 | - print 'jQuery("select[name=\'' . $paramkey . '\']").focus();' . "\n"; // Not really usefull, but we keep it in case of.
|
|
| 7160 | + print 'jQuery("input[name=\''.$paramkey.'\']").focus();'."\n";
|
|
| 7161 | + print 'jQuery("textarea[name=\''.$paramkey.'\']").focus();'."\n";
|
|
| 7162 | + print 'jQuery("select[name=\''.$paramkey.'\']").focus();'."\n"; // Not really usefull, but we keep it in case of.
|
|
| 7163 | 7163 | } |
| 7164 | 7164 | } |
| 7165 | 7165 | } |
@@ -7183,16 +7183,16 @@ discard block |
||
| 7183 | 7183 | if ($qualified) {
|
| 7184 | 7184 | foreach ($defval as $paramkey => $paramval) {
|
| 7185 | 7185 | // Add property 'required' on input |
| 7186 | - print 'jQuery("input[name=\'' . $paramkey . '\']").prop(\'required\',true);' . "\n";
|
|
| 7187 | - print 'jQuery("textarea[name=\'' . $paramkey . '\']").prop(\'required\',true);' . "\n";
|
|
| 7188 | - print 'jQuery("select[name=\'' . $paramkey . '\']").prop(\'required\',true);' . "\n"; // required on a select works only if key is "", this does not happen in Dolibarr
|
|
| 7186 | + print 'jQuery("input[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n";
|
|
| 7187 | + print 'jQuery("textarea[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n";
|
|
| 7188 | + print 'jQuery("select[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n"; // required on a select works only if key is "", this does not happen in Dolibarr
|
|
| 7189 | 7189 | } |
| 7190 | 7190 | } |
| 7191 | 7191 | } |
| 7192 | 7192 | } |
| 7193 | 7193 | } |
| 7194 | 7194 | |
| 7195 | - print '});' . "\n"; |
|
| 7195 | + print '});'."\n"; |
|
| 7196 | 7196 | |
| 7197 | 7197 | // Google Analytics |
| 7198 | 7198 | // TODO Add a hook here |
@@ -7200,15 +7200,15 @@ discard block |
||
| 7200 | 7200 | if ((Globals::$conf->dol_use_jmobile != 4)) {
|
| 7201 | 7201 | print "\n"; |
| 7202 | 7202 | print "/* JS CODE TO ENABLE for google analtics tag */\n"; |
| 7203 | - print ' var _gaq = _gaq || [];' . "\n"; |
|
| 7204 | - print ' _gaq.push([\'_setAccount\', \'' . Globals::$conf->global->MAIN_GOOGLE_AN_ID . '\']);' . "\n"; |
|
| 7205 | - print ' _gaq.push([\'_trackPageview\']);' . "\n"; |
|
| 7206 | - print '' . "\n"; |
|
| 7207 | - print ' (function() {' . "\n";
|
|
| 7208 | - print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;' . "\n"; |
|
| 7209 | - print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';' . "\n"; |
|
| 7210 | - print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);' . "\n"; |
|
| 7211 | - print ' })();' . "\n"; |
|
| 7203 | + print ' var _gaq = _gaq || [];'."\n"; |
|
| 7204 | + print ' _gaq.push([\'_setAccount\', \''.Globals::$conf->global->MAIN_GOOGLE_AN_ID.'\']);'."\n"; |
|
| 7205 | + print ' _gaq.push([\'_trackPageview\']);'."\n"; |
|
| 7206 | + print ''."\n"; |
|
| 7207 | + print ' (function() {'."\n";
|
|
| 7208 | + print ' var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;'."\n"; |
|
| 7209 | + print ' ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';'."\n"; |
|
| 7210 | + print ' var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);'."\n"; |
|
| 7211 | + print ' })();'."\n"; |
|
| 7212 | 7212 | } |
| 7213 | 7213 | } |
| 7214 | 7214 | |
@@ -7218,27 +7218,27 @@ discard block |
||
| 7218 | 7218 | print "/* JS CODE TO ENABLE to add memory info */\n"; |
| 7219 | 7219 | print 'window.console && console.log("';
|
| 7220 | 7220 | if (!empty(Globals::$conf->global->MEMCACHED_SERVER)) |
| 7221 | - print 'MEMCACHED_SERVER=' . Globals::$conf->global->MEMCACHED_SERVER . ' - '; |
|
| 7222 | - print 'MAIN_OPTIMIZE_SPEED=' . (isset(Globals::$conf->global->MAIN_OPTIMIZE_SPEED) ? Globals::$conf->global->MAIN_OPTIMIZE_SPEED : 'off'); |
|
| 7221 | + print 'MEMCACHED_SERVER='.Globals::$conf->global->MEMCACHED_SERVER.' - '; |
|
| 7222 | + print 'MAIN_OPTIMIZE_SPEED='.(isset(Globals::$conf->global->MAIN_OPTIMIZE_SPEED) ? Globals::$conf->global->MAIN_OPTIMIZE_SPEED : 'off'); |
|
| 7223 | 7223 | if (!empty($micro_start_time)) { // Works only if MAIN_SHOW_TUNING_INFO is defined at $_SERVER level. Not in// global variable.
|
| 7224 | 7224 | $micro_end_time = microtime(true); |
| 7225 | - print ' - Build time: ' . ceil(1000 * ($micro_end_time - $micro_start_time)) . ' ms'; |
|
| 7225 | + print ' - Build time: '.ceil(1000 * ($micro_end_time - $micro_start_time)).' ms'; |
|
| 7226 | 7226 | } |
| 7227 | 7227 | if (function_exists("memory_get_usage")) {
|
| 7228 | - print ' - Mem: ' . memory_get_usage(); |
|
| 7228 | + print ' - Mem: '.memory_get_usage(); |
|
| 7229 | 7229 | } |
| 7230 | 7230 | if (function_exists("xdebug_memory_usage")) {
|
| 7231 | - print ' - XDebug time: ' . ceil(1000 * xdebug_time_index()) . ' ms'; |
|
| 7232 | - print ' - XDebug mem: ' . xdebug_memory_usage(); |
|
| 7233 | - print ' - XDebug mem peak: ' . xdebug_peak_memory_usage(); |
|
| 7231 | + print ' - XDebug time: '.ceil(1000 * xdebug_time_index()).' ms'; |
|
| 7232 | + print ' - XDebug mem: '.xdebug_memory_usage(); |
|
| 7233 | + print ' - XDebug mem peak: '.xdebug_peak_memory_usage(); |
|
| 7234 | 7234 | } |
| 7235 | 7235 | if (function_exists("zend_loader_file_encoded")) {
|
| 7236 | - print ' - Zend encoded file: ' . (zend_loader_file_encoded() ? 'yes' : 'no'); |
|
| 7236 | + print ' - Zend encoded file: '.(zend_loader_file_encoded() ? 'yes' : 'no'); |
|
| 7237 | 7237 | } |
| 7238 | - print '");' . "\n"; |
|
| 7238 | + print '");'."\n"; |
|
| 7239 | 7239 | } |
| 7240 | 7240 | |
| 7241 | - print "\n" . '</script>' . "\n"; |
|
| 7241 | + print "\n".'</script>'."\n"; |
|
| 7242 | 7242 | } |
| 7243 | 7243 | |
| 7244 | 7244 | // Add Xdebug coverage of code |
@@ -7252,7 +7252,7 @@ discard block |
||
| 7252 | 7252 | print "<!-- Start of log output\n"; |
| 7253 | 7253 | //print '<div class="hidden">'."\n"; |
| 7254 | 7254 | foreach (Globals::$conf->logbuffer as $logline) {
|
| 7255 | - print $logline . "<br>\n"; |
|
| 7255 | + print $logline."<br>\n"; |
|
| 7256 | 7256 | } |
| 7257 | 7257 | //print '</div>'."\n"; |
| 7258 | 7258 | print "End of log output -->\n"; |
@@ -7295,8 +7295,8 @@ discard block |
||
| 7295 | 7295 | */ |
| 7296 | 7296 | static function dol_set_focus($selector) |
| 7297 | 7297 | {
|
| 7298 | - print "\n" . '<!-- Set focus onto a specific field -->' . "\n"; |
|
| 7299 | - print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("' . dol_escape_js($selector) . '").focus(); });</script>' . "\n";
|
|
| 7298 | + print "\n".'<!-- Set focus onto a specific field -->'."\n"; |
|
| 7299 | + print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("'.dol_escape_js($selector).'").focus(); });</script>'."\n";
|
|
| 7300 | 7300 | } |
| 7301 | 7301 | |
| 7302 | 7302 | /** |
@@ -7341,7 +7341,7 @@ discard block |
||
| 7341 | 7341 | $value = preg_replace('/\*/', '%', $value); // Replace * with %
|
| 7342 | 7342 | } |
| 7343 | 7343 | if ($mode == 1) {
|
| 7344 | - $value = preg_replace('/([<>=]+)\s+([0-9' . preg_quote(Globals::$langs->trans("DecimalSeparator"), '/') . '\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
|
|
| 7344 | + $value = preg_replace('/([<>=]+)\s+([0-9'.preg_quote(Globals::$langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
|
|
| 7345 | 7345 | } |
| 7346 | 7346 | |
| 7347 | 7347 | $value = preg_replace('/\s*\|\s*/', '|', $value);
|
@@ -7370,14 +7370,14 @@ discard block |
||
| 7370 | 7370 | if ($newcrit != '') {
|
| 7371 | 7371 | $numnewcrit = price2num($newcrit); |
| 7372 | 7372 | if (is_numeric($numnewcrit)) {
|
| 7373 | - $newres .= ($i2 > 0 ? ' OR ' : '') . $field . ' ' . $operator . ' ' . $numnewcrit; |
|
| 7373 | + $newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.$numnewcrit; |
|
| 7374 | 7374 | } else {
|
| 7375 | - $newres .= ($i2 > 0 ? ' OR ' : '') . '1 = 2'; // force false |
|
| 7375 | + $newres .= ($i2 > 0 ? ' OR ' : '').'1 = 2'; // force false |
|
| 7376 | 7376 | } |
| 7377 | 7377 | $i2++; // a criteria was added to string |
| 7378 | 7378 | } |
| 7379 | 7379 | } else if ($mode == 2) {
|
| 7380 | - $newres .= ($i2 > 0 ? ' OR ' : '') . $field . " IN (" . $db->escape(trim($crit)) . ")";
|
|
| 7380 | + $newres .= ($i2 > 0 ? ' OR ' : '').$field." IN (".$db->escape(trim($crit)).")";
|
|
| 7381 | 7381 | $i2++; // a criteria was added to string |
| 7382 | 7382 | } else if ($mode == 3) {
|
| 7383 | 7383 | $tmparray = explode(',', trim($crit));
|
@@ -7386,10 +7386,10 @@ discard block |
||
| 7386 | 7386 | foreach ($tmparray as $val) {
|
| 7387 | 7387 | if ($val) {
|
| 7388 | 7388 | $listofcodes .= ($listofcodes ? ',' : ''); |
| 7389 | - $listofcodes .= "'" . $db->escape(trim($val)) . "'"; |
|
| 7389 | + $listofcodes .= "'".$db->escape(trim($val))."'"; |
|
| 7390 | 7390 | } |
| 7391 | 7391 | } |
| 7392 | - $newres .= ($i2 > 0 ? ' OR ' : '') . $field . " IN (" . $listofcodes . ")";
|
|
| 7392 | + $newres .= ($i2 > 0 ? ' OR ' : '').$field." IN (".$listofcodes.")";
|
|
| 7393 | 7393 | $i2++; // a criteria was added to string |
| 7394 | 7394 | } |
| 7395 | 7395 | } else if ($mode == 4) {
|
@@ -7398,10 +7398,10 @@ discard block |
||
| 7398 | 7398 | $listofcodes = ''; |
| 7399 | 7399 | foreach ($tmparray as $val) {
|
| 7400 | 7400 | if ($val) {
|
| 7401 | - $newres .= ($i2 > 0 ? ' OR (' : '(') . $field . ' LIKE \'' . $db->escape(trim($val)) . ',%\'';
|
|
| 7402 | - $newres .= ' OR ' . $field . ' = \'' . $db->escape(trim($val)) . '\''; |
|
| 7403 | - $newres .= ' OR ' . $field . ' LIKE \'%,' . $db->escape(trim($val)) . '\''; |
|
| 7404 | - $newres .= ' OR ' . $field . ' LIKE \'%,' . $db->escape(trim($val)) . ',%\''; |
|
| 7401 | + $newres .= ($i2 > 0 ? ' OR (' : '(').$field.' LIKE \''.$db->escape(trim($val)).',%\'';
|
|
| 7402 | + $newres .= ' OR '.$field.' = \''.$db->escape(trim($val)).'\''; |
|
| 7403 | + $newres .= ' OR '.$field.' LIKE \'%,'.$db->escape(trim($val)).'\''; |
|
| 7404 | + $newres .= ' OR '.$field.' LIKE \'%,'.$db->escape(trim($val)).',%\''; |
|
| 7405 | 7405 | $newres .= ')'; |
| 7406 | 7406 | $i2++; |
| 7407 | 7407 | } |
@@ -7418,9 +7418,9 @@ discard block |
||
| 7418 | 7418 | $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : ''); |
| 7419 | 7419 | |
| 7420 | 7420 | if (preg_match('/\.(id|rowid)$/', $field)) { // Special case for rowid that is sometimes a ref so used as a search field
|
| 7421 | - $newres .= $field . " = " . (is_numeric(trim($tmpcrit)) ? trim($tmpcrit) : '0'); |
|
| 7421 | + $newres .= $field." = ".(is_numeric(trim($tmpcrit)) ? trim($tmpcrit) : '0'); |
|
| 7422 | 7422 | } else {
|
| 7423 | - $newres .= $field . " LIKE '"; |
|
| 7423 | + $newres .= $field." LIKE '"; |
|
| 7424 | 7424 | |
| 7425 | 7425 | $tmpcrit = trim($tmpcrit); |
| 7426 | 7426 | $tmpcrit2 = $tmpcrit; |
@@ -7439,7 +7439,7 @@ discard block |
||
| 7439 | 7439 | $newres .= $tmpafter; |
| 7440 | 7440 | $newres .= "'"; |
| 7441 | 7441 | if ($tmpcrit2 == '') {
|
| 7442 | - $newres .= ' OR ' . $field . " IS NULL"; |
|
| 7442 | + $newres .= ' OR '.$field." IS NULL"; |
|
| 7443 | 7443 | } |
| 7444 | 7444 | } |
| 7445 | 7445 | |
@@ -7450,10 +7450,10 @@ discard block |
||
| 7450 | 7450 | $i++; |
| 7451 | 7451 | } |
| 7452 | 7452 | if ($newres) |
| 7453 | - $res = $res . ($res ? ' AND ' : '') . ($i2 > 1 ? '(' : '') . $newres . ($i2 > 1 ? ')' : '');
|
|
| 7453 | + $res = $res.($res ? ' AND ' : '').($i2 > 1 ? '(' : '').$newres.($i2 > 1 ? ')' : '');
|
|
| 7454 | 7454 | $j++; |
| 7455 | 7455 | } |
| 7456 | - $res = ($nofirstand ? "" : " AND ") . "(" . $res . ")";
|
|
| 7456 | + $res = ($nofirstand ? "" : " AND ")."(".$res.")";
|
|
| 7457 | 7457 | //print 'xx'.$res.'yy'; |
| 7458 | 7458 | return $res; |
| 7459 | 7459 | } |
@@ -7472,8 +7472,8 @@ discard block |
||
| 7472 | 7472 | $url = $object->getLastMainDocLink($object->element); |
| 7473 | 7473 | |
| 7474 | 7474 | if ($url) {
|
| 7475 | - $out .= img_picto('', 'object_globe.png') . ' ' . Globals::$langs->trans("DirectDownloadLink") . '<br>';
|
|
| 7476 | - $out .= '<input type="text" id="directdownloadlink" class="quatrevingtpercent" value="' . $url . '">'; |
|
| 7475 | + $out .= img_picto('', 'object_globe.png').' '.Globals::$langs->trans("DirectDownloadLink").'<br>';
|
|
| 7476 | + $out .= '<input type="text" id="directdownloadlink" class="quatrevingtpercent" value="'.$url.'">'; |
|
| 7477 | 7477 | $out .= ajax_autoselect("directdownloadlink", 0);
|
| 7478 | 7478 | } |
| 7479 | 7479 | return $out; |
@@ -7514,7 +7514,7 @@ discard block |
||
| 7514 | 7514 | if ($extName) |
| 7515 | 7515 | $subdir = 'thumbs/'; |
| 7516 | 7516 | |
| 7517 | - return ($dirName ? $dirName . '/' : '') . $subdir . $fileName . $extName . $extImgTarget; // New filename for thumb |
|
| 7517 | + return ($dirName ? $dirName.'/' : '').$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb |
|
| 7518 | 7518 | } |
| 7519 | 7519 | |
| 7520 | 7520 | /** |
@@ -7540,14 +7540,14 @@ discard block |
||
| 7540 | 7540 | |
| 7541 | 7541 | if ($alldata == 1) {
|
| 7542 | 7542 | if ($num_mime !== false) |
| 7543 | - return array('target' => '_blank', 'css' => 'documentpreview', 'url' => DOL_BASE_URI . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : ''), 'mime' => dol_mimetype($relativepath),);
|
|
| 7543 | + return array('target' => '_blank', 'css' => 'documentpreview', 'url' => DOL_BASE_URI.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : ''), 'mime' => dol_mimetype($relativepath),);
|
|
| 7544 | 7544 | else |
| 7545 | 7545 | return array(); |
| 7546 | 7546 | } |
| 7547 | 7547 | |
| 7548 | 7548 | // old behavior |
| 7549 | 7549 | if ($num_mime !== false) |
| 7550 | - return 'javascript:document_preview(\'' . dol_escape_js(DOL_BASE_URI . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : '')) . '\', \'' . dol_mimetype($relativepath) . '\', \'' . dol_escape_js(Globals::$langs->trans('Preview')) . '\')';
|
|
| 7550 | + return 'javascript:document_preview(\''.dol_escape_js(DOL_BASE_URI.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : '')).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js(Globals::$langs->trans('Preview')).'\')';
|
|
| 7551 | 7551 | else |
| 7552 | 7552 | return ''; |
| 7553 | 7553 | } |
@@ -7564,11 +7564,11 @@ discard block |
||
| 7564 | 7564 | // global Globals::$langs; |
| 7565 | 7565 | $out = '<script type="text/javascript"> |
| 7566 | 7566 | jQuery(document).ready(static function () {
|
| 7567 | - jQuery("#' . $htmlname . '").click(function() { jQuery(this).select(); } );
|
|
| 7567 | + jQuery("#' . $htmlname.'").click(function() { jQuery(this).select(); } );
|
|
| 7568 | 7568 | }); |
| 7569 | 7569 | </script>'; |
| 7570 | 7570 | if ($addlink) |
| 7571 | - $out .= ' <a href="' . $addlink . '" target="_blank">' . Globals::$langs->trans("Link") . '</a>';
|
|
| 7571 | + $out .= ' <a href="'.$addlink.'" target="_blank">'.Globals::$langs->trans("Link").'</a>';
|
|
| 7572 | 7572 | return $out; |
| 7573 | 7573 | } |
| 7574 | 7574 | |
@@ -7949,9 +7949,9 @@ discard block |
||
| 7949 | 7949 | |
| 7950 | 7950 | if (!isset($dictvalues[$tablename])) {
|
| 7951 | 7951 | $dictvalues[$tablename] = array(); |
| 7952 | - $sql = 'SELECT * FROM ' . $tablename . ' WHERE 1'; |
|
| 7952 | + $sql = 'SELECT * FROM '.$tablename.' WHERE 1'; |
|
| 7953 | 7953 | if ($checkentity) |
| 7954 | - $sql .= ' AND entity IN (0,' . getEntity($tablename) . ')'; |
|
| 7954 | + $sql .= ' AND entity IN (0,'.getEntity($tablename).')'; |
|
| 7955 | 7955 | |
| 7956 | 7956 | $resql = $db->query($sql); |
| 7957 | 7957 | if ($resql) {
|
@@ -7989,14 +7989,14 @@ discard block |
||
| 7989 | 7989 | $g = $tmp[1]; |
| 7990 | 7990 | $b = $tmp[2]; |
| 7991 | 7991 | } else {
|
| 7992 | - $hexr = $stringcolor[0] . $stringcolor[1]; |
|
| 7993 | - $hexg = $stringcolor[2] . $stringcolor[3]; |
|
| 7994 | - $hexb = $stringcolor[4] . $stringcolor[5]; |
|
| 7992 | + $hexr = $stringcolor[0].$stringcolor[1]; |
|
| 7993 | + $hexg = $stringcolor[2].$stringcolor[3]; |
|
| 7994 | + $hexb = $stringcolor[4].$stringcolor[5]; |
|
| 7995 | 7995 | $r = hexdec($hexr); |
| 7996 | 7996 | $g = hexdec($hexg); |
| 7997 | 7997 | $b = hexdec($hexb); |
| 7998 | 7998 | } |
| 7999 | - $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm |
|
| 7999 | + $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm |
|
| 8000 | 8000 | if ($bright > 0.6) |
| 8001 | 8001 | $res = 1; |
| 8002 | 8002 | } |
@@ -8031,11 +8031,11 @@ discard block |
||
| 8031 | 8031 | return 0; // Entry is for menus all excluded to external users |
| 8032 | 8032 | } |
| 8033 | 8033 | if (!$menuentry['perms'] && $type_user) |
| 8034 | - return 0; // No permissions and user is external |
|
| 8034 | + return 0; // No permissions and user is external |
|
| 8035 | 8035 | if (!$menuentry['perms'] && !empty(Globals::$conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) |
| 8036 | 8036 | return 0; // No permissions and option to hide when not allowed, even for internal user, is on |
| 8037 | 8037 | if (!$menuentry['perms']) |
| 8038 | - return 2; // No permissions and user is external |
|
| 8038 | + return 2; // No permissions and user is external |
|
| 8039 | 8039 | return 1; |
| 8040 | 8040 | } |
| 8041 | 8041 | |
@@ -75,8 +75,9 @@ discard block |
||
| 75 | 75 | if ($found) return $result; |
| 76 | 76 | } */ |
| 77 | 77 | |
| 78 | - if (isset($class::$member)) |
|
| 79 | - return $class::$member; |
|
| 78 | + if (isset($class::$member)) { |
|
| 79 | + return $class::$member; |
|
| 80 | + } |
|
| 80 | 81 | dol_print_error('', 'Try to get a static member "' . $member . '" in class "' . $class . '" that does not exists or is not static.');
|
| 81 | 82 | return null; |
| 82 | 83 | } |
@@ -127,8 +128,9 @@ discard block |
||
| 127 | 128 | } else {
|
| 128 | 129 | $out = ''; |
| 129 | 130 | $addzero = array('user', 'usergroup', 'c_email_templates', 'email_template', 'default_values');
|
| 130 | - if (in_array($element, $addzero)) |
|
| 131 | - $out .= '0,'; |
|
| 131 | + if (in_array($element, $addzero)) { |
|
| 132 | + $out .= '0,'; |
|
| 133 | + } |
|
| 132 | 134 | $out .= Globals::$conf->entity; |
| 133 | 135 | return $out; |
| 134 | 136 | } |
@@ -391,14 +393,17 @@ discard block |
||
| 391 | 393 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
| 392 | 394 | $foundintru = 0; |
| 393 | 395 | foreach ($tmpqueryarraytohave as $tmpquerytohave) {
|
| 394 | - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) |
|
| 395 | - $foundintru = 1; |
|
| 396 | + if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) { |
|
| 397 | + $foundintru = 1; |
|
| 398 | + } |
|
| 396 | 399 | } |
| 397 | - if (!$foundintru) |
|
| 398 | - $qualified = 1; |
|
| 400 | + if (!$foundintru) { |
|
| 401 | + $qualified = 1; |
|
| 402 | + } |
|
| 399 | 403 | //var_dump($defkey.'-'.$qualified); |
| 400 | - } else |
|
| 401 | - $qualified = 1; |
|
| 404 | + } else { |
|
| 405 | + $qualified = 1; |
|
| 406 | + } |
|
| 402 | 407 | |
| 403 | 408 | if ($qualified) {
|
| 404 | 409 | //var_dump($user->default_values[$relativepathstring][$defkey]['createform']); |
@@ -425,20 +430,24 @@ discard block |
||
| 425 | 430 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
| 426 | 431 | $foundintru = 0; |
| 427 | 432 | foreach ($tmpqueryarraytohave as $tmpquerytohave) {
|
| 428 | - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) |
|
| 429 | - $foundintru = 1; |
|
| 433 | + if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) { |
|
| 434 | + $foundintru = 1; |
|
| 435 | + } |
|
| 430 | 436 | } |
| 431 | - if (!$foundintru) |
|
| 432 | - $qualified = 1; |
|
| 437 | + if (!$foundintru) { |
|
| 438 | + $qualified = 1; |
|
| 439 | + } |
|
| 433 | 440 | //var_dump($defkey.'-'.$qualified); |
| 434 | - } else |
|
| 435 | - $qualified = 1; |
|
| 441 | + } else { |
|
| 442 | + $qualified = 1; |
|
| 443 | + } |
|
| 436 | 444 | |
| 437 | 445 | if ($qualified) {
|
| 438 | 446 | $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
|
| 439 | 447 | foreach ($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val) {
|
| 440 | - if ($out) |
|
| 441 | - $out .= ', '; |
|
| 448 | + if ($out) { |
|
| 449 | + $out .= ', '; |
|
| 450 | + } |
|
| 442 | 451 | if ($paramname == 'sortfield') {
|
| 443 | 452 | $out .= dol_string_nospecial($key, '', $forbidden_chars_to_replace); |
| 444 | 453 | } |
@@ -458,14 +467,17 @@ discard block |
||
| 458 | 467 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
| 459 | 468 | $foundintru = 0; |
| 460 | 469 | foreach ($tmpqueryarraytohave as $tmpquerytohave) {
|
| 461 | - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) |
|
| 462 | - $foundintru = 1; |
|
| 470 | + if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) { |
|
| 471 | + $foundintru = 1; |
|
| 472 | + } |
|
| 463 | 473 | } |
| 464 | - if (!$foundintru) |
|
| 465 | - $qualified = 1; |
|
| 474 | + if (!$foundintru) { |
|
| 475 | + $qualified = 1; |
|
| 476 | + } |
|
| 466 | 477 | //var_dump($defkey.'-'.$qualified); |
| 467 | - } else |
|
| 468 | - $qualified = 1; |
|
| 478 | + } else { |
|
| 479 | + $qualified = 1; |
|
| 480 | + } |
|
| 469 | 481 | |
| 470 | 482 | if ($qualified) {
|
| 471 | 483 | if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all'])) {
|
@@ -556,18 +568,20 @@ discard block |
||
| 556 | 568 | } |
| 557 | 569 | break; |
| 558 | 570 | case 'intcomma': |
| 559 | - if (preg_match('/[^0-9,-]+/i', $out))
|
|
| 560 | - $out = ''; |
|
| 571 | + if (preg_match('/[^0-9,-]+/i', $out)) { |
|
| 572 | + $out = ''; |
|
| 573 | + } |
|
| 561 | 574 | break; |
| 562 | 575 | case 'alpha': |
| 563 | 576 | if (!is_array($out)) {
|
| 564 | 577 | $out = trim($out); |
| 565 | 578 | // '"' is dangerous because param in url can close the href= or src= and add javascript functions. |
| 566 | 579 | // '../' is dangerous because it allows dir transversals |
| 567 | - if (preg_match('/"/', $out))
|
|
| 568 | - $out = ''; |
|
| 569 | - else if (preg_match('/\.\.\//', $out))
|
|
| 570 | - $out = ''; |
|
| 580 | + if (preg_match('/"/', $out)) { |
|
| 581 | + $out = ''; |
|
| 582 | + } else if (preg_match('/\.\.\//', $out)) { |
|
| 583 | + $out = ''; |
|
| 584 | + } |
|
| 571 | 585 | } |
| 572 | 586 | break; |
| 573 | 587 | case 'san_alpha': |
@@ -576,27 +590,31 @@ discard block |
||
| 576 | 590 | case 'aZ': |
| 577 | 591 | if (!is_array($out)) {
|
| 578 | 592 | $out = trim($out); |
| 579 | - if (preg_match('/[^a-z]+/i', $out))
|
|
| 580 | - $out = ''; |
|
| 593 | + if (preg_match('/[^a-z]+/i', $out)) { |
|
| 594 | + $out = ''; |
|
| 595 | + } |
|
| 581 | 596 | } |
| 582 | 597 | break; |
| 583 | 598 | case 'aZ09': |
| 584 | 599 | if (!is_array($out)) {
|
| 585 | 600 | $out = trim($out); |
| 586 | - if (preg_match('/[^a-z0-9_\-\.]+/i', $out))
|
|
| 587 | - $out = ''; |
|
| 601 | + if (preg_match('/[^a-z0-9_\-\.]+/i', $out)) { |
|
| 602 | + $out = ''; |
|
| 603 | + } |
|
| 588 | 604 | } |
| 589 | 605 | break; |
| 590 | 606 | case 'aZ09comma': // great to sanitize sortfield or sortorder params that can be t.abc,t.def_gh |
| 591 | 607 | if (!is_array($out)) {
|
| 592 | 608 | $out = trim($out); |
| 593 | - if (preg_match('/[^a-z0-9_\-\.,]+/i', $out))
|
|
| 594 | - $out = ''; |
|
| 609 | + if (preg_match('/[^a-z0-9_\-\.,]+/i', $out)) { |
|
| 610 | + $out = ''; |
|
| 611 | + } |
|
| 595 | 612 | } |
| 596 | 613 | break; |
| 597 | 614 | case 'array': |
| 598 | - if (!is_array($out) || empty($out)) |
|
| 599 | - $out = array(); |
|
| 615 | + if (!is_array($out) || empty($out)) { |
|
| 616 | + $out = array(); |
|
| 617 | + } |
|
| 600 | 618 | break; |
| 601 | 619 | case 'nohtml': // Recommended for most scalar parameters |
| 602 | 620 | $out = dol_string_nohtmltag($out, 0); |
@@ -606,16 +624,18 @@ discard block |
||
| 606 | 624 | $out = trim($out); |
| 607 | 625 | // '"' is dangerous because param in url can close the href= or src= and add javascript functions. |
| 608 | 626 | // '../' is dangerous because it allows dir transversals |
| 609 | - if (preg_match('/"/', $out))
|
|
| 610 | - $out = ''; |
|
| 611 | - else if (preg_match('/\.\.\//', $out))
|
|
| 612 | - $out = ''; |
|
| 627 | + if (preg_match('/"/', $out)) { |
|
| 628 | + $out = ''; |
|
| 629 | + } else if (preg_match('/\.\.\//', $out)) { |
|
| 630 | + $out = ''; |
|
| 631 | + } |
|
| 613 | 632 | $out = dol_string_nohtmltag($out); |
| 614 | 633 | } |
| 615 | 634 | break; |
| 616 | 635 | case 'custom': |
| 617 | - if (empty($filter)) |
|
| 618 | - return 'BadFourthParameterForDolUtils::GETPOST'; |
|
| 636 | + if (empty($filter)) { |
|
| 637 | + return 'BadFourthParameterForDolUtils::GETPOST'; |
|
| 638 | + } |
|
| 619 | 639 | $out = filter_var($out, $filter, $options); |
| 620 | 640 | break; |
| 621 | 641 | } |
@@ -733,11 +753,11 @@ discard block |
||
| 733 | 753 | } |
| 734 | 754 | } |
| 735 | 755 | if ($returnemptyifnotfound) { // Not found into alternate dir
|
| 736 | - if ($returnemptyifnotfound == 1 || !file_exists($res)) |
|
| 737 | - return ''; |
|
| 756 | + if ($returnemptyifnotfound == 1 || !file_exists($res)) { |
|
| 757 | + return ''; |
|
| 758 | + } |
|
| 738 | 759 | } |
| 739 | - } |
|
| 740 | - else { // For an url path
|
|
| 760 | + } else { // For an url path
|
|
| 741 | 761 | // We try to get local path of file on filesystem from url |
| 742 | 762 | // Note that trying to know if a file on disk exist by forging path on disk from url |
| 743 | 763 | // works only for some web server and some setup. This is bugged when |
@@ -831,12 +851,14 @@ discard block |
||
| 831 | 851 | static function dol_size($size, $type = '') |
| 832 | 852 | {
|
| 833 | 853 | //global Globals::$conf; |
| 834 | - if (empty(Globals::$conf->dol_optimize_smallscreen)) |
|
| 835 | - return $size; |
|
| 836 | - if ($type == 'width' && $size > 250) |
|
| 837 | - return 250; |
|
| 838 | - else |
|
| 839 | - return 10; |
|
| 854 | + if (empty(Globals::$conf->dol_optimize_smallscreen)) { |
|
| 855 | + return $size; |
|
| 856 | + } |
|
| 857 | + if ($type == 'width' && $size > 250) { |
|
| 858 | + return 250; |
|
| 859 | + } else { |
|
| 860 | + return 10; |
|
| 861 | + } |
|
| 840 | 862 | } |
| 841 | 863 | |
| 842 | 864 | /** |
@@ -936,9 +958,10 @@ discard block |
||
| 936 | 958 | {
|
| 937 | 959 | $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName
|
| 938 | 960 | $forbidden_chars_to_remove = array(); |
| 939 | - if (is_array($badcharstoreplace)) |
|
| 940 | - $forbidden_chars_to_replace = $badcharstoreplace; |
|
| 941 | -//$forbidden_chars_to_remove=array("(",")");
|
|
| 961 | + if (is_array($badcharstoreplace)) { |
|
| 962 | + $forbidden_chars_to_replace = $badcharstoreplace; |
|
| 963 | + } |
|
| 964 | + //$forbidden_chars_to_remove=array("(",")");
|
|
| 942 | 965 | |
| 943 | 966 | return str_replace($forbidden_chars_to_replace, $newstr, str_replace($forbidden_chars_to_remove, "", $str)); |
| 944 | 967 | } |
@@ -974,9 +997,9 @@ discard block |
||
| 974 | 997 | if (empty($mode)) {
|
| 975 | 998 | $substitjs["'"] = "\\'"; |
| 976 | 999 | $substitjs['"'] = "\\'"; |
| 977 | - } else if ($mode == 1) |
|
| 978 | - $substitjs["'"] = "\\'"; |
|
| 979 | - else if ($mode == 2) {
|
|
| 1000 | + } else if ($mode == 1) { |
|
| 1001 | + $substitjs["'"] = "\\'"; |
|
| 1002 | + } else if ($mode == 2) {
|
|
| 980 | 1003 | $substitjs['"'] = '\\"'; |
| 981 | 1004 | } else if ($mode == 3) {
|
| 982 | 1005 | $substitjs["'"] = "\\'"; |
@@ -998,10 +1021,12 @@ discard block |
||
| 998 | 1021 | {
|
| 999 | 1022 | // escape quotes and backslashes, newlines, etc. |
| 1000 | 1023 | $tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags |
| 1001 | - if (!$keepb) |
|
| 1002 | - $tmp = strtr($tmp, array("<b>" => '', '</b>' => ''));
|
|
| 1003 | - if (!$keepn) |
|
| 1004 | - $tmp = strtr($tmp, array("\r" => '\\r', "\n" => '\\n'));
|
|
| 1024 | + if (!$keepb) { |
|
| 1025 | + $tmp = strtr($tmp, array("<b>" => '', '</b>' => '')); |
|
| 1026 | + } |
|
| 1027 | + if (!$keepn) { |
|
| 1028 | + $tmp = strtr($tmp, array("\r" => '\\r', "\n" => '\\n')); |
|
| 1029 | + } |
|
| 1005 | 1030 | return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html tags |
| 1006 | 1031 | } |
| 1007 | 1032 | |
@@ -1051,8 +1076,9 @@ discard block |
||
| 1051 | 1076 | {
|
| 1052 | 1077 | // global Globals::$conf, $user; |
| 1053 | 1078 | // If syslog module enabled |
| 1054 | - if (empty(Globals::$conf->syslog->enabled)) |
|
| 1055 | - return; |
|
| 1079 | + if (empty(Globals::$conf->syslog->enabled)) { |
|
| 1080 | + return; |
|
| 1081 | + } |
|
| 1056 | 1082 | |
| 1057 | 1083 | if ($ident < 0) {
|
| 1058 | 1084 | foreach (Globals::$conf->loghandlers as $loghandlerinstance) {
|
@@ -1066,8 +1092,9 @@ discard block |
||
| 1066 | 1092 | if (!in_array($level, $logLevels, true)) {
|
| 1067 | 1093 | throw new Exception('Incorrect log level');
|
| 1068 | 1094 | } |
| 1069 | - if ($level > Globals::$conf->global->SYSLOG_LEVEL) |
|
| 1070 | - return; |
|
| 1095 | + if ($level > Globals::$conf->global->SYSLOG_LEVEL) { |
|
| 1096 | + return; |
|
| 1097 | + } |
|
| 1071 | 1098 | |
| 1072 | 1099 | $message = preg_replace('/password=\'[^\']*\'/', 'password=\'hidden\'', $message); // protection to avoid to have value of password in log
|
| 1073 | 1100 | // If adding log inside HTML page is required |
@@ -1092,24 +1119,30 @@ discard block |
||
| 1092 | 1119 | ); |
| 1093 | 1120 | |
| 1094 | 1121 | // This is when server run behind a reverse proxy |
| 1095 | - if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) |
|
| 1096 | - $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'] . (empty($_SERVER["REMOTE_ADDR"]) ? '' : '->' . $_SERVER['REMOTE_ADDR']); |
|
| 1097 | -// This is when server run normally on a server |
|
| 1098 | - else if (!empty($_SERVER["REMOTE_ADDR"])) |
|
| 1099 | - $data['ip'] = $_SERVER['REMOTE_ADDR']; |
|
| 1100 | -// This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache) |
|
| 1101 | - else if (!empty($_SERVER['SERVER_ADDR'])) |
|
| 1102 | - $data['ip'] = $_SERVER['SERVER_ADDR']; |
|
| 1103 | -// This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it). |
|
| 1104 | - else if (!empty($_SERVER['COMPUTERNAME'])) |
|
| 1105 | - $data['ip'] = $_SERVER['COMPUTERNAME'] . (empty($_SERVER['USERNAME']) ? '' : '@' . $_SERVER['USERNAME']); |
|
| 1106 | -// This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). |
|
| 1107 | - else if (!empty($_SERVER['LOGNAME'])) |
|
| 1108 | - $data['ip'] = '???@' . $_SERVER['LOGNAME']; |
|
| 1109 | -// Loop on each log handler and send output |
|
| 1122 | + if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
| 1123 | + $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'] . (empty($_SERVER["REMOTE_ADDR"]) ? '' : '->' . $_SERVER['REMOTE_ADDR']); |
|
| 1124 | + } |
|
| 1125 | + // This is when server run normally on a server |
|
| 1126 | + else if (!empty($_SERVER["REMOTE_ADDR"])) { |
|
| 1127 | + $data['ip'] = $_SERVER['REMOTE_ADDR']; |
|
| 1128 | + } |
|
| 1129 | + // This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache) |
|
| 1130 | + else if (!empty($_SERVER['SERVER_ADDR'])) { |
|
| 1131 | + $data['ip'] = $_SERVER['SERVER_ADDR']; |
|
| 1132 | + } |
|
| 1133 | + // This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it). |
|
| 1134 | + else if (!empty($_SERVER['COMPUTERNAME'])) { |
|
| 1135 | + $data['ip'] = $_SERVER['COMPUTERNAME'] . (empty($_SERVER['USERNAME']) ? '' : '@' . $_SERVER['USERNAME']); |
|
| 1136 | + } |
|
| 1137 | + // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). |
|
| 1138 | + else if (!empty($_SERVER['LOGNAME'])) { |
|
| 1139 | + $data['ip'] = '???@' . $_SERVER['LOGNAME']; |
|
| 1140 | + } |
|
| 1141 | + // Loop on each log handler and send output |
|
| 1110 | 1142 | foreach (Globals::$conf->loghandlers as $loghandlerinstance) {
|
| 1111 | - if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) |
|
| 1112 | - continue; |
|
| 1143 | + if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler) { |
|
| 1144 | + continue; |
|
| 1145 | + } |
|
| 1113 | 1146 | $loghandlerinstance->export($data, $suffixinfilename); |
| 1114 | 1147 | } |
| 1115 | 1148 | unset($data); |
@@ -1165,13 +1198,15 @@ discard block |
||
| 1165 | 1198 | |
| 1166 | 1199 | // Show title |
| 1167 | 1200 | $showtitle = 1; |
| 1168 | - if (!empty(Globals::$conf->dol_optimize_smallscreen)) |
|
| 1169 | - $showtitle = 0; |
|
| 1201 | + if (!empty(Globals::$conf->dol_optimize_smallscreen)) { |
|
| 1202 | + $showtitle = 0; |
|
| 1203 | + } |
|
| 1170 | 1204 | if (!empty($title) && $showtitle) {
|
| 1171 | 1205 | $limittitle = 30; |
| 1172 | 1206 | $out .= '<a class="tabTitle">'; |
| 1173 | - if ($picto) |
|
| 1174 | - $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_') . $picto, '', $pictoisfullpath) . ' '; |
|
| 1207 | + if ($picto) { |
|
| 1208 | + $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_') . $picto, '', $pictoisfullpath) . ' '; |
|
| 1209 | + } |
|
| 1175 | 1210 | $out .= '<span class="tabTitleText">' . dol_trunc($title, $limittitle) . '</span>'; |
| 1176 | 1211 | $out .= '</a>'; |
| 1177 | 1212 | } |
@@ -1180,12 +1215,14 @@ discard block |
||
| 1180 | 1215 | $maxkey = -1; |
| 1181 | 1216 | if (is_array($links) && !empty($links)) {
|
| 1182 | 1217 | $keys = array_keys($links); |
| 1183 | - if (count($keys)) |
|
| 1184 | - $maxkey = max($keys); |
|
| 1218 | + if (count($keys)) { |
|
| 1219 | + $maxkey = max($keys); |
|
| 1220 | + } |
|
| 1185 | 1221 | } |
| 1186 | 1222 | |
| 1187 | - if (!empty(Globals::$conf->dol_optimize_smallscreen)) |
|
| 1188 | - Globals::$conf->global->MAIN_MAXTABS_IN_CARD = 2; |
|
| 1223 | + if (!empty(Globals::$conf->dol_optimize_smallscreen)) { |
|
| 1224 | + Globals::$conf->global->MAIN_MAXTABS_IN_CARD = 2; |
|
| 1225 | + } |
|
| 1189 | 1226 | |
| 1190 | 1227 | // Show tabs |
| 1191 | 1228 | $bactive = false; |
@@ -1198,8 +1235,9 @@ discard block |
||
| 1198 | 1235 | for ($i = 0; $i <= $maxkey; $i++) {
|
| 1199 | 1236 | if ((is_numeric($active) && $i == $active) || (!empty($links[$i][2]) && !is_numeric($active) && $active == $links[$i][2])) {
|
| 1200 | 1237 | // If active tab is already present |
| 1201 | - if ($i >= $limittoshow) |
|
| 1202 | - $limittoshow--; |
|
| 1238 | + if ($i >= $limittoshow) { |
|
| 1239 | + $limittoshow--; |
|
| 1240 | + } |
|
| 1203 | 1241 | } |
| 1204 | 1242 | } |
| 1205 | 1243 | |
@@ -1240,12 +1278,12 @@ discard block |
||
| 1240 | 1278 | } |
| 1241 | 1279 | $outmore .= '<div class="popuptab wordwrap" style="display:inherit;">'; |
| 1242 | 1280 | if (isset($links[$i][2]) && $links[$i][2] == 'image') {
|
| 1243 | - if (!empty($links[$i][0])) |
|
| 1244 | - $outmore .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n"; |
|
| 1245 | - else |
|
| 1246 | - $outmore .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n"; |
|
| 1247 | - } |
|
| 1248 | - else if (!empty($links[$i][1])) {
|
|
| 1281 | + if (!empty($links[$i][0])) { |
|
| 1282 | + $outmore .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n"; |
|
| 1283 | + } else { |
|
| 1284 | + $outmore .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n"; |
|
| 1285 | + } |
|
| 1286 | + } else if (!empty($links[$i][1])) {
|
|
| 1249 | 1287 | $outmore .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="wordwrap inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">'; |
| 1250 | 1288 | $outmore .= preg_replace('/([a-z])\/([a-z])/i', '\\1 / \\2', $links[$i][1]); // Replace x/y with x / y to allow wrap on long composed texts.
|
| 1251 | 1289 | $outmore .= '</a>' . "\n"; |
@@ -1256,8 +1294,9 @@ discard block |
||
| 1256 | 1294 | } |
| 1257 | 1295 | $displaytab = $i; |
| 1258 | 1296 | } |
| 1259 | - if ($popuptab) |
|
| 1260 | - $outmore .= '</div>'; |
|
| 1297 | + if ($popuptab) { |
|
| 1298 | + $outmore .= '</div>'; |
|
| 1299 | + } |
|
| 1261 | 1300 | |
| 1262 | 1301 | if ($displaytab > $limittoshow) {
|
| 1263 | 1302 | $left = (Globals::$langs->trans("DIRECTION") == 'rtl' ? 'right' : 'left');
|
@@ -1280,8 +1319,9 @@ discard block |
||
| 1280 | 1319 | |
| 1281 | 1320 | $out .= "</div>\n"; |
| 1282 | 1321 | |
| 1283 | - if (!$notab || $notab == -1) |
|
| 1284 | - $out .= "\n" . '<div class="tabBar' . ($notab == -1 ? '' : ' tabBarWithBottom') . '">' . "\n"; |
|
| 1322 | + if (!$notab || $notab == -1) { |
|
| 1323 | + $out .= "\n" . '<div class="tabBar' . ($notab == -1 ? '' : ' tabBarWithBottom') . '">' . "\n"; |
|
| 1324 | + } |
|
| 1285 | 1325 | |
| 1286 | 1326 | $parameters = array('tabname' => $active, 'out' => $out);
|
| 1287 | 1327 | $reshook = Globals::$hookManager->executeHooks('printTabsHead', $parameters); // This hook usage is called just before output the head of tabs. Take also a look at "completeTabsHead"
|
@@ -1311,10 +1351,11 @@ discard block |
||
| 1311 | 1351 | */ |
| 1312 | 1352 | static function dol_get_fiche_end($notab = 0) |
| 1313 | 1353 | {
|
| 1314 | - if (!$notab || $notab == -1) |
|
| 1315 | - return "\n</div>\n"; |
|
| 1316 | - else |
|
| 1317 | - return ''; |
|
| 1354 | + if (!$notab || $notab == -1) { |
|
| 1355 | + return "\n</div>\n"; |
|
| 1356 | + } else { |
|
| 1357 | + return ''; |
|
| 1358 | + } |
|
| 1318 | 1359 | } |
| 1319 | 1360 | |
| 1320 | 1361 | /** |
@@ -1346,8 +1387,9 @@ discard block |
||
| 1346 | 1387 | $showimage = 1; |
| 1347 | 1388 | $entity = (empty($object->entity) ? Globals::$conf->entity : $object->entity); |
| 1348 | 1389 | $showbarcode = empty(Globals::$conf->barcode->enabled) ? 0 : ($object->barcode ? 1 : 0); |
| 1349 | - if (!empty(Globals::$conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) |
|
| 1350 | - $showbarcode = 0; |
|
| 1390 | + if (!empty(Globals::$conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) { |
|
| 1391 | + $showbarcode = 0; |
|
| 1392 | + } |
|
| 1351 | 1393 | $modulepart = 'unknown'; |
| 1352 | 1394 | |
| 1353 | 1395 | if ($object->element == 'societe') {
|
@@ -1452,8 +1494,10 @@ discard block |
||
| 1452 | 1494 | } else {
|
| 1453 | 1495 | $subdir = get_exdir($object->id, 0, 0, 1, $object, $modulepart); |
| 1454 | 1496 | } |
| 1455 | - if (empty($subdir)) |
|
| 1456 | - $subdir = 'errorgettingsubdirofobject'; // Protection to avoid to return empty path |
|
| 1497 | + if (empty($subdir)) { |
|
| 1498 | + $subdir = 'errorgettingsubdirofobject'; |
|
| 1499 | + } |
|
| 1500 | + // Protection to avoid to return empty path |
|
| 1457 | 1501 | |
| 1458 | 1502 | $filepath = $dir_output . $subdir . "/"; |
| 1459 | 1503 | |
@@ -1474,14 +1518,16 @@ discard block |
||
| 1474 | 1518 | if (empty(Globals::$conf->global->MAIN_DISABLE_PDF_THUMBS)) { // If you experienc trouble with pdf thumb generation and imagick, you can disable here.
|
| 1475 | 1519 | include_once DOL_BASE_PATH . '/core/lib/files.lib.php'; |
| 1476 | 1520 | $ret = dol_convert_file($file, 'png', $fileimage); |
| 1477 | - if ($ret < 0) |
|
| 1478 | - $error++; |
|
| 1521 | + if ($ret < 0) { |
|
| 1522 | + $error++; |
|
| 1523 | + } |
|
| 1479 | 1524 | } |
| 1480 | 1525 | } |
| 1481 | 1526 | |
| 1482 | 1527 | $heightforphotref = 70; |
| 1483 | - if (!empty(Globals::$conf->dol_optimize_smallscreen)) |
|
| 1484 | - $heightforphotref = 60; |
|
| 1528 | + if (!empty(Globals::$conf->dol_optimize_smallscreen)) { |
|
| 1529 | + $heightforphotref = 60; |
|
| 1530 | + } |
|
| 1485 | 1531 | // Si fichier png PDF d'1 page trouve |
| 1486 | 1532 | if (file_exists($fileimage)) {
|
| 1487 | 1533 | $phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">'; |
@@ -1517,8 +1563,10 @@ discard block |
||
| 1517 | 1563 | $width = 14; |
| 1518 | 1564 | $cssclass = 'photorefcenter'; |
| 1519 | 1565 | $picto = $object->picto; |
| 1520 | - if ($object->element == 'project' && !$object->public) |
|
| 1521 | - $picto = 'project'; // instead of projectpub |
|
| 1566 | + if ($object->element == 'project' && !$object->public) { |
|
| 1567 | + $picto = 'project'; |
|
| 1568 | + } |
|
| 1569 | + // instead of projectpub |
|
| 1522 | 1570 | $nophoto = img_picto('', 'object_' . $picto, '', false, 1);
|
| 1523 | 1571 | } |
| 1524 | 1572 | $morehtmlleft .= '<!-- No photo to show -->'; |
@@ -1529,8 +1577,9 @@ discard block |
||
| 1529 | 1577 | } |
| 1530 | 1578 | } |
| 1531 | 1579 | |
| 1532 | - if ($showbarcode) |
|
| 1533 | - $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $form->showbarcode($object) . '</div>'; |
|
| 1580 | + if ($showbarcode) { |
|
| 1581 | + $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $form->showbarcode($object) . '</div>'; |
|
| 1582 | + } |
|
| 1534 | 1583 | |
| 1535 | 1584 | if ($object->element == 'societe') {
|
| 1536 | 1585 | if (!empty(Globals::$conf->use_javascript_ajax) && $user->rights->societe->creer && !empty(Globals::$conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
|
@@ -1554,35 +1603,37 @@ discard block |
||
| 1554 | 1603 | } |
| 1555 | 1604 | } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan'))) {
|
| 1556 | 1605 | $tmptxt = $object->getLibStatut(6, $object->totalpaye); |
| 1557 | - if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || Globals::$conf->browser->layout == 'phone') |
|
| 1558 | - $tmptxt = $object->getLibStatut(5, $object->totalpaye); |
|
| 1606 | + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || Globals::$conf->browser->layout == 'phone') { |
|
| 1607 | + $tmptxt = $object->getLibStatut(5, $object->totalpaye); |
|
| 1608 | + } |
|
| 1559 | 1609 | $morehtmlstatus .= $tmptxt; |
| 1560 | - } |
|
| 1561 | - elseif ($object->element == 'contrat' || $object->element == 'contract') {
|
|
| 1562 | - if ($object->statut == 0) |
|
| 1563 | - $morehtmlstatus .= $object->getLibStatut(5); |
|
| 1564 | - else |
|
| 1565 | - $morehtmlstatus .= $object->getLibStatut(4); |
|
| 1566 | - } |
|
| 1567 | - elseif ($object->element == 'facturerec') {
|
|
| 1568 | - if ($object->frequency == 0) |
|
| 1569 | - $morehtmlstatus .= $object->getLibStatut(2); |
|
| 1570 | - else |
|
| 1571 | - $morehtmlstatus .= $object->getLibStatut(5); |
|
| 1572 | - } |
|
| 1573 | - elseif ($object->element == 'project_task') {
|
|
| 1610 | + } elseif ($object->element == 'contrat' || $object->element == 'contract') {
|
|
| 1611 | + if ($object->statut == 0) { |
|
| 1612 | + $morehtmlstatus .= $object->getLibStatut(5); |
|
| 1613 | + } else { |
|
| 1614 | + $morehtmlstatus .= $object->getLibStatut(4); |
|
| 1615 | + } |
|
| 1616 | + } elseif ($object->element == 'facturerec') {
|
|
| 1617 | + if ($object->frequency == 0) { |
|
| 1618 | + $morehtmlstatus .= $object->getLibStatut(2); |
|
| 1619 | + } else { |
|
| 1620 | + $morehtmlstatus .= $object->getLibStatut(5); |
|
| 1621 | + } |
|
| 1622 | + } elseif ($object->element == 'project_task') {
|
|
| 1574 | 1623 | $object->fk_statut = 1; |
| 1575 | - if ($object->progress > 0) |
|
| 1576 | - $object->fk_statut = 2; |
|
| 1577 | - if ($object->progress >= 100) |
|
| 1578 | - $object->fk_statut = 3; |
|
| 1624 | + if ($object->progress > 0) { |
|
| 1625 | + $object->fk_statut = 2; |
|
| 1626 | + } |
|
| 1627 | + if ($object->progress >= 100) { |
|
| 1628 | + $object->fk_statut = 3; |
|
| 1629 | + } |
|
| 1579 | 1630 | $tmptxt = $object->getLibStatut(5); |
| 1580 | 1631 | $morehtmlstatus .= $tmptxt; // No status on task |
| 1581 | - } |
|
| 1582 | - else { // Generic case
|
|
| 1632 | + } else { // Generic case
|
|
| 1583 | 1633 | $tmptxt = $object->getLibStatut(6); |
| 1584 | - if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || Globals::$conf->browser->layout == 'phone') |
|
| 1585 | - $tmptxt = $object->getLibStatut(5); |
|
| 1634 | + if (empty($tmptxt) || $tmptxt == $object->getLibStatut(3) || Globals::$conf->browser->layout == 'phone') { |
|
| 1635 | + $tmptxt = $object->getLibStatut(5); |
|
| 1636 | + } |
|
| 1586 | 1637 | $morehtmlstatus .= $tmptxt; |
| 1587 | 1638 | } |
| 1588 | 1639 | |
@@ -1596,13 +1647,15 @@ discard block |
||
| 1596 | 1647 | } |
| 1597 | 1648 | |
| 1598 | 1649 | // Add alias for thirdparty |
| 1599 | - if (!empty($object->name_alias)) |
|
| 1600 | - $morehtmlref .= '<div class="refidno">' . $object->name_alias . '</div>'; |
|
| 1650 | + if (!empty($object->name_alias)) { |
|
| 1651 | + $morehtmlref .= '<div class="refidno">' . $object->name_alias . '</div>'; |
|
| 1652 | + } |
|
| 1601 | 1653 | |
| 1602 | 1654 | // Add label |
| 1603 | 1655 | if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task') {
|
| 1604 | - if (!empty($object->label)) |
|
| 1605 | - $morehtmlref .= '<div class="refidno">' . $object->label . '</div>'; |
|
| 1656 | + if (!empty($object->label)) { |
|
| 1657 | + $morehtmlref .= '<div class="refidno">' . $object->label . '</div>'; |
|
| 1658 | + } |
|
| 1606 | 1659 | } |
| 1607 | 1660 | |
| 1608 | 1661 | if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files') {
|
@@ -1635,15 +1688,19 @@ discard block |
||
| 1635 | 1688 | {
|
| 1636 | 1689 | // global Globals::$conf, Globals::$langs; |
| 1637 | 1690 | $ret = ''; |
| 1638 | - if ($fieldrequired) |
|
| 1639 | - $ret .= '<span class="fieldrequired">'; |
|
| 1640 | - if ((Globals::$conf->dol_use_jmobile != 4)) |
|
| 1641 | - $ret .= '<label for="' . $fieldkey . '">'; |
|
| 1691 | + if ($fieldrequired) { |
|
| 1692 | + $ret .= '<span class="fieldrequired">'; |
|
| 1693 | + } |
|
| 1694 | + if ((Globals::$conf->dol_use_jmobile != 4)) { |
|
| 1695 | + $ret .= '<label for="' . $fieldkey . '">'; |
|
| 1696 | + } |
|
| 1642 | 1697 | $ret .= Globals::$langs->trans($langkey); |
| 1643 | - if ((Globals::$conf->dol_use_jmobile != 4)) |
|
| 1644 | - $ret .= '</label>'; |
|
| 1645 | - if ($fieldrequired) |
|
| 1646 | - $ret .= '</span>'; |
|
| 1698 | + if ((Globals::$conf->dol_use_jmobile != 4)) { |
|
| 1699 | + $ret .= '</label>'; |
|
| 1700 | + } |
|
| 1701 | + if ($fieldrequired) { |
|
| 1702 | + $ret .= '</span>'; |
|
| 1703 | + } |
|
| 1647 | 1704 | return $ret; |
| 1648 | 1705 | } |
| 1649 | 1706 | |
@@ -1658,8 +1715,9 @@ discard block |
||
| 1658 | 1715 | {
|
| 1659 | 1716 | // global $bc; |
| 1660 | 1717 | $ret = ' ' . $bc[$var]; |
| 1661 | - if ($moreclass) |
|
| 1662 | - $ret = preg_replace('/class=\"/', 'class="' . $moreclass . ' ', $ret);
|
|
| 1718 | + if ($moreclass) { |
|
| 1719 | + $ret = preg_replace('/class=\"/', 'class="' . $moreclass . ' ', $ret); |
|
| 1720 | + } |
|
| 1663 | 1721 | return $ret; |
| 1664 | 1722 | } |
| 1665 | 1723 | |
@@ -1690,18 +1748,18 @@ discard block |
||
| 1690 | 1748 | if ($object->state) {
|
| 1691 | 1749 | $ret .= ($ret ? ", " : '') . $object->state; |
| 1692 | 1750 | } |
| 1693 | - if ($object->zip) |
|
| 1694 | - $ret .= ($ret ? ", " : '') . $object->zip; |
|
| 1695 | - } |
|
| 1696 | - else if (in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country
|
|
| 1751 | + if ($object->zip) { |
|
| 1752 | + $ret .= ($ret ? ", " : '') . $object->zip; |
|
| 1753 | + } |
|
| 1754 | + } else if (in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country
|
|
| 1697 | 1755 | $ret .= ($ret ? $sep : '' ) . $object->town; |
| 1698 | 1756 | if ($object->state) {
|
| 1699 | 1757 | $ret .= ($ret ? ", " : '') . $object->state; |
| 1700 | 1758 | } |
| 1701 | - if ($object->zip) |
|
| 1702 | - $ret .= ($ret ? $sep : '' ) . $object->zip; |
|
| 1703 | - } |
|
| 1704 | - else if (in_array($object->country_code, array('ES', 'TR'))) { // ES: title firstname name \n address lines \n zip town \n state \n country
|
|
| 1759 | + if ($object->zip) { |
|
| 1760 | + $ret .= ($ret ? $sep : '' ) . $object->zip; |
|
| 1761 | + } |
|
| 1762 | + } else if (in_array($object->country_code, array('ES', 'TR'))) { // ES: title firstname name \n address lines \n zip town \n state \n country
|
|
| 1705 | 1763 | $ret .= ($ret ? $sep : '' ) . $object->zip; |
| 1706 | 1764 | $ret .= ($object->town ? (($object->zip ? ' ' : '') . $object->town) : ''); |
| 1707 | 1765 | if ($object->state) {
|
@@ -1718,8 +1776,9 @@ discard block |
||
| 1718 | 1776 | $ret .= ($ret ? ", " : '') . $object->state; |
| 1719 | 1777 | } |
| 1720 | 1778 | } |
| 1721 | - if (!is_object($outputlangs)) |
|
| 1722 | - $outputlangs = Globals::$langs; |
|
| 1779 | + if (!is_object($outputlangs)) { |
|
| 1780 | + $outputlangs = Globals::$langs; |
|
| 1781 | + } |
|
| 1723 | 1782 | if ($withcountry) {
|
| 1724 | 1783 | Globals::$langs->load("dict");
|
| 1725 | 1784 | $ret .= ($object->country_code ? ($ret ? $sep : '') . $outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country" . $object->country_code)) : '');
|
@@ -1740,8 +1799,9 @@ discard block |
||
| 1740 | 1799 | {
|
| 1741 | 1800 | if ((abs($ts) <= 0x7FFFFFFF)) { // check if number in 32-bit signed range
|
| 1742 | 1801 | return ($is_gmt) ? @gmstrftime($fmt, $ts) : @strftime($fmt, $ts); |
| 1743 | - } else |
|
| 1744 | - return 'Error date into a not supported range'; |
|
| 1802 | + } else { |
|
| 1803 | + return 'Error date into a not supported range'; |
|
| 1804 | + } |
|
| 1745 | 1805 | } |
| 1746 | 1806 | |
| 1747 | 1807 | /** |
@@ -1787,10 +1847,12 @@ discard block |
||
| 1787 | 1847 | } |
| 1788 | 1848 | } |
| 1789 | 1849 | } |
| 1790 | - if (!is_object($outputlangs)) |
|
| 1791 | - $outputlangs = Globals::$langs; |
|
| 1792 | - if (!$format) |
|
| 1793 | - $format = 'daytextshort'; |
|
| 1850 | + if (!is_object($outputlangs)) { |
|
| 1851 | + $outputlangs = Globals::$langs; |
|
| 1852 | + } |
|
| 1853 | + if (!$format) { |
|
| 1854 | + $format = 'daytextshort'; |
|
| 1855 | + } |
|
| 1794 | 1856 | $reduceformat = (!empty(Globals::$conf->dol_optimize_smallscreen) && in_array($format, array('day', 'dayhour'))) ? 1 : 0;
|
| 1795 | 1857 | $formatwithoutreduce = preg_replace('/reduceformat/', '', $format);
|
| 1796 | 1858 | if ($formatwithoutreduce != $format) {
|
@@ -1799,40 +1861,46 @@ discard block |
||
| 1799 | 1861 | } // so format 'dayreduceformat' is processed like day |
| 1800 | 1862 | // Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default. |
| 1801 | 1863 | // TODO Add format daysmallyear and dayhoursmallyear |
| 1802 | - if ($format == 'day') |
|
| 1803 | - $format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : Globals::$conf->format_date_short);
|
|
| 1804 | - else if ($format == 'hour') |
|
| 1805 | - $format = ($outputlangs->trans("FormatHourShort") != "FormatHourShort" ? $outputlangs->trans("FormatHourShort") : Globals::$conf->format_hour_short);
|
|
| 1806 | - else if ($format == 'hourduration') |
|
| 1807 | - $format = ($outputlangs->trans("FormatHourShortDuration") != "FormatHourShortDuration" ? $outputlangs->trans("FormatHourShortDuration") : Globals::$conf->format_hour_short_duration);
|
|
| 1808 | - else if ($format == 'daytext') |
|
| 1809 | - $format = ($outputlangs->trans("FormatDateText") != "FormatDateText" ? $outputlangs->trans("FormatDateText") : Globals::$conf->format_date_text);
|
|
| 1810 | - else if ($format == 'daytextshort') |
|
| 1811 | -// Notice: Undefined property: stdClass::$format_date_text_short in \alixar\dolibarr\htdocs\core\lib\functions.lib.php on line 1781 |
|
| 1812 | - $format = ($outputlangs->trans("FormatDateTextShort") != "FormatDateTextShort" ? $outputlangs->trans("FormatDateTextShort") : Globals::$conf->format_date_text_short);
|
|
| 1813 | - else if ($format == 'dayhour') |
|
| 1814 | - $format = ($outputlangs->trans("FormatDateHourShort") != "FormatDateHourShort" ? $outputlangs->trans("FormatDateHourShort") : Globals::$conf->format_date_hour_short ?? "%d/%m/%Y %H:%M");
|
|
| 1815 | - else if ($format == 'dayhoursec') |
|
| 1816 | - $format = ($outputlangs->trans("FormatDateHourSecShort") != "FormatDateHourSecShort" ? $outputlangs->trans("FormatDateHourSecShort") : Globals::$conf->format_date_hour_sec_short);
|
|
| 1817 | - else if ($format == 'dayhourtext') |
|
| 1818 | - $format = ($outputlangs->trans("FormatDateHourText") != "FormatDateHourText" ? $outputlangs->trans("FormatDateHourText") : Globals::$conf->format_date_hour_text);
|
|
| 1819 | - else if ($format == 'dayhourtextshort') |
|
| 1820 | - $format = ($outputlangs->trans("FormatDateHourTextShort") != "FormatDateHourTextShort" ? $outputlangs->trans("FormatDateHourTextShort") : Globals::$conf->format_date_hour_text_short);
|
|
| 1821 | -// Format not sensitive to language |
|
| 1822 | - else if ($format == 'dayhourlog') |
|
| 1823 | - $format = '%Y%m%d%H%M%S'; |
|
| 1824 | - else if ($format == 'dayhourldap') |
|
| 1825 | - $format = '%Y%m%d%H%M%SZ'; |
|
| 1826 | - else if ($format == 'dayhourxcard') |
|
| 1827 | - $format = '%Y%m%dT%H%M%SZ'; |
|
| 1828 | - else if ($format == 'dayxcard') |
|
| 1829 | - $format = '%Y%m%d'; |
|
| 1830 | - else if ($format == 'dayrfc') |
|
| 1831 | - $format = '%Y-%m-%d'; // DATE_RFC3339 |
|
| 1832 | - else if ($format == 'dayhourrfc') |
|
| 1833 | - $format = '%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339 |
|
| 1834 | - else if ($format == 'standard') |
|
| 1835 | - $format = '%Y-%m-%d %H:%M:%S'; |
|
| 1864 | + if ($format == 'day') { |
|
| 1865 | + $format = ($outputlangs->trans("FormatDateShort") != "FormatDateShort" ? $outputlangs->trans("FormatDateShort") : Globals::$conf->format_date_short); |
|
| 1866 | + } else if ($format == 'hour') { |
|
| 1867 | + $format = ($outputlangs->trans("FormatHourShort") != "FormatHourShort" ? $outputlangs->trans("FormatHourShort") : Globals::$conf->format_hour_short); |
|
| 1868 | + } else if ($format == 'hourduration') { |
|
| 1869 | + $format = ($outputlangs->trans("FormatHourShortDuration") != "FormatHourShortDuration" ? $outputlangs->trans("FormatHourShortDuration") : Globals::$conf->format_hour_short_duration); |
|
| 1870 | + } else if ($format == 'daytext') { |
|
| 1871 | + $format = ($outputlangs->trans("FormatDateText") != "FormatDateText" ? $outputlangs->trans("FormatDateText") : Globals::$conf->format_date_text); |
|
| 1872 | + } else if ($format == 'daytextshort') { |
|
| 1873 | + // Notice: Undefined property: stdClass::$format_date_text_short in \alixar\dolibarr\htdocs\core\lib\functions.lib.php on line 1781 |
|
| 1874 | + $format = ($outputlangs->trans("FormatDateTextShort") != "FormatDateTextShort" ? $outputlangs->trans("FormatDateTextShort") : Globals::$conf->format_date_text_short); |
|
| 1875 | + } else if ($format == 'dayhour') { |
|
| 1876 | + $format = ($outputlangs->trans("FormatDateHourShort") != "FormatDateHourShort" ? $outputlangs->trans("FormatDateHourShort") : Globals::$conf->format_date_hour_short ?? "%d/%m/%Y %H:%M"); |
|
| 1877 | + } else if ($format == 'dayhoursec') { |
|
| 1878 | + $format = ($outputlangs->trans("FormatDateHourSecShort") != "FormatDateHourSecShort" ? $outputlangs->trans("FormatDateHourSecShort") : Globals::$conf->format_date_hour_sec_short); |
|
| 1879 | + } else if ($format == 'dayhourtext') { |
|
| 1880 | + $format = ($outputlangs->trans("FormatDateHourText") != "FormatDateHourText" ? $outputlangs->trans("FormatDateHourText") : Globals::$conf->format_date_hour_text); |
|
| 1881 | + } else if ($format == 'dayhourtextshort') { |
|
| 1882 | + $format = ($outputlangs->trans("FormatDateHourTextShort") != "FormatDateHourTextShort" ? $outputlangs->trans("FormatDateHourTextShort") : Globals::$conf->format_date_hour_text_short); |
|
| 1883 | + } |
|
| 1884 | + // Format not sensitive to language |
|
| 1885 | + else if ($format == 'dayhourlog') { |
|
| 1886 | + $format = '%Y%m%d%H%M%S'; |
|
| 1887 | + } else if ($format == 'dayhourldap') { |
|
| 1888 | + $format = '%Y%m%d%H%M%SZ'; |
|
| 1889 | + } else if ($format == 'dayhourxcard') { |
|
| 1890 | + $format = '%Y%m%dT%H%M%SZ'; |
|
| 1891 | + } else if ($format == 'dayxcard') { |
|
| 1892 | + $format = '%Y%m%d'; |
|
| 1893 | + } else if ($format == 'dayrfc') { |
|
| 1894 | + $format = '%Y-%m-%d'; |
|
| 1895 | + } |
|
| 1896 | + // DATE_RFC3339 |
|
| 1897 | + else if ($format == 'dayhourrfc') { |
|
| 1898 | + $format = '%Y-%m-%dT%H:%M:%SZ'; |
|
| 1899 | + } |
|
| 1900 | + // DATETIME RFC3339 |
|
| 1901 | + else if ($format == 'standard') { |
|
| 1902 | + $format = '%Y-%m-%d %H:%M:%S'; |
|
| 1903 | + } |
|
| 1836 | 1904 | |
| 1837 | 1905 | if ($reduceformat) {
|
| 1838 | 1906 | $format = str_replace('%Y', '%y', $format);
|
@@ -1840,8 +1908,10 @@ discard block |
||
| 1840 | 1908 | } |
| 1841 | 1909 | |
| 1842 | 1910 | // If date undefined or "", we return "" |
| 1843 | - if (AlDolUtils::dol_strlen($time) == 0) |
|
| 1844 | - return ''; // $time=0 allowed (it means 01/01/1970 00:00:00) |
|
| 1911 | + if (AlDolUtils::dol_strlen($time) == 0) { |
|
| 1912 | + return ''; |
|
| 1913 | + } |
|
| 1914 | + // $time=0 allowed (it means 01/01/1970 00:00:00) |
|
| 1845 | 1915 | |
| 1846 | 1916 | |
| 1847 | 1917 | |
@@ -1928,8 +1998,9 @@ discard block |
||
| 1928 | 1998 | $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with static function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring. |
| 1929 | 1999 | |
| 1930 | 2000 | $ret = adodb_strftime($format, $timetouse, $to_gmt); |
| 1931 | - } else |
|
| 1932 | - $ret = 'Bad value ' . $time . ' for date'; |
|
| 2001 | + } else { |
|
| 2002 | + $ret = 'Bad value ' . $time . ' for date'; |
|
| 2003 | + } |
|
| 1933 | 2004 | } |
| 1934 | 2005 | |
| 1935 | 2006 | if (preg_match('/__b__/i', $format)) {
|
@@ -2000,10 +2071,14 @@ discard block |
||
| 2000 | 2071 | // global Globals::$conf; |
| 2001 | 2072 | |
| 2002 | 2073 | $usealternatemethod = false; |
| 2003 | - if ($timestamp <= 0) |
|
| 2004 | - $usealternatemethod = true; // <= 1970 |
|
| 2005 | - if ($timestamp >= 2145913200) |
|
| 2006 | - $usealternatemethod = true; // >= 2038 |
|
| 2074 | + if ($timestamp <= 0) { |
|
| 2075 | + $usealternatemethod = true; |
|
| 2076 | + } |
|
| 2077 | + // <= 1970 |
|
| 2078 | + if ($timestamp >= 2145913200) { |
|
| 2079 | + $usealternatemethod = true; |
|
| 2080 | + } |
|
| 2081 | + // >= 2038 |
|
| 2007 | 2082 | |
| 2008 | 2083 | if ($usealternatemethod) {
|
| 2009 | 2084 | $arrayinfo = adodb_getdate($timestamp, $fast); |
@@ -2038,27 +2113,36 @@ discard block |
||
| 2038 | 2113 | // global Globals::$conf; |
| 2039 | 2114 | //print "- ".$hour.",".$minute.",".$second.",".$month.",".$day.",".$year.",".$_SERVER["WINDIR"]." -"; |
| 2040 | 2115 | // Clean parameters |
| 2041 | - if ($hour == -1 || empty($hour)) |
|
| 2042 | - $hour = 0; |
|
| 2043 | - if ($minute == -1 || empty($minute)) |
|
| 2044 | - $minute = 0; |
|
| 2045 | - if ($second == -1 || empty($second)) |
|
| 2046 | - $second = 0; |
|
| 2116 | + if ($hour == -1 || empty($hour)) { |
|
| 2117 | + $hour = 0; |
|
| 2118 | + } |
|
| 2119 | + if ($minute == -1 || empty($minute)) { |
|
| 2120 | + $minute = 0; |
|
| 2121 | + } |
|
| 2122 | + if ($second == -1 || empty($second)) { |
|
| 2123 | + $second = 0; |
|
| 2124 | + } |
|
| 2047 | 2125 | |
| 2048 | 2126 | // Check parameters |
| 2049 | 2127 | if ($check) {
|
| 2050 | - if (!$month || !$day) |
|
| 2051 | - return ''; |
|
| 2052 | - if ($day > 31) |
|
| 2053 | - return ''; |
|
| 2054 | - if ($month > 12) |
|
| 2055 | - return ''; |
|
| 2056 | - if ($hour < 0 || $hour > 24) |
|
| 2057 | - return ''; |
|
| 2058 | - if ($minute < 0 || $minute > 60) |
|
| 2059 | - return ''; |
|
| 2060 | - if ($second < 0 || $second > 60) |
|
| 2061 | - return ''; |
|
| 2128 | + if (!$month || !$day) { |
|
| 2129 | + return ''; |
|
| 2130 | + } |
|
| 2131 | + if ($day > 31) { |
|
| 2132 | + return ''; |
|
| 2133 | + } |
|
| 2134 | + if ($month > 12) { |
|
| 2135 | + return ''; |
|
| 2136 | + } |
|
| 2137 | + if ($hour < 0 || $hour > 24) { |
|
| 2138 | + return ''; |
|
| 2139 | + } |
|
| 2140 | + if ($minute < 0 || $minute > 60) { |
|
| 2141 | + return ''; |
|
| 2142 | + } |
|
| 2143 | + if ($second < 0 || $second > 60) { |
|
| 2144 | + return ''; |
|
| 2145 | + } |
|
| 2062 | 2146 | } |
| 2063 | 2147 | |
| 2064 | 2148 | if (method_exists('DateTime', 'getTimestamp')) {
|
@@ -2115,8 +2199,10 @@ discard block |
||
| 2115 | 2199 | |
| 2116 | 2200 | // Note that gmmktime and mktime return same value (GMT) when used without parameters |
| 2117 | 2201 | //if ($mode == 'gmt') $ret=gmmktime(); // Strict Standards: gmmktime(): You should be using the time() static function instead |
| 2118 | - if ($mode == 'gmt') |
|
| 2119 | - $ret = time(); // Time for now at greenwich. |
|
| 2202 | + if ($mode == 'gmt') { |
|
| 2203 | + $ret = time(); |
|
| 2204 | + } |
|
| 2205 | + // Time for now at greenwich. |
|
| 2120 | 2206 | else if ($mode == 'tzserver') { // Time for now with PHP server timezone added
|
| 2121 | 2207 | require_once DOL_BASE_PATH . '/core/lib/date.lib.php'; |
| 2122 | 2208 | $tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time
|
@@ -2150,8 +2236,9 @@ discard block |
||
| 2150 | 2236 | // global Globals::$conf, Globals::$langs; |
| 2151 | 2237 | $level = 1024; |
| 2152 | 2238 | |
| 2153 | - if (!empty(Globals::$conf->dol_optimize_smallscreen)) |
|
| 2154 | - $shortunit = 1; |
|
| 2239 | + if (!empty(Globals::$conf->dol_optimize_smallscreen)) { |
|
| 2240 | + $shortunit = 1; |
|
| 2241 | + } |
|
| 2155 | 2242 | |
| 2156 | 2243 | // Set value text |
| 2157 | 2244 | if (empty($shortvalue) || $size < ($level * 10)) {
|
@@ -2186,19 +2273,23 @@ discard block |
||
| 2186 | 2273 | {
|
| 2187 | 2274 | // global Globals::$langs; |
| 2188 | 2275 | |
| 2189 | - if (empty($url)) |
|
| 2190 | - return ''; |
|
| 2276 | + if (empty($url)) { |
|
| 2277 | + return ''; |
|
| 2278 | + } |
|
| 2191 | 2279 | |
| 2192 | 2280 | $link = '<a href="'; |
| 2193 | - if (!preg_match('/^http/i', $url))
|
|
| 2194 | - $link .= 'http://'; |
|
| 2281 | + if (!preg_match('/^http/i', $url)) { |
|
| 2282 | + $link .= 'http://'; |
|
| 2283 | + } |
|
| 2195 | 2284 | $link .= $url; |
| 2196 | 2285 | $link .= '"'; |
| 2197 | - if ($target) |
|
| 2198 | - $link .= ' target="' . $target . '"'; |
|
| 2286 | + if ($target) { |
|
| 2287 | + $link .= ' target="' . $target . '"'; |
|
| 2288 | + } |
|
| 2199 | 2289 | $link .= '>'; |
| 2200 | - if (!preg_match('/^http/i', $url))
|
|
| 2201 | - $link .= 'http://'; |
|
| 2290 | + if (!preg_match('/^http/i', $url)) { |
|
| 2291 | + $link .= 'http://'; |
|
| 2292 | + } |
|
| 2202 | 2293 | $link .= dol_trunc($url, $max); |
| 2203 | 2294 | $link .= '</a>'; |
| 2204 | 2295 | return '<div class="nospan float" style="margin-right: 10px">' . ($withpicto ? img_picto(Globals::$langs->trans("Url"), 'object_globe.png') . ' ' : '') . $link . '</div>';
|
@@ -2222,13 +2313,15 @@ discard block |
||
| 2222 | 2313 | |
| 2223 | 2314 | $newemail = $email; |
| 2224 | 2315 | |
| 2225 | - if (empty($email)) |
|
| 2226 | - return ' '; |
|
| 2316 | + if (empty($email)) { |
|
| 2317 | + return ' '; |
|
| 2318 | + } |
|
| 2227 | 2319 | |
| 2228 | 2320 | if (!empty($addlink)) {
|
| 2229 | 2321 | $newemail = '<a style="text-overflow: ellipsis;" href="'; |
| 2230 | - if (!preg_match('/^mailto:/i', $email))
|
|
| 2231 | - $newemail .= 'mailto:'; |
|
| 2322 | + if (!preg_match('/^mailto:/i', $email)) { |
|
| 2323 | + $newemail .= 'mailto:'; |
|
| 2324 | + } |
|
| 2232 | 2325 | $newemail .= $email; |
| 2233 | 2326 | $newemail .= '">'; |
| 2234 | 2327 | $newemail .= dol_trunc($email, $max); |
@@ -2241,13 +2334,14 @@ discard block |
||
| 2241 | 2334 | if (($cid || $socid) && !empty(Globals::$conf->agenda->enabled) && $user->rights->agenda->myactions->create) {
|
| 2242 | 2335 | $type = 'AC_EMAIL'; |
| 2243 | 2336 | $link = ''; |
| 2244 | - if (!empty(Globals::$conf->global->AGENDA_ADDACTIONFOREMAIL)) |
|
| 2245 | - $link = '<a href="' . DOL_BASE_URI . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object(Globals::$langs->trans("AddAction"), "calendar") . '</a>';
|
|
| 2246 | - if ($link) |
|
| 2247 | - $newemail = '<div>' . $newemail . ' ' . $link . '</div>'; |
|
| 2337 | + if (!empty(Globals::$conf->global->AGENDA_ADDACTIONFOREMAIL)) { |
|
| 2338 | + $link = '<a href="' . DOL_BASE_URI . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object(Globals::$langs->trans("AddAction"), "calendar") . '</a>'; |
|
| 2339 | + } |
|
| 2340 | + if ($link) { |
|
| 2341 | + $newemail = '<div>' . $newemail . ' ' . $link . '</div>'; |
|
| 2342 | + } |
|
| 2248 | 2343 | } |
| 2249 | - } |
|
| 2250 | - else {
|
|
| 2344 | + } else {
|
|
| 2251 | 2345 | if ($showinvalid && !isValidEmail($email)) {
|
| 2252 | 2346 | Globals::$langs->load("errors");
|
| 2253 | 2347 | $newemail .= img_warning(Globals::$langs->trans("ErrorBadEMail", $email));
|
@@ -2279,8 +2373,9 @@ discard block |
||
| 2279 | 2373 | |
| 2280 | 2374 | $newskype = $value; |
| 2281 | 2375 | |
| 2282 | - if (empty($value)) |
|
| 2283 | - return ' '; |
|
| 2376 | + if (empty($value)) { |
|
| 2377 | + return ' '; |
|
| 2378 | + } |
|
| 2284 | 2379 | |
| 2285 | 2380 | if (!empty($type)) {
|
| 2286 | 2381 | $newskype = '<div class="divsocialnetwork inline-block valignmiddle">'; |
@@ -2301,13 +2396,13 @@ discard block |
||
| 2301 | 2396 | if (($cid || $socid) && !empty(Globals::$conf->agenda->enabled) && $user->rights->agenda->myactions->create && $type == 'skype') {
|
| 2302 | 2397 | $addlink = 'AC_SKYPE'; |
| 2303 | 2398 | $link = ''; |
| 2304 | - if (!empty(Globals::$conf->global->AGENDA_ADDACTIONFORSKYPE)) |
|
| 2305 | - $link = '<a href="' . DOL_BASE_URI . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $addlink . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object(Globals::$langs->trans("AddAction"), "calendar") . '</a>';
|
|
| 2399 | + if (!empty(Globals::$conf->global->AGENDA_ADDACTIONFORSKYPE)) { |
|
| 2400 | + $link = '<a href="' . DOL_BASE_URI . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $addlink . '&contactid=' . $cid . '&socid=' . $socid . '">' . img_object(Globals::$langs->trans("AddAction"), "calendar") . '</a>'; |
|
| 2401 | + } |
|
| 2306 | 2402 | $newskype .= ($link ? ' ' . $link : ''); |
| 2307 | 2403 | } |
| 2308 | 2404 | $newskype .= '</div>'; |
| 2309 | - } |
|
| 2310 | - else {
|
|
| 2405 | + } else {
|
|
| 2311 | 2406 | Globals::$langs->load("errors");
|
| 2312 | 2407 | $newskype .= img_warning(Globals::$langs->trans("ErrorBadSocialNetworkValue", $value));
|
| 2313 | 2408 | } |
@@ -2336,12 +2431,14 @@ discard block |
||
| 2336 | 2431 | if (empty($phone)) {
|
| 2337 | 2432 | return ''; |
| 2338 | 2433 | } |
| 2339 | - if (empty($countrycode)) |
|
| 2340 | - $countrycode = $mysoc->country_code; |
|
| 2434 | + if (empty($countrycode)) { |
|
| 2435 | + $countrycode = $mysoc->country_code; |
|
| 2436 | + } |
|
| 2341 | 2437 | |
| 2342 | 2438 | // Short format for small screens |
| 2343 | - if (Globals::$conf->dol_optimize_smallscreen) |
|
| 2344 | - $separ = ''; |
|
| 2439 | + if (Globals::$conf->dol_optimize_smallscreen) { |
|
| 2440 | + $separ = ''; |
|
| 2441 | + } |
|
| 2345 | 2442 | |
| 2346 | 2443 | $newphone = $phone; |
| 2347 | 2444 | if (strtoupper($countrycode) == "FR") {
|
@@ -2507,15 +2604,18 @@ discard block |
||
| 2507 | 2604 | $newphone = '<a href="tel:' . $phone . '"'; |
| 2508 | 2605 | $newphone .= '>' . $phone . '</a>'; |
| 2509 | 2606 | } else if (!empty(Globals::$conf->clicktodial->enabled) && $addlink == 'AC_TEL') { // If click to dial, we use click to dial url
|
| 2510 | - if (empty($user->clicktodial_loaded)) |
|
| 2511 | - $user->fetch_clicktodial(); |
|
| 2607 | + if (empty($user->clicktodial_loaded)) { |
|
| 2608 | + $user->fetch_clicktodial(); |
|
| 2609 | + } |
|
| 2512 | 2610 | |
| 2513 | 2611 | // Define urlmask |
| 2514 | 2612 | $urlmask = 'ErrorClickToDialModuleNotConfigured'; |
| 2515 | - if (!empty(Globals::$conf->global->CLICKTODIAL_URL)) |
|
| 2516 | - $urlmask = Globals::$conf->global->CLICKTODIAL_URL; |
|
| 2517 | - if (!empty($user->clicktodial_url)) |
|
| 2518 | - $urlmask = $user->clicktodial_url; |
|
| 2613 | + if (!empty(Globals::$conf->global->CLICKTODIAL_URL)) { |
|
| 2614 | + $urlmask = Globals::$conf->global->CLICKTODIAL_URL; |
|
| 2615 | + } |
|
| 2616 | + if (!empty($user->clicktodial_url)) { |
|
| 2617 | + $urlmask = $user->clicktodial_url; |
|
| 2618 | + } |
|
| 2519 | 2619 | |
| 2520 | 2620 | $clicktodial_poste = (!empty($user->clicktodial_poste) ? urlencode($user->clicktodial_poste) : ''); |
| 2521 | 2621 | $clicktodial_login = (!empty($user->clicktodial_login) ? urlencode($user->clicktodial_login) : ''); |
@@ -2530,8 +2630,9 @@ discard block |
||
| 2530 | 2630 | $url = make_substitutions($url, $substitarray); |
| 2531 | 2631 | $newphonesav = $newphone; |
| 2532 | 2632 | $newphone = '<a href="' . $url . '"'; |
| 2533 | - if (!empty(Globals::$conf->global->CLICKTODIAL_FORCENEWTARGET)) |
|
| 2534 | - $newphone .= ' target="_blank"'; |
|
| 2633 | + if (!empty(Globals::$conf->global->CLICKTODIAL_FORCENEWTARGET)) { |
|
| 2634 | + $newphone .= ' target="_blank"'; |
|
| 2635 | + } |
|
| 2535 | 2636 | $newphone .= '>' . $newphonesav . '</a>'; |
| 2536 | 2637 | } |
| 2537 | 2638 | |
@@ -2539,12 +2640,15 @@ discard block |
||
| 2539 | 2640 | if (!empty(Globals::$conf->agenda->enabled) && $user->rights->agenda->myactions->create) {
|
| 2540 | 2641 | $type = 'AC_TEL'; |
| 2541 | 2642 | $link = ''; |
| 2542 | - if ($addlink == 'AC_FAX') |
|
| 2543 | - $type = 'AC_FAX'; |
|
| 2544 | - if (!empty(Globals::$conf->global->AGENDA_ADDACTIONFORPHONE)) |
|
| 2545 | - $link = '<a href="' . DOL_BASE_URI . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . ($cid ? '&contactid=' . $cid : '') . ($socid ? '&socid=' . $socid : '') . '">' . img_object(Globals::$langs->trans("AddAction"), "calendar") . '</a>';
|
|
| 2546 | - if ($link) |
|
| 2547 | - $newphone = '<div>' . $newphone . ' ' . $link . '</div>'; |
|
| 2643 | + if ($addlink == 'AC_FAX') { |
|
| 2644 | + $type = 'AC_FAX'; |
|
| 2645 | + } |
|
| 2646 | + if (!empty(Globals::$conf->global->AGENDA_ADDACTIONFORPHONE)) { |
|
| 2647 | + $link = '<a href="' . DOL_BASE_URI . '/comm/action/card.php?action=create&backtopage=1&actioncode=' . $type . ($cid ? '&contactid=' . $cid : '') . ($socid ? '&socid=' . $socid : '') . '">' . img_object(Globals::$langs->trans("AddAction"), "calendar") . '</a>'; |
|
| 2648 | + } |
|
| 2649 | + if ($link) { |
|
| 2650 | + $newphone = '<div>' . $newphone . ' ' . $link . '</div>'; |
|
| 2651 | + } |
|
| 2548 | 2652 | } |
| 2549 | 2653 | } |
| 2550 | 2654 | |
@@ -2571,15 +2675,17 @@ discard block |
||
| 2571 | 2675 | $picto = ''; |
| 2572 | 2676 | } |
| 2573 | 2677 | } |
| 2574 | - if ($adddivfloat) |
|
| 2575 | - $rep .= '<div class="nospan float" style="margin-right: 10px">'; |
|
| 2576 | - else |
|
| 2577 | - $rep .= '<span style="margin-right: 10px;">'; |
|
| 2678 | + if ($adddivfloat) { |
|
| 2679 | + $rep .= '<div class="nospan float" style="margin-right: 10px">'; |
|
| 2680 | + } else { |
|
| 2681 | + $rep .= '<span style="margin-right: 10px;">'; |
|
| 2682 | + } |
|
| 2578 | 2683 | $rep .= ($withpicto ? img_picto($titlealt, 'object_' . $picto . '.png') . ' ' : '') . $newphone; |
| 2579 | - if ($adddivfloat) |
|
| 2580 | - $rep .= '</div>'; |
|
| 2581 | - else |
|
| 2582 | - $rep .= '</span>'; |
|
| 2684 | + if ($adddivfloat) { |
|
| 2685 | + $rep .= '</div>'; |
|
| 2686 | + } else { |
|
| 2687 | + $rep .= '</span>'; |
|
| 2688 | + } |
|
| 2583 | 2689 | } |
| 2584 | 2690 | |
| 2585 | 2691 | return $rep; |
@@ -2609,8 +2715,9 @@ discard block |
||
| 2609 | 2715 | if ($countrycode) { // If success, countrycode is us, fr, ...
|
| 2610 | 2716 | if (file_exists(DOL_BASE_PATH . '/theme/common/flags/' . $countrycode . '.png')) {
|
| 2611 | 2717 | $ret .= ' ' . img_picto($countrycode . ' ' . Globals::$langs->trans("AccordingToGeoIPDatabase"), DOL_BASE_URI . '/theme/common/flags/' . $countrycode . '.png', '', 1);
|
| 2612 | - } else |
|
| 2613 | - $ret .= ' (' . $countrycode . ')';
|
|
| 2718 | + } else { |
|
| 2719 | + $ret .= ' (' . $countrycode . ')'; |
|
| 2720 | + } |
|
| 2614 | 2721 | } |
| 2615 | 2722 | } |
| 2616 | 2723 | |
@@ -2707,26 +2814,33 @@ discard block |
||
| 2707 | 2814 | $out .= Globals::$hookManager->resPrint; |
| 2708 | 2815 | } |
| 2709 | 2816 | if (empty($reshook)) {
|
| 2710 | - if (empty($charfornl)) |
|
| 2711 | - $out .= nl2br($address); |
|
| 2712 | - else |
|
| 2713 | - $out .= preg_replace('/[\r\n]+/', $charfornl, $address);
|
|
| 2817 | + if (empty($charfornl)) { |
|
| 2818 | + $out .= nl2br($address); |
|
| 2819 | + } else { |
|
| 2820 | + $out .= preg_replace('/[\r\n]+/', $charfornl, $address); |
|
| 2821 | + } |
|
| 2714 | 2822 | |
| 2715 | 2823 | $showgmap = $showomap = 0; |
| 2716 | 2824 | |
| 2717 | 2825 | // TODO Add a hook here |
| 2718 | - if (($mode == 'thirdparty' || $mode == 'societe') && !empty(Globals::$conf->google->enabled) && !empty(Globals::$conf->global->GOOGLE_ENABLE_GMAPS)) |
|
| 2719 | - $showgmap = 1; |
|
| 2720 | - if ($mode == 'contact' && !empty(Globals::$conf->google->enabled) && !empty(Globals::$conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS)) |
|
| 2721 | - $showgmap = 1; |
|
| 2722 | - if ($mode == 'member' && !empty(Globals::$conf->google->enabled) && !empty(Globals::$conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS)) |
|
| 2723 | - $showgmap = 1; |
|
| 2724 | - if (($mode == 'thirdparty' || $mode == 'societe') && !empty(Globals::$conf->openstreetmap->enabled) && !empty(Globals::$conf->global->OPENSTREETMAP_ENABLE_MAPS)) |
|
| 2725 | - $showomap = 1; |
|
| 2726 | - if ($mode == 'contact' && !empty(Globals::$conf->openstreetmap->enabled) && !empty(Globals::$conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS)) |
|
| 2727 | - $showomap = 1; |
|
| 2728 | - if ($mode == 'member' && !empty(Globals::$conf->openstreetmap->enabled) && !empty(Globals::$conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS)) |
|
| 2729 | - $showomap = 1; |
|
| 2826 | + if (($mode == 'thirdparty' || $mode == 'societe') && !empty(Globals::$conf->google->enabled) && !empty(Globals::$conf->global->GOOGLE_ENABLE_GMAPS)) { |
|
| 2827 | + $showgmap = 1; |
|
| 2828 | + } |
|
| 2829 | + if ($mode == 'contact' && !empty(Globals::$conf->google->enabled) && !empty(Globals::$conf->global->GOOGLE_ENABLE_GMAPS_CONTACTS)) { |
|
| 2830 | + $showgmap = 1; |
|
| 2831 | + } |
|
| 2832 | + if ($mode == 'member' && !empty(Globals::$conf->google->enabled) && !empty(Globals::$conf->global->GOOGLE_ENABLE_GMAPS_MEMBERS)) { |
|
| 2833 | + $showgmap = 1; |
|
| 2834 | + } |
|
| 2835 | + if (($mode == 'thirdparty' || $mode == 'societe') && !empty(Globals::$conf->openstreetmap->enabled) && !empty(Globals::$conf->global->OPENSTREETMAP_ENABLE_MAPS)) { |
|
| 2836 | + $showomap = 1; |
|
| 2837 | + } |
|
| 2838 | + if ($mode == 'contact' && !empty(Globals::$conf->openstreetmap->enabled) && !empty(Globals::$conf->global->OPENSTREETMAP_ENABLE_MAPS_CONTACTS)) { |
|
| 2839 | + $showomap = 1; |
|
| 2840 | + } |
|
| 2841 | + if ($mode == 'member' && !empty(Globals::$conf->openstreetmap->enabled) && !empty(Globals::$conf->global->OPENSTREETMAP_ENABLE_MAPS_MEMBERS)) { |
|
| 2842 | + $showomap = 1; |
|
| 2843 | + } |
|
| 2730 | 2844 | |
| 2731 | 2845 | if ($showgmap) {
|
| 2732 | 2846 | $url = dol_buildpath('/google/gmaps.php?mode=' . $mode . '&id=' . $id, 1);
|
@@ -2738,10 +2852,11 @@ discard block |
||
| 2738 | 2852 | } |
| 2739 | 2853 | } |
| 2740 | 2854 | } |
| 2741 | - if ($noprint) |
|
| 2742 | - return $out; |
|
| 2743 | - else |
|
| 2744 | - print $out; |
|
| 2855 | + if ($noprint) { |
|
| 2856 | + return $out; |
|
| 2857 | + } else { |
|
| 2858 | + print $out; |
|
| 2859 | + } |
|
| 2745 | 2860 | } |
| 2746 | 2861 | |
| 2747 | 2862 | /** |
@@ -2753,10 +2868,12 @@ discard block |
||
| 2753 | 2868 | */ |
| 2754 | 2869 | static function isValidEmail($address, $acceptsupervisorkey = 0) |
| 2755 | 2870 | {
|
| 2756 | - if ($acceptsupervisorkey && $address == '__SUPERVISOREMAIL__') |
|
| 2757 | - return true; |
|
| 2758 | - if (filter_var($address, FILTER_VALIDATE_EMAIL)) |
|
| 2759 | - return true; |
|
| 2871 | + if ($acceptsupervisorkey && $address == '__SUPERVISOREMAIL__') { |
|
| 2872 | + return true; |
|
| 2873 | + } |
|
| 2874 | + if (filter_var($address, FILTER_VALIDATE_EMAIL)) { |
|
| 2875 | + return true; |
|
| 2876 | + } |
|
| 2760 | 2877 | |
| 2761 | 2878 | return false; |
| 2762 | 2879 | } |
@@ -2778,10 +2895,12 @@ discard block |
||
| 2778 | 2895 | $mxhosts = array(); |
| 2779 | 2896 | $weight = array(); |
| 2780 | 2897 | getmxrr(idn_to_ascii($domain), $mxhosts, $weight); |
| 2781 | - if (count($mxhosts) > 1) |
|
| 2782 | - return 1; |
|
| 2783 | - if (count($mxhosts) == 1 && !empty($mxhosts[0])) |
|
| 2784 | - return 1; |
|
| 2898 | + if (count($mxhosts) > 1) { |
|
| 2899 | + return 1; |
|
| 2900 | + } |
|
| 2901 | + if (count($mxhosts) == 1 && !empty($mxhosts[0])) { |
|
| 2902 | + return 1; |
|
| 2903 | + } |
|
| 2785 | 2904 | |
| 2786 | 2905 | return 0; |
| 2787 | 2906 | } |
@@ -2810,10 +2929,11 @@ discard block |
||
| 2810 | 2929 | */ |
| 2811 | 2930 | static function dol_strlen($string, $stringencoding = 'UTF-8') |
| 2812 | 2931 | {
|
| 2813 | - if (function_exists('mb_strlen'))
|
|
| 2814 | - return mb_strlen($string, $stringencoding); |
|
| 2815 | - else |
|
| 2816 | - return strlen($string); |
|
| 2932 | + if (function_exists('mb_strlen')) { |
|
| 2933 | + return mb_strlen($string, $stringencoding); |
|
| 2934 | + } else { |
|
| 2935 | + return strlen($string); |
|
| 2936 | + } |
|
| 2817 | 2937 | } |
| 2818 | 2938 | |
| 2819 | 2939 | /** |
@@ -2830,8 +2950,9 @@ discard block |
||
| 2830 | 2950 | {
|
| 2831 | 2951 | // global Globals::$langs; |
| 2832 | 2952 | |
| 2833 | - if (empty($stringencoding)) |
|
| 2834 | - $stringencoding = Globals::$langs->charset_output; |
|
| 2953 | + if (empty($stringencoding)) { |
|
| 2954 | + $stringencoding = Globals::$langs->charset_output; |
|
| 2955 | + } |
|
| 2835 | 2956 | |
| 2836 | 2957 | $ret = ''; |
| 2837 | 2958 | if (empty($trunconbytes)) {
|
@@ -2867,48 +2988,55 @@ discard block |
||
| 2867 | 2988 | {
|
| 2868 | 2989 | // global Globals::$conf; |
| 2869 | 2990 | |
| 2870 | - if ($size == 0 || !empty(Globals::$conf->global->MAIN_DISABLE_TRUNC)) |
|
| 2871 | - return $string; |
|
| 2991 | + if ($size == 0 || !empty(Globals::$conf->global->MAIN_DISABLE_TRUNC)) { |
|
| 2992 | + return $string; |
|
| 2993 | + } |
|
| 2872 | 2994 | |
| 2873 | - if (empty($stringencoding)) |
|
| 2874 | - $stringencoding = 'UTF-8'; |
|
| 2875 | -// reduce for small screen |
|
| 2876 | - if (Globals::$conf->dol_optimize_smallscreen == 1 && $display == 1) |
|
| 2877 | - $size = round($size / 3); |
|
| 2995 | + if (empty($stringencoding)) { |
|
| 2996 | + $stringencoding = 'UTF-8'; |
|
| 2997 | + } |
|
| 2998 | + // reduce for small screen |
|
| 2999 | + if (Globals::$conf->dol_optimize_smallscreen == 1 && $display == 1) { |
|
| 3000 | + $size = round($size / 3); |
|
| 3001 | + } |
|
| 2878 | 3002 | |
| 2879 | 3003 | // We go always here |
| 2880 | 3004 | if ($trunc == 'right') {
|
| 2881 | 3005 | $newstring = AlDolUtils::dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
| 2882 | - if (AlDolUtils::dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
|
| 2883 | - return dol_substr($newstring, 0, $size, $stringencoding) . ($nodot ? '' : '...'); |
|
| 2884 | - else |
|
| 2885 | - //return 'u'.$size.'-'.$newstring.'-'.DolUtils::dol_strlen($newstring,$stringencoding).'-'.$string; |
|
| 2886 | - return $string; |
|
| 2887 | - } |
|
| 2888 | - elseif ($trunc == 'middle') {
|
|
| 3006 | + if (AlDolUtils::dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) { |
|
| 3007 | + // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
|
| 3008 | + return dol_substr($newstring, 0, $size, $stringencoding) . ($nodot ? '' : '...'); |
|
| 3009 | + } else { |
|
| 3010 | + //return 'u'.$size.'-'.$newstring.'-'.DolUtils::dol_strlen($newstring,$stringencoding).'-'.$string; |
|
| 3011 | + return $string; |
|
| 3012 | + } |
|
| 3013 | + } elseif ($trunc == 'middle') {
|
|
| 2889 | 3014 | $newstring = AlDolUtils::dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
| 2890 | 3015 | if (AlDolUtils::dol_strlen($newstring, $stringencoding) > 2 && AlDolUtils::dol_strlen($newstring, $stringencoding) > ($size + 1)) {
|
| 2891 | 3016 | $size1 = round($size / 2); |
| 2892 | 3017 | $size2 = round($size / 2); |
| 2893 | 3018 | return dol_substr($newstring, 0, $size1, $stringencoding) . '...' . dol_substr($newstring, AlDolUtils::dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding); |
| 2894 | - } else |
|
| 2895 | - return $string; |
|
| 2896 | - } |
|
| 2897 | - elseif ($trunc == 'left') {
|
|
| 3019 | + } else { |
|
| 3020 | + return $string; |
|
| 3021 | + } |
|
| 3022 | + } elseif ($trunc == 'left') {
|
|
| 2898 | 3023 | $newstring = AlDolUtils::dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
| 2899 | - if (AlDolUtils::dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
|
| 2900 | - return '...' . dol_substr($newstring, AlDolUtils::dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding); |
|
| 2901 | - else |
|
| 2902 | - return $string; |
|
| 2903 | - } |
|
| 2904 | - elseif ($trunc == 'wrap') {
|
|
| 3024 | + if (AlDolUtils::dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3))) { |
|
| 3025 | + // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ... |
|
| 3026 | + return '...' . dol_substr($newstring, AlDolUtils::dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding); |
|
| 3027 | + } else { |
|
| 3028 | + return $string; |
|
| 3029 | + } |
|
| 3030 | + } elseif ($trunc == 'wrap') {
|
|
| 2905 | 3031 | $newstring = AlDolUtils::dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string; |
| 2906 | - if (AlDolUtils::dol_strlen($newstring, $stringencoding) > ($size + 1)) |
|
| 2907 | - return dol_substr($newstring, 0, $size, $stringencoding) . "\n" . dol_trunc(dol_substr($newstring, $size, AlDolUtils::dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc); |
|
| 2908 | - else |
|
| 2909 | - return $string; |
|
| 2910 | - } else |
|
| 2911 | - return 'BadParam3CallingDolTrunc'; |
|
| 3032 | + if (AlDolUtils::dol_strlen($newstring, $stringencoding) > ($size + 1)) { |
|
| 3033 | + return dol_substr($newstring, 0, $size, $stringencoding) . "\n" . dol_trunc(dol_substr($newstring, $size, AlDolUtils::dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc); |
|
| 3034 | + } else { |
|
| 3035 | + return $string; |
|
| 3036 | + } |
|
| 3037 | + } else { |
|
| 3038 | + return 'BadParam3CallingDolTrunc'; |
|
| 3039 | + } |
|
| 2912 | 3040 | } |
| 2913 | 3041 | |
| 2914 | 3042 | /** |
@@ -3118,8 +3246,9 @@ discard block |
||
| 3118 | 3246 | {
|
| 3119 | 3247 | // global Globals::$conf; |
| 3120 | 3248 | |
| 3121 | - if (!preg_match('/(\.png|\.gif)$/i', $picto))
|
|
| 3122 | - $picto .= '.png'; |
|
| 3249 | + if (!preg_match('/(\.png|\.gif)$/i', $picto)) { |
|
| 3250 | + $picto .= '.png'; |
|
| 3251 | + } |
|
| 3123 | 3252 | |
| 3124 | 3253 | //$path = DOL_BASE_URI . '/theme/' . Globals::$conf->theme . '/img/weather/' . $picto; |
| 3125 | 3254 | $path = DOL_BASE_URI . '/theme/' . Globals::$conf->theme . '/img/weather/' . $picto; |
@@ -3195,8 +3324,9 @@ discard block |
||
| 3195 | 3324 | $numaction = 0; |
| 3196 | 3325 | } |
| 3197 | 3326 | } |
| 3198 | - if (!is_numeric($numaction)) |
|
| 3199 | - $numaction = 0; |
|
| 3327 | + if (!is_numeric($numaction)) { |
|
| 3328 | + $numaction = 0; |
|
| 3329 | + } |
|
| 3200 | 3330 | |
| 3201 | 3331 | return img_picto($titlealt, 'stcomm' . $numaction . '.png'); |
| 3202 | 3332 | } |
@@ -3212,8 +3342,9 @@ discard block |
||
| 3212 | 3342 | {
|
| 3213 | 3343 | // global Globals::$conf, Globals::$langs; |
| 3214 | 3344 | |
| 3215 | - if ($titlealt == 'default') |
|
| 3216 | - $titlealt = Globals::$langs->trans('Show');
|
|
| 3345 | + if ($titlealt == 'default') { |
|
| 3346 | + $titlealt = Globals::$langs->trans('Show'); |
|
| 3347 | + } |
|
| 3217 | 3348 | |
| 3218 | 3349 | return img_picto($titlealt, 'pdf' . $size . '.png'); |
| 3219 | 3350 | } |
@@ -3229,8 +3360,9 @@ discard block |
||
| 3229 | 3360 | {
|
| 3230 | 3361 | // global Globals::$conf, Globals::$langs; |
| 3231 | 3362 | |
| 3232 | - if ($titlealt == 'default') |
|
| 3233 | - $titlealt = Globals::$langs->trans('Add');
|
|
| 3363 | + if ($titlealt == 'default') { |
|
| 3364 | + $titlealt = Globals::$langs->trans('Add'); |
|
| 3365 | + } |
|
| 3234 | 3366 | |
| 3235 | 3367 | return img_picto($titlealt, 'edit_add.png', $other); |
| 3236 | 3368 | } |
@@ -3246,8 +3378,9 @@ discard block |
||
| 3246 | 3378 | {
|
| 3247 | 3379 | // global Globals::$conf, Globals::$langs; |
| 3248 | 3380 | |
| 3249 | - if ($titlealt == 'default') |
|
| 3250 | - $titlealt = Globals::$langs->trans('Remove');
|
|
| 3381 | + if ($titlealt == 'default') { |
|
| 3382 | + $titlealt = Globals::$langs->trans('Remove'); |
|
| 3383 | + } |
|
| 3251 | 3384 | |
| 3252 | 3385 | return img_picto($titlealt, 'edit_remove.png', $other); |
| 3253 | 3386 | } |
@@ -3264,8 +3397,9 @@ discard block |
||
| 3264 | 3397 | {
|
| 3265 | 3398 | // global Globals::$conf, Globals::$langs; |
| 3266 | 3399 | |
| 3267 | - if ($titlealt == 'default') |
|
| 3268 | - $titlealt = Globals::$langs->trans('Modify');
|
|
| 3400 | + if ($titlealt == 'default') { |
|
| 3401 | + $titlealt = Globals::$langs->trans('Modify'); |
|
| 3402 | + } |
|
| 3269 | 3403 | |
| 3270 | 3404 | return img_picto($titlealt, 'edit.png', ($float ? 'style="float: ' . (Globals::$langs->tab_translate["DIRECTION"] == 'rtl' ? 'left' : 'right') . '"' : "") . ($other ? ' ' . $other : '')); |
| 3271 | 3405 | } |
@@ -3282,8 +3416,9 @@ discard block |
||
| 3282 | 3416 | {
|
| 3283 | 3417 | // global Globals::$conf, Globals::$langs; |
| 3284 | 3418 | |
| 3285 | - if ($titlealt == 'default') |
|
| 3286 | - $titlealt = Globals::$langs->trans('View');
|
|
| 3419 | + if ($titlealt == 'default') { |
|
| 3420 | + $titlealt = Globals::$langs->trans('View'); |
|
| 3421 | + } |
|
| 3287 | 3422 | |
| 3288 | 3423 | $moreatt = ($float ? 'style="float: right" ' : '') . $other; |
| 3289 | 3424 | |
@@ -3301,8 +3436,9 @@ discard block |
||
| 3301 | 3436 | {
|
| 3302 | 3437 | // global Globals::$conf, Globals::$langs; |
| 3303 | 3438 | |
| 3304 | - if ($titlealt == 'default') |
|
| 3305 | - $titlealt = Globals::$langs->trans('Delete');
|
|
| 3439 | + if ($titlealt == 'default') { |
|
| 3440 | + $titlealt = Globals::$langs->trans('Delete'); |
|
| 3441 | + } |
|
| 3306 | 3442 | |
| 3307 | 3443 | return img_picto($titlealt, 'delete.png', $other); |
| 3308 | 3444 | //return '<span class="fa fa-trash fa-2x fa-fw" style="font-size: 1.7em;" title="'.$titlealt.'"></span>'; |
@@ -3318,8 +3454,9 @@ discard block |
||
| 3318 | 3454 | static function img_printer($titlealt = "default", $other = '') |
| 3319 | 3455 | {
|
| 3320 | 3456 | // global Globals::$conf, Globals::$langs; |
| 3321 | - if ($titlealt == "default") |
|
| 3322 | - $titlealt = Globals::$langs->trans("Print");
|
|
| 3457 | + if ($titlealt == "default") { |
|
| 3458 | + $titlealt = Globals::$langs->trans("Print"); |
|
| 3459 | + } |
|
| 3323 | 3460 | return img_picto($titlealt, 'printer.png', $other); |
| 3324 | 3461 | } |
| 3325 | 3462 | |
@@ -3334,8 +3471,9 @@ discard block |
||
| 3334 | 3471 | {
|
| 3335 | 3472 | // global Globals::$conf, Globals::$langs; |
| 3336 | 3473 | |
| 3337 | - if ($titlealt == 'default') |
|
| 3338 | - $titlealt = Globals::$langs->trans('Split');
|
|
| 3474 | + if ($titlealt == 'default') { |
|
| 3475 | + $titlealt = Globals::$langs->trans('Split'); |
|
| 3476 | + } |
|
| 3339 | 3477 | |
| 3340 | 3478 | return img_picto($titlealt, 'split.png', $other); |
| 3341 | 3479 | } |
@@ -3352,10 +3490,11 @@ discard block |
||
| 3352 | 3490 | // global Globals::$conf, Globals::$langs; |
| 3353 | 3491 | |
| 3354 | 3492 | if ($usealttitle) {
|
| 3355 | - if (is_string($usealttitle)) |
|
| 3356 | - $usealttitle = AlDolUtils::dol_escape_htmltag($usealttitle); |
|
| 3357 | - else |
|
| 3358 | - $usealttitle = Globals::$langs->trans('Info');
|
|
| 3493 | + if (is_string($usealttitle)) { |
|
| 3494 | + $usealttitle = AlDolUtils::dol_escape_htmltag($usealttitle); |
|
| 3495 | + } else { |
|
| 3496 | + $usealttitle = Globals::$langs->trans('Info'); |
|
| 3497 | + } |
|
| 3359 | 3498 | } |
| 3360 | 3499 | |
| 3361 | 3500 | return img_picto($usealttitle, 'info.png', 'style="vertical-align: middle;' . ($usehelpcursor == 1 ? ' cursor: help' : ($usehelpcursor == 2 ? ' cursor: pointer' : '')) . '"'); |
@@ -3371,8 +3510,9 @@ discard block |
||
| 3371 | 3510 | {
|
| 3372 | 3511 | // global Globals::$conf, Globals::$langs; |
| 3373 | 3512 | |
| 3374 | - if ($titlealt == 'default') |
|
| 3375 | - $titlealt = Globals::$langs->trans('Informations');
|
|
| 3513 | + if ($titlealt == 'default') { |
|
| 3514 | + $titlealt = Globals::$langs->trans('Informations'); |
|
| 3515 | + } |
|
| 3376 | 3516 | |
| 3377 | 3517 | return img_picto($titlealt, 'info.png', 'style="vertical-align: middle;"'); |
| 3378 | 3518 | } |
@@ -3388,8 +3528,9 @@ discard block |
||
| 3388 | 3528 | {
|
| 3389 | 3529 | // global Globals::$conf, Globals::$langs; |
| 3390 | 3530 | |
| 3391 | - if ($titlealt == 'default') |
|
| 3392 | - $titlealt = Globals::$langs->trans('Warning');
|
|
| 3531 | + if ($titlealt == 'default') { |
|
| 3532 | + $titlealt = Globals::$langs->trans('Warning'); |
|
| 3533 | + } |
|
| 3393 | 3534 | |
| 3394 | 3535 | //return '<div class="imglatecoin">'.img_picto($titlealt, 'warning_white.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')).'</div>'; |
| 3395 | 3536 | return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"' . ($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' ' . $moreatt) : '')); |
@@ -3405,8 +3546,9 @@ discard block |
||
| 3405 | 3546 | {
|
| 3406 | 3547 | // global Globals::$conf, Globals::$langs; |
| 3407 | 3548 | |
| 3408 | - if ($titlealt == 'default') |
|
| 3409 | - $titlealt = Globals::$langs->trans('Error');
|
|
| 3549 | + if ($titlealt == 'default') { |
|
| 3550 | + $titlealt = Globals::$langs->trans('Error'); |
|
| 3551 | + } |
|
| 3410 | 3552 | |
| 3411 | 3553 | return img_picto($titlealt, 'error.png', 'class="valigntextbottom"'); |
| 3412 | 3554 | } |
@@ -3422,8 +3564,9 @@ discard block |
||
| 3422 | 3564 | {
|
| 3423 | 3565 | // global Globals::$conf, Globals::$langs; |
| 3424 | 3566 | |
| 3425 | - if ($titlealt == 'default') |
|
| 3426 | - $titlealt = Globals::$langs->trans('Next');
|
|
| 3567 | + if ($titlealt == 'default') { |
|
| 3568 | + $titlealt = Globals::$langs->trans('Next'); |
|
| 3569 | + } |
|
| 3427 | 3570 | |
| 3428 | 3571 | //return img_picto($titlealt, 'next.png', $moreatt); |
| 3429 | 3572 | return '<span class="fa fa-chevron-right paddingright paddingleft" title="' . AlDolUtils::dol_escape_htmltag($titlealt) . '"></span>'; |
@@ -3440,8 +3583,9 @@ discard block |
||
| 3440 | 3583 | {
|
| 3441 | 3584 | // global Globals::$conf, Globals::$langs; |
| 3442 | 3585 | |
| 3443 | - if ($titlealt == 'default') |
|
| 3444 | - $titlealt = Globals::$langs->trans('Previous');
|
|
| 3586 | + if ($titlealt == 'default') { |
|
| 3587 | + $titlealt = Globals::$langs->trans('Previous'); |
|
| 3588 | + } |
|
| 3445 | 3589 | |
| 3446 | 3590 | //return img_picto($titlealt, 'previous.png', $moreatt); |
| 3447 | 3591 | return '<span class="fa fa-chevron-left paddingright paddingleft" title="' . AlDolUtils::dol_escape_htmltag($titlealt) . '"></span>'; |
@@ -3459,8 +3603,9 @@ discard block |
||
| 3459 | 3603 | {
|
| 3460 | 3604 | // global Globals::$conf, Globals::$langs; |
| 3461 | 3605 | |
| 3462 | - if ($titlealt == 'default') |
|
| 3463 | - $titlealt = Globals::$langs->trans('Down');
|
|
| 3606 | + if ($titlealt == 'default') { |
|
| 3607 | + $titlealt = Globals::$langs->trans('Down'); |
|
| 3608 | + } |
|
| 3464 | 3609 | |
| 3465 | 3610 | return img_picto($titlealt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown' . ($moreclass ? " " . $moreclass : "") . '"'); |
| 3466 | 3611 | } |
@@ -3477,8 +3622,9 @@ discard block |
||
| 3477 | 3622 | {
|
| 3478 | 3623 | // global Globals::$conf, Globals::$langs; |
| 3479 | 3624 | |
| 3480 | - if ($titlealt == 'default') |
|
| 3481 | - $titlealt = Globals::$langs->trans('Up');
|
|
| 3625 | + if ($titlealt == 'default') { |
|
| 3626 | + $titlealt = Globals::$langs->trans('Up'); |
|
| 3627 | + } |
|
| 3482 | 3628 | |
| 3483 | 3629 | return img_picto($titlealt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup' . ($moreclass ? " " . $moreclass : "") . '"'); |
| 3484 | 3630 | } |
@@ -3495,8 +3641,9 @@ discard block |
||
| 3495 | 3641 | {
|
| 3496 | 3642 | // global Globals::$conf, Globals::$langs; |
| 3497 | 3643 | |
| 3498 | - if ($titlealt == 'default') |
|
| 3499 | - $titlealt = Globals::$langs->trans('Left');
|
|
| 3644 | + if ($titlealt == 'default') { |
|
| 3645 | + $titlealt = Globals::$langs->trans('Left'); |
|
| 3646 | + } |
|
| 3500 | 3647 | |
| 3501 | 3648 | return img_picto($titlealt, ($selected ? '1leftarrow_selected.png' : '1leftarrow.png'), $moreatt); |
| 3502 | 3649 | } |
@@ -3513,8 +3660,9 @@ discard block |
||
| 3513 | 3660 | {
|
| 3514 | 3661 | // global Globals::$conf, Globals::$langs; |
| 3515 | 3662 | |
| 3516 | - if ($titlealt == 'default') |
|
| 3517 | - $titlealt = Globals::$langs->trans('Right');
|
|
| 3663 | + if ($titlealt == 'default') { |
|
| 3664 | + $titlealt = Globals::$langs->trans('Right'); |
|
| 3665 | + } |
|
| 3518 | 3666 | |
| 3519 | 3667 | return img_picto($titlealt, ($selected ? '1rightarrow_selected.png' : '1rightarrow.png'), $moreatt); |
| 3520 | 3668 | } |
@@ -3530,11 +3678,13 @@ discard block |
||
| 3530 | 3678 | {
|
| 3531 | 3679 | // global Globals::$conf, Globals::$langs; |
| 3532 | 3680 | |
| 3533 | - if ($titlealt == 'default') |
|
| 3534 | - $titlealt = Globals::$langs->trans('Active');
|
|
| 3681 | + if ($titlealt == 'default') { |
|
| 3682 | + $titlealt = Globals::$langs->trans('Active'); |
|
| 3683 | + } |
|
| 3535 | 3684 | |
| 3536 | - if ($allow == 1) |
|
| 3537 | - return img_picto($titlealt, 'tick.png'); |
|
| 3685 | + if ($allow == 1) { |
|
| 3686 | + return img_picto($titlealt, 'tick.png'); |
|
| 3687 | + } |
|
| 3538 | 3688 | |
| 3539 | 3689 | return '-'; |
| 3540 | 3690 | } |
@@ -3582,8 +3732,9 @@ discard block |
||
| 3582 | 3732 | $mimeimg = dol_mimetype($file, '', 2); |
| 3583 | 3733 | $mimefa = dol_mimetype($file, '', 4); |
| 3584 | 3734 | |
| 3585 | - if (empty($titlealt)) |
|
| 3586 | - $titlealt = 'Mime type: ' . $mimetype; |
|
| 3735 | + if (empty($titlealt)) { |
|
| 3736 | + $titlealt = 'Mime type: ' . $mimetype; |
|
| 3737 | + } |
|
| 3587 | 3738 | |
| 3588 | 3739 | //return img_picto_common($titlealt, 'mime/'.$mimeimg, 'class="'.$morecss.'"'); |
| 3589 | 3740 | return '<i class="fa fa-' . $mimefa . ' paddingright"></i>'; |
@@ -3605,13 +3756,15 @@ discard block |
||
| 3605 | 3756 | |
| 3606 | 3757 | // global Globals::$conf, Globals::$langs; |
| 3607 | 3758 | |
| 3608 | - if ($titlealt == 'default') |
|
| 3609 | - $titlealt = Globals::$langs->trans('Call');
|
|
| 3759 | + if ($titlealt == 'default') { |
|
| 3760 | + $titlealt = Globals::$langs->trans('Call'); |
|
| 3761 | + } |
|
| 3610 | 3762 | |
| 3611 | - if ($option == 1) |
|
| 3612 | - $img = 'call'; |
|
| 3613 | - else |
|
| 3614 | - $img = 'call_out'; |
|
| 3763 | + if ($option == 1) { |
|
| 3764 | + $img = 'call'; |
|
| 3765 | + } else { |
|
| 3766 | + $img = 'call_out'; |
|
| 3767 | + } |
|
| 3615 | 3768 | |
| 3616 | 3769 | return img_picto($titlealt, $img); |
| 3617 | 3770 | } |
@@ -3627,8 +3780,9 @@ discard block |
||
| 3627 | 3780 | {
|
| 3628 | 3781 | // global Globals::$conf, Globals::$langs; |
| 3629 | 3782 | |
| 3630 | - if ($titlealt == 'default') |
|
| 3631 | - $titlealt = Globals::$langs->trans('Search');
|
|
| 3783 | + if ($titlealt == 'default') { |
|
| 3784 | + $titlealt = Globals::$langs->trans('Search'); |
|
| 3785 | + } |
|
| 3632 | 3786 | |
| 3633 | 3787 | $img = img_picto($titlealt, 'search.png', $other, false, 1); |
| 3634 | 3788 | |
@@ -3649,8 +3803,9 @@ discard block |
||
| 3649 | 3803 | {
|
| 3650 | 3804 | // global Globals::$conf, Globals::$langs; |
| 3651 | 3805 | |
| 3652 | - if ($titlealt == 'default') |
|
| 3653 | - $titlealt = Globals::$langs->trans('Search');
|
|
| 3806 | + if ($titlealt == 'default') { |
|
| 3807 | + $titlealt = Globals::$langs->trans('Search'); |
|
| 3808 | + } |
|
| 3654 | 3809 | |
| 3655 | 3810 | $img = img_picto($titlealt, 'searchclear.png', $other, false, 1); |
| 3656 | 3811 | |
@@ -4078,12 +4233,15 @@ discard block |
||
| 4078 | 4233 | $savtotalnboflines = $totalnboflines; |
| 4079 | 4234 | $totalnboflines = abs($totalnboflines); |
| 4080 | 4235 | |
| 4081 | - if ($picto == 'setup') |
|
| 4082 | - $picto = 'title_setup.png'; |
|
| 4083 | - if ((Globals::$conf->browser->name == 'ie') && $picto == 'title_generic.png') |
|
| 4084 | - $picto = 'title.gif'; |
|
| 4085 | - if ($limit < 0) |
|
| 4086 | - $limit = Globals::$conf->liste_limit; |
|
| 4236 | + if ($picto == 'setup') { |
|
| 4237 | + $picto = 'title_setup.png'; |
|
| 4238 | + } |
|
| 4239 | + if ((Globals::$conf->browser->name == 'ie') && $picto == 'title_generic.png') { |
|
| 4240 | + $picto = 'title.gif'; |
|
| 4241 | + } |
|
| 4242 | + if ($limit < 0) { |
|
| 4243 | + $limit = Globals::$conf->liste_limit; |
|
| 4244 | + } |
|
| 4087 | 4245 | if ($savlimit != 0 && (($num > $limit) || ($num == -1) || ($limit == 0))) {
|
| 4088 | 4246 | $nextpage = 1; |
| 4089 | 4247 | } else {
|
@@ -4097,11 +4255,13 @@ discard block |
||
| 4097 | 4255 | // Left |
| 4098 | 4256 | //if ($picto && $titre) print '<td class="nobordernopadding hideonsmartphone" width="40" align="left" valign="middle">'.img_picto('', $picto, 'id="pictotitle"', $pictoisfullpath).'</td>';
|
| 4099 | 4257 | print '<td class="nobordernopadding valignmiddle">'; |
| 4100 | - if ($picto && $titre) |
|
| 4101 | - print img_picto('', $picto, 'class="hideonsmartphone valignmiddle opacityhigh pictotitle widthpictotitle"', $pictoisfullpath);
|
|
| 4258 | + if ($picto && $titre) { |
|
| 4259 | + print img_picto('', $picto, 'class="hideonsmartphone valignmiddle opacityhigh pictotitle widthpictotitle"', $pictoisfullpath); |
|
| 4260 | + } |
|
| 4102 | 4261 | print '<div class="titre inline-block">' . $titre; |
| 4103 | - if (!empty($titre) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') |
|
| 4104 | - print ' (' . $totalnboflines . ')';
|
|
| 4262 | + if (!empty($titre) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') { |
|
| 4263 | + print ' (' . $totalnboflines . ')'; |
|
| 4264 | + } |
|
| 4105 | 4265 | print '</div></td>'; |
| 4106 | 4266 | |
| 4107 | 4267 | // Center |
@@ -4111,21 +4271,24 @@ discard block |
||
| 4111 | 4271 | |
| 4112 | 4272 | // Right |
| 4113 | 4273 | print '<td class="nobordernopadding valignmiddle" align="right">'; |
| 4114 | - if ($sortfield) |
|
| 4115 | - $options .= "&sortfield=" . urlencode($sortfield); |
|
| 4116 | - if ($sortorder) |
|
| 4117 | - $options .= "&sortorder=" . urlencode($sortorder); |
|
| 4118 | -// Show navigation bar |
|
| 4274 | + if ($sortfield) { |
|
| 4275 | + $options .= "&sortfield=" . urlencode($sortfield); |
|
| 4276 | + } |
|
| 4277 | + if ($sortorder) { |
|
| 4278 | + $options .= "&sortorder=" . urlencode($sortorder); |
|
| 4279 | + } |
|
| 4280 | + // Show navigation bar |
|
| 4119 | 4281 | $pagelist = ''; |
| 4120 | 4282 | if ($savlimit != 0 && ($page > 0 || $num > $limit)) {
|
| 4121 | 4283 | if ($totalnboflines) { // If we know total nb of lines
|
| 4122 | 4284 | // Define nb of extra page links before and after selected page + ... + first or last |
| 4123 | 4285 | $maxnbofpage = (empty(Globals::$conf->dol_optimize_smallscreen) ? 4 : 1); |
| 4124 | 4286 | |
| 4125 | - if ($limit > 0) |
|
| 4126 | - $nbpages = ceil($totalnboflines / $limit); |
|
| 4127 | - else |
|
| 4128 | - $nbpages = 1; |
|
| 4287 | + if ($limit > 0) { |
|
| 4288 | + $nbpages = ceil($totalnboflines / $limit); |
|
| 4289 | + } else { |
|
| 4290 | + $nbpages = 1; |
|
| 4291 | + } |
|
| 4129 | 4292 | $cpt = ($page - $maxnbofpage); |
| 4130 | 4293 | if ($cpt < 0) {
|
| 4131 | 4294 | $cpt = 0; |
@@ -4133,10 +4296,11 @@ discard block |
||
| 4133 | 4296 | |
| 4134 | 4297 | if ($cpt >= 1) {
|
| 4135 | 4298 | $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=0' . $options . '">1</a></li>'; |
| 4136 | - if ($cpt > 2) |
|
| 4137 | - $pagelist .= '<li' . ( (Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . ((Globals::$conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
| 4138 | - else if ($cpt == 2) |
|
| 4139 | - $pagelist .= '<li' . ( (Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=1' . $options . '">2</a></li>'; |
|
| 4299 | + if ($cpt > 2) { |
|
| 4300 | + $pagelist .= '<li' . ( (Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . ((Globals::$conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
| 4301 | + } else if ($cpt == 2) { |
|
| 4302 | + $pagelist .= '<li' . ( (Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=1' . $options . '">2</a></li>'; |
|
| 4303 | + } |
|
| 4140 | 4304 | } |
| 4141 | 4305 | |
| 4142 | 4306 | do {
|
@@ -4149,14 +4313,14 @@ discard block |
||
| 4149 | 4313 | } while ($cpt < $nbpages && $cpt <= $page + $maxnbofpage); |
| 4150 | 4314 | |
| 4151 | 4315 | if ($cpt < $nbpages) {
|
| 4152 | - if ($cpt < $nbpages - 2) |
|
| 4153 | - $pagelist .= '<li' . ( (Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . ((Globals::$conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
| 4154 | - else if ($cpt == $nbpages - 2) |
|
| 4155 | - $pagelist .= '<li' . ( (Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 2) . $options . '">' . ($nbpages - 1) . '</a></li>'; |
|
| 4316 | + if ($cpt < $nbpages - 2) { |
|
| 4317 | + $pagelist .= '<li' . ( (Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . ((Globals::$conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>'; |
|
| 4318 | + } else if ($cpt == $nbpages - 2) { |
|
| 4319 | + $pagelist .= '<li' . ( (Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 2) . $options . '">' . ($nbpages - 1) . '</a></li>'; |
|
| 4320 | + } |
|
| 4156 | 4321 | $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 1) . $options . '">' . $nbpages . '</a></li>'; |
| 4157 | 4322 | } |
| 4158 | - } |
|
| 4159 | - else {
|
|
| 4323 | + } else {
|
|
| 4160 | 4324 | $pagelist .= '<li' . ((Globals::$conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . ((Globals::$conf->dol_use_jmobile != 4) ? 'class="active"' : '') . '>' . ($page + 1) . "</li>"; |
| 4161 | 4325 | } |
| 4162 | 4326 | } |
@@ -4192,18 +4356,21 @@ discard block |
||
| 4192 | 4356 | $pagesizechoices = '10:10,15:15,20:20,30:30,40:40,50:50,100:100,250:250,500:500,1000:1000,5000:5000'; |
| 4193 | 4357 | //$pagesizechoices.=',0:'.Globals::$langs->trans("All"); // Not yet supported
|
| 4194 | 4358 | //$pagesizechoices.=',2:2'; |
| 4195 | - if (!empty(Globals::$conf->global->MAIN_PAGESIZE_CHOICES)) |
|
| 4196 | - $pagesizechoices = Globals::$conf->global->MAIN_PAGESIZE_CHOICES; |
|
| 4359 | + if (!empty(Globals::$conf->global->MAIN_PAGESIZE_CHOICES)) { |
|
| 4360 | + $pagesizechoices = Globals::$conf->global->MAIN_PAGESIZE_CHOICES; |
|
| 4361 | + } |
|
| 4197 | 4362 | |
| 4198 | 4363 | print '<li class="pagination">'; |
| 4199 | 4364 | print '<select class="flat selectlimit" name="limit" title="' . AlDolUtils::dol_escape_htmltag(Globals::$langs->trans("MaxNbOfRecordPerPage")) . '">';
|
| 4200 | 4365 | $tmpchoice = explode(',', $pagesizechoices);
|
| 4201 | 4366 | $tmpkey = $limit . ':' . $limit; |
| 4202 | - if (!in_array($tmpkey, $tmpchoice)) |
|
| 4203 | - $tmpchoice[] = $tmpkey; |
|
| 4367 | + if (!in_array($tmpkey, $tmpchoice)) { |
|
| 4368 | + $tmpchoice[] = $tmpkey; |
|
| 4369 | + } |
|
| 4204 | 4370 | $tmpkey = Globals::$conf->liste_limit . ':' . Globals::$conf->liste_limit; |
| 4205 | - if (!in_array($tmpkey, $tmpchoice)) |
|
| 4206 | - $tmpchoice[] = $tmpkey; |
|
| 4371 | + if (!in_array($tmpkey, $tmpchoice)) { |
|
| 4372 | + $tmpchoice[] = $tmpkey; |
|
| 4373 | + } |
|
| 4207 | 4374 | asort($tmpchoice, SORT_NUMERIC); |
| 4208 | 4375 | $found = false; |
| 4209 | 4376 | foreach ($tmpchoice as $val) {
|
@@ -4279,14 +4446,15 @@ discard block |
||
| 4279 | 4446 | } |
| 4280 | 4447 | |
| 4281 | 4448 | // If rate is '9/9/9' we don't change it. If rate is '9.000' we apply price() |
| 4282 | - if (!preg_match('/\//', $rate))
|
|
| 4283 | - $ret = price($rate, 0, '', 0, 0) . ($addpercent ? '%' : ''); |
|
| 4284 | - else {
|
|
| 4449 | + if (!preg_match('/\//', $rate)) { |
|
| 4450 | + $ret = price($rate, 0, '', 0, 0) . ($addpercent ? '%' : ''); |
|
| 4451 | + } else {
|
|
| 4285 | 4452 | // TODO Split on / and output with a price2num to have clean numbers without ton of 000. |
| 4286 | 4453 | $ret = $rate . ($addpercent ? '%' : ''); |
| 4287 | 4454 | } |
| 4288 | - if (($info_bits & 1) && $usestarfornpr >= 0) |
|
| 4289 | - $ret .= ' *'; |
|
| 4455 | + if (($info_bits & 1) && $usestarfornpr >= 0) { |
|
| 4456 | + $ret .= ' *'; |
|
| 4457 | + } |
|
| 4290 | 4458 | $ret .= $morelabel; |
| 4291 | 4459 | return $ret; |
| 4292 | 4460 | } |
@@ -4310,11 +4478,14 @@ discard block |
||
| 4310 | 4478 | {
|
| 4311 | 4479 | // global Globals::$langs, Globals::$conf; |
| 4312 | 4480 | // Clean parameters |
| 4313 | - if (empty($amount)) |
|
| 4314 | - $amount = 0; // To have a numeric value if amount not defined or = '' |
|
| 4481 | + if (empty($amount)) { |
|
| 4482 | + $amount = 0; |
|
| 4483 | + } |
|
| 4484 | + // To have a numeric value if amount not defined or = '' |
|
| 4315 | 4485 | $amount = (is_numeric($amount) ? $amount : 0); // Check if amount is numeric, for example, an error occured when amount value = o (letter) instead 0 (number) |
| 4316 | - if ($rounding < 0) |
|
| 4317 | - $rounding = min(Globals::$conf->global->MAIN_MAX_DECIMALS_UNIT, Globals::$conf->global->MAIN_MAX_DECIMALS_TOT); |
|
| 4486 | + if ($rounding < 0) { |
|
| 4487 | + $rounding = min(Globals::$conf->global->MAIN_MAX_DECIMALS_UNIT, Globals::$conf->global->MAIN_MAX_DECIMALS_TOT); |
|
| 4488 | + } |
|
| 4318 | 4489 | $nbdecimal = $rounding; |
| 4319 | 4490 | |
| 4320 | 4491 | // Output separators by default (french) |
@@ -4322,18 +4493,22 @@ discard block |
||
| 4322 | 4493 | $thousand = ' '; |
| 4323 | 4494 | |
| 4324 | 4495 | // If $outlangs not forced, we use use language |
| 4325 | - if (!is_object($outlangs)) |
|
| 4326 | - $outlangs = Globals::$langs; |
|
| 4327 | - |
|
| 4328 | - if ($outlangs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal")
|
|
| 4329 | - $dec = $outlangs->transnoentitiesnoconv("SeparatorDecimal");
|
|
| 4330 | - if ($outlangs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand")
|
|
| 4331 | - $thousand = $outlangs->transnoentitiesnoconv("SeparatorThousand");
|
|
| 4332 | - if ($thousand == 'None') |
|
| 4333 | - $thousand = ''; |
|
| 4334 | - else if ($thousand == 'Space') |
|
| 4335 | - $thousand = ' '; |
|
| 4336 | -//print "outlangs=".$outlangs->defaultlang." amount=".$amount." html=".$form." trunc=".$trunc." nbdecimal=".$nbdecimal." dec='".$dec."' thousand='".$thousand."'<br>"; |
|
| 4496 | + if (!is_object($outlangs)) { |
|
| 4497 | + $outlangs = Globals::$langs; |
|
| 4498 | + } |
|
| 4499 | + |
|
| 4500 | + if ($outlangs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") { |
|
| 4501 | + $dec = $outlangs->transnoentitiesnoconv("SeparatorDecimal"); |
|
| 4502 | + } |
|
| 4503 | + if ($outlangs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") { |
|
| 4504 | + $thousand = $outlangs->transnoentitiesnoconv("SeparatorThousand"); |
|
| 4505 | + } |
|
| 4506 | + if ($thousand == 'None') { |
|
| 4507 | + $thousand = ''; |
|
| 4508 | + } else if ($thousand == 'Space') { |
|
| 4509 | + $thousand = ' '; |
|
| 4510 | + } |
|
| 4511 | + //print "outlangs=".$outlangs->defaultlang." amount=".$amount." html=".$form." trunc=".$trunc." nbdecimal=".$nbdecimal." dec='".$dec."' thousand='".$thousand."'<br>"; |
|
| 4337 | 4512 | //print "amount=".$amount."-"; |
| 4338 | 4513 | $amount = str_replace(',', '.', $amount); // should be useless
|
| 4339 | 4514 | //print $amount."-"; |
@@ -4344,9 +4519,10 @@ discard block |
||
| 4344 | 4519 | $end = ''; |
| 4345 | 4520 | |
| 4346 | 4521 | // We increase nbdecimal if there is more decimal than asked (to not loose information) |
| 4347 | - if (AlDolUtils::dol_strlen($decpart) > $nbdecimal) |
|
| 4348 | - $nbdecimal = AlDolUtils::dol_strlen($decpart); |
|
| 4349 | -// Si on depasse max |
|
| 4522 | + if (AlDolUtils::dol_strlen($decpart) > $nbdecimal) { |
|
| 4523 | + $nbdecimal = AlDolUtils::dol_strlen($decpart); |
|
| 4524 | + } |
|
| 4525 | + // Si on depasse max |
|
| 4350 | 4526 | if ($trunc && $nbdecimal > Globals::$conf->global->MAIN_MAX_DECIMALS_SHOWN) {
|
| 4351 | 4527 | $nbdecimal = Globals::$conf->global->MAIN_MAX_DECIMALS_SHOWN; |
| 4352 | 4528 | if (preg_match('/\.\.\./i', Globals::$conf->global->MAIN_MAX_DECIMALS_SHOWN)) {
|
@@ -4356,8 +4532,9 @@ discard block |
||
| 4356 | 4532 | } |
| 4357 | 4533 | |
| 4358 | 4534 | // If force rounding |
| 4359 | - if ($forcerounding >= 0) |
|
| 4360 | - $nbdecimal = $forcerounding; |
|
| 4535 | + if ($forcerounding >= 0) { |
|
| 4536 | + $nbdecimal = $forcerounding; |
|
| 4537 | + } |
|
| 4361 | 4538 | |
| 4362 | 4539 | // Format number |
| 4363 | 4540 | $output = number_format($amount, $nbdecimal, $dec, $thousand); |
@@ -4368,13 +4545,14 @@ discard block |
||
| 4368 | 4545 | // Add symbol of currency if requested |
| 4369 | 4546 | $cursymbolbefore = $cursymbolafter = ''; |
| 4370 | 4547 | if ($currency_code) {
|
| 4371 | - if ($currency_code == 'auto') |
|
| 4372 | - $currency_code = Globals::$conf->currency; |
|
| 4548 | + if ($currency_code == 'auto') { |
|
| 4549 | + $currency_code = Globals::$conf->currency; |
|
| 4550 | + } |
|
| 4373 | 4551 | |
| 4374 | 4552 | $listofcurrenciesbefore = array('USD', 'GBP', 'AUD', 'MXN', 'PEN', 'CNY');
|
| 4375 | - if (in_array($currency_code, $listofcurrenciesbefore)) |
|
| 4376 | - $cursymbolbefore .= $outlangs->getCurrencySymbol($currency_code); |
|
| 4377 | - else {
|
|
| 4553 | + if (in_array($currency_code, $listofcurrenciesbefore)) { |
|
| 4554 | + $cursymbolbefore .= $outlangs->getCurrencySymbol($currency_code); |
|
| 4555 | + } else {
|
|
| 4378 | 4556 | $tmpcur = $outlangs->getCurrencySymbol($currency_code); |
| 4379 | 4557 | $cursymbolafter .= ($tmpcur == $currency_code ? ' ' . $tmpcur : $tmpcur); |
| 4380 | 4558 | } |
@@ -4407,15 +4585,18 @@ discard block |
||
| 4407 | 4585 | // Decimal delimiter for PHP and database SQL requests must be '.' |
| 4408 | 4586 | $dec = ','; |
| 4409 | 4587 | $thousand = ' '; |
| 4410 | - if (Globals::$langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal")
|
|
| 4411 | - $dec = Globals::$langs->transnoentitiesnoconv("SeparatorDecimal");
|
|
| 4412 | - if (Globals::$langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand")
|
|
| 4413 | - $thousand = Globals::$langs->transnoentitiesnoconv("SeparatorThousand");
|
|
| 4414 | - if ($thousand == 'None') |
|
| 4415 | - $thousand = ''; |
|
| 4416 | - elseif ($thousand == 'Space') |
|
| 4417 | - $thousand = ' '; |
|
| 4418 | -//print "amount=".$amount." html=".$form." trunc=".$trunc." nbdecimal=".$nbdecimal." dec='".$dec."' thousand='".$thousand."'<br>"; |
|
| 4588 | + if (Globals::$langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") { |
|
| 4589 | + $dec = Globals::$langs->transnoentitiesnoconv("SeparatorDecimal"); |
|
| 4590 | + } |
|
| 4591 | + if (Globals::$langs->transnoentitiesnoconv("SeparatorThousand") != "SeparatorThousand") { |
|
| 4592 | + $thousand = Globals::$langs->transnoentitiesnoconv("SeparatorThousand"); |
|
| 4593 | + } |
|
| 4594 | + if ($thousand == 'None') { |
|
| 4595 | + $thousand = ''; |
|
| 4596 | + } elseif ($thousand == 'Space') { |
|
| 4597 | + $thousand = ' '; |
|
| 4598 | + } |
|
| 4599 | + //print "amount=".$amount." html=".$form." trunc=".$trunc." nbdecimal=".$nbdecimal." dec='".$dec."' thousand='".$thousand."'<br>"; |
|
| 4419 | 4600 | // Convert value to universal number format (no thousand separator, '.' as decimal separator) |
| 4420 | 4601 | if ($alreadysqlnb != 1) { // If not a PHP number or unknown, we change format
|
| 4421 | 4602 | //print 'PP'.$amount.' - '.$dec.' - '.$thousand.' - '.intval($amount).'<br>'; |
@@ -4430,8 +4611,10 @@ discard block |
||
| 4430 | 4611 | } |
| 4431 | 4612 | //print "QQ".$amount.'<br>'; |
| 4432 | 4613 | // Now make replace (the main goal of function) |
| 4433 | - if ($thousand != ',' && $thousand != '.') |
|
| 4434 | - $amount = str_replace(',', '.', $amount); // To accept 2 notations for french users
|
|
| 4614 | + if ($thousand != ',' && $thousand != '.') { |
|
| 4615 | + $amount = str_replace(',', '.', $amount); |
|
| 4616 | + } |
|
| 4617 | + // To accept 2 notations for french users |
|
| 4435 | 4618 | $amount = str_replace(' ', '', $amount); // To avoid spaces
|
| 4436 | 4619 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
| 4437 | 4620 | $amount = str_replace($dec, '.', $amount); |
@@ -4440,20 +4623,24 @@ discard block |
||
| 4440 | 4623 | // Now, make a rounding if required |
| 4441 | 4624 | if ($rounding) {
|
| 4442 | 4625 | $nbofdectoround = ''; |
| 4443 | - if ($rounding == 'MU') |
|
| 4444 | - $nbofdectoround = Globals::$conf->global->MAIN_MAX_DECIMALS_UNIT; |
|
| 4445 | - elseif ($rounding == 'MT') |
|
| 4446 | - $nbofdectoround = Globals::$conf->global->MAIN_MAX_DECIMALS_TOT; |
|
| 4447 | - elseif ($rounding == 'MS') |
|
| 4448 | - $nbofdectoround = empty(Globals::$conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : Globals::$conf->global->MAIN_MAX_DECIMALS_STOCK; |
|
| 4449 | - elseif (is_numeric($rounding)) |
|
| 4450 | - $nbofdectoround = $rounding; |
|
| 4451 | -//print "RR".$amount.' - '.$nbofdectoround.'<br>'; |
|
| 4452 | - if (AlDolUtils::dol_strlen($nbofdectoround)) |
|
| 4453 | - $amount = round($amount, $nbofdectoround); // $nbofdectoround can be 0. |
|
| 4454 | - else |
|
| 4455 | - return 'ErrorBadParameterProvidedToFunction'; |
|
| 4456 | -//print 'SS'.$amount.' - '.$nbofdec.' - '.$dec.' - '.$thousand.' - '.$nbofdectoround.'<br>'; |
|
| 4626 | + if ($rounding == 'MU') { |
|
| 4627 | + $nbofdectoround = Globals::$conf->global->MAIN_MAX_DECIMALS_UNIT; |
|
| 4628 | + } elseif ($rounding == 'MT') { |
|
| 4629 | + $nbofdectoround = Globals::$conf->global->MAIN_MAX_DECIMALS_TOT; |
|
| 4630 | + } elseif ($rounding == 'MS') { |
|
| 4631 | + $nbofdectoround = empty(Globals::$conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : Globals::$conf->global->MAIN_MAX_DECIMALS_STOCK; |
|
| 4632 | + } elseif (is_numeric($rounding)) { |
|
| 4633 | + $nbofdectoround = $rounding; |
|
| 4634 | + } |
|
| 4635 | + //print "RR".$amount.' - '.$nbofdectoround.'<br>'; |
|
| 4636 | + if (AlDolUtils::dol_strlen($nbofdectoround)) { |
|
| 4637 | + $amount = round($amount, $nbofdectoround); |
|
| 4638 | + } |
|
| 4639 | + // $nbofdectoround can be 0. |
|
| 4640 | + else { |
|
| 4641 | + return 'ErrorBadParameterProvidedToFunction'; |
|
| 4642 | + } |
|
| 4643 | + //print 'SS'.$amount.' - '.$nbofdec.' - '.$dec.' - '.$thousand.' - '.$nbofdectoround.'<br>'; |
|
| 4457 | 4644 | // Convert amount to format with dolibarr dec and thousand (this is because PHP convert a number |
| 4458 | 4645 | // to format defined by LC_NUMERIC after a calculation and we want source format to be defined by Dolibarr setup. |
| 4459 | 4646 | if (is_numeric($amount)) {
|
@@ -4466,8 +4653,10 @@ discard block |
||
| 4466 | 4653 | //print "TT".$amount.'<br>'; |
| 4467 | 4654 | // Always make replace because each math static function (like round) replace |
| 4468 | 4655 | // with local values and we want a number that has a SQL string format x.y |
| 4469 | - if ($thousand != ',' && $thousand != '.') |
|
| 4470 | - $amount = str_replace(',', '.', $amount); // To accept 2 notations for french users
|
|
| 4656 | + if ($thousand != ',' && $thousand != '.') { |
|
| 4657 | + $amount = str_replace(',', '.', $amount); |
|
| 4658 | + } |
|
| 4659 | + // To accept 2 notations for french users |
|
| 4471 | 4660 | $amount = str_replace(' ', '', $amount); // To avoid spaces
|
| 4472 | 4661 | $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is . |
| 4473 | 4662 | $amount = str_replace($dec, '.', $amount); |
@@ -4526,8 +4715,9 @@ discard block |
||
| 4526 | 4715 | {
|
| 4527 | 4716 | // global $db, Globals::$conf, $mysoc; |
| 4528 | 4717 | |
| 4529 | - if (empty($thirdparty_seller) || !is_object($thirdparty_seller)) |
|
| 4530 | - $thirdparty_seller = $mysoc; |
|
| 4718 | + if (empty($thirdparty_seller) || !is_object($thirdparty_seller)) { |
|
| 4719 | + $thirdparty_seller = $mysoc; |
|
| 4720 | + } |
|
| 4531 | 4721 | |
| 4532 | 4722 | AlDolUtils::dol_syslog("get_localtax tva=" . $vatrate . " local=" . $local . " thirdparty_buyer id=" . (is_object($thirdparty_buyer) ? $thirdparty_buyer->id : '') . "/country_code=" . (is_object($thirdparty_buyer) ? $thirdparty_buyer->country_code : '') . " thirdparty_seller id=" . $thirdparty_seller->id . "/country_code=" . $thirdparty_seller->country_code . " thirdparty_seller localtax1_assuj=" . $thirdparty_seller->localtax1_assuj . " thirdparty_seller localtax2_assuj=" . $thirdparty_seller->localtax2_assuj);
|
| 4533 | 4723 | |
@@ -4545,37 +4735,43 @@ discard block |
||
| 4545 | 4735 | // Some test to guess with no need to make database access |
| 4546 | 4736 | if ($mysoc->country_code == 'ES') { // For spain localtaxes 1 and 2, tax is qualified if buyer use local tax
|
| 4547 | 4737 | if ($local == 1) {
|
| 4548 | - if (!$mysoc->localtax1_assuj || (string) $vatratecleaned == "0") |
|
| 4549 | - return 0; |
|
| 4738 | + if (!$mysoc->localtax1_assuj || (string) $vatratecleaned == "0") { |
|
| 4739 | + return 0; |
|
| 4740 | + } |
|
| 4550 | 4741 | if ($thirdparty_seller->id == $mysoc->id) {
|
| 4551 | - if (!$thirdparty_buyer->localtax1_assuj) |
|
| 4552 | - return 0; |
|
| 4553 | - } |
|
| 4554 | - else {
|
|
| 4555 | - if (!$thirdparty_seller->localtax1_assuj) |
|
| 4556 | - return 0; |
|
| 4742 | + if (!$thirdparty_buyer->localtax1_assuj) { |
|
| 4743 | + return 0; |
|
| 4744 | + } |
|
| 4745 | + } else {
|
|
| 4746 | + if (!$thirdparty_seller->localtax1_assuj) { |
|
| 4747 | + return 0; |
|
| 4748 | + } |
|
| 4557 | 4749 | } |
| 4558 | 4750 | } |
| 4559 | 4751 | |
| 4560 | 4752 | if ($local == 2) {
|
| 4561 | 4753 | //if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0; |
| 4562 | - if (!$mysoc->localtax2_assuj) |
|
| 4563 | - return 0; // If main vat is 0, IRPF may be different than 0. |
|
| 4754 | + if (!$mysoc->localtax2_assuj) { |
|
| 4755 | + return 0; |
|
| 4756 | + } |
|
| 4757 | + // If main vat is 0, IRPF may be different than 0. |
|
| 4564 | 4758 | if ($thirdparty_seller->id == $mysoc->id) {
|
| 4565 | - if (!$thirdparty_buyer->localtax2_assuj) |
|
| 4566 | - return 0; |
|
| 4567 | - } |
|
| 4568 | - else {
|
|
| 4569 | - if (!$thirdparty_seller->localtax2_assuj) |
|
| 4570 | - return 0; |
|
| 4759 | + if (!$thirdparty_buyer->localtax2_assuj) { |
|
| 4760 | + return 0; |
|
| 4761 | + } |
|
| 4762 | + } else {
|
|
| 4763 | + if (!$thirdparty_seller->localtax2_assuj) { |
|
| 4764 | + return 0; |
|
| 4765 | + } |
|
| 4571 | 4766 | } |
| 4572 | 4767 | } |
| 4573 | - } |
|
| 4574 | - else {
|
|
| 4575 | - if ($local == 1 && !$thirdparty_seller->localtax1_assuj) |
|
| 4576 | - return 0; |
|
| 4577 | - if ($local == 2 && !$thirdparty_seller->localtax2_assuj) |
|
| 4578 | - return 0; |
|
| 4768 | + } else {
|
|
| 4769 | + if ($local == 1 && !$thirdparty_seller->localtax1_assuj) { |
|
| 4770 | + return 0; |
|
| 4771 | + } |
|
| 4772 | + if ($local == 2 && !$thirdparty_seller->localtax2_assuj) { |
|
| 4773 | + return 0; |
|
| 4774 | + } |
|
| 4579 | 4775 | } |
| 4580 | 4776 | |
| 4581 | 4777 | // For some country MAIN_GET_LOCALTAXES_VALUES_FROM_THIRDPARTY is forced to on. |
@@ -4617,19 +4813,23 @@ discard block |
||
| 4617 | 4813 | $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c"; |
| 4618 | 4814 | $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $thirdparty_seller->country_code . "'"; |
| 4619 | 4815 | $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
| 4620 | - if ($vatratecode) |
|
| 4621 | - $sql .= " AND t.code ='" . $vatratecode . "'"; // If we have the code, we use it in priority |
|
| 4622 | - else |
|
| 4623 | - $sql .= " AND t.recuperableonly ='" . $vatnpr . "'"; |
|
| 4816 | + if ($vatratecode) { |
|
| 4817 | + $sql .= " AND t.code ='" . $vatratecode . "'"; |
|
| 4818 | + } |
|
| 4819 | + // If we have the code, we use it in priority |
|
| 4820 | + else { |
|
| 4821 | + $sql .= " AND t.recuperableonly ='" . $vatnpr . "'"; |
|
| 4822 | + } |
|
| 4624 | 4823 | AlDolUtils::dol_syslog("get_localtax", LOG_DEBUG);
|
| 4625 | 4824 | $resql = $db->query($sql); |
| 4626 | 4825 | |
| 4627 | 4826 | if ($resql) {
|
| 4628 | 4827 | $obj = $db->fetch_object($resql); |
| 4629 | - if ($local == 1) |
|
| 4630 | - return $obj->localtax1; |
|
| 4631 | - elseif ($local == 2) |
|
| 4632 | - return $obj->localtax2; |
|
| 4828 | + if ($local == 1) { |
|
| 4829 | + return $obj->localtax1; |
|
| 4830 | + } elseif ($local == 2) { |
|
| 4831 | + return $obj->localtax2; |
|
| 4832 | + } |
|
| 4633 | 4833 | } |
| 4634 | 4834 | |
| 4635 | 4835 | return 0; |
@@ -4675,10 +4875,11 @@ discard block |
||
| 4675 | 4875 | $resql = $db->query($sql); |
| 4676 | 4876 | if ($resql) {
|
| 4677 | 4877 | $obj = $db->fetch_object($resql); |
| 4678 | - if ($local == 1) |
|
| 4679 | - return $obj->localtax1; |
|
| 4680 | - elseif ($local == 2) |
|
| 4681 | - return $obj->localtax2; |
|
| 4878 | + if ($local == 1) { |
|
| 4879 | + return $obj->localtax1; |
|
| 4880 | + } elseif ($local == 2) { |
|
| 4881 | + return $obj->localtax2; |
|
| 4882 | + } |
|
| 4682 | 4883 | } |
| 4683 | 4884 | |
| 4684 | 4885 | return 0; |
@@ -4704,9 +4905,9 @@ discard block |
||
| 4704 | 4905 | // Search local taxes |
| 4705 | 4906 | $sql = "SELECT t.rowid, t.code, t.taux as rate, t.recuperableonly as npr, t.accountancy_code_sell, t.accountancy_code_buy"; |
| 4706 | 4907 | $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t"; |
| 4707 | - if ($firstparamisid) |
|
| 4708 | - $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
| 4709 | - else {
|
|
| 4908 | + if ($firstparamisid) { |
|
| 4909 | + $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
| 4910 | + } else {
|
|
| 4710 | 4911 | $vatratecleaned = $vatrate; |
| 4711 | 4912 | $vatratecode = ''; |
| 4712 | 4913 | if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) { // If vat is "xx (yy)"
|
@@ -4719,19 +4920,22 @@ discard block |
||
| 4719 | 4920 | else $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; */ |
| 4720 | 4921 | $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'"; |
| 4721 | 4922 | $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
| 4722 | - if ($vatratecode) |
|
| 4723 | - $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
| 4923 | + if ($vatratecode) { |
|
| 4924 | + $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
| 4925 | + } |
|
| 4724 | 4926 | } |
| 4725 | 4927 | |
| 4726 | 4928 | $resql = $db->query($sql); |
| 4727 | 4929 | if ($resql) {
|
| 4728 | 4930 | $obj = $db->fetch_object($resql); |
| 4729 | - if ($obj) |
|
| 4730 | - return array('rowid' => $obj->rowid, 'code' => $obj->code, 'rate' => $obj->rate, 'npr' => $obj->npr, 'accountancy_code_sell' => $obj->accountancy_code_sell, 'accountancy_code_buy' => $obj->accountancy_code_buy);
|
|
| 4731 | - else |
|
| 4732 | - return array(); |
|
| 4733 | - } else |
|
| 4734 | - dol_print_error($db); |
|
| 4931 | + if ($obj) { |
|
| 4932 | + return array('rowid' => $obj->rowid, 'code' => $obj->code, 'rate' => $obj->rate, 'npr' => $obj->npr, 'accountancy_code_sell' => $obj->accountancy_code_sell, 'accountancy_code_buy' => $obj->accountancy_code_buy); |
|
| 4933 | + } else { |
|
| 4934 | + return array(); |
|
| 4935 | + } |
|
| 4936 | + } else { |
|
| 4937 | + dol_print_error($db); |
|
| 4938 | + } |
|
| 4735 | 4939 | |
| 4736 | 4940 | return array(); |
| 4737 | 4941 | } |
@@ -4761,9 +4965,9 @@ discard block |
||
| 4761 | 4965 | // Search local taxes |
| 4762 | 4966 | $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy"; |
| 4763 | 4967 | $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t"; |
| 4764 | - if ($firstparamisid) |
|
| 4765 | - $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
| 4766 | - else {
|
|
| 4968 | + if ($firstparamisid) { |
|
| 4969 | + $sql .= " WHERE t.rowid = " . (int) $vatrate; |
|
| 4970 | + } else {
|
|
| 4767 | 4971 | $vatratecleaned = $vatrate; |
| 4768 | 4972 | $vatratecode = ''; |
| 4769 | 4973 | if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) { // If vat is "x.x (yy)"
|
@@ -4772,13 +4976,17 @@ discard block |
||
| 4772 | 4976 | } |
| 4773 | 4977 | |
| 4774 | 4978 | $sql .= ", " . MAIN_DB_PREFIX . "c_country as c"; |
| 4775 | - if ($mysoc->country_code == 'ES') |
|
| 4776 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $buyer->country_code . "'"; // local tax in spain use the buyer country ?? |
|
| 4777 | - else |
|
| 4778 | - $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'"; |
|
| 4979 | + if ($mysoc->country_code == 'ES') { |
|
| 4980 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $buyer->country_code . "'"; |
|
| 4981 | + } |
|
| 4982 | + // local tax in spain use the buyer country ?? |
|
| 4983 | + else { |
|
| 4984 | + $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'"; |
|
| 4985 | + } |
|
| 4779 | 4986 | $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1"; |
| 4780 | - if ($vatratecode) |
|
| 4781 | - $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
| 4987 | + if ($vatratecode) { |
|
| 4988 | + $sql .= " AND t.code = '" . $vatratecode . "'"; |
|
| 4989 | + } |
|
| 4782 | 4990 | } |
| 4783 | 4991 | |
| 4784 | 4992 | $resql = $db->query($sql); |
@@ -4824,17 +5032,17 @@ discard block |
||
| 4824 | 5032 | if ($idprodfournprice > 0) { // We want vat for product for a "supplier" object
|
| 4825 | 5033 | $product->get_buyprice($idprodfournprice, 0, 0, 0); |
| 4826 | 5034 | $ret = $product->vatrate_supplier; |
| 4827 | - if ($product->default_vat_code) |
|
| 4828 | - $ret .= ' (' . $product->default_vat_code . ')';
|
|
| 4829 | - } |
|
| 4830 | - else {
|
|
| 5035 | + if ($product->default_vat_code) { |
|
| 5036 | + $ret .= ' (' . $product->default_vat_code . ')'; |
|
| 5037 | + } |
|
| 5038 | + } else {
|
|
| 4831 | 5039 | $ret = $product->tva_tx; // Default vat of product we defined |
| 4832 | - if ($product->default_vat_code) |
|
| 4833 | - $ret .= ' (' . $product->default_vat_code . ')';
|
|
| 5040 | + if ($product->default_vat_code) { |
|
| 5041 | + $ret .= ' (' . $product->default_vat_code . ')'; |
|
| 5042 | + } |
|
| 4834 | 5043 | } |
| 4835 | 5044 | $found = 1; |
| 4836 | - } |
|
| 4837 | - else {
|
|
| 5045 | + } else {
|
|
| 4838 | 5046 | // TODO Read default product vat according to countrycode and product. Vat for couple countrycode/product is a feature not implemeted yet. |
| 4839 | 5047 | // May be usefull/required if hidden option SERVICE_ARE_ECOMMERCE_200238EC is on |
| 4840 | 5048 | } |
@@ -4854,14 +5062,18 @@ discard block |
||
| 4854 | 5062 | $obj = $db->fetch_object($resql); |
| 4855 | 5063 | if ($obj) {
|
| 4856 | 5064 | $ret = $obj->vat_rate; |
| 4857 | - if ($obj->default_vat_code) |
|
| 4858 | - $ret .= ' (' . $obj->default_vat_code . ')';
|
|
| 5065 | + if ($obj->default_vat_code) { |
|
| 5066 | + $ret .= ' (' . $obj->default_vat_code . ')'; |
|
| 5067 | + } |
|
| 4859 | 5068 | } |
| 4860 | 5069 | $db->free($sql); |
| 4861 | - } else |
|
| 4862 | - dol_print_error($db); |
|
| 4863 | - } else |
|
| 4864 | - $ret = Globals::$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; // Forced value if autodetect fails |
|
| 5070 | + } else { |
|
| 5071 | + dol_print_error($db); |
|
| 5072 | + } |
|
| 5073 | + } else { |
|
| 5074 | + $ret = Globals::$conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; |
|
| 5075 | + } |
|
| 5076 | + // Forced value if autodetect fails |
|
| 4865 | 5077 | } |
| 4866 | 5078 | |
| 4867 | 5079 | AlDolUtils::dol_syslog("get_product_vat_for_country: ret=" . $ret);
|
@@ -4916,13 +5128,15 @@ discard block |
||
| 4916 | 5128 | if ($resql) {
|
| 4917 | 5129 | $obj = $db->fetch_object($resql); |
| 4918 | 5130 | if ($obj) {
|
| 4919 | - if ($local == 1) |
|
| 4920 | - $ret = $obj->localtax1; |
|
| 4921 | - elseif ($local == 2) |
|
| 4922 | - $ret = $obj->localtax2; |
|
| 5131 | + if ($local == 1) { |
|
| 5132 | + $ret = $obj->localtax1; |
|
| 5133 | + } elseif ($local == 2) { |
|
| 5134 | + $ret = $obj->localtax2; |
|
| 5135 | + } |
|
| 4923 | 5136 | } |
| 4924 | - } else |
|
| 4925 | - dol_print_error($db); |
|
| 5137 | + } else { |
|
| 5138 | + dol_print_error($db); |
|
| 5139 | + } |
|
| 4926 | 5140 | } |
| 4927 | 5141 | |
| 4928 | 5142 | AlDolUtils::dol_syslog("get_product_localtax_for_country: ret=" . $ret);
|
@@ -5025,15 +5239,16 @@ discard block |
||
| 5025 | 5239 | // global $db; |
| 5026 | 5240 | |
| 5027 | 5241 | if ($idprodfournprice > 0) {
|
| 5028 | - if (!class_exists('ProductFournisseur'))
|
|
| 5029 | - require_once DOL_BASE_PATH . '/fourn/class/fournisseur.product.class.php'; |
|
| 5242 | + if (!class_exists('ProductFournisseur')) { |
|
| 5243 | + require_once DOL_BASE_PATH . '/fourn/class/fournisseur.product.class.php'; |
|
| 5244 | + } |
|
| 5030 | 5245 | $prodprice = new ProductFournisseur($db); |
| 5031 | 5246 | $prodprice->fetch_product_fournisseur_price($idprodfournprice); |
| 5032 | 5247 | return $prodprice->fourn_tva_npr; |
| 5033 | - } |
|
| 5034 | - elseif ($idprod > 0) {
|
|
| 5035 | - if (!class_exists('Product'))
|
|
| 5036 | - require_once DOL_BASE_PATH . 'product/class/product.class.php'; |
|
| 5248 | + } elseif ($idprod > 0) {
|
|
| 5249 | + if (!class_exists('Product')) { |
|
| 5250 | + require_once DOL_BASE_PATH . 'product/class/product.class.php'; |
|
| 5251 | + } |
|
| 5037 | 5252 | $prod = new Product($db); |
| 5038 | 5253 | $prod->fetch($idprod); |
| 5039 | 5254 | return $prod->tva_npr; |
@@ -5059,30 +5274,35 @@ discard block |
||
| 5059 | 5274 | {
|
| 5060 | 5275 | // global $mysoc; |
| 5061 | 5276 | |
| 5062 | - if (!is_object($thirdparty_seller)) |
|
| 5063 | - return -1; |
|
| 5064 | - if (!is_object($thirdparty_buyer)) |
|
| 5065 | - return -1; |
|
| 5277 | + if (!is_object($thirdparty_seller)) { |
|
| 5278 | + return -1; |
|
| 5279 | + } |
|
| 5280 | + if (!is_object($thirdparty_buyer)) { |
|
| 5281 | + return -1; |
|
| 5282 | + } |
|
| 5066 | 5283 | |
| 5067 | 5284 | if ($local == 1) { // Localtax 1
|
| 5068 | 5285 | if ($mysoc->country_code == 'ES') {
|
| 5069 | - if (is_numeric($thirdparty_buyer->localtax1_assuj) && !$thirdparty_buyer->localtax1_assuj) |
|
| 5070 | - return 0; |
|
| 5071 | - } |
|
| 5072 | - else {
|
|
| 5286 | + if (is_numeric($thirdparty_buyer->localtax1_assuj) && !$thirdparty_buyer->localtax1_assuj) { |
|
| 5287 | + return 0; |
|
| 5288 | + } |
|
| 5289 | + } else {
|
|
| 5073 | 5290 | // Si vendeur non assujeti a Localtax1, localtax1 par default=0 |
| 5074 | - if (is_numeric($thirdparty_seller->localtax1_assuj) && !$thirdparty_seller->localtax1_assuj) |
|
| 5075 | - return 0; |
|
| 5076 | - if (!is_numeric($thirdparty_seller->localtax1_assuj) && $thirdparty_seller->localtax1_assuj == 'localtax1off') |
|
| 5077 | - return 0; |
|
| 5078 | - } |
|
| 5079 | - } |
|
| 5080 | - elseif ($local == 2) { //I Localtax 2
|
|
| 5291 | + if (is_numeric($thirdparty_seller->localtax1_assuj) && !$thirdparty_seller->localtax1_assuj) { |
|
| 5292 | + return 0; |
|
| 5293 | + } |
|
| 5294 | + if (!is_numeric($thirdparty_seller->localtax1_assuj) && $thirdparty_seller->localtax1_assuj == 'localtax1off') { |
|
| 5295 | + return 0; |
|
| 5296 | + } |
|
| 5297 | + } |
|
| 5298 | + } elseif ($local == 2) { //I Localtax 2
|
|
| 5081 | 5299 | // Si vendeur non assujeti a Localtax2, localtax2 par default=0 |
| 5082 | - if (is_numeric($thirdparty_seller->localtax2_assuj) && !$thirdparty_seller->localtax2_assuj) |
|
| 5083 | - return 0; |
|
| 5084 | - if (!is_numeric($thirdparty_seller->localtax2_assuj) && $thirdparty_seller->localtax2_assuj == 'localtax2off') |
|
| 5085 | - return 0; |
|
| 5300 | + if (is_numeric($thirdparty_seller->localtax2_assuj) && !$thirdparty_seller->localtax2_assuj) { |
|
| 5301 | + return 0; |
|
| 5302 | + } |
|
| 5303 | + if (!is_numeric($thirdparty_seller->localtax2_assuj) && $thirdparty_seller->localtax2_assuj == 'localtax2off') { |
|
| 5304 | + return 0; |
|
| 5305 | + } |
|
| 5086 | 5306 | } |
| 5087 | 5307 | |
| 5088 | 5308 | if ($thirdparty_seller->country_code == $thirdparty_buyer->country_code) {
|
@@ -5107,31 +5327,38 @@ discard block |
||
| 5107 | 5327 | $classname = ''; |
| 5108 | 5328 | if ($yesno == 1 || strtolower($yesno) == 'yes' || strtolower($yesno) == 'true') { // A mettre avant test sur no a cause du == 0
|
| 5109 | 5329 | $result = Globals::$langs->trans('yes');
|
| 5110 | - if ($case == 1 || $case == 3) |
|
| 5111 | - $result = Globals::$langs->trans("Yes");
|
|
| 5112 | - if ($case == 2) |
|
| 5113 | - $result = '<input type="checkbox" value="1" checked disabled>'; |
|
| 5114 | - if ($case == 3) |
|
| 5115 | - $result = '<input type="checkbox" value="1" checked disabled> ' . $result; |
|
| 5330 | + if ($case == 1 || $case == 3) { |
|
| 5331 | + $result = Globals::$langs->trans("Yes"); |
|
| 5332 | + } |
|
| 5333 | + if ($case == 2) { |
|
| 5334 | + $result = '<input type="checkbox" value="1" checked disabled>'; |
|
| 5335 | + } |
|
| 5336 | + if ($case == 3) { |
|
| 5337 | + $result = '<input type="checkbox" value="1" checked disabled> ' . $result; |
|
| 5338 | + } |
|
| 5116 | 5339 | |
| 5117 | 5340 | $classname = 'ok'; |
| 5118 | - } |
|
| 5119 | - elseif ($yesno == 0 || strtolower($yesno) == 'no' || strtolower($yesno) == 'false') {
|
|
| 5341 | + } elseif ($yesno == 0 || strtolower($yesno) == 'no' || strtolower($yesno) == 'false') {
|
|
| 5120 | 5342 | $result = Globals::$langs->trans("no");
|
| 5121 | - if ($case == 1 || $case == 3) |
|
| 5122 | - $result = Globals::$langs->trans("No");
|
|
| 5123 | - if ($case == 2) |
|
| 5124 | - $result = '<input type="checkbox" value="0" disabled>'; |
|
| 5125 | - if ($case == 3) |
|
| 5126 | - $result = '<input type="checkbox" value="0" disabled> ' . $result; |
|
| 5127 | - |
|
| 5128 | - if ($color == 2) |
|
| 5129 | - $classname = 'ok'; |
|
| 5130 | - else |
|
| 5131 | - $classname = 'error'; |
|
| 5132 | - } |
|
| 5133 | - if ($color) |
|
| 5134 | - return '<font class="' . $classname . '">' . $result . '</font>'; |
|
| 5343 | + if ($case == 1 || $case == 3) { |
|
| 5344 | + $result = Globals::$langs->trans("No"); |
|
| 5345 | + } |
|
| 5346 | + if ($case == 2) { |
|
| 5347 | + $result = '<input type="checkbox" value="0" disabled>'; |
|
| 5348 | + } |
|
| 5349 | + if ($case == 3) { |
|
| 5350 | + $result = '<input type="checkbox" value="0" disabled> ' . $result; |
|
| 5351 | + } |
|
| 5352 | + |
|
| 5353 | + if ($color == 2) { |
|
| 5354 | + $classname = 'ok'; |
|
| 5355 | + } else { |
|
| 5356 | + $classname = 'error'; |
|
| 5357 | + } |
|
| 5358 | + } |
|
| 5359 | + if ($color) { |
|
| 5360 | + return '<font class="' . $classname . '">' . $result . '</font>'; |
|
| 5361 | + } |
|
| 5135 | 5362 | return $result; |
| 5136 | 5363 | } |
| 5137 | 5364 | |
@@ -5157,23 +5384,27 @@ discard block |
||
| 5157 | 5384 | $path = ''; |
| 5158 | 5385 | |
| 5159 | 5386 | $arrayforoldpath = array('cheque', 'user', 'category', 'holiday', 'supplier_invoice', 'invoice_supplier', 'mailing', 'supplier_payment');
|
| 5160 | - if (!empty(Globals::$conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) |
|
| 5161 | - $arrayforoldpath[] = 'product'; |
|
| 5387 | + if (!empty(Globals::$conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { |
|
| 5388 | + $arrayforoldpath[] = 'product'; |
|
| 5389 | + } |
|
| 5162 | 5390 | if (!empty($level) && in_array($modulepart, $arrayforoldpath)) {
|
| 5163 | 5391 | // This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided. |
| 5164 | - if (empty($alpha)) |
|
| 5165 | - $num = preg_replace('/([^0-9])/i', '', $num);
|
|
| 5166 | - else |
|
| 5167 | - $num = preg_replace('/^.*\-/i', '', $num);
|
|
| 5392 | + if (empty($alpha)) { |
|
| 5393 | + $num = preg_replace('/([^0-9])/i', '', $num); |
|
| 5394 | + } else { |
|
| 5395 | + $num = preg_replace('/^.*\-/i', '', $num); |
|
| 5396 | + } |
|
| 5168 | 5397 | $num = substr("000" . $num, -$level);
|
| 5169 | - if ($level == 1) |
|
| 5170 | - $path = substr($num, 0, 1); |
|
| 5171 | - if ($level == 2) |
|
| 5172 | - $path = substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
| 5173 | - if ($level == 3) |
|
| 5174 | - $path = substr($num, 2, 1) . '/' . substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
| 5175 | - } |
|
| 5176 | - else {
|
|
| 5398 | + if ($level == 1) { |
|
| 5399 | + $path = substr($num, 0, 1); |
|
| 5400 | + } |
|
| 5401 | + if ($level == 2) { |
|
| 5402 | + $path = substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
| 5403 | + } |
|
| 5404 | + if ($level == 3) { |
|
| 5405 | + $path = substr($num, 2, 1) . '/' . substr($num, 1, 1) . '/' . substr($num, 0, 1); |
|
| 5406 | + } |
|
| 5407 | + } else {
|
|
| 5177 | 5408 | // TODO |
| 5178 | 5409 | // We will enhance here a common way of forging path for document storage |
| 5179 | 5410 | // Here, object->id, object->ref and modulepart are required. |
@@ -5184,8 +5415,9 @@ discard block |
||
| 5184 | 5415 | } |
| 5185 | 5416 | } |
| 5186 | 5417 | |
| 5187 | - if (empty($withoutslash) && !empty($path)) |
|
| 5188 | - $path .= '/'; |
|
| 5418 | + if (empty($withoutslash) && !empty($path)) { |
|
| 5419 | + $path .= '/'; |
|
| 5420 | + } |
|
| 5189 | 5421 | |
| 5190 | 5422 | return $path; |
| 5191 | 5423 | } |
@@ -5205,8 +5437,9 @@ discard block |
||
| 5205 | 5437 | AlDolUtils::dol_syslog("functions.lib::dol_mkdir: dir=" . $dir, LOG_INFO);
|
| 5206 | 5438 | |
| 5207 | 5439 | $dir_osencoded = dol_osencode($dir); |
| 5208 | - if (@is_dir($dir_osencoded)) |
|
| 5209 | - return 0; |
|
| 5440 | + if (@is_dir($dir_osencoded)) { |
|
| 5441 | + return 0; |
|
| 5442 | + } |
|
| 5210 | 5443 | |
| 5211 | 5444 | $nberr = 0; |
| 5212 | 5445 | $nbcreated = 0; |
@@ -5221,12 +5454,15 @@ discard block |
||
| 5221 | 5454 | $cdir = explode("/", $dir);
|
| 5222 | 5455 | $num = count($cdir); |
| 5223 | 5456 | for ($i = 0; $i < $num; $i++) {
|
| 5224 | - if ($i > 0) |
|
| 5225 | - $ccdir .= '/' . $cdir[$i]; |
|
| 5226 | - else |
|
| 5227 | - $ccdir .= $cdir[$i]; |
|
| 5228 | - if (preg_match("/^.:$/", $ccdir, $regs))
|
|
| 5229 | - continue; // Si chemin Windows incomplet, on poursuit par rep suivant |
|
| 5457 | + if ($i > 0) { |
|
| 5458 | + $ccdir .= '/' . $cdir[$i]; |
|
| 5459 | + } else { |
|
| 5460 | + $ccdir .= $cdir[$i]; |
|
| 5461 | + } |
|
| 5462 | + if (preg_match("/^.:$/", $ccdir, $regs)) { |
|
| 5463 | + continue; |
|
| 5464 | + } |
|
| 5465 | + // Si chemin Windows incomplet, on poursuit par rep suivant |
|
| 5230 | 5466 | |
| 5231 | 5467 | |
| 5232 | 5468 | |
@@ -5337,8 +5573,9 @@ discard block |
||
| 5337 | 5573 | */ |
| 5338 | 5574 | static function dol_string_nohtmltag($stringtoclean, $removelinefeed = 1, $pagecodeto = 'UTF-8', $strip_tags = 0) |
| 5339 | 5575 | {
|
| 5340 | - if ($removelinefeed == 2) |
|
| 5341 | - $stringtoclean = preg_replace('/<br[^>]*>\n+/ims', '<br>', $stringtoclean);
|
|
| 5576 | + if ($removelinefeed == 2) { |
|
| 5577 | + $stringtoclean = preg_replace('/<br[^>]*>\n+/ims', '<br>', $stringtoclean); |
|
| 5578 | + } |
|
| 5342 | 5579 | $temp = preg_replace('/<br[^>]*>/i', "\n", $stringtoclean);
|
| 5343 | 5580 | |
| 5344 | 5581 | if ($strip_tags) {
|
@@ -5355,8 +5592,9 @@ discard block |
||
| 5355 | 5592 | $temp = dol_html_entity_decode($temp, ENT_COMPAT, $pagecodeto); |
| 5356 | 5593 | |
| 5357 | 5594 | // Supprime aussi les retours |
| 5358 | - if ($removelinefeed == 1) |
|
| 5359 | - $temp = str_replace(array("\r\n", "\r", "\n"), " ", $temp);
|
|
| 5595 | + if ($removelinefeed == 1) { |
|
| 5596 | + $temp = str_replace(array("\r\n", "\r", "\n"), " ", $temp); |
|
| 5597 | + } |
|
| 5360 | 5598 | |
| 5361 | 5599 | // et les espaces doubles |
| 5362 | 5600 | while (strpos($temp, " ")) {
|
@@ -5442,18 +5680,21 @@ discard block |
||
| 5442 | 5680 | if ($charset == 'UTF-8') {
|
| 5443 | 5681 | $pattern = '/(<br[^>]*>)/Uu'; |
| 5444 | 5682 | } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support |
| 5445 | - else |
|
| 5446 | - $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
| 5683 | + else { |
|
| 5684 | + $pattern = '/(<br[^>]*>)/U'; |
|
| 5685 | + } |
|
| 5686 | + // /U is to have UNGREEDY regex to limit to one html tag. |
|
| 5447 | 5687 | $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
| 5448 | 5688 | |
| 5449 | 5689 | $firstline = ''; |
| 5450 | 5690 | $i = 0; |
| 5451 | 5691 | $nba = count($a); // 2x nb of lines in $a because $a contains also a line for each new line separator |
| 5452 | 5692 | while (($i < $nba) && ($i < ($nboflines * 2))) {
|
| 5453 | - if ($i % 2 == 0) |
|
| 5454 | - $firstline .= $a[$i]; |
|
| 5455 | - elseif (($i < (($nboflines * 2) - 1)) && ($i < ($nba - 1))) |
|
| 5456 | - $firstline .= ($ishtml ? "<br>\n" : "\n"); |
|
| 5693 | + if ($i % 2 == 0) { |
|
| 5694 | + $firstline .= $a[$i]; |
|
| 5695 | + } elseif (($i < (($nboflines * 2) - 1)) && ($i < ($nba - 1))) { |
|
| 5696 | + $firstline .= ($ishtml ? "<br>\n" : "\n"); |
|
| 5697 | + } |
|
| 5457 | 5698 | $i++; |
| 5458 | 5699 | } |
| 5459 | 5700 | unset($a); |
@@ -5502,15 +5743,18 @@ discard block |
||
| 5502 | 5743 | $newstring = $stringtoencode; |
| 5503 | 5744 | if (AlDolUtils::dol_textishtml($stringtoencode)) { // Check if text is already HTML or not
|
| 5504 | 5745 | $newstring = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', '<br>', $newstring); // Replace "<br type="_moz" />" by "<br>". It's same and avoid pb with FPDF.
|
| 5505 | - if ($removelasteolbr) |
|
| 5506 | - $newstring = preg_replace('/<br>$/i', '', $newstring); // Remove last <br> (remove only last one)
|
|
| 5746 | + if ($removelasteolbr) { |
|
| 5747 | + $newstring = preg_replace('/<br>$/i', '', $newstring); |
|
| 5748 | + } |
|
| 5749 | + // Remove last <br> (remove only last one) |
|
| 5507 | 5750 | $newstring = strtr($newstring, array('&' => '__and__', '<' => '__lt__', '>' => '__gt__', '"' => '__dquot__'));
|
| 5508 | 5751 | $newstring = AlDolUtils::dol_htmlentities($newstring, ENT_COMPAT, $pagecodefrom); // Make entity encoding |
| 5509 | 5752 | $newstring = strtr($newstring, array('__and__' => '&', '__lt__' => '<', '__gt__' => '>', '__dquot__' => '"'));
|
| 5510 | - } |
|
| 5511 | - else {
|
|
| 5512 | - if ($removelasteolbr) |
|
| 5513 | - $newstring = preg_replace('/(\r\n|\r|\n)$/i', '', $newstring); // Remove last \n (may remove several)
|
|
| 5753 | + } else {
|
|
| 5754 | + if ($removelasteolbr) { |
|
| 5755 | + $newstring = preg_replace('/(\r\n|\r|\n)$/i', '', $newstring); |
|
| 5756 | + } |
|
| 5757 | + // Remove last \n (may remove several) |
|
| 5514 | 5758 | $newstring = dol_nl2br(AlDolUtils::dol_htmlentities($newstring, ENT_COMPAT, $pagecodefrom), $nl2brmode); |
| 5515 | 5759 | } |
| 5516 | 5760 | // Other substitutions that htmlentities does not do |
@@ -5612,8 +5856,9 @@ discard block |
||
| 5612 | 5856 | */ |
| 5613 | 5857 | static function dol_nboflines($s, $maxchar = 0) |
| 5614 | 5858 | {
|
| 5615 | - if ($s == '') |
|
| 5616 | - return 0; |
|
| 5859 | + if ($s == '') { |
|
| 5860 | + return 0; |
|
| 5861 | + } |
|
| 5617 | 5862 | $arraystring = explode("\n", $s);
|
| 5618 | 5863 | $nb = count($arraystring); |
| 5619 | 5864 | |
@@ -5632,15 +5877,18 @@ discard block |
||
| 5632 | 5877 | static function dol_nboflines_bis($text, $maxlinesize = 0, $charset = 'UTF-8') |
| 5633 | 5878 | {
|
| 5634 | 5879 | $repTable = array("\t" => " ", "\n" => "<br>", "\r" => " ", "\0" => " ", "\x0B" => " ");
|
| 5635 | - if (AlDolUtils::dol_textishtml($text)) |
|
| 5636 | - $repTable = array("\t" => " ", "\n" => " ", "\r" => " ", "\0" => " ", "\x0B" => " ");
|
|
| 5880 | + if (AlDolUtils::dol_textishtml($text)) { |
|
| 5881 | + $repTable = array("\t" => " ", "\n" => " ", "\r" => " ", "\0" => " ", "\x0B" => " "); |
|
| 5882 | + } |
|
| 5637 | 5883 | |
| 5638 | 5884 | $text = strtr($text, $repTable); |
| 5639 | 5885 | if ($charset == 'UTF-8') {
|
| 5640 | 5886 | $pattern = '/(<br[^>]*>)/Uu'; |
| 5641 | 5887 | } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support |
| 5642 | - else |
|
| 5643 | - $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. |
|
| 5888 | + else { |
|
| 5889 | + $pattern = '/(<br[^>]*>)/U'; |
|
| 5890 | + } |
|
| 5891 | + // /U is to have UNGREEDY regex to limit to one html tag. |
|
| 5644 | 5892 | $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
| 5645 | 5893 | |
| 5646 | 5894 | $nblines = (int) floor((count($a) + 1) / 2); |
@@ -5687,39 +5935,47 @@ discard block |
||
| 5687 | 5935 | static function dol_textishtml($msg, $option = 0) |
| 5688 | 5936 | {
|
| 5689 | 5937 | if ($option == 1) {
|
| 5690 | - if (preg_match('/<html/i', $msg))
|
|
| 5691 | - return true; |
|
| 5692 | - elseif (preg_match('/<body/i', $msg))
|
|
| 5693 | - return true; |
|
| 5694 | - elseif (preg_match('/<br/i', $msg))
|
|
| 5695 | - return true; |
|
| 5938 | + if (preg_match('/<html/i', $msg)) { |
|
| 5939 | + return true; |
|
| 5940 | + } elseif (preg_match('/<body/i', $msg)) { |
|
| 5941 | + return true; |
|
| 5942 | + } elseif (preg_match('/<br/i', $msg)) { |
|
| 5943 | + return true; |
|
| 5944 | + } |
|
| 5696 | 5945 | return false; |
| 5697 | - } |
|
| 5698 | - else {
|
|
| 5699 | - if (preg_match('/<html/i', $msg))
|
|
| 5700 | - return true; |
|
| 5701 | - elseif (preg_match('/<body/i', $msg))
|
|
| 5702 | - return true; |
|
| 5703 | - elseif (preg_match('/<(b|em|i|u)>/i', $msg))
|
|
| 5704 | - return true; |
|
| 5705 | - elseif (preg_match('/<br\/>/i', $msg))
|
|
| 5706 | - return true; |
|
| 5707 | - elseif (preg_match('/<(br|div|font|li|p|span|strong|table)>/i', $msg))
|
|
| 5708 | - return true; |
|
| 5709 | - elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*>/i', $msg))
|
|
| 5710 | - return true; |
|
| 5711 | - elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*\/>/i', $msg))
|
|
| 5712 | - return true; |
|
| 5713 | - elseif (preg_match('/<img\s+[^<>]*src[^<>]*>/i', $msg))
|
|
| 5714 | - return true; // must accept <img src="http://example.com/aaa.png" /> |
|
| 5715 | - elseif (preg_match('/<a\s+[^<>]*href[^<>]*>/i', $msg))
|
|
| 5716 | - return true; // must accept <a href="http://example.com/aaa.png" /> |
|
| 5717 | - elseif (preg_match('/<h[0-9]>/i', $msg))
|
|
| 5718 | - return true; |
|
| 5719 | - elseif (preg_match('/&[A-Z0-9]{1,6};/i', $msg))
|
|
| 5720 | - return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) |
|
| 5721 | - elseif (preg_match('/&#[0-9]{2,3};/i', $msg))
|
|
| 5722 | - return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) |
|
| 5946 | + } else {
|
|
| 5947 | + if (preg_match('/<html/i', $msg)) { |
|
| 5948 | + return true; |
|
| 5949 | + } elseif (preg_match('/<body/i', $msg)) { |
|
| 5950 | + return true; |
|
| 5951 | + } elseif (preg_match('/<(b|em|i|u)>/i', $msg)) { |
|
| 5952 | + return true; |
|
| 5953 | + } elseif (preg_match('/<br\/>/i', $msg)) { |
|
| 5954 | + return true; |
|
| 5955 | + } elseif (preg_match('/<(br|div|font|li|p|span|strong|table)>/i', $msg)) { |
|
| 5956 | + return true; |
|
| 5957 | + } elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*>/i', $msg)) { |
|
| 5958 | + return true; |
|
| 5959 | + } elseif (preg_match('/<(br|div|font|li|p|span|strong|table)\s+[^<>\/]*\/>/i', $msg)) { |
|
| 5960 | + return true; |
|
| 5961 | + } elseif (preg_match('/<img\s+[^<>]*src[^<>]*>/i', $msg)) { |
|
| 5962 | + return true; |
|
| 5963 | + } |
|
| 5964 | + // must accept <img src="http://example.com/aaa.png" /> |
|
| 5965 | + elseif (preg_match('/<a\s+[^<>]*href[^<>]*>/i', $msg)) { |
|
| 5966 | + return true; |
|
| 5967 | + } |
|
| 5968 | + // must accept <a href="http://example.com/aaa.png" /> |
|
| 5969 | + elseif (preg_match('/<h[0-9]>/i', $msg)) { |
|
| 5970 | + return true; |
|
| 5971 | + } elseif (preg_match('/&[A-Z0-9]{1,6};/i', $msg)) { |
|
| 5972 | + return true; |
|
| 5973 | + } |
|
| 5974 | + // Html entities names (http://www.w3schools.com/tags/ref_entities.asp) |
|
| 5975 | + elseif (preg_match('/&#[0-9]{2,3};/i', $msg)) { |
|
| 5976 | + return true; |
|
| 5977 | + } |
|
| 5978 | + // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp) |
|
| 5723 | 5979 | |
| 5724 | 5980 | return false; |
| 5725 | 5981 | } |
@@ -5871,12 +6127,14 @@ discard block |
||
| 5871 | 6127 | $birthday = AlDolUtils::dol_print_date($object->birth, 'day'); |
| 5872 | 6128 | |
| 5873 | 6129 | $substitutionarray['__MEMBER_ID__'] = $object->id; |
| 5874 | - if (method_exists($object, 'getCivilityLabel')) |
|
| 5875 | - $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel(); |
|
| 6130 | + if (method_exists($object, 'getCivilityLabel')) { |
|
| 6131 | + $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel(); |
|
| 6132 | + } |
|
| 5876 | 6133 | $substitutionarray['__MEMBER_FIRSTNAME__'] = $msgishtml ? AlDolUtils::dol_htmlentitiesbr($object->firstname) : $object->firstname; |
| 5877 | 6134 | $substitutionarray['__MEMBER_LASTNAME__'] = $msgishtml ? AlDolUtils::dol_htmlentitiesbr($object->lastname) : $object->lastname; |
| 5878 | - if (method_exists($object, 'getFullName')) |
|
| 5879 | - $substitutionarray['__MEMBER_FULLNAME__'] = $msgishtml ? AlDolUtils::dol_htmlentitiesbr($object->getFullName($outputlangs)) : $object->getFullName($outputlangs); |
|
| 6135 | + if (method_exists($object, 'getFullName')) { |
|
| 6136 | + $substitutionarray['__MEMBER_FULLNAME__'] = $msgishtml ? AlDolUtils::dol_htmlentitiesbr($object->getFullName($outputlangs)) : $object->getFullName($outputlangs); |
|
| 6137 | + } |
|
| 5880 | 6138 | $substitutionarray['__MEMBER_COMPANY__'] = $msgishtml ? AlDolUtils::dol_htmlentitiesbr($object->societe) : $object->societe; |
| 5881 | 6139 | $substitutionarray['__MEMBER_ADDRESS__'] = $msgishtml ? AlDolUtils::dol_htmlentitiesbr($object->address) : $object->address; |
| 5882 | 6140 | $substitutionarray['__MEMBER_ZIP__'] = $msgishtml ? AlDolUtils::dol_htmlentitiesbr($object->zip) : $object->zip; |
@@ -5924,10 +6182,12 @@ discard block |
||
| 5924 | 6182 | $dateplannedstart = ''; |
| 5925 | 6183 | $datenextexpiration = ''; |
| 5926 | 6184 | foreach ($object->lines as $line) {
|
| 5927 | - if ($line->date_ouverture_prevue > $dateplannedstart) |
|
| 5928 | - $dateplannedstart = $line->date_ouverture_prevue; |
|
| 5929 | - if ($line->statut == 4 && $line->date_fin_prevue && (!$datenextexpiration || $line->date_fin_prevue < $datenextexpiration)) |
|
| 5930 | - $datenextexpiration = $line->date_fin_prevue; |
|
| 6185 | + if ($line->date_ouverture_prevue > $dateplannedstart) { |
|
| 6186 | + $dateplannedstart = $line->date_ouverture_prevue; |
|
| 6187 | + } |
|
| 6188 | + if ($line->statut == 4 && $line->date_fin_prevue && (!$datenextexpiration || $line->date_fin_prevue < $datenextexpiration)) { |
|
| 6189 | + $datenextexpiration = $line->date_fin_prevue; |
|
| 6190 | + } |
|
| 5931 | 6191 | } |
| 5932 | 6192 | $substitutionarray['__CONTRACT_HIGHEST_PLANNED_START_DATE__'] = AlDolUtils::dol_print_date($dateplannedstart, 'dayrfc'); |
| 5933 | 6193 | $substitutionarray['__CONTRACT_HIGHEST_PLANNED_START_DATETIME__'] = AlDolUtils::dol_print_date($dateplannedstart, 'standard'); |
@@ -5937,8 +6197,9 @@ discard block |
||
| 5937 | 6197 | |
| 5938 | 6198 | // Create dynamic tags for __EXTRAFIELD_FIELD__ |
| 5939 | 6199 | if ($object->table_element && $object->id > 0) {
|
| 5940 | - if (!is_object($extrafields)) |
|
| 5941 | - $extrafields = new ExtraFields($db); |
|
| 6200 | + if (!is_object($extrafields)) { |
|
| 6201 | + $extrafields = new ExtraFields($db); |
|
| 6202 | + } |
|
| 5942 | 6203 | $extrafields->fetch_name_optionals_label($object->table_element, true); |
| 5943 | 6204 | |
| 5944 | 6205 | if ($object->fetch_optionals() > 0) {
|
@@ -5959,12 +6220,15 @@ discard block |
||
| 5959 | 6220 | require_once DOL_BASE_PATH . '/core/lib/payments.lib.php'; |
| 5960 | 6221 | $outputlangs->loadLangs(array('paypal', 'other'));
|
| 5961 | 6222 | $typeforonlinepayment = 'free'; |
| 5962 | - if (is_object($object) && $object->element == 'commande') |
|
| 5963 | - $typeforonlinepayment = 'order'; |
|
| 5964 | - if (is_object($object) && $object->element == 'facture') |
|
| 5965 | - $typeforonlinepayment = 'invoice'; |
|
| 5966 | - if (is_object($object) && $object->element == 'member') |
|
| 5967 | - $typeforonlinepayment = 'member'; |
|
| 6223 | + if (is_object($object) && $object->element == 'commande') { |
|
| 6224 | + $typeforonlinepayment = 'order'; |
|
| 6225 | + } |
|
| 6226 | + if (is_object($object) && $object->element == 'facture') { |
|
| 6227 | + $typeforonlinepayment = 'invoice'; |
|
| 6228 | + } |
|
| 6229 | + if (is_object($object) && $object->element == 'member') { |
|
| 6230 | + $typeforonlinepayment = 'member'; |
|
| 6231 | + } |
|
| 5968 | 6232 | $url = getOnlinePaymentUrl(0, $typeforonlinepayment, $substitutionarray['__REF__']); |
| 5969 | 6233 | $paymenturl = $url; |
| 5970 | 6234 | } |
@@ -5974,16 +6238,19 @@ discard block |
||
| 5974 | 6238 | |
| 5975 | 6239 | if (!empty(Globals::$conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'propal') {
|
| 5976 | 6240 | $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = $object->getLastMainDocLink($object->element); |
| 5977 | - } else |
|
| 5978 | - $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = ''; |
|
| 6241 | + } else { |
|
| 6242 | + $substitutionarray['__DIRECTDOWNLOAD_URL_PROPOSAL__'] = ''; |
|
| 6243 | + } |
|
| 5979 | 6244 | if (!empty(Globals::$conf->global->ORDER_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'commande') {
|
| 5980 | 6245 | $substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = $object->getLastMainDocLink($object->element); |
| 5981 | - } else |
|
| 5982 | - $substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = ''; |
|
| 6246 | + } else { |
|
| 6247 | + $substitutionarray['__DIRECTDOWNLOAD_URL_ORDER__'] = ''; |
|
| 6248 | + } |
|
| 5983 | 6249 | if (!empty(Globals::$conf->global->INVOICE_ALLOW_EXTERNAL_DOWNLOAD) && is_object($object) && $object->element == 'facture') {
|
| 5984 | 6250 | $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = $object->getLastMainDocLink($object->element); |
| 5985 | - } else |
|
| 5986 | - $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = ''; |
|
| 6251 | + } else { |
|
| 6252 | + $substitutionarray['__DIRECTDOWNLOAD_URL_INVOICE__'] = ''; |
|
| 6253 | + } |
|
| 5987 | 6254 | } |
| 5988 | 6255 | } |
| 5989 | 6256 | if (empty($exclude) || !in_array('objectamount', $exclude)) {
|
@@ -5993,18 +6260,22 @@ discard block |
||
| 5993 | 6260 | $substitutionarray['__AMOUNT__'] = is_object($object) ? $object->total_ttc : ''; |
| 5994 | 6261 | $substitutionarray['__AMOUNT_EXCL_TAX__'] = is_object($object) ? $object->total_ht : ''; |
| 5995 | 6262 | $substitutionarray['__AMOUNT_VAT__'] = is_object($object) ? ($object->total_vat ? $object->total_vat : $object->total_tva) : ''; |
| 5996 | - if ($onlykey != 2 || $mysoc->useLocalTax(1)) |
|
| 5997 | - $substitutionarray['__AMOUNT_TAX2__'] = is_object($object) ? $object->total_localtax1 : ''; |
|
| 5998 | - if ($onlykey != 2 || $mysoc->useLocalTax(2)) |
|
| 5999 | - $substitutionarray['__AMOUNT_TAX3__'] = is_object($object) ? $object->total_localtax2 : ''; |
|
| 6263 | + if ($onlykey != 2 || $mysoc->useLocalTax(1)) { |
|
| 6264 | + $substitutionarray['__AMOUNT_TAX2__'] = is_object($object) ? $object->total_localtax1 : ''; |
|
| 6265 | + } |
|
| 6266 | + if ($onlykey != 2 || $mysoc->useLocalTax(2)) { |
|
| 6267 | + $substitutionarray['__AMOUNT_TAX3__'] = is_object($object) ? $object->total_localtax2 : ''; |
|
| 6268 | + } |
|
| 6000 | 6269 | |
| 6001 | 6270 | $substitutionarray['__AMOUNT_FORMATED__'] = is_object($object) ? price($object->total_ttc, 0, $outputlangs, 0, 0, -1, Globals::$conf->currency) : ''; |
| 6002 | 6271 | $substitutionarray['__AMOUNT_EXCL_TAX_FORMATED__'] = is_object($object) ? price($object->total_ht, 0, $outputlangs, 0, 0, -1, Globals::$conf->currency) : ''; |
| 6003 | 6272 | $substitutionarray['__AMOUNT_VAT_FORMATED__'] = is_object($object) ? ($object->total_vat ? price($object->total_vat, 0, $outputlangs, 0, 0, -1, Globals::$conf->currency) : price($object->total_tva, 0, $outputlangs, 0, 0, -1, Globals::$conf->currency)) : ''; |
| 6004 | - if ($onlykey != 2 || $mysoc->useLocalTax(1)) |
|
| 6005 | - $substitutionarray['__AMOUNT_TAX2_FORMATED__'] = is_object($object) ? price($object->total_localtax1, 0, $outputlangs, 0, 0, -1, Globals::$conf->currency) : ''; |
|
| 6006 | - if ($onlykey != 2 || $mysoc->useLocalTax(2)) |
|
| 6007 | - $substitutionarray['__AMOUNT_TAX3_FORMATED__'] = is_object($object) ? price($object->total_localtax2, 0, $outputlangs, 0, 0, -1, Globals::$conf->currency) : ''; |
|
| 6273 | + if ($onlykey != 2 || $mysoc->useLocalTax(1)) { |
|
| 6274 | + $substitutionarray['__AMOUNT_TAX2_FORMATED__'] = is_object($object) ? price($object->total_localtax1, 0, $outputlangs, 0, 0, -1, Globals::$conf->currency) : ''; |
|
| 6275 | + } |
|
| 6276 | + if ($onlykey != 2 || $mysoc->useLocalTax(2)) { |
|
| 6277 | + $substitutionarray['__AMOUNT_TAX3_FORMATED__'] = is_object($object) ? price($object->total_localtax2, 0, $outputlangs, 0, 0, -1, Globals::$conf->currency) : ''; |
|
| 6278 | + } |
|
| 6008 | 6279 | |
| 6009 | 6280 | // TODO Add keys for foreign multicurrency |
| 6010 | 6281 | // For backward compatibility |
@@ -6074,23 +6345,27 @@ discard block |
||
| 6074 | 6345 | {
|
| 6075 | 6346 | // global Globals::$conf, Globals::$langs; |
| 6076 | 6347 | |
| 6077 | - if (!is_array($substitutionarray)) |
|
| 6078 | - return 'ErrorBadParameterSubstitutionArrayWhenCalling_make_substitutions'; |
|
| 6348 | + if (!is_array($substitutionarray)) { |
|
| 6349 | + return 'ErrorBadParameterSubstitutionArrayWhenCalling_make_substitutions'; |
|
| 6350 | + } |
|
| 6079 | 6351 | |
| 6080 | - if (empty($outputlangs)) |
|
| 6081 | - $outputlangs = Globals::$langs; |
|
| 6352 | + if (empty($outputlangs)) { |
|
| 6353 | + $outputlangs = Globals::$langs; |
|
| 6354 | + } |
|
| 6082 | 6355 | |
| 6083 | 6356 | // Make substitution for language keys |
| 6084 | 6357 | if (is_object($outputlangs)) {
|
| 6085 | 6358 | while (preg_match('/__\(([^\)]+)\)__/', $text, $reg)) {
|
| 6086 | 6359 | $msgishtml = 0; |
| 6087 | - if (AlDolUtils::dol_textishtml($text, 1)) |
|
| 6088 | - $msgishtml = 1; |
|
| 6360 | + if (AlDolUtils::dol_textishtml($text, 1)) { |
|
| 6361 | + $msgishtml = 1; |
|
| 6362 | + } |
|
| 6089 | 6363 | |
| 6090 | 6364 | // If key is __(TranslationKey|langfile)__, then force load of langfile.lang |
| 6091 | 6365 | $tmp = explode('|', $reg[1]);
|
| 6092 | - if (!empty($tmp[1])) |
|
| 6093 | - $outputlangs->load($tmp[1]); |
|
| 6366 | + if (!empty($tmp[1])) { |
|
| 6367 | + $outputlangs->load($tmp[1]); |
|
| 6368 | + } |
|
| 6094 | 6369 | |
| 6095 | 6370 | $text = preg_replace('/__\(' . preg_quote($reg[1], '/') . '\)__/', $msgishtml ? AlDolUtils::dol_htmlentitiesbr($outputlangs->transnoentitiesnoconv($reg[1])) : $outputlangs->transnoentitiesnoconv($reg[1]), $text);
|
| 6096 | 6371 | } |
@@ -6100,23 +6375,29 @@ discard block |
||
| 6100 | 6375 | // it is also converted. |
| 6101 | 6376 | while (preg_match('/__\[([^\]]+)\]__/', $text, $reg)) {
|
| 6102 | 6377 | $msgishtml = 0; |
| 6103 | - if (AlDolUtils::dol_textishtml($text, 1)) |
|
| 6104 | - $msgishtml = 1; |
|
| 6378 | + if (AlDolUtils::dol_textishtml($text, 1)) { |
|
| 6379 | + $msgishtml = 1; |
|
| 6380 | + } |
|
| 6105 | 6381 | |
| 6106 | 6382 | $keyfound = $reg[1]; |
| 6107 | - if (preg_match('/(_pass|password|secret|_key|key$)/i', $keyfound))
|
|
| 6108 | - $newval = '*****forbidden*****'; |
|
| 6109 | - else |
|
| 6110 | - $newval = empty(Globals::$conf->global->$keyfound) ? '' : Globals::$conf->global->$keyfound; |
|
| 6383 | + if (preg_match('/(_pass|password|secret|_key|key$)/i', $keyfound)) { |
|
| 6384 | + $newval = '*****forbidden*****'; |
|
| 6385 | + } else { |
|
| 6386 | + $newval = empty(Globals::$conf->global->$keyfound) ? '' : Globals::$conf->global->$keyfound; |
|
| 6387 | + } |
|
| 6111 | 6388 | $text = preg_replace('/__\[' . preg_quote($keyfound, '/') . '\]__/', $msgishtml ? AlDolUtils::dol_htmlentitiesbr($newval) : $newval, $text);
|
| 6112 | 6389 | } |
| 6113 | 6390 | |
| 6114 | 6391 | // Make substitition for array $substitutionarray |
| 6115 | 6392 | foreach ($substitutionarray as $key => $value) {
|
| 6116 | - if ($key == '__SIGNATURE__' && (!empty(Globals::$conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) |
|
| 6117 | - $value = ''; // Protection |
|
| 6118 | - if ($key == '__USER_SIGNATURE__' && (!empty(Globals::$conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) |
|
| 6119 | - $value = ''; // Protection |
|
| 6393 | + if ($key == '__SIGNATURE__' && (!empty(Globals::$conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) { |
|
| 6394 | + $value = ''; |
|
| 6395 | + } |
|
| 6396 | + // Protection |
|
| 6397 | + if ($key == '__USER_SIGNATURE__' && (!empty(Globals::$conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))) { |
|
| 6398 | + $value = ''; |
|
| 6399 | + } |
|
| 6400 | + // Protection |
|
| 6120 | 6401 | |
| 6121 | 6402 | $text = str_replace("$key", "$value", $text); // We must keep the " to work when value is 123.5 for example
|
| 6122 | 6403 | } |
@@ -6162,8 +6443,9 @@ discard block |
||
| 6162 | 6443 | $dir = dol_buildpath($reldir, 0); |
| 6163 | 6444 | |
| 6164 | 6445 | // Check if directory exists |
| 6165 | - if (!dol_is_dir($dir)) |
|
| 6166 | - continue; |
|
| 6446 | + if (!dol_is_dir($dir)) { |
|
| 6447 | + continue; |
|
| 6448 | + } |
|
| 6167 | 6449 | |
| 6168 | 6450 | $substitfiles = dol_dir_list($dir, 'files', 0, 'functions_'); |
| 6169 | 6451 | foreach ($substitfiles as $substitfile) {
|
@@ -6175,8 +6457,9 @@ discard block |
||
| 6175 | 6457 | require_once $dir . $substitfile['name']; |
| 6176 | 6458 | // Call the user's function, and only if it is defined |
| 6177 | 6459 | $function_name = $module . "_" . $callfunc; |
| 6178 | - if (function_exists($function_name)) |
|
| 6179 | - $function_name($substitutionarray, $outputlangs, $object, $parameters); |
|
| 6460 | + if (function_exists($function_name)) { |
|
| 6461 | + $function_name($substitutionarray, $outputlangs, $object, $parameters); |
|
| 6462 | + } |
|
| 6180 | 6463 | } |
| 6181 | 6464 | } |
| 6182 | 6465 | } |
@@ -6212,8 +6495,9 @@ discard block |
||
| 6212 | 6495 | |
| 6213 | 6496 | $out = ''; |
| 6214 | 6497 | |
| 6215 | - if (!is_object($outputlangs)) |
|
| 6216 | - $outputlangs = Globals::$langs; |
|
| 6498 | + if (!is_object($outputlangs)) { |
|
| 6499 | + $outputlangs = Globals::$langs; |
|
| 6500 | + } |
|
| 6217 | 6501 | |
| 6218 | 6502 | if ($date_start && $date_end) {
|
| 6219 | 6503 | $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateFromTo', AlDolUtils::dol_print_date($date_start, $format, false, $outputlangs), AlDolUtils::dol_print_date($date_end, $format, false, $outputlangs)) . ($withparenthesis ? ')' : '');
|
@@ -6242,20 +6526,22 @@ discard block |
||
| 6242 | 6526 | |
| 6243 | 6527 | $ret = ''; |
| 6244 | 6528 | // If order not defined, we use the setup |
| 6245 | - if ($nameorder < 0) |
|
| 6246 | - $nameorder = (empty(Globals::$conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? 1 : 0); |
|
| 6529 | + if ($nameorder < 0) { |
|
| 6530 | + $nameorder = (empty(Globals::$conf->global->MAIN_FIRSTNAME_NAME_POSITION) ? 1 : 0); |
|
| 6531 | + } |
|
| 6247 | 6532 | if ($nameorder && ((string) $nameorder != '2')) {
|
| 6248 | 6533 | $ret .= $firstname; |
| 6249 | - if ($firstname && $lastname) |
|
| 6250 | - $ret .= ' '; |
|
| 6534 | + if ($firstname && $lastname) { |
|
| 6535 | + $ret .= ' '; |
|
| 6536 | + } |
|
| 6251 | 6537 | $ret .= $lastname; |
| 6252 | - } |
|
| 6253 | - else if ($nameorder == 2) {
|
|
| 6538 | + } else if ($nameorder == 2) {
|
|
| 6254 | 6539 | $ret .= $firstname; |
| 6255 | 6540 | } else {
|
| 6256 | 6541 | $ret .= $lastname; |
| 6257 | - if ($firstname && $lastname) |
|
| 6258 | - $ret .= ' '; |
|
| 6542 | + if ($firstname && $lastname) { |
|
| 6543 | + $ret .= ' '; |
|
| 6544 | + } |
|
| 6259 | 6545 | $ret .= $firstname; |
| 6260 | 6546 | } |
| 6261 | 6547 | return $ret; |
@@ -6275,13 +6561,14 @@ discard block |
||
| 6275 | 6561 | {
|
| 6276 | 6562 | //DolUtils::dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING); This is not deprecated, it is used by setEventMessages function |
| 6277 | 6563 | if (!is_array($mesgs)) { // If mesgs is a string
|
| 6278 | - if ($mesgs) |
|
| 6279 | - $_SESSION['dol_events'][$style][] = $mesgs; |
|
| 6280 | - } |
|
| 6281 | - else { // If mesgs is an array
|
|
| 6564 | + if ($mesgs) { |
|
| 6565 | + $_SESSION['dol_events'][$style][] = $mesgs; |
|
| 6566 | + } |
|
| 6567 | + } else { // If mesgs is an array
|
|
| 6282 | 6568 | foreach ($mesgs as $mesg) {
|
| 6283 | - if ($mesg) |
|
| 6284 | - $_SESSION['dol_events'][$style][] = $mesg; |
|
| 6569 | + if ($mesg) { |
|
| 6570 | + $_SESSION['dol_events'][$style][] = $mesg; |
|
| 6571 | + } |
|
| 6285 | 6572 | } |
| 6286 | 6573 | } |
| 6287 | 6574 | } |
@@ -6301,13 +6588,16 @@ discard block |
||
| 6301 | 6588 | if (empty($mesg) && empty($mesgs)) {
|
| 6302 | 6589 | AlDolUtils::dol_syslog("Try to add a message in stack with empty message", LOG_WARNING);
|
| 6303 | 6590 | } else {
|
| 6304 | - if (!in_array((string) $style, array('mesgs', 'warnings', 'errors')))
|
|
| 6305 | - dol_print_error('', 'Bad parameter style=' . $style . ' for setEventMessages');
|
|
| 6306 | - if (empty($mesgs)) |
|
| 6307 | - setEventMessage($mesg, $style); |
|
| 6308 | - else {
|
|
| 6309 | - if (!empty($mesg) && !in_array($mesg, $mesgs)) |
|
| 6310 | - setEventMessage($mesg, $style); // Add message string if not already into array |
|
| 6591 | + if (!in_array((string) $style, array('mesgs', 'warnings', 'errors'))) { |
|
| 6592 | + dol_print_error('', 'Bad parameter style=' . $style . ' for setEventMessages'); |
|
| 6593 | + } |
|
| 6594 | + if (empty($mesgs)) { |
|
| 6595 | + setEventMessage($mesg, $style); |
|
| 6596 | + } else {
|
|
| 6597 | + if (!empty($mesg) && !in_array($mesg, $mesgs)) { |
|
| 6598 | + setEventMessage($mesg, $style); |
|
| 6599 | + } |
|
| 6600 | + // Add message string if not already into array |
|
| 6311 | 6601 | setEventMessage($mesgs, $style); |
| 6312 | 6602 | } |
| 6313 | 6603 | } |
@@ -6326,22 +6616,25 @@ discard block |
||
| 6326 | 6616 | {
|
| 6327 | 6617 | // Show mesgs |
| 6328 | 6618 | if (isset($_SESSION['dol_events']['mesgs'])) {
|
| 6329 | - if (empty($disabledoutputofmessages)) |
|
| 6330 | - dol_htmloutput_mesg('', $_SESSION['dol_events']['mesgs']);
|
|
| 6619 | + if (empty($disabledoutputofmessages)) { |
|
| 6620 | + dol_htmloutput_mesg('', $_SESSION['dol_events']['mesgs']); |
|
| 6621 | + } |
|
| 6331 | 6622 | unset($_SESSION['dol_events']['mesgs']); |
| 6332 | 6623 | } |
| 6333 | 6624 | |
| 6334 | 6625 | // Show errors |
| 6335 | 6626 | if (isset($_SESSION['dol_events']['errors'])) {
|
| 6336 | - if (empty($disabledoutputofmessages)) |
|
| 6337 | - dol_htmloutput_mesg('', $_SESSION['dol_events']['errors'], 'error');
|
|
| 6627 | + if (empty($disabledoutputofmessages)) { |
|
| 6628 | + dol_htmloutput_mesg('', $_SESSION['dol_events']['errors'], 'error'); |
|
| 6629 | + } |
|
| 6338 | 6630 | unset($_SESSION['dol_events']['errors']); |
| 6339 | 6631 | } |
| 6340 | 6632 | |
| 6341 | 6633 | // Show warnings |
| 6342 | 6634 | if (isset($_SESSION['dol_events']['warnings'])) {
|
| 6343 | - if (empty($disabledoutputofmessages)) |
|
| 6344 | - dol_htmloutput_mesg('', $_SESSION['dol_events']['warnings'], 'warning');
|
|
| 6635 | + if (empty($disabledoutputofmessages)) { |
|
| 6636 | + dol_htmloutput_mesg('', $_SESSION['dol_events']['warnings'], 'warning'); |
|
| 6637 | + } |
|
| 6345 | 6638 | unset($_SESSION['dol_events']['warnings']); |
| 6346 | 6639 | } |
| 6347 | 6640 | } |
@@ -6382,8 +6675,9 @@ discard block |
||
| 6382 | 6675 | foreach ($mesgarray as $message) {
|
| 6383 | 6676 | $ret++; |
| 6384 | 6677 | $out .= Globals::$langs->trans($message); |
| 6385 | - if ($ret < count($mesgarray)) |
|
| 6386 | - $out .= "<br>\n"; |
|
| 6678 | + if ($ret < count($mesgarray)) { |
|
| 6679 | + $out .= "<br>\n"; |
|
| 6680 | + } |
|
| 6387 | 6681 | } |
| 6388 | 6682 | } |
| 6389 | 6683 | if ($mesgstring) {
|
@@ -6449,8 +6743,9 @@ discard block |
||
| 6449 | 6743 | */ |
| 6450 | 6744 | static function dol_htmloutput_mesg($mesgstring = '', $mesgarray = array(), $style = 'ok', $keepembedded = 0) |
| 6451 | 6745 | {
|
| 6452 | - if (empty($mesgstring) && (!is_array($mesgarray) || count($mesgarray) == 0)) |
|
| 6453 | - return; |
|
| 6746 | + if (empty($mesgstring) && (!is_array($mesgarray) || count($mesgarray) == 0)) { |
|
| 6747 | + return; |
|
| 6748 | + } |
|
| 6454 | 6749 | |
| 6455 | 6750 | $iserror = 0; |
| 6456 | 6751 | $iswarning = 0; |
@@ -6465,14 +6760,17 @@ discard block |
||
| 6465 | 6760 | break; |
| 6466 | 6761 | } |
| 6467 | 6762 | } |
| 6468 | - } else if ($mesgstring && preg_match('/class="error"/i', $mesgstring))
|
|
| 6469 | - $iserror++; |
|
| 6470 | - else if ($mesgstring && preg_match('/class="warning"/i', $mesgstring))
|
|
| 6471 | - $iswarning++; |
|
| 6472 | - if ($style == 'error') |
|
| 6473 | - $iserror++; |
|
| 6474 | - if ($style == 'warning') |
|
| 6475 | - $iswarning++; |
|
| 6763 | + } else if ($mesgstring && preg_match('/class="error"/i', $mesgstring)) { |
|
| 6764 | + $iserror++; |
|
| 6765 | + } else if ($mesgstring && preg_match('/class="warning"/i', $mesgstring)) { |
|
| 6766 | + $iswarning++; |
|
| 6767 | + } |
|
| 6768 | + if ($style == 'error') { |
|
| 6769 | + $iserror++; |
|
| 6770 | + } |
|
| 6771 | + if ($style == 'warning') { |
|
| 6772 | + $iswarning++; |
|
| 6773 | + } |
|
| 6476 | 6774 | |
| 6477 | 6775 | if ($iserror || $iswarning) {
|
| 6478 | 6776 | // Remove div from texts |
@@ -6491,8 +6789,9 @@ discard block |
||
| 6491 | 6789 | $mesgarray = $newmesgarray; |
| 6492 | 6790 | } |
| 6493 | 6791 | print get_htmloutput_mesg($mesgstring, $mesgarray, ($iserror ? 'error' : 'warning'), $keepembedded); |
| 6494 | - } else |
|
| 6495 | - print get_htmloutput_mesg($mesgstring, $mesgarray, 'ok', $keepembedded); |
|
| 6792 | + } else { |
|
| 6793 | + print get_htmloutput_mesg($mesgstring, $mesgarray, 'ok', $keepembedded); |
|
| 6794 | + } |
|
| 6496 | 6795 | } |
| 6497 | 6796 | |
| 6498 | 6797 | /** |
@@ -6533,15 +6832,17 @@ discard block |
||
| 6533 | 6832 | $sizearray = count($array); |
| 6534 | 6833 | if ($sizearray > 0) {
|
| 6535 | 6834 | $temp = array(); |
| 6536 | - foreach (array_keys($array) as $key) |
|
| 6537 | - $temp[$key] = $array[$key][$index]; |
|
| 6835 | + foreach (array_keys($array) as $key) { |
|
| 6836 | + $temp[$key] = $array[$key][$index]; |
|
| 6837 | + } |
|
| 6538 | 6838 | |
| 6539 | - if (!$natsort) |
|
| 6540 | - ($order == 'asc') ? asort($temp) : arsort($temp); |
|
| 6541 | - else {
|
|
| 6839 | + if (!$natsort) { |
|
| 6840 | + ($order == 'asc') ? asort($temp) : arsort($temp); |
|
| 6841 | + } else {
|
|
| 6542 | 6842 | ($case_sensitive) ? natsort($temp) : natcasesort($temp); |
| 6543 | - if ($order != 'asc') |
|
| 6544 | - $temp = array_reverse($temp, true); |
|
| 6843 | + if ($order != 'asc') { |
|
| 6844 | + $temp = array_reverse($temp, true); |
|
| 6845 | + } |
|
| 6545 | 6846 | } |
| 6546 | 6847 | |
| 6547 | 6848 | $sorted = array(); |
@@ -6567,23 +6868,38 @@ discard block |
||
| 6567 | 6868 | // We must use here a binary strlen static function (so not AlDolUtils::dol_strlen) |
| 6568 | 6869 | $strLength = AlDolUtils::dol_strlen($str); |
| 6569 | 6870 | for ($i = 0; $i < $strLength; $i++) {
|
| 6570 | - if (ord($str[$i]) < 0x80) |
|
| 6571 | - continue; // 0bbbbbbb |
|
| 6572 | - elseif ((ord($str[$i]) & 0xE0) == 0xC0) |
|
| 6573 | - $n = 1; // 110bbbbb |
|
| 6574 | - elseif ((ord($str[$i]) & 0xF0) == 0xE0) |
|
| 6575 | - $n = 2; // 1110bbbb |
|
| 6576 | - elseif ((ord($str[$i]) & 0xF8) == 0xF0) |
|
| 6577 | - $n = 3; // 11110bbb |
|
| 6578 | - elseif ((ord($str[$i]) & 0xFC) == 0xF8) |
|
| 6579 | - $n = 4; // 111110bb |
|
| 6580 | - elseif ((ord($str[$i]) & 0xFE) == 0xFC) |
|
| 6581 | - $n = 5; // 1111110b |
|
| 6582 | - else |
|
| 6583 | - return false; // Does not match any model |
|
| 6871 | + if (ord($str[$i]) < 0x80) { |
|
| 6872 | + continue; |
|
| 6873 | + } |
|
| 6874 | + // 0bbbbbbb |
|
| 6875 | + elseif ((ord($str[$i]) & 0xE0) == 0xC0) { |
|
| 6876 | + $n = 1; |
|
| 6877 | + } |
|
| 6878 | + // 110bbbbb |
|
| 6879 | + elseif ((ord($str[$i]) & 0xF0) == 0xE0) { |
|
| 6880 | + $n = 2; |
|
| 6881 | + } |
|
| 6882 | + // 1110bbbb |
|
| 6883 | + elseif ((ord($str[$i]) & 0xF8) == 0xF0) { |
|
| 6884 | + $n = 3; |
|
| 6885 | + } |
|
| 6886 | + // 11110bbb |
|
| 6887 | + elseif ((ord($str[$i]) & 0xFC) == 0xF8) { |
|
| 6888 | + $n = 4; |
|
| 6889 | + } |
|
| 6890 | + // 111110bb |
|
| 6891 | + elseif ((ord($str[$i]) & 0xFE) == 0xFC) { |
|
| 6892 | + $n = 5; |
|
| 6893 | + } |
|
| 6894 | + // 1111110b |
|
| 6895 | + else { |
|
| 6896 | + return false; |
|
| 6897 | + } |
|
| 6898 | + // Does not match any model |
|
| 6584 | 6899 | for ($j = 0; $j < $n; $j++) { // n bytes matching 10bbbbbb follow ?
|
| 6585 | - if (( ++$i == strlen($str)) || ((ord($str[$i]) & 0xC0) != 0x80)) |
|
| 6586 | - return false; |
|
| 6900 | + if (( ++$i == strlen($str)) || ((ord($str[$i]) & 0xC0) != 0x80)) { |
|
| 6901 | + return false; |
|
| 6902 | + } |
|
| 6587 | 6903 | } |
| 6588 | 6904 | } |
| 6589 | 6905 | return true; |
@@ -6601,15 +6917,21 @@ discard block |
||
| 6601 | 6917 | // global Globals::$conf; |
| 6602 | 6918 | |
| 6603 | 6919 | $tmp = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
|
| 6604 | - if (empty($tmp) && !empty($_SERVER["WINDIR"])) |
|
| 6605 | - $tmp = 'iso-8859-1'; // By default for windows |
|
| 6606 | - if (empty($tmp)) |
|
| 6607 | - $tmp = 'utf-8'; // By default for other |
|
| 6608 | - if (!empty(Globals::$conf->global->MAIN_FILESYSTEM_ENCODING)) |
|
| 6609 | - $tmp = Globals::$conf->global->MAIN_FILESYSTEM_ENCODING; |
|
| 6610 | - |
|
| 6611 | - if ($tmp == 'iso-8859-1') |
|
| 6612 | - return utf8_decode($str); |
|
| 6920 | + if (empty($tmp) && !empty($_SERVER["WINDIR"])) { |
|
| 6921 | + $tmp = 'iso-8859-1'; |
|
| 6922 | + } |
|
| 6923 | + // By default for windows |
|
| 6924 | + if (empty($tmp)) { |
|
| 6925 | + $tmp = 'utf-8'; |
|
| 6926 | + } |
|
| 6927 | + // By default for other |
|
| 6928 | + if (!empty(Globals::$conf->global->MAIN_FILESYSTEM_ENCODING)) { |
|
| 6929 | + $tmp = Globals::$conf->global->MAIN_FILESYSTEM_ENCODING; |
|
| 6930 | + } |
|
| 6931 | + |
|
| 6932 | + if ($tmp == 'iso-8859-1') { |
|
| 6933 | + return utf8_decode($str); |
|
| 6934 | + } |
|
| 6613 | 6935 | return $str; |
| 6614 | 6936 | } |
| 6615 | 6937 | |
@@ -6630,8 +6952,9 @@ discard block |
||
| 6630 | 6952 | {
|
| 6631 | 6953 | // global $cache_codes; |
| 6632 | 6954 | // If key empty |
| 6633 | - if ($key == '') |
|
| 6634 | - return ''; |
|
| 6955 | + if ($key == '') { |
|
| 6956 | + return ''; |
|
| 6957 | + } |
|
| 6635 | 6958 | |
| 6636 | 6959 | // Check in cache |
| 6637 | 6960 | if (isset($cache_codes[$tablename][$key][$fieldid])) { // Can be defined to 0 or ''
|
@@ -6643,20 +6966,21 @@ discard block |
||
| 6643 | 6966 | $sql = "SELECT " . $fieldid . " as valuetoget"; |
| 6644 | 6967 | $sql .= " FROM " . MAIN_DB_PREFIX . $tablename; |
| 6645 | 6968 | $sql .= " WHERE " . $fieldkey . " = '" . $db->escape($key) . "'"; |
| 6646 | - if (!empty($entityfilter)) |
|
| 6647 | - $sql .= " AND entity IN (" . getEntity($tablename) . ")";
|
|
| 6969 | + if (!empty($entityfilter)) { |
|
| 6970 | + $sql .= " AND entity IN (" . getEntity($tablename) . ")"; |
|
| 6971 | + } |
|
| 6648 | 6972 | |
| 6649 | 6973 | $resql = $db->query($sql); |
| 6650 | 6974 | if ($resql) {
|
| 6651 | 6975 | $obj = $db->fetch_object($resql); |
| 6652 | - if ($obj) |
|
| 6653 | - $cache_codes[$tablename][$key][$fieldid] = $obj->valuetoget; |
|
| 6654 | - else |
|
| 6655 | - $cache_codes[$tablename][$key][$fieldid] = ''; |
|
| 6976 | + if ($obj) { |
|
| 6977 | + $cache_codes[$tablename][$key][$fieldid] = $obj->valuetoget; |
|
| 6978 | + } else { |
|
| 6979 | + $cache_codes[$tablename][$key][$fieldid] = ''; |
|
| 6980 | + } |
|
| 6656 | 6981 | $db->free($resql); |
| 6657 | 6982 | return $cache_codes[$tablename][$key][$fieldid]; |
| 6658 | - } |
|
| 6659 | - else {
|
|
| 6983 | + } else {
|
|
| 6660 | 6984 | return -1; |
| 6661 | 6985 | } |
| 6662 | 6986 | } |
@@ -6702,16 +7026,17 @@ discard block |
||
| 6702 | 7026 | // global $soc; // For backward compatibility |
| 6703 | 7027 | //print $s."<br>\n"; |
| 6704 | 7028 | if ($returnvalue) {
|
| 6705 | - if ($hideerrors) |
|
| 6706 | - return @eval('return ' . $s . ';');
|
|
| 6707 | - else |
|
| 6708 | - return eval('return ' . $s . ';');
|
|
| 6709 | - } |
|
| 6710 | - else {
|
|
| 6711 | - if ($hideerrors) |
|
| 6712 | - @eval($s); |
|
| 6713 | - else |
|
| 6714 | - eval($s); |
|
| 7029 | + if ($hideerrors) { |
|
| 7030 | + return @eval('return ' . $s . ';'); |
|
| 7031 | + } else { |
|
| 7032 | + return eval('return ' . $s . ';'); |
|
| 7033 | + } |
|
| 7034 | + } else {
|
|
| 7035 | + if ($hideerrors) { |
|
| 7036 | + @eval($s); |
|
| 7037 | + } else { |
|
| 7038 | + eval($s); |
|
| 7039 | + } |
|
| 6715 | 7040 | } |
| 6716 | 7041 | } |
| 6717 | 7042 | |
@@ -6737,8 +7062,9 @@ discard block |
||
| 6737 | 7062 | {
|
| 6738 | 7063 | // global Globals::$langs; |
| 6739 | 7064 | |
| 6740 | - if (empty($codelang)) |
|
| 6741 | - return ''; |
|
| 7065 | + if (empty($codelang)) { |
|
| 7066 | + return ''; |
|
| 7067 | + } |
|
| 6742 | 7068 | |
| 6743 | 7069 | if ($codelang == 'auto') {
|
| 6744 | 7070 | return '<span class="fa fa-globe"></span>'; |
@@ -6752,9 +7078,9 @@ discard block |
||
| 6752 | 7078 | 'sv_SV' => 'se' |
| 6753 | 7079 | ); |
| 6754 | 7080 | |
| 6755 | - if (isset($langtocountryflag[$codelang])) |
|
| 6756 | - $flagImage = $langtocountryflag[$codelang]; |
|
| 6757 | - else {
|
|
| 7081 | + if (isset($langtocountryflag[$codelang])) { |
|
| 7082 | + $flagImage = $langtocountryflag[$codelang]; |
|
| 7083 | + } else {
|
|
| 6758 | 7084 | $tmparray = explode('_', $codelang);
|
| 6759 | 7085 | $flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1]; |
| 6760 | 7086 | } |
@@ -6772,15 +7098,20 @@ discard block |
||
| 6772 | 7098 | {
|
| 6773 | 7099 | // global $mysoc; |
| 6774 | 7100 | |
| 6775 | - if (strtoupper($countrycode) == 'MQ') |
|
| 6776 | - return 'fr_CA'; |
|
| 6777 | - if (strtoupper($countrycode) == 'SE') |
|
| 6778 | - return 'sv_SE'; // se_SE is Sami/Sweden, and we want in priority sv_SE for SE country |
|
| 7101 | + if (strtoupper($countrycode) == 'MQ') { |
|
| 7102 | + return 'fr_CA'; |
|
| 7103 | + } |
|
| 7104 | + if (strtoupper($countrycode) == 'SE') { |
|
| 7105 | + return 'sv_SE'; |
|
| 7106 | + } |
|
| 7107 | + // se_SE is Sami/Sweden, and we want in priority sv_SE for SE country |
|
| 6779 | 7108 | if (strtoupper($countrycode) == 'CH') {
|
| 6780 | - if ($mysoc->country_code == 'FR') |
|
| 6781 | - return 'fr_CH'; |
|
| 6782 | - if ($mysoc->country_code == 'DE') |
|
| 6783 | - return 'de_CH'; |
|
| 7109 | + if ($mysoc->country_code == 'FR') { |
|
| 7110 | + return 'fr_CH'; |
|
| 7111 | + } |
|
| 7112 | + if ($mysoc->country_code == 'DE') { |
|
| 7113 | + return 'de_CH'; |
|
| 7114 | + } |
|
| 6784 | 7115 | } |
| 6785 | 7116 | |
| 6786 | 7117 | // Locale list taken from: |
@@ -6958,8 +7289,9 @@ discard block |
||
| 6958 | 7289 | ); |
| 6959 | 7290 | |
| 6960 | 7291 | $buildprimarykeytotest = strtolower($countrycode) . '-' . strtoupper($countrycode); |
| 6961 | - if (in_array($buildprimarykeytotest, $locales)) |
|
| 6962 | - return strtolower($countrycode) . '_' . strtoupper($countrycode); |
|
| 7292 | + if (in_array($buildprimarykeytotest, $locales)) { |
|
| 7293 | + return strtolower($countrycode) . '_' . strtoupper($countrycode); |
|
| 7294 | + } |
|
| 6963 | 7295 | |
| 6964 | 7296 | foreach ($locales as $locale) {
|
| 6965 | 7297 | $locale_language = locale_get_primary_language($locale); |
@@ -7013,18 +7345,21 @@ discard block |
||
| 7013 | 7345 | |
| 7014 | 7346 | if ($mode == 'add' && !preg_match('/^\-/', $values[1])) {
|
| 7015 | 7347 | if (count($values) == 6) { // new declaration with permissions: $value='objecttype:+tabname1:Title1:langfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__'
|
| 7016 | - if ($values[0] != $type) |
|
| 7017 | - continue; |
|
| 7348 | + if ($values[0] != $type) { |
|
| 7349 | + continue; |
|
| 7350 | + } |
|
| 7018 | 7351 | |
| 7019 | 7352 | if (verifCond($values[4])) {
|
| 7020 | - if ($values[3]) |
|
| 7021 | - Globals::$langs->load($values[3]); |
|
| 7353 | + if ($values[3]) { |
|
| 7354 | + Globals::$langs->load($values[3]); |
|
| 7355 | + } |
|
| 7022 | 7356 | if (preg_match('/SUBSTITUTION_([^_]+)/i', $values[2], $reg)) {
|
| 7023 | 7357 | $substitutionarray = array(); |
| 7024 | 7358 | complete_substitutions_array($substitutionarray, Globals::$langs, $object, array('needforkey' => $values[2]));
|
| 7025 | 7359 | $label = make_substitutions($reg[1], $substitutionarray); |
| 7026 | - } else |
|
| 7027 | - $label = Globals::$langs->trans($values[2]); |
|
| 7360 | + } else { |
|
| 7361 | + $label = Globals::$langs->trans($values[2]); |
|
| 7362 | + } |
|
| 7028 | 7363 | |
| 7029 | 7364 | //$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]), 1);
|
| 7030 | 7365 | $head[$h][0] = BASE_URI . preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]);
|
@@ -7032,30 +7367,32 @@ discard block |
||
| 7032 | 7367 | $head[$h][2] = str_replace('+', '', $values[1]);
|
| 7033 | 7368 | $h++; |
| 7034 | 7369 | } |
| 7035 | - } |
|
| 7036 | - else if (count($values) == 5) { // deprecated
|
|
| 7370 | + } else if (count($values) == 5) { // deprecated
|
|
| 7037 | 7371 | AlDolUtils::dol_syslog('Passing 5 values in tabs module_parts is deprecated. Please update to 6 with permissions.', LOG_WARNING);
|
| 7038 | 7372 | |
| 7039 | - if ($values[0] != $type) |
|
| 7040 | - continue; |
|
| 7041 | - if ($values[3]) |
|
| 7042 | - Globals::$langs->load($values[3]); |
|
| 7373 | + if ($values[0] != $type) { |
|
| 7374 | + continue; |
|
| 7375 | + } |
|
| 7376 | + if ($values[3]) { |
|
| 7377 | + Globals::$langs->load($values[3]); |
|
| 7378 | + } |
|
| 7043 | 7379 | if (preg_match('/SUBSTITUTION_([^_]+)/i', $values[2], $reg)) {
|
| 7044 | 7380 | $substitutionarray = array(); |
| 7045 | 7381 | complete_substitutions_array($substitutionarray, Globals::$langs, $object, array('needforkey' => $values[2]));
|
| 7046 | 7382 | $label = make_substitutions($reg[1], $substitutionarray); |
| 7047 | - } else |
|
| 7048 | - $label = Globals::$langs->trans($values[2]); |
|
| 7383 | + } else { |
|
| 7384 | + $label = Globals::$langs->trans($values[2]); |
|
| 7385 | + } |
|
| 7049 | 7386 | |
| 7050 | 7387 | $head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[4]), 1);
|
| 7051 | 7388 | $head[$h][1] = $label; |
| 7052 | 7389 | $head[$h][2] = str_replace('+', '', $values[1]);
|
| 7053 | 7390 | $h++; |
| 7054 | 7391 | } |
| 7055 | - } |
|
| 7056 | - else if ($mode == 'remove' && preg_match('/^\-/', $values[1])) {
|
|
| 7057 | - if ($values[0] != $type) |
|
| 7058 | - continue; |
|
| 7392 | + } else if ($mode == 'remove' && preg_match('/^\-/', $values[1])) {
|
|
| 7393 | + if ($values[0] != $type) { |
|
| 7394 | + continue; |
|
| 7395 | + } |
|
| 7059 | 7396 | $tabname = str_replace('-', '', $values[1]);
|
| 7060 | 7397 | foreach ($head as $key => $val) {
|
| 7061 | 7398 | $condition = (!empty($values[3]) ? verifCond($values[3]) : 1); |
@@ -7097,10 +7434,11 @@ discard block |
||
| 7097 | 7434 | // global $action; |
| 7098 | 7435 | // global $micro_start_time; |
| 7099 | 7436 | |
| 7100 | - if ($zone == 'private') |
|
| 7101 | - print "\n" . '<!-- Common footer for private page -->' . "\n"; |
|
| 7102 | - else |
|
| 7103 | - print "\n" . '<!-- Common footer for public page -->' . "\n"; |
|
| 7437 | + if ($zone == 'private') { |
|
| 7438 | + print "\n" . '<!-- Common footer for private page -->' . "\n"; |
|
| 7439 | + } else { |
|
| 7440 | + print "\n" . '<!-- Common footer for public page -->' . "\n"; |
|
| 7441 | + } |
|
| 7104 | 7442 | |
| 7105 | 7443 | // A div to store page_y POST parameter so we can read it using javascript |
| 7106 | 7444 | print "\n<!-- A div to store page_y POST paramater -->\n"; |
@@ -7109,8 +7447,9 @@ discard block |
||
| 7109 | 7447 | $parameters = array(); |
| 7110 | 7448 | $reshook = Globals::$hookManager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks
|
| 7111 | 7449 | if (empty($reshook)) {
|
| 7112 | - if (!empty(Globals::$conf->global->MAIN_HTML_FOOTER)) |
|
| 7113 | - print Globals::$conf->global->MAIN_HTML_FOOTER . "\n"; |
|
| 7450 | + if (!empty(Globals::$conf->global->MAIN_HTML_FOOTER)) { |
|
| 7451 | + print Globals::$conf->global->MAIN_HTML_FOOTER . "\n"; |
|
| 7452 | + } |
|
| 7114 | 7453 | |
| 7115 | 7454 | print "\n"; |
| 7116 | 7455 | if (!empty(Globals::$conf->use_javascript_ajax)) {
|
@@ -7133,8 +7472,9 @@ discard block |
||
| 7133 | 7472 | print '/* JS CODE TO ENABLE to manage focus and mandatory form fields */' . "\n"; |
| 7134 | 7473 | $relativepathstring = $_SERVER["PHP_SELF"]; |
| 7135 | 7474 | // Clean $relativepathstring |
| 7136 | - if (constant('DOL_BASE_URI'))
|
|
| 7137 | - $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
|
|
| 7475 | + if (constant('DOL_BASE_URI')) { |
|
| 7476 | + $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring); |
|
| 7477 | + } |
|
| 7138 | 7478 | $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
|
| 7139 | 7479 | $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
|
| 7140 | 7480 | $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
|
@@ -7145,14 +7485,17 @@ discard block |
||
| 7145 | 7485 | $tmpqueryarraytohave = explode('&', $defkey);
|
| 7146 | 7486 | $foundintru = 0; |
| 7147 | 7487 | foreach ($tmpqueryarraytohave as $tmpquerytohave) {
|
| 7148 | - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) |
|
| 7149 | - $foundintru = 1; |
|
| 7488 | + if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) { |
|
| 7489 | + $foundintru = 1; |
|
| 7490 | + } |
|
| 7150 | 7491 | } |
| 7151 | - if (!$foundintru) |
|
| 7152 | - $qualified = 1; |
|
| 7492 | + if (!$foundintru) { |
|
| 7493 | + $qualified = 1; |
|
| 7494 | + } |
|
| 7153 | 7495 | //var_dump($defkey.'-'.$qualified); |
| 7154 | - } else |
|
| 7155 | - $qualified = 1; |
|
| 7496 | + } else { |
|
| 7497 | + $qualified = 1; |
|
| 7498 | + } |
|
| 7156 | 7499 | |
| 7157 | 7500 | if ($qualified) {
|
| 7158 | 7501 | foreach ($defval as $paramkey => $paramval) {
|
@@ -7171,14 +7514,17 @@ discard block |
||
| 7171 | 7514 | $tmpqueryarraytohave = explode('&', $defkey);
|
| 7172 | 7515 | $foundintru = 0; |
| 7173 | 7516 | foreach ($tmpqueryarraytohave as $tmpquerytohave) {
|
| 7174 | - if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) |
|
| 7175 | - $foundintru = 1; |
|
| 7517 | + if (!in_array($tmpquerytohave, $tmpqueryarraywehave)) { |
|
| 7518 | + $foundintru = 1; |
|
| 7519 | + } |
|
| 7176 | 7520 | } |
| 7177 | - if (!$foundintru) |
|
| 7178 | - $qualified = 1; |
|
| 7521 | + if (!$foundintru) { |
|
| 7522 | + $qualified = 1; |
|
| 7523 | + } |
|
| 7179 | 7524 | //var_dump($defkey.'-'.$qualified); |
| 7180 | - } else |
|
| 7181 | - $qualified = 1; |
|
| 7525 | + } else { |
|
| 7526 | + $qualified = 1; |
|
| 7527 | + } |
|
| 7182 | 7528 | |
| 7183 | 7529 | if ($qualified) {
|
| 7184 | 7530 | foreach ($defval as $paramkey => $paramval) {
|
@@ -7217,8 +7563,9 @@ discard block |
||
| 7217 | 7563 | print "\n"; |
| 7218 | 7564 | print "/* JS CODE TO ENABLE to add memory info */\n"; |
| 7219 | 7565 | print 'window.console && console.log("';
|
| 7220 | - if (!empty(Globals::$conf->global->MEMCACHED_SERVER)) |
|
| 7221 | - print 'MEMCACHED_SERVER=' . Globals::$conf->global->MEMCACHED_SERVER . ' - '; |
|
| 7566 | + if (!empty(Globals::$conf->global->MEMCACHED_SERVER)) { |
|
| 7567 | + print 'MEMCACHED_SERVER=' . Globals::$conf->global->MEMCACHED_SERVER . ' - '; |
|
| 7568 | + } |
|
| 7222 | 7569 | print 'MAIN_OPTIMIZE_SPEED=' . (isset(Globals::$conf->global->MAIN_OPTIMIZE_SPEED) ? Globals::$conf->global->MAIN_OPTIMIZE_SPEED : 'off'); |
| 7223 | 7570 | if (!empty($micro_start_time)) { // Works only if MAIN_SHOW_TUNING_INFO is defined at $_SERVER level. Not in// global variable.
|
| 7224 | 7571 | $micro_end_time = microtime(true); |
@@ -7348,8 +7695,9 @@ discard block |
||
| 7348 | 7695 | |
| 7349 | 7696 | $crits = explode(' ', $value);
|
| 7350 | 7697 | $res = ''; |
| 7351 | - if (!is_array($fields)) |
|
| 7352 | - $fields = array($fields); |
|
| 7698 | + if (!is_array($fields)) { |
|
| 7699 | + $fields = array($fields); |
|
| 7700 | + } |
|
| 7353 | 7701 | |
| 7354 | 7702 | $nboffields = count($fields); |
| 7355 | 7703 | $end2 = count($crits); |
@@ -7412,8 +7760,9 @@ discard block |
||
| 7412 | 7760 | $tmpcrits = explode('|', $crit);
|
| 7413 | 7761 | $i3 = 0; |
| 7414 | 7762 | foreach ($tmpcrits as $tmpcrit) {
|
| 7415 | - if (empty($tmpcrit)) |
|
| 7416 | - continue; |
|
| 7763 | + if (empty($tmpcrit)) { |
|
| 7764 | + continue; |
|
| 7765 | + } |
|
| 7417 | 7766 | |
| 7418 | 7767 | $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : ''); |
| 7419 | 7768 | |
@@ -7449,8 +7798,9 @@ discard block |
||
| 7449 | 7798 | } |
| 7450 | 7799 | $i++; |
| 7451 | 7800 | } |
| 7452 | - if ($newres) |
|
| 7453 | - $res = $res . ($res ? ' AND ' : '') . ($i2 > 1 ? '(' : '') . $newres . ($i2 > 1 ? ')' : '');
|
|
| 7801 | + if ($newres) { |
|
| 7802 | + $res = $res . ($res ? ' AND ' : '') . ($i2 > 1 ? '(' : '') . $newres . ($i2 > 1 ? ')' : ''); |
|
| 7803 | + } |
|
| 7454 | 7804 | $j++; |
| 7455 | 7805 | } |
| 7456 | 7806 | $res = ($nofirstand ? "" : " AND ") . "(" . $res . ")";
|
@@ -7490,29 +7840,37 @@ discard block |
||
| 7490 | 7840 | static function getImageFileNameForSize($file, $extName, $extImgTarget = '') |
| 7491 | 7841 | {
|
| 7492 | 7842 | $dirName = dirname($file); |
| 7493 | - if ($dirName == '.') |
|
| 7494 | - $dirName = ''; |
|
| 7843 | + if ($dirName == '.') { |
|
| 7844 | + $dirName = ''; |
|
| 7845 | + } |
|
| 7495 | 7846 | |
| 7496 | 7847 | $fileName = preg_replace('/(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$/i', '', $file); // We remove extension, whatever is its case
|
| 7497 | 7848 | $fileName = basename($fileName); |
| 7498 | 7849 | |
| 7499 | - if (empty($extImgTarget)) |
|
| 7500 | - $extImgTarget = (preg_match('/\.jpg$/i', $file) ? '.jpg' : '');
|
|
| 7501 | - if (empty($extImgTarget)) |
|
| 7502 | - $extImgTarget = (preg_match('/\.jpeg$/i', $file) ? '.jpeg' : '');
|
|
| 7503 | - if (empty($extImgTarget)) |
|
| 7504 | - $extImgTarget = (preg_match('/\.gif$/i', $file) ? '.gif' : '');
|
|
| 7505 | - if (empty($extImgTarget)) |
|
| 7506 | - $extImgTarget = (preg_match('/\.png$/i', $file) ? '.png' : '');
|
|
| 7507 | - if (empty($extImgTarget)) |
|
| 7508 | - $extImgTarget = (preg_match('/\.bmp$/i', $file) ? '.bmp' : '');
|
|
| 7509 | - |
|
| 7510 | - if (!$extImgTarget) |
|
| 7511 | - return $file; |
|
| 7850 | + if (empty($extImgTarget)) { |
|
| 7851 | + $extImgTarget = (preg_match('/\.jpg$/i', $file) ? '.jpg' : ''); |
|
| 7852 | + } |
|
| 7853 | + if (empty($extImgTarget)) { |
|
| 7854 | + $extImgTarget = (preg_match('/\.jpeg$/i', $file) ? '.jpeg' : ''); |
|
| 7855 | + } |
|
| 7856 | + if (empty($extImgTarget)) { |
|
| 7857 | + $extImgTarget = (preg_match('/\.gif$/i', $file) ? '.gif' : ''); |
|
| 7858 | + } |
|
| 7859 | + if (empty($extImgTarget)) { |
|
| 7860 | + $extImgTarget = (preg_match('/\.png$/i', $file) ? '.png' : ''); |
|
| 7861 | + } |
|
| 7862 | + if (empty($extImgTarget)) { |
|
| 7863 | + $extImgTarget = (preg_match('/\.bmp$/i', $file) ? '.bmp' : ''); |
|
| 7864 | + } |
|
| 7865 | + |
|
| 7866 | + if (!$extImgTarget) { |
|
| 7867 | + return $file; |
|
| 7868 | + } |
|
| 7512 | 7869 | |
| 7513 | 7870 | $subdir = ''; |
| 7514 | - if ($extName) |
|
| 7515 | - $subdir = 'thumbs/'; |
|
| 7871 | + if ($extName) { |
|
| 7872 | + $subdir = 'thumbs/'; |
|
| 7873 | + } |
|
| 7516 | 7874 | |
| 7517 | 7875 | return ($dirName ? $dirName . '/' : '') . $subdir . $fileName . $extName . $extImgTarget; // New filename for thumb |
| 7518 | 7876 | } |
@@ -7530,8 +7888,9 @@ discard block |
||
| 7530 | 7888 | {
|
| 7531 | 7889 | // global Globals::$conf, Globals::$langs; |
| 7532 | 7890 | |
| 7533 | - if (empty(Globals::$conf->use_javascript_ajax)) |
|
| 7534 | - return ''; |
|
| 7891 | + if (empty(Globals::$conf->use_javascript_ajax)) { |
|
| 7892 | + return ''; |
|
| 7893 | + } |
|
| 7535 | 7894 | |
| 7536 | 7895 | $mime_preview = array('bmp', 'jpeg', 'png', 'gif', 'tiff', 'pdf', 'plain', 'css', 'svg+xml');
|
| 7537 | 7896 | //$mime_preview[]='vnd.oasis.opendocument.presentation'; |
@@ -7539,17 +7898,19 @@ discard block |
||
| 7539 | 7898 | $num_mime = array_search(dol_mimetype($relativepath, '', 1), $mime_preview); |
| 7540 | 7899 | |
| 7541 | 7900 | if ($alldata == 1) {
|
| 7542 | - if ($num_mime !== false) |
|
| 7543 | - return array('target' => '_blank', 'css' => 'documentpreview', 'url' => DOL_BASE_URI . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : ''), 'mime' => dol_mimetype($relativepath),);
|
|
| 7544 | - else |
|
| 7545 | - return array(); |
|
| 7901 | + if ($num_mime !== false) { |
|
| 7902 | + return array('target' => '_blank', 'css' => 'documentpreview', 'url' => DOL_BASE_URI . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : ''), 'mime' => dol_mimetype($relativepath),); |
|
| 7903 | + } else { |
|
| 7904 | + return array(); |
|
| 7905 | + } |
|
| 7546 | 7906 | } |
| 7547 | 7907 | |
| 7548 | 7908 | // old behavior |
| 7549 | - if ($num_mime !== false) |
|
| 7550 | - return 'javascript:document_preview(\'' . dol_escape_js(DOL_BASE_URI . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : '')) . '\', \'' . dol_mimetype($relativepath) . '\', \'' . dol_escape_js(Globals::$langs->trans('Preview')) . '\')';
|
|
| 7551 | - else |
|
| 7552 | - return ''; |
|
| 7909 | + if ($num_mime !== false) { |
|
| 7910 | + return 'javascript:document_preview(\'' . dol_escape_js(DOL_BASE_URI . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : '')) . '\', \'' . dol_mimetype($relativepath) . '\', \'' . dol_escape_js(Globals::$langs->trans('Preview')) . '\')'; |
|
| 7911 | + } else { |
|
| 7912 | + return ''; |
|
| 7913 | + } |
|
| 7553 | 7914 | } |
| 7554 | 7915 | |
| 7555 | 7916 | /** |
@@ -7567,8 +7928,9 @@ discard block |
||
| 7567 | 7928 | jQuery("#' . $htmlname . '").click(function() { jQuery(this).select(); } );
|
| 7568 | 7929 | }); |
| 7569 | 7930 | </script>'; |
| 7570 | - if ($addlink) |
|
| 7571 | - $out .= ' <a href="' . $addlink . '" target="_blank">' . Globals::$langs->trans("Link") . '</a>';
|
|
| 7931 | + if ($addlink) { |
|
| 7932 | + $out .= ' <a href="' . $addlink . '" target="_blank">' . Globals::$langs->trans("Link") . '</a>'; |
|
| 7933 | + } |
|
| 7572 | 7934 | return $out; |
| 7573 | 7935 | } |
| 7574 | 7936 | |
@@ -7950,8 +8312,9 @@ discard block |
||
| 7950 | 8312 | if (!isset($dictvalues[$tablename])) {
|
| 7951 | 8313 | $dictvalues[$tablename] = array(); |
| 7952 | 8314 | $sql = 'SELECT * FROM ' . $tablename . ' WHERE 1'; |
| 7953 | - if ($checkentity) |
|
| 7954 | - $sql .= ' AND entity IN (0,' . getEntity($tablename) . ')'; |
|
| 8315 | + if ($checkentity) { |
|
| 8316 | + $sql .= ' AND entity IN (0,' . getEntity($tablename) . ')'; |
|
| 8317 | + } |
|
| 7955 | 8318 | |
| 7956 | 8319 | $resql = $db->query($sql); |
| 7957 | 8320 | if ($resql) {
|
@@ -7963,11 +8326,14 @@ discard block |
||
| 7963 | 8326 | } |
| 7964 | 8327 | } |
| 7965 | 8328 | |
| 7966 | - if (!empty($dictvalues[$tablename][$id])) |
|
| 7967 | - return $dictvalues[$tablename][$id]->{$field}; // Found
|
|
| 8329 | + if (!empty($dictvalues[$tablename][$id])) { |
|
| 8330 | + return $dictvalues[$tablename][$id]->{$field}; |
|
| 8331 | + } |
|
| 8332 | + // Found |
|
| 7968 | 8333 | else { // Not found
|
| 7969 | - if ($id > 0) |
|
| 7970 | - return $id; |
|
| 8334 | + if ($id > 0) { |
|
| 8335 | + return $id; |
|
| 8336 | + } |
|
| 7971 | 8337 | return ''; |
| 7972 | 8338 | } |
| 7973 | 8339 | } |
@@ -7997,8 +8363,9 @@ discard block |
||
| 7997 | 8363 | $b = hexdec($hexb); |
| 7998 | 8364 | } |
| 7999 | 8365 | $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm |
| 8000 | - if ($bright > 0.6) |
|
| 8001 | - $res = 1; |
|
| 8366 | + if ($bright > 0.6) { |
|
| 8367 | + $res = 1; |
|
| 8368 | + } |
|
| 8002 | 8369 | } |
| 8003 | 8370 | return $res; |
| 8004 | 8371 | } |
@@ -8016,8 +8383,10 @@ discard block |
||
| 8016 | 8383 | // global Globals::$conf; |
| 8017 | 8384 | //print 'type_user='.$type_user.' module='.$menuentry['module'].' enabled='.$menuentry['enabled'].' perms='.$menuentry['perms']; |
| 8018 | 8385 | //print 'ok='.in_array($menuentry['module'], $listofmodulesforexternal); |
| 8019 | - if (empty($menuentry['enabled'])) |
|
| 8020 | - return 0; // Entry disabled by condition |
|
| 8386 | + if (empty($menuentry['enabled'])) { |
|
| 8387 | + return 0; |
|
| 8388 | + } |
|
| 8389 | + // Entry disabled by condition |
|
| 8021 | 8390 | if ($type_user && $menuentry['module']) {
|
| 8022 | 8391 | $tmploops = explode('|', $menuentry['module']);
|
| 8023 | 8392 | $found = 0; |
@@ -8027,15 +8396,23 @@ discard block |
||
| 8027 | 8396 | break; |
| 8028 | 8397 | } |
| 8029 | 8398 | } |
| 8030 | - if (!$found) |
|
| 8031 | - return 0; // Entry is for menus all excluded to external users |
|
| 8032 | - } |
|
| 8033 | - if (!$menuentry['perms'] && $type_user) |
|
| 8034 | - return 0; // No permissions and user is external |
|
| 8035 | - if (!$menuentry['perms'] && !empty(Globals::$conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) |
|
| 8036 | - return 0; // No permissions and option to hide when not allowed, even for internal user, is on |
|
| 8037 | - if (!$menuentry['perms']) |
|
| 8038 | - return 2; // No permissions and user is external |
|
| 8399 | + if (!$found) { |
|
| 8400 | + return 0; |
|
| 8401 | + } |
|
| 8402 | + // Entry is for menus all excluded to external users |
|
| 8403 | + } |
|
| 8404 | + if (!$menuentry['perms'] && $type_user) { |
|
| 8405 | + return 0; |
|
| 8406 | + } |
|
| 8407 | + // No permissions and user is external |
|
| 8408 | + if (!$menuentry['perms'] && !empty(Globals::$conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) { |
|
| 8409 | + return 0; |
|
| 8410 | + } |
|
| 8411 | + // No permissions and option to hide when not allowed, even for internal user, is on |
|
| 8412 | + if (!$menuentry['perms']) { |
|
| 8413 | + return 2; |
|
| 8414 | + } |
|
| 8415 | + // No permissions and user is external |
|
| 8039 | 8416 | return 1; |
| 8040 | 8417 | } |
| 8041 | 8418 | |
@@ -25,23 +25,23 @@ discard block |
||
| 25 | 25 | $login = ''; |
| 26 | 26 | |
| 27 | 27 | if (!empty($usertotest)) {
|
| 28 | - AlDolUtils::dol_syslog("functions_dolibarr::check_user_password_dolibarr usertotest=" . $usertotest . " passwordtotest=" . preg_replace('/./', '*', $passwordtotest) . " entitytotest=" . $entitytotest);
|
|
| 28 | + AlDolUtils::dol_syslog("functions_dolibarr::check_user_password_dolibarr usertotest=".$usertotest." passwordtotest=".preg_replace('/./', '*', $passwordtotest)." entitytotest=".$entitytotest);
|
|
| 29 | 29 | |
| 30 | 30 | // If test username/password asked, we define $test=false if ko and $login var to login if ok, set also $_SESSION["dol_loginmesg"] if ko |
| 31 | - $table = MAIN_DB_PREFIX . "user"; |
|
| 31 | + $table = MAIN_DB_PREFIX."user"; |
|
| 32 | 32 | $usernamecol1 = 'login'; |
| 33 | 33 | $usernamecol2 = 'email'; |
| 34 | 34 | $entitycol = 'entity'; |
| 35 | 35 | |
| 36 | 36 | $sql = 'SELECT rowid, login, entity, pass, pass_crypted'; |
| 37 | - $sql .= ' FROM ' . $table; |
|
| 37 | + $sql .= ' FROM '.$table; |
|
| 38 | 38 | //$sql .= ' WHERE (' . $usernamecol1 . " = '" . $db->escape($usertotest) . "'";
|
| 39 | - $sql .= ' WHERE (' . $usernamecol1 . " = '" . $usertotest . "'";
|
|
| 39 | + $sql .= ' WHERE ('.$usernamecol1." = '".$usertotest."'";
|
|
| 40 | 40 | if (preg_match('/@/', $usertotest)) {
|
| 41 | 41 | // $sql .= ' OR ' . $usernamecol2 . " = '" . $db->escape($usertotest) . "'"; |
| 42 | - $sql .= ' OR ' . $usernamecol2 . " = '" . $usertotest . "'"; |
|
| 42 | + $sql .= ' OR '.$usernamecol2." = '".$usertotest."'"; |
|
| 43 | 43 | } |
| 44 | - $sql .= ') AND ' . $entitycol . " IN (0," . ($entity ? $entity : 1) . ")"; |
|
| 44 | + $sql .= ') AND '.$entitycol." IN (0,".($entity ? $entity : 1).")"; |
|
| 45 | 45 | $sql .= ' AND statut = 1'; |
| 46 | 46 | // Required to first found the user into entity, then the superadmin. |
| 47 | 47 | // For the case (TODO and that we must avoid) a user has renamed its login with same value than a user in entity 0. |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | if ($cryptType == 'md5') {
|
| 72 | 72 | if (AlSecurity::dol_verifyHash($passtyped, $passcrypted)) {
|
| 73 | 73 | $passok = true; |
| 74 | - AlDolUtils::dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - " . $cryptType . " of pass is ok");
|
|
| 74 | + AlDolUtils::dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - ".$cryptType." of pass is ok");
|
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
@@ -87,15 +87,15 @@ discard block |
||
| 87 | 87 | if ($passok) {
|
| 88 | 88 | $login = $user['login']; |
| 89 | 89 | } else {
|
| 90 | - DolUtils::dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '" . $usertotest . "'");
|
|
| 91 | - sleep(2); // Anti brut force protection |
|
| 90 | + DolUtils::dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko bad password for '".$usertotest."'");
|
|
| 91 | + sleep(2); // Anti brut force protection |
|
| 92 | 92 | // Load translation files required by the page |
| 93 | 93 | Globals::$langs->loadLangs(array('main', 'errors'));
|
| 94 | 94 | |
| 95 | 95 | $_SESSION["dol_loginmesg"] = Globals::$langs->trans("ErrorBadLoginPassword");
|
| 96 | 96 | } |
| 97 | 97 | } else {
|
| 98 | - AlDolUtils::dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko user not found for '" . $usertotest . "'");
|
|
| 98 | + AlDolUtils::dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ko user not found for '".$usertotest."'");
|
|
| 99 | 99 | sleep(1); |
| 100 | 100 | |
| 101 | 101 | // Load translation files required by the page |