Passed
Push — main ( b35285...f1540e )
by Rafael
58:14
created
Dolibarr/Modules/Install/Controller/InstallController.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
                             print '<span class="error">A ' . $conffiletoshow . ' file exists with a dolibarr_main_document_root to ' . $dolibarr_main_document_root . ' that seems wrong. Try to fix or remove the ' . $conffiletoshow . ' file.</span><br>' . "\n";
441 441
                             dol_syslog("A '" . $conffiletoshow . "' file exists with a dolibarr_main_document_root to " . $dolibarr_main_document_root . " that seems wrong. Try to fix or remove the '" . $conffiletoshow . "' file.", LOG_WARNING);
442 442
                         } else {
443
-                            require_once $dolibarr_main_document_root . '/../Dolibarr/Lib/Admin.php';;
443
+                            require_once $dolibarr_main_document_root . '/../Dolibarr/Lib/Admin.php'; ;
444 444
 
445 445
                             // If password is encoded, we decode it
446 446
                             if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass)) {
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
                     $allowupgrade = true;
558 558
                 }
559 559
 
560
-                $dir = DOL_DOCUMENT_ROOT . "/install/mysql/migration/";   // We use mysql migration scripts whatever is database driver
560
+                $dir = DOL_DOCUMENT_ROOT . "/install/mysql/migration/"; // We use mysql migration scripts whatever is database driver
561 561
                 dolibarr_install_syslog("Scan sql files for migration files in " . $dir);
562 562
 
563 563
                 // Get files list of migration file x.y.z-a.b.c.sql into /install/mysql/migration
@@ -2052,67 +2052,67 @@  discard block
 block discarded – undo
2052 2052
                     fwrite($fp, "\n");
2053 2053
                     if (empty($force_dolibarr_lib_FPDF_PATH)) {
2054 2054
                         fwrite($fp, '//');
2055
-                        $force_dolibarr_lib_FPDF_PATH = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
2055
+                        $force_dolibarr_lib_FPDF_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
2056 2056
                     }
2057 2057
                     fwrite($fp, '$dolibarr_lib_FPDF_PATH="' . dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_FPDF_PATH)) . '";');
2058 2058
                     fwrite($fp, "\n");
2059 2059
                     if (empty($force_dolibarr_lib_TCPDF_PATH)) {
2060 2060
                         fwrite($fp, '//');
2061
-                        $force_dolibarr_lib_TCPDF_PATH = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
2061
+                        $force_dolibarr_lib_TCPDF_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
2062 2062
                     }
2063 2063
                     fwrite($fp, '$dolibarr_lib_TCPDF_PATH="' . dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_TCPDF_PATH)) . '";');
2064 2064
                     fwrite($fp, "\n");
2065 2065
                     if (empty($force_dolibarr_lib_FPDI_PATH)) {
2066 2066
                         fwrite($fp, '//');
2067
-                        $force_dolibarr_lib_FPDI_PATH = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
2067
+                        $force_dolibarr_lib_FPDI_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
2068 2068
                     }
2069 2069
                     fwrite($fp, '$dolibarr_lib_FPDI_PATH="' . dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_FPDI_PATH)) . '";');
2070 2070
                     fwrite($fp, "\n");
2071 2071
                     if (empty($force_dolibarr_lib_TCPDI_PATH)) {
2072 2072
                         fwrite($fp, '//');
2073
-                        $force_dolibarr_lib_TCPDI_PATH = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
2073
+                        $force_dolibarr_lib_TCPDI_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
2074 2074
                     }
2075 2075
                     fwrite($fp, '$dolibarr_lib_TCPDI_PATH="' . dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_TCPDI_PATH)) . '";');
2076 2076
                     fwrite($fp, "\n");
2077 2077
                     if (empty($force_dolibarr_lib_GEOIP_PATH)) {
2078 2078
                         fwrite($fp, '//');
2079
-                        $force_dolibarr_lib_GEOIP_PATH = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
2079
+                        $force_dolibarr_lib_GEOIP_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
2080 2080
                     }
2081 2081
                     fwrite($fp, '$dolibarr_lib_GEOIP_PATH="' . dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_GEOIP_PATH)) . '";');
2082 2082
                     fwrite($fp, "\n");
2083 2083
                     if (empty($force_dolibarr_lib_NUSOAP_PATH)) {
2084 2084
                         fwrite($fp, '//');
2085
-                        $force_dolibarr_lib_NUSOAP_PATH = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
2085
+                        $force_dolibarr_lib_NUSOAP_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
2086 2086
                     }
2087 2087
                     fwrite($fp, '$dolibarr_lib_NUSOAP_PATH="' . dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_NUSOAP_PATH)) . '";');
2088 2088
                     fwrite($fp, "\n");
2089 2089
                     if (empty($force_dolibarr_lib_ODTPHP_PATH)) {
2090 2090
                         fwrite($fp, '//');
2091
-                        $force_dolibarr_lib_ODTPHP_PATH = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
2091
+                        $force_dolibarr_lib_ODTPHP_PATH = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
2092 2092
                     }
2093 2093
                     fwrite($fp, '$dolibarr_lib_ODTPHP_PATH="' . dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_ODTPHP_PATH)) . '";');
2094 2094
                     fwrite($fp, "\n");
2095 2095
                     if (empty($force_dolibarr_lib_ODTPHP_PATHTOPCLZIP)) {
2096 2096
                         fwrite($fp, '//');
2097
-                        $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
2097
+                        $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
2098 2098
                     }
2099 2099
                     fwrite($fp, '$dolibarr_lib_ODTPHP_PATHTOPCLZIP="' . dol_escape_php(dol_sanitizePathName($force_dolibarr_lib_ODTPHP_PATHTOPCLZIP)) . '";');
2100 2100
                     fwrite($fp, "\n");
2101 2101
                     if (empty($force_dolibarr_js_CKEDITOR)) {
2102 2102
                         fwrite($fp, '//');
2103
-                        $force_dolibarr_js_CKEDITOR = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
2103
+                        $force_dolibarr_js_CKEDITOR = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
2104 2104
                     }
2105 2105
                     fwrite($fp, '$dolibarr_js_CKEDITOR=\'' . dol_escape_php($force_dolibarr_js_CKEDITOR, 1) . '\';');
2106 2106
                     fwrite($fp, "\n");
2107 2107
                     if (empty($force_dolibarr_js_JQUERY)) {
2108 2108
                         fwrite($fp, '//');
2109
-                        $force_dolibarr_js_JQUERY = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
2109
+                        $force_dolibarr_js_JQUERY = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
2110 2110
                     }
2111 2111
                     fwrite($fp, '$dolibarr_js_JQUERY=\'' . dol_escape_php($force_dolibarr_js_JQUERY, 1) . '\';');
2112 2112
                     fwrite($fp, "\n");
2113 2113
                     if (empty($force_dolibarr_js_JQUERY_UI)) {
2114 2114
                         fwrite($fp, '//');
2115
-                        $force_dolibarr_js_JQUERY_UI = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
2115
+                        $force_dolibarr_js_JQUERY_UI = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
2116 2116
                     }
2117 2117
                     fwrite($fp, '$dolibarr_js_JQUERY_UI=\'' . dol_escape_php($force_dolibarr_js_JQUERY_UI, 1) . '\';');
2118 2118
                     fwrite($fp, "\n");
@@ -2121,13 +2121,13 @@  discard block
 block discarded – undo
2121 2121
                     fwrite($fp, "\n");
2122 2122
                     if (empty($force_dolibarr_font_DOL_DEFAULT_TTF)) {
2123 2123
                         fwrite($fp, '//');
2124
-                        $force_dolibarr_font_DOL_DEFAULT_TTF = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
2124
+                        $force_dolibarr_font_DOL_DEFAULT_TTF = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
2125 2125
                     }
2126 2126
                     fwrite($fp, '$dolibarr_font_DOL_DEFAULT_TTF=\'' . dol_escape_php($force_dolibarr_font_DOL_DEFAULT_TTF, 1) . '\';');
2127 2127
                     fwrite($fp, "\n");
2128 2128
                     if (empty($force_dolibarr_font_DOL_DEFAULT_TTF_BOLD)) {
2129 2129
                         fwrite($fp, '//');
2130
-                        $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD = '';  // @phan-suppress-current-line PhanPluginRedundantAssignment
2130
+                        $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD = ''; // @phan-suppress-current-line PhanPluginRedundantAssignment
2131 2131
                     }
2132 2132
                     fwrite($fp, '$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\'' . dol_escape_php($force_dolibarr_font_DOL_DEFAULT_TTF_BOLD, 1) . '\';');
2133 2133
                     fwrite($fp, "\n");
@@ -2447,9 +2447,9 @@  discard block
 block discarded – undo
2447 2447
 // Only works if you are not in safe_mode. / Ne fonctionne que si on est pas en safe_mode.
2448 2448
 
2449 2449
         $err = error_reporting();
2450
-        error_reporting(0);      // Disable all errors
2450
+        error_reporting(0); // Disable all errors
2451 2451
 //error_reporting(E_ALL);
2452
-        @set_time_limit(1800);   // Need 1800 on some very slow OS like Windows 7/64
2452
+        @set_time_limit(1800); // Need 1800 on some very slow OS like Windows 7/64
2453 2453
         error_reporting($err);
2454 2454
 
2455 2455
         $action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : (empty($argv[1]) ? '' : $argv[1]);
@@ -3003,7 +3003,7 @@  discard block
 block discarded – undo
3003 3003
 
3004 3004
         $conf->file->instance_unique_id = (empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id); // Unique id of instance
3005 3005
 
3006
-        $hash_unique_id = dol_hash('dolibarr' . $conf->file->instance_unique_id, 'sha256');   // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
3006
+        $hash_unique_id = dol_hash('dolibarr' . $conf->file->instance_unique_id, 'sha256'); // Note: if the global salt changes, this hash changes too so ping may be counted twice. We don't mind. It is for statistics purpose only.
3007 3007
 
3008 3008
         //$out = '<input type="checkbox" name="dolibarrpingno" id="dolibarrpingno"' . ((getDolGlobalString('MAIN_FIRST_PING_OK_ID') == 'disabled') ? '' : ' value="checked" checked="true"') . '> ';
3009 3009
 		$out = '<input type="checkbox" name="dolibarrpingno" id="dolibarrpingno"' . ((getDolGlobalString('MAIN_FIRST_PING_OK_ID') == 'disabled') ? '' : ' value="checked"') . '> ';
@@ -3277,7 +3277,7 @@  discard block
 block discarded – undo
3277 3277
             $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port);
3278 3278
 
3279 3279
 			$conf = Config::getConf();
3280
-			$config=Config::getConfig();
3280
+			$config = Config::getConfig();
3281 3281
 
3282 3282
 			// Create the global $hookmanager object
3283 3283
             // include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
@@ -3342,8 +3342,8 @@  discard block
 block discarded – undo
3342 3342
                     $newuser->admin = 1;
3343 3343
                     $newuser->entity = 0;
3344 3344
 
3345
-                    $conf->global->USER_MAIL_REQUIRED = 0;          // Force global option to be sure to create a new user with no email
3346
-                    $conf->global->USER_PASSWORD_GENERATED = '';    // To not use any rule for password validation
3345
+                    $conf->global->USER_MAIL_REQUIRED = 0; // Force global option to be sure to create a new user with no email
3346
+                    $conf->global->USER_PASSWORD_GENERATED = ''; // To not use any rule for password validation
3347 3347
 
3348 3348
                     $result = $newuser->create($createuser, 1);
3349 3349
 
Please login to merge, or discard this patch.
Dolibarr/Modules/User/Model/User.php 1 patch
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
 			// If we ask to add a given permission, we first load properties of this permission (module, perms and subperms).
440 440
 			$sql = "SELECT module, perms, subperms";
441 441
 			$sql .= " FROM " . $dbPrefix . "rights_def";
442
-			$sql .= " WHERE id = " . ((int)$rid);
443
-			$sql .= " AND entity = " . ((int)$entity);
442
+			$sql .= " WHERE id = " . ((int) $rid);
443
+			$sql .= " AND entity = " . ((int) $entity);
444 444
 
445 445
 			$result = $this->db->query($sql);
446 446
 			if ($result) {
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 			}
458 458
 
459 459
 			// Define the where for the permission to add
460
-			$whereforadd = "id=" . ((int)$rid);
460
+			$whereforadd = "id=" . ((int) $rid);
461 461
 			// Add also inherited permissions
462 462
 			if (!empty($subperms)) {
463 463
 				$whereforadd .= " OR (module='" . $this->db->escape($module) . "' AND perms='" . $this->db->escape($perms) . "' AND (subperms='lire' OR subperms='read'))";
@@ -486,15 +486,15 @@  discard block
 block discarded – undo
486 486
 			//print "$module-$perms-$subperms";
487 487
 			$sql = "SELECT id";
488 488
 			$sql .= " FROM " . $dbPrefix . "rights_def";
489
-			$sql .= " WHERE entity = " . ((int)$entity);
489
+			$sql .= " WHERE entity = " . ((int) $entity);
490 490
 			if (!empty($whereforadd) && $whereforadd != 'allmodules') {
491
-				$sql .= " AND (" . $whereforadd . ")";  // Note: parenthesis are important because whereforadd can contains OR. Also note that $whereforadd is already sanitized
491
+				$sql .= " AND (" . $whereforadd . ")"; // Note: parenthesis are important because whereforadd can contains OR. Also note that $whereforadd is already sanitized
492 492
 			}
493 493
 
494 494
 			$sqldelete = "DELETE FROM " . $dbPrefix . "user_rights";
495
-			$sqldelete .= " WHERE fk_user = " . ((int)$this->id) . " AND fk_id IN (";
495
+			$sqldelete .= " WHERE fk_user = " . ((int) $this->id) . " AND fk_id IN (";
496 496
 			$sqldelete .= $sql;
497
-			$sqldelete .= ") AND entity = " . ((int)$entity);
497
+			$sqldelete .= ") AND entity = " . ((int) $entity);
498 498
 			if (!$this->db->query($sqldelete)) {
499 499
 				$error++;
500 500
 			}
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 						if ($obj) {
511 511
 							$nid = $obj->id;
512 512
 
513
-							$sql = "INSERT INTO " . $dbPrefix . "user_rights (entity, fk_user, fk_id) VALUES (" . ((int)$entity) . ", " . ((int)$this->id) . ", " . ((int)$nid) . ")";
513
+							$sql = "INSERT INTO " . $dbPrefix . "user_rights (entity, fk_user, fk_id) VALUES (" . ((int) $entity) . ", " . ((int) $this->id) . ", " . ((int) $nid) . ")";
514 514
 							if (!$this->db->query($sql)) {
515 515
 								$error++;
516 516
 							}
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 			$sql = "SELECT module, perms, subperms";
577 577
 			$sql .= " FROM " . $dbPrefix . "rights_def";
578 578
 			$sql .= " WHERE id = '" . $this->db->escape($rid) . "'";
579
-			$sql .= " AND entity = " . ((int)$entity);
579
+			$sql .= " AND entity = " . ((int) $entity);
580 580
 
581 581
 			$result = $this->db->query($sql);
582 582
 			if ($result) {
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 			}
594 594
 
595 595
 			// Where clause for the list of permissions to delete
596
-			$wherefordel = "id=" . ((int)$rid);
596
+			$wherefordel = "id=" . ((int) $rid);
597 597
 			// Suppression des droits induits
598 598
 			if ($subperms == 'lire' || $subperms == 'read') {
599 599
 				$wherefordel .= " OR (module='" . $this->db->escape($module) . "' AND perms='" . $this->db->escape($perms) . "' AND subperms IS NOT NULL)";
@@ -622,9 +622,9 @@  discard block
 block discarded – undo
622 622
 			//print "$module-$perms-$subperms";
623 623
 			$sql = "SELECT id";
624 624
 			$sql .= " FROM " . $dbPrefix . "rights_def";
625
-			$sql .= " WHERE entity = " . ((int)$entity);
625
+			$sql .= " WHERE entity = " . ((int) $entity);
626 626
 			if (!empty($wherefordel) && $wherefordel != 'allmodules') {
627
-				$sql .= " AND (" . $wherefordel . ")";  // Note: parenthesis are important because wherefordel can contains OR. Also note that $wherefordel is already sanitized
627
+				$sql .= " AND (" . $wherefordel . ")"; // Note: parenthesis are important because wherefordel can contains OR. Also note that $wherefordel is already sanitized
628 628
 			}
629 629
 
630 630
 			// avoid admin can remove his own important rights
@@ -636,10 +636,10 @@  discard block
 block discarded – undo
636 636
 			}
637 637
 
638 638
 			$sqldelete = "DELETE FROM " . $dbPrefix . "user_rights";
639
-			$sqldelete .= " WHERE fk_user = " . ((int)$this->id) . " AND fk_id IN (";
639
+			$sqldelete .= " WHERE fk_user = " . ((int) $this->id) . " AND fk_id IN (";
640 640
 			$sqldelete .= $sql;
641 641
 			$sqldelete .= ")";
642
-			$sqldelete .= " AND entity = " . ((int)$entity);
642
+			$sqldelete .= " AND entity = " . ((int) $entity);
643 643
 
644 644
 			$resql = $this->db->query($sqldelete);
645 645
 			if (!$resql) {
@@ -733,9 +733,9 @@  discard block
 block discarded – undo
733 733
 			} else {
734 734
 				// On table r=rights_def, the unique key is (id, entity) because id is hard coded into module descriptor and insert during module activation.
735 735
 				// So we must include the filter on entity on both table r. and ur.
736
-				$sql .= " AND r.entity = " . ((int)$conf->entity) . " AND ur.entity = " . ((int)$conf->entity);
736
+				$sql .= " AND r.entity = " . ((int) $conf->entity) . " AND ur.entity = " . ((int) $conf->entity);
737 737
 			}
738
-			$sql .= " AND ur.fk_user= " . ((int)$this->id);
738
+			$sql .= " AND ur.fk_user= " . ((int) $this->id);
739 739
 			$sql .= " AND r.perms IS NOT NULL";
740 740
 			if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
741 741
 				$sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
@@ -794,19 +794,19 @@  discard block
 block discarded – undo
794 794
 				if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) {
795 795
 					$sql .= " AND gu.entity IN (0," . $conf->entity . ")";
796 796
 				} else {
797
-					$sql .= " AND r.entity = " . ((int)$conf->entity);
797
+					$sql .= " AND r.entity = " . ((int) $conf->entity);
798 798
 				}
799 799
 			} else {
800
-				$sql .= " AND gr.entity = " . ((int)$conf->entity);  // Only groups created in current entity
800
+				$sql .= " AND gr.entity = " . ((int) $conf->entity); // Only groups created in current entity
801 801
 				// The entity on the table usergroup_user should be useless and should never be used because it is already into gr and r.
802 802
 				// but when using MULTICOMPANY_TRANSVERSE_MODE, we may insert record that make rubbish result due to duplicate record of
803 803
 				// other entities, so we are forced to add a filter here
804 804
 				$sql .= " AND gu.entity IN (0," . $conf->entity . ")";
805
-				$sql .= " AND r.entity = " . ((int)$conf->entity);   // Only permission of modules enabled in current entity
805
+				$sql .= " AND r.entity = " . ((int) $conf->entity); // Only permission of modules enabled in current entity
806 806
 			}
807 807
 			// End of strange business rule
808 808
 			$sql .= " AND gr.fk_usergroup = gu.fk_usergroup";
809
-			$sql .= " AND gu.fk_user = " . ((int)$this->id);
809
+			$sql .= " AND gu.fk_user = " . ((int) $this->id);
810 810
 			$sql .= " AND r.perms IS NOT NULL";
811 811
 			if ($moduletag) {
812 812
 				$sql .= " AND r.module = '" . $this->db->escape($moduletag) . "'";
@@ -957,8 +957,8 @@  discard block
 block discarded – undo
957 957
 
958 958
 		// Save in database
959 959
 		$sql = "UPDATE " . $dbPrefix . "user";
960
-		$sql .= " SET statut = " . ((int)$status);
961
-		$sql .= " WHERE rowid = " . ((int)$this->id);
960
+		$sql .= " SET statut = " . ((int) $status);
961
+		$sql .= " WHERE rowid = " . ((int) $this->id);
962 962
 		$result = $this->db->query($sql);
963 963
 
964 964
 		dol_syslog(get_class($this) . "::setstatus", LOG_DEBUG);
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 		dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
1024 1024
 
1025 1025
 		// Remove rights
1026
-		$sql = "DELETE FROM " . $dbPrefix . "user_rights WHERE fk_user = " . ((int)$this->id);
1026
+		$sql = "DELETE FROM " . $dbPrefix . "user_rights WHERE fk_user = " . ((int) $this->id);
1027 1027
 
1028 1028
 		if (!$error && !$this->db->query($sql)) {
1029 1029
 			$error++;
@@ -1031,14 +1031,14 @@  discard block
 block discarded – undo
1031 1031
 		}
1032 1032
 
1033 1033
 		// Remove group
1034
-		$sql = "DELETE FROM " . $dbPrefix . "usergroup_user WHERE fk_user  = " . ((int)$this->id);
1034
+		$sql = "DELETE FROM " . $dbPrefix . "usergroup_user WHERE fk_user  = " . ((int) $this->id);
1035 1035
 		if (!$error && !$this->db->query($sql)) {
1036 1036
 			$error++;
1037 1037
 			$this->error = $this->db->lasterror();
1038 1038
 		}
1039 1039
 
1040 1040
 		// Remove params
1041
-		$sql = "DELETE FROM " . $dbPrefix . "user_param WHERE fk_user  = " . ((int)$this->id);
1041
+		$sql = "DELETE FROM " . $dbPrefix . "user_param WHERE fk_user  = " . ((int) $this->id);
1042 1042
 		if (!$error && !$this->db->query($sql)) {
1043 1043
 			$error++;
1044 1044
 			$this->error = $this->db->lasterror();
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 
1047 1047
 		// If contact, remove link
1048 1048
 		if ($this->contact_id > 0) {
1049
-			$sql = "UPDATE " . $dbPrefix . "socpeople SET fk_user_creat = null WHERE rowid = " . ((int)$this->contact_id);
1049
+			$sql = "UPDATE " . $dbPrefix . "socpeople SET fk_user_creat = null WHERE rowid = " . ((int) $this->contact_id);
1050 1050
 			if (!$error && !$this->db->query($sql)) {
1051 1051
 				$error++;
1052 1052
 				$this->error = $this->db->lasterror();
@@ -1064,7 +1064,7 @@  discard block
 block discarded – undo
1064 1064
 
1065 1065
 		// Remove user
1066 1066
 		if (!$error) {
1067
-			$sql = "DELETE FROM " . $dbPrefix . "user WHERE rowid = " . ((int)$this->id);
1067
+			$sql = "DELETE FROM " . $dbPrefix . "user WHERE rowid = " . ((int) $this->id);
1068 1068
 			dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
1069 1069
 			if (!$this->db->query($sql)) {
1070 1070
 				$error++;
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 
1160 1160
 		if ($entity < 0) {
1161 1161
 			if ((!isModEnabled('multicompany') || !getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) && (!empty($user->entity))) {
1162
-				$sql .= " WHERE u.entity IN (0, " . ((int)$conf->entity) . ")";
1162
+				$sql .= " WHERE u.entity IN (0, " . ((int) $conf->entity) . ")";
1163 1163
 			} else {
1164 1164
 				$sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
1165 1165
 			}
@@ -1168,7 +1168,7 @@  discard block
 block discarded – undo
1168 1168
 			if (isModEnabled('multicompany') && getDolGlobalString('MULTICOMPANY_TRANSVERSE_MODE')) {
1169 1169
 				$sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database
1170 1170
 			} else {
1171
-				$sql .= " WHERE u.entity IN (0, " . ((int)(($entity != '' && $entity >= 0) ? $entity : $conf->entity)) . ")"; // search in entity provided in parameter
1171
+				$sql .= " WHERE u.entity IN (0, " . ((int) (($entity != '' && $entity >= 0) ? $entity : $conf->entity)) . ")"; // search in entity provided in parameter
1172 1172
 			}
1173 1173
 		}
1174 1174
 
@@ -1184,9 +1184,9 @@  discard block
 block discarded – undo
1184 1184
 			}
1185 1185
 			$sql .= ")";
1186 1186
 		} elseif ($fk_socpeople > 0) {
1187
-			$sql .= " AND u.fk_socpeople = " . ((int)$fk_socpeople);
1187
+			$sql .= " AND u.fk_socpeople = " . ((int) $fk_socpeople);
1188 1188
 		} else {
1189
-			$sql .= " AND u.rowid = " . ((int)$id);
1189
+			$sql .= " AND u.rowid = " . ((int) $id);
1190 1190
 		}
1191 1191
 		$sql .= " ORDER BY u.entity ASC"; // Avoid random result when there is 2 login in 2 different entities
1192 1192
 
@@ -1250,15 +1250,15 @@  discard block
 block discarded – undo
1250 1250
 				$this->email = $obj->email;
1251 1251
 				$this->email_oauth2 = $obj->email_oauth2;
1252 1252
 				$this->personal_email = $obj->personal_email;
1253
-				$this->socialnetworks = ($obj->socialnetworks ? (array)json_decode($obj->socialnetworks, true) : []);
1253
+				$this->socialnetworks = ($obj->socialnetworks ? (array) json_decode($obj->socialnetworks, true) : []);
1254 1254
 				$this->job = $obj->job;
1255 1255
 				$this->signature = $obj->signature;
1256 1256
 				$this->admin = $obj->admin;
1257 1257
 				$this->note_public = $obj->note_public;
1258 1258
 				$this->note_private = $obj->note_private;
1259
-				$this->note = $obj->note_private;   // deprecated
1259
+				$this->note = $obj->note_private; // deprecated
1260 1260
 
1261
-				$this->statut = $obj->status;         // deprecated
1261
+				$this->statut = $obj->status; // deprecated
1262 1262
 				$this->status = $obj->status;
1263 1263
 
1264 1264
 				$this->photo = $obj->photo;
@@ -1345,8 +1345,8 @@  discard block
 block discarded – undo
1345 1345
 
1346 1346
 		// Load user->conf for user
1347 1347
 		$sql = "SELECT param, value FROM " . $dbPrefix . "user_param";
1348
-		$sql .= " WHERE fk_user = " . ((int)$this->id);
1349
-		$sql .= " AND entity = " . ((int)$conf->entity);
1348
+		$sql .= " WHERE fk_user = " . ((int) $this->id);
1349
+		$sql .= " AND entity = " . ((int) $conf->entity);
1350 1350
 		//dol_syslog(get_class($this).'::fetch load personalized conf', LOG_DEBUG);
1351 1351
 		$resql = $this->db->query($sql);
1352 1352
 		if ($resql) {
@@ -1383,7 +1383,7 @@  discard block
 block discarded – undo
1383 1383
 			// Load user->default_values for user. TODO Save this in memcached ?
1384 1384
 
1385 1385
 			$defaultValues = new DefaultValues($this->db);
1386
-			$result = $defaultValues->fetchAll('', '', 0, 0, '(t.user_id:in:0,' . $this->id . ') AND (entity:in:' . (isset($this->entity) ? $this->entity : $conf->entity) . ',' . $conf->entity . ')');    // User 0 (all) + me (if defined)
1386
+			$result = $defaultValues->fetchAll('', '', 0, 0, '(t.user_id:in:0,' . $this->id . ') AND (entity:in:' . (isset($this->entity) ? $this->entity : $conf->entity) . ',' . $conf->entity . ')'); // User 0 (all) + me (if defined)
1387 1387
 			//$result = $defaultValues->fetchAll('', '', 0, 0, array('t.user_id'=>array(0, $this->id), 'entity'=>array((isset($this->entity) ? $this->entity : $conf->entity), $conf->entity)));    // User 0 (all) + me (if defined)
1388 1388
 
1389 1389
 			if (!is_array($result) && $result < 0) {
@@ -1544,12 +1544,12 @@  discard block
 block discarded – undo
1544 1544
 		$result = $this->create($user, 1);
1545 1545
 		if ($result > 0) {
1546 1546
 			$sql = "UPDATE " . $dbPrefix . "user";
1547
-			$sql .= " SET fk_socpeople=" . ((int)$contact->id);
1547
+			$sql .= " SET fk_socpeople=" . ((int) $contact->id);
1548 1548
 			$sql .= ", civility='" . $this->db->escape($contact->civility_code) . "'";
1549 1549
 			if ($contact->socid > 0) {
1550
-				$sql .= ", fk_soc=" . ((int)$contact->socid);
1550
+				$sql .= ", fk_soc=" . ((int) $contact->socid);
1551 1551
 			}
1552
-			$sql .= " WHERE rowid=" . ((int)$this->id);
1552
+			$sql .= " WHERE rowid=" . ((int) $this->id);
1553 1553
 
1554 1554
 			$resql = $this->db->query($sql);
1555 1555
 
@@ -1604,8 +1604,8 @@  discard block
 block discarded – undo
1604 1604
 		// Clean parameters
1605 1605
 		$this->setUpperOrLowerCase();
1606 1606
 
1607
-		$this->civility_code = trim((string)$this->civility_code);
1608
-		$this->login = trim((string)$this->login);
1607
+		$this->civility_code = trim((string) $this->civility_code);
1608
+		$this->login = trim((string) $this->login);
1609 1609
 		if (!isset($this->entity)) {
1610 1610
 			$this->entity = $conf->entity; // If not defined, we use default value
1611 1611
 		}
@@ -1637,7 +1637,7 @@  discard block
 block discarded – undo
1637 1637
 
1638 1638
 		// Check if login already exists in same entity or into entity 0.
1639 1639
 		if ($this->login) {
1640
-			$sqltochecklogin = "SELECT COUNT(*) as nb FROM " . $dbPrefix . "user WHERE entity IN (" . $this->db->sanitize((int)$this->entity) . ", 0) AND login = '" . $this->db->escape($this->login) . "'";
1640
+			$sqltochecklogin = "SELECT COUNT(*) as nb FROM " . $dbPrefix . "user WHERE entity IN (" . $this->db->sanitize((int) $this->entity) . ", 0) AND login = '" . $this->db->escape($this->login) . "'";
1641 1641
 			$resqltochecklogin = $this->db->query($sqltochecklogin);
1642 1642
 			if ($resqltochecklogin) {
1643 1643
 				$objtochecklogin = $this->db->fetch_object($resqltochecklogin);
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
 			}
1653 1653
 		}
1654 1654
 		if (!empty($this->email)) {
1655
-			$sqltochecklogin = "SELECT COUNT(*) as nb FROM " . $dbPrefix . "user WHERE entity IN (" . $this->db->sanitize((int)$this->entity) . ", 0) AND email = '" . $this->db->escape($this->email) . "'";
1655
+			$sqltochecklogin = "SELECT COUNT(*) as nb FROM " . $dbPrefix . "user WHERE entity IN (" . $this->db->sanitize((int) $this->entity) . ", 0) AND email = '" . $this->db->escape($this->email) . "'";
1656 1656
 			$resqltochecklogin = $this->db->query($sqltochecklogin);
1657 1657
 			if ($resqltochecklogin) {
1658 1658
 				$objtochecklogin = $this->db->fetch_object($resqltochecklogin);
@@ -1669,7 +1669,7 @@  discard block
 block discarded – undo
1669 1669
 
1670 1670
 		// Insert into database
1671 1671
 		$sql = "INSERT INTO " . $dbPrefix . "user (datec, login, ldap_sid, entity)";
1672
-		$sql .= " VALUES('" . $this->db->idate($this->datec) . "', '" . $this->db->escape($this->login) . "', '" . $this->db->escape($this->ldap_sid) . "', " . ((int)$this->entity) . ")";
1672
+		$sql .= " VALUES('" . $this->db->idate($this->datec) . "', '" . $this->db->escape($this->login) . "', '" . $this->db->escape($this->ldap_sid) . "', " . ((int) $this->entity) . ")";
1673 1673
 		$result = $this->db->query($sql);
1674 1674
 
1675 1675
 		dol_syslog(get_class($this) . "::create", LOG_DEBUG);
@@ -1745,7 +1745,7 @@  discard block
 block discarded – undo
1745 1745
 		$num = 0;
1746 1746
 		$sql = "SELECT id FROM " . $dbPrefix . "rights_def";
1747 1747
 		$sql .= " WHERE bydefault = 1";
1748
-		$sql .= " AND entity = " . ((int)$conf->entity);
1748
+		$sql .= " AND entity = " . ((int) $conf->entity);
1749 1749
 
1750 1750
 		$resql = $this->db->query($sql);
1751 1751
 		if ($resql) {
@@ -1800,47 +1800,47 @@  discard block
 block discarded – undo
1800 1800
 		dol_syslog(get_class($this) . "::update notrigger=" . $notrigger . ", nosyncmember=" . $nosyncmember . ", nosyncmemberpass=" . $nosyncmemberpass);
1801 1801
 
1802 1802
 		// Clean parameters
1803
-		$this->civility_code = trim((string)$this->civility_code);
1804
-		$this->lastname = trim((string)$this->lastname);
1805
-		$this->firstname = trim((string)$this->firstname);
1806
-		$this->ref_employee = trim((string)$this->ref_employee);
1807
-		$this->national_registration_number = trim((string)$this->national_registration_number);
1803
+		$this->civility_code = trim((string) $this->civility_code);
1804
+		$this->lastname = trim((string) $this->lastname);
1805
+		$this->firstname = trim((string) $this->firstname);
1806
+		$this->ref_employee = trim((string) $this->ref_employee);
1807
+		$this->national_registration_number = trim((string) $this->national_registration_number);
1808 1808
 		$this->employee = ($this->employee > 0 ? $this->employee : 0);
1809
-		$this->login = trim((string)$this->login);
1810
-		$this->gender = trim((string)$this->gender);
1809
+		$this->login = trim((string) $this->login);
1810
+		$this->gender = trim((string) $this->gender);
1811 1811
 
1812
-		$this->pass = trim((string)$this->pass);
1813
-		$this->api_key = trim((string)$this->api_key);
1812
+		$this->pass = trim((string) $this->pass);
1813
+		$this->api_key = trim((string) $this->api_key);
1814 1814
 		$this->datestartvalidity = empty($this->datestartvalidity) ? '' : $this->datestartvalidity;
1815 1815
 		$this->dateendvalidity = empty($this->dateendvalidity) ? '' : $this->dateendvalidity;
1816 1816
 
1817
-		$this->address = trim((string)$this->address);
1818
-		$this->zip = trim((string)$this->zip);
1819
-		$this->town = trim((string)$this->town);
1817
+		$this->address = trim((string) $this->address);
1818
+		$this->zip = trim((string) $this->zip);
1819
+		$this->town = trim((string) $this->town);
1820 1820
 
1821 1821
 		$this->state_id = ($this->state_id > 0 ? $this->state_id : 0);
1822 1822
 		$this->country_id = ($this->country_id > 0 ? $this->country_id : 0);
1823
-		$this->office_phone = trim((string)$this->office_phone);
1824
-		$this->office_fax = trim((string)$this->office_fax);
1825
-		$this->user_mobile = trim((string)$this->user_mobile);
1826
-		$this->personal_mobile = trim((string)$this->personal_mobile);
1827
-		$this->email = trim((string)$this->email);
1828
-		$this->personal_email = trim((string)$this->personal_email);
1829
-
1830
-		$this->job = trim((string)$this->job);
1831
-		$this->signature = trim((string)$this->signature);
1832
-		$this->note_public = trim((string)$this->note_public);
1833
-		$this->note_private = trim((string)$this->note_private);
1834
-		$this->openid = trim((string)$this->openid);
1823
+		$this->office_phone = trim((string) $this->office_phone);
1824
+		$this->office_fax = trim((string) $this->office_fax);
1825
+		$this->user_mobile = trim((string) $this->user_mobile);
1826
+		$this->personal_mobile = trim((string) $this->personal_mobile);
1827
+		$this->email = trim((string) $this->email);
1828
+		$this->personal_email = trim((string) $this->personal_email);
1829
+
1830
+		$this->job = trim((string) $this->job);
1831
+		$this->signature = trim((string) $this->signature);
1832
+		$this->note_public = trim((string) $this->note_public);
1833
+		$this->note_private = trim((string) $this->note_private);
1834
+		$this->openid = trim((string) $this->openid);
1835 1835
 		$this->admin = ($this->admin > 0 ? $this->admin : 0);
1836 1836
 
1837
-		$this->accountancy_code = trim((string)$this->accountancy_code);
1838
-		$this->color = trim((string)$this->color);
1837
+		$this->accountancy_code = trim((string) $this->accountancy_code);
1838
+		$this->color = trim((string) $this->color);
1839 1839
 		$this->dateemployment = empty($this->dateemployment) ? '' : $this->dateemployment;
1840 1840
 		$this->dateemploymentend = empty($this->dateemploymentend) ? '' : $this->dateemploymentend;
1841 1841
 
1842 1842
 		$this->birth = empty($this->birth) ? '' : $this->birth;
1843
-		$this->fk_warehouse = (int)$this->fk_warehouse;
1843
+		$this->fk_warehouse = (int) $this->fk_warehouse;
1844 1844
 
1845 1845
 		$this->setUpperOrLowerCase();
1846 1846
 
@@ -1866,7 +1866,7 @@  discard block
 block discarded – undo
1866 1866
 
1867 1867
 		// Check if login already exists in same entity or into entity 0.
1868 1868
 		if (!empty($this->oldcopy) && $this->oldcopy->login != $this->login) {
1869
-			$sqltochecklogin = "SELECT COUNT(*) as nb FROM " . $dbPrefix . "user WHERE entity IN (" . $this->db->sanitize((int)$this->entity) . ", 0) AND login = '" . $this->db->escape($this->login) . "'";
1869
+			$sqltochecklogin = "SELECT COUNT(*) as nb FROM " . $dbPrefix . "user WHERE entity IN (" . $this->db->sanitize((int) $this->entity) . ", 0) AND login = '" . $this->db->escape($this->login) . "'";
1870 1870
 			$resqltochecklogin = $this->db->query($sqltochecklogin);
1871 1871
 			if ($resqltochecklogin) {
1872 1872
 				$objtochecklogin = $this->db->fetch_object($resqltochecklogin);
@@ -1880,7 +1880,7 @@  discard block
 block discarded – undo
1880 1880
 			}
1881 1881
 		}
1882 1882
 		if (!empty($this->oldcopy) && !empty($this->email) && $this->oldcopy->email != $this->email) {
1883
-			$sqltochecklogin = "SELECT COUNT(*) as nb FROM " . $dbPrefix . "user WHERE entity IN (" . $this->db->sanitize((int)$this->entity) . ", 0) AND email = '" . $this->db->escape($this->email) . "'";
1883
+			$sqltochecklogin = "SELECT COUNT(*) as nb FROM " . $dbPrefix . "user WHERE entity IN (" . $this->db->sanitize((int) $this->entity) . ", 0) AND email = '" . $this->db->escape($this->email) . "'";
1884 1884
 			$resqltochecklogin = $this->db->query($sqltochecklogin);
1885 1885
 			if ($resqltochecklogin) {
1886 1886
 				$objtochecklogin = $this->db->fetch_object($resqltochecklogin);
@@ -1901,13 +1901,13 @@  discard block
 block discarded – undo
1901 1901
 		$sql .= ", firstname = '" . $this->db->escape($this->firstname) . "'";
1902 1902
 		$sql .= ", ref_employee = '" . $this->db->escape($this->ref_employee) . "'";
1903 1903
 		$sql .= ", national_registration_number = '" . $this->db->escape($this->national_registration_number) . "'";
1904
-		$sql .= ", employee = " . (int)$this->employee;
1904
+		$sql .= ", employee = " . (int) $this->employee;
1905 1905
 		$sql .= ", login = '" . $this->db->escape($this->login) . "'";
1906 1906
 		$sql .= ", api_key = " . ($this->api_key ? "'" . $this->db->escape(dolEncrypt($this->api_key, '', '', 'dolibarr')) . "'" : "null");
1907 1907
 		$sql .= ", gender = " . ($this->gender != -1 ? "'" . $this->db->escape($this->gender) . "'" : "null"); // 'man' or 'woman'
1908 1908
 		$sql .= ", birth=" . (strval($this->birth) != '' ? "'" . $this->db->idate($this->birth, 'tzserver') . "'" : 'null');
1909 1909
 		if (!empty($user->admin)) {
1910
-			$sql .= ", admin = " . (int)$this->admin; // admin flag can be set/unset only by an admin user
1910
+			$sql .= ", admin = " . (int) $this->admin; // admin flag can be set/unset only by an admin user
1911 1911
 		}
1912 1912
 		$sql .= ", address = '" . $this->db->escape($this->address) . "'";
1913 1913
 		$sql .= ", zip = '" . $this->db->escape($this->zip) . "'";
@@ -1950,13 +1950,13 @@  discard block
 block discarded – undo
1950 1950
 		}
1951 1951
 		$sql .= ", weeklyhours= " . ($this->weeklyhours != '' ? "'" . $this->db->escape($this->weeklyhours) . "'" : "null");
1952 1952
 		if (!empty($user->admin) && empty($user->entity) && $user->id != $this->id) {
1953
-			$sql .= ", entity = " . ((int)$this->entity); // entity flag can be set/unset only by an another superadmin user
1953
+			$sql .= ", entity = " . ((int) $this->entity); // entity flag can be set/unset only by an another superadmin user
1954 1954
 		}
1955 1955
 		$sql .= ", default_range = " . ($this->default_range > 0 ? $this->default_range : 'null');
1956 1956
 		$sql .= ", default_c_exp_tax_cat = " . ($this->default_c_exp_tax_cat > 0 ? $this->default_c_exp_tax_cat : 'null');
1957 1957
 		$sql .= ", fk_warehouse = " . ($this->fk_warehouse > 0 ? $this->fk_warehouse : "null");
1958 1958
 		$sql .= ", lang = " . ($this->lang ? "'" . $this->db->escape($this->lang) . "'" : "null");
1959
-		$sql .= " WHERE rowid = " . ((int)$this->id);
1959
+		$sql .= " WHERE rowid = " . ((int) $this->id);
1960 1960
 
1961 1961
 		dol_syslog(get_class($this) . "::update", LOG_DEBUG);
1962 1962
 		$resql = $this->db->query($sql);
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 			// If user is linked to a member, remove old link to this member
1978 1978
 			if ($this->fk_member > 0) {
1979 1979
 				dol_syslog(get_class($this) . "::update remove link with member. We will recreate it later", LOG_DEBUG);
1980
-				$sql = "UPDATE " . $dbPrefix . "user SET fk_member = NULL where fk_member = " . ((int)$this->fk_member);
1980
+				$sql = "UPDATE " . $dbPrefix . "user SET fk_member = NULL where fk_member = " . ((int) $this->fk_member);
1981 1981
 				$resql = $this->db->query($sql);
1982 1982
 				if (!$resql) {
1983 1983
 					$this->error = $this->db->error();
@@ -1987,7 +1987,7 @@  discard block
 block discarded – undo
1987 1987
 			}
1988 1988
 			// Set link to user
1989 1989
 			dol_syslog(get_class($this) . "::update set link with member", LOG_DEBUG);
1990
-			$sql = "UPDATE " . $dbPrefix . "user SET fk_member =" . ($this->fk_member > 0 ? ((int)$this->fk_member) : 'null') . " where rowid = " . ((int)$this->id);
1990
+			$sql = "UPDATE " . $dbPrefix . "user SET fk_member =" . ($this->fk_member > 0 ? ((int) $this->fk_member) : 'null') . " where rowid = " . ((int) $this->id);
1991 1991
 			$resql = $this->db->query($sql);
1992 1992
 			if (!$resql) {
1993 1993
 				$this->error = $this->db->error();
@@ -2214,7 +2214,7 @@  discard block
 block discarded – undo
2214 2214
 			} else {
2215 2215
 				$sql .= ", pass = '" . $this->db->escape($password) . "'";
2216 2216
 			}
2217
-			$sql .= " WHERE rowid = " . ((int)$this->id);
2217
+			$sql .= " WHERE rowid = " . ((int) $this->id);
2218 2218
 
2219 2219
 			dol_syslog(get_class($this) . "::setPassword", LOG_DEBUG);
2220 2220
 			$result = $this->db->query($sql);
@@ -2272,7 +2272,7 @@  discard block
 block discarded – undo
2272 2272
 			// After receiving confirmation link, we will erase and store it in pass_crypted
2273 2273
 			$sql = "UPDATE " . $dbPrefix . "user";
2274 2274
 			$sql .= " SET pass_temp = '" . $this->db->escape($password) . "'";
2275
-			$sql .= " WHERE rowid = " . ((int)$this->id);
2275
+			$sql .= " WHERE rowid = " . ((int) $this->id);
2276 2276
 
2277 2277
 			dol_syslog(get_class($this) . "::setPassword", LOG_DEBUG); // No log
2278 2278
 			$result = $this->db->query($sql);
@@ -2349,7 +2349,7 @@  discard block
 block discarded – undo
2349 2349
 			} elseif (!empty($this->pass_crypted)) {    // If an encrypted password is already known, we save it directly into database because the previous create did not save it.
2350 2350
 				$sql = "UPDATE " . $dbPrefix . "user";
2351 2351
 				$sql .= " SET pass_crypted = '" . $this->db->escape($this->pass_crypted) . "'";
2352
-				$sql .= " WHERE rowid=" . ((int)$this->id);
2352
+				$sql .= " WHERE rowid=" . ((int) $this->id);
2353 2353
 
2354 2354
 				$resql = $this->db->query($sql);
2355 2355
 				if (!$resql) {
@@ -2359,8 +2359,8 @@  discard block
 block discarded – undo
2359 2359
 
2360 2360
 			if ($result > 0 && $member->socid) {    // If member is linked to a thirdparty
2361 2361
 				$sql = "UPDATE " . $dbPrefix . "user";
2362
-				$sql .= " SET fk_soc=" . ((int)$member->socid);
2363
-				$sql .= " WHERE rowid=" . ((int)$this->id);
2362
+				$sql .= " SET fk_soc=" . ((int) $member->socid);
2363
+				$sql .= " WHERE rowid=" . ((int) $this->id);
2364 2364
 
2365 2365
 				dol_syslog(get_class($this) . "::create_from_member", LOG_DEBUG);
2366 2366
 				$resql = $this->db->query($sql);
@@ -2411,7 +2411,7 @@  discard block
 block discarded – undo
2411 2411
 		$sql .= " datelastlogin = '" . $this->db->idate($now) . "',";
2412 2412
 		$sql .= " iplastlogin = '" . $this->db->escape($userremoteip) . "',";
2413 2413
 		$sql .= " tms = tms"; // The last update date must change because the last login date is updated
2414
-		$sql .= " WHERE rowid = " . ((int)$this->id);
2414
+		$sql .= " WHERE rowid = " . ((int) $this->id);
2415 2415
 
2416 2416
 		dol_syslog(get_class($this) . "::update_last_login_date user->id=" . $this->id . " " . $sql, LOG_DEBUG);
2417 2417
 		$resql = $this->db->query($sql);
@@ -2562,7 +2562,7 @@  discard block
 block discarded – undo
2562 2562
 		// phpcs:enable
2563 2563
 		$sql = "SELECT url, login, pass, poste ";
2564 2564
 		$sql .= " FROM " . $dbPrefix . "user_clicktodial as u";
2565
-		$sql .= " WHERE u.fk_user = " . ((int)$this->id);
2565
+		$sql .= " WHERE u.fk_user = " . ((int) $this->id);
2566 2566
 
2567 2567
 		$resql = $this->db->query($sql);
2568 2568
 		if ($resql) {
@@ -2601,7 +2601,7 @@  discard block
 block discarded – undo
2601 2601
 		$this->db->begin();
2602 2602
 
2603 2603
 		$sql = "DELETE FROM " . $dbPrefix . "user_clicktodial";
2604
-		$sql .= " WHERE fk_user = " . ((int)$this->id);
2604
+		$sql .= " WHERE fk_user = " . ((int) $this->id);
2605 2605
 
2606 2606
 		dol_syslog(get_class($this) . '::update_clicktodial', LOG_DEBUG);
2607 2607
 		$result = $this->db->query($sql);
@@ -2647,14 +2647,14 @@  discard block
 block discarded – undo
2647 2647
 		$this->db->begin();
2648 2648
 
2649 2649
 		$sql = "DELETE FROM " . $dbPrefix . "usergroup_user";
2650
-		$sql .= " WHERE fk_user  = " . ((int)$this->id);
2651
-		$sql .= " AND fk_usergroup = " . ((int)$group);
2652
-		$sql .= " AND entity = " . ((int)$entity);
2650
+		$sql .= " WHERE fk_user  = " . ((int) $this->id);
2651
+		$sql .= " AND fk_usergroup = " . ((int) $group);
2652
+		$sql .= " AND entity = " . ((int) $entity);
2653 2653
 
2654 2654
 		$result = $this->db->query($sql);
2655 2655
 
2656 2656
 		$sql = "INSERT INTO " . $dbPrefix . "usergroup_user (entity, fk_user, fk_usergroup)";
2657
-		$sql .= " VALUES (" . ((int)$entity) . "," . ((int)$this->id) . "," . ((int)$group) . ")";
2657
+		$sql .= " VALUES (" . ((int) $entity) . "," . ((int) $this->id) . "," . ((int) $group) . ")";
2658 2658
 
2659 2659
 		$result = $this->db->query($sql);
2660 2660
 		if ($result) {
@@ -2703,12 +2703,12 @@  discard block
 block discarded – undo
2703 2703
 		$this->db->begin();
2704 2704
 
2705 2705
 		$sql = "DELETE FROM " . $dbPrefix . "usergroup_user";
2706
-		$sql .= " WHERE fk_user  = " . ((int)$this->id);
2707
-		$sql .= " AND fk_usergroup = " . ((int)$group);
2706
+		$sql .= " WHERE fk_user  = " . ((int) $this->id);
2707
+		$sql .= " AND fk_usergroup = " . ((int) $group);
2708 2708
 		if (empty($entity)) {
2709
-			$sql .= " AND entity IN (0, 1)";    // group may be in entity 0 (so $entity=0) and link with user into entity 1.
2709
+			$sql .= " AND entity IN (0, 1)"; // group may be in entity 0 (so $entity=0) and link with user into entity 1.
2710 2710
 		} else {
2711
-			$sql .= " AND entity = " . ((int)$entity);
2711
+			$sql .= " AND entity = " . ((int) $entity);
2712 2712
 		}
2713 2713
 
2714 2714
 		$result = $this->db->query($sql);
@@ -2894,7 +2894,7 @@  discard block
 block discarded – undo
2894 2894
 	 */
2895 2895
 	public function getLibStatut($mode = 0)
2896 2896
 	{
2897
-		return $this->LibStatut(isset($this->statut) ? (int)$this->statut : (int)$this->status, $mode);
2897
+		return $this->LibStatut(isset($this->statut) ? (int) $this->statut : (int) $this->status, $mode);
2898 2898
 	}
2899 2899
 
2900 2900
 	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
@@ -3046,7 +3046,7 @@  discard block
 block discarded – undo
3046 3046
 		$result .= (($option == 'nolink') ? '' : $linkstart);
3047 3047
 		if ($withpictoimg) {
3048 3048
 			$paddafterimage = '';
3049
-			if (abs((int)$withpictoimg) == 1) {
3049
+			if (abs((int) $withpictoimg) == 1) {
3050 3050
 				$paddafterimage = 'style="margin-' . ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right') . ': 3px;"';
3051 3051
 			}
3052 3052
 			// Only picto
@@ -3176,7 +3176,7 @@  discard block
 block discarded – undo
3176 3176
 		// Special case for external user
3177 3177
 		if (!empty($this->socid)) {
3178 3178
 			if ($module = 'societe' && $permlevel1 = 'client' && $permlevel2 == 'voir') {
3179
-				return 0;   // An external user never has the permission ->societe->client->voir to see all thirdparties (always restricted to himself)
3179
+				return 0; // An external user never has the permission ->societe->client->voir to see all thirdparties (always restricted to himself)
3180 3180
 			}
3181 3181
 		}
3182 3182
 
@@ -3269,7 +3269,7 @@  discard block
 block discarded – undo
3269 3269
 
3270 3270
 		if ($option == 'xxx') {
3271 3271
 			$linkstart = '<a href="' . DOL_URL_ROOT . '/user/card.php?id=' . $this->id . '">';
3272
-			$linkend = '</a>';  // @phan-suppress-current-line PhanPluginRedundantAssignment
3272
+			$linkend = '</a>'; // @phan-suppress-current-line PhanPluginRedundantAssignment
3273 3273
 		}
3274 3274
 
3275 3275
 		if ($option == 'nolink') {
@@ -3586,7 +3586,7 @@  discard block
 block discarded – undo
3586 3586
 		$this->iplastlogin = '127.0.0.1';
3587 3587
 		$this->datepreviouslogin = $now;
3588 3588
 		$this->ippreviouslogin = '127.0.0.1';
3589
-		$this->statut = 1;      // deprecated
3589
+		$this->statut = 1; // deprecated
3590 3590
 		$this->status = 1;
3591 3591
 
3592 3592
 		$this->entity = 1;
@@ -3608,7 +3608,7 @@  discard block
 block discarded – undo
3608 3608
 		$sql = "SELECT u.rowid, u.login as ref, u.datec,";
3609 3609
 		$sql .= " u.tms as date_modification, u.entity";
3610 3610
 		$sql .= " FROM " . $dbPrefix . "user as u";
3611
-		$sql .= " WHERE u.rowid = " . ((int)$id);
3611
+		$sql .= " WHERE u.rowid = " . ((int) $id);
3612 3612
 
3613 3613
 		$result = $this->db->query($sql);
3614 3614
 		if ($result) {
@@ -3681,13 +3681,13 @@  discard block
 block discarded – undo
3681 3681
 			}
3682 3682
 		}
3683 3683
 		if ($admin >= 0) {
3684
-			$sql .= " AND admin = " . (int)$admin;
3684
+			$sql .= " AND admin = " . (int) $admin;
3685 3685
 		}
3686 3686
 
3687 3687
 		$resql = $this->db->query($sql);
3688 3688
 		if ($resql) {
3689 3689
 			$obj = $this->db->fetch_object($resql);
3690
-			$nb = (int)$obj->nb;
3690
+			$nb = (int) $obj->nb;
3691 3691
 
3692 3692
 			$this->db->free($resql);
3693 3693
 			return $nb;
@@ -3762,7 +3762,7 @@  discard block
 block discarded – undo
3762 3762
 	{
3763 3763
 		// phpcs:enable
3764 3764
 		$sql = "SELECT rowid FROM " . $dbPrefix . "user";
3765
-		$sql .= " WHERE fk_user = " . ((int)$this->id);
3765
+		$sql .= " WHERE fk_user = " . ((int) $this->id);
3766 3766
 
3767 3767
 		dol_syslog(get_class($this) . "::get_children", LOG_DEBUG);
3768 3768
 		$res = $this->db->query($sql);
@@ -4098,7 +4098,7 @@  discard block
 block discarded – undo
4098 4098
 
4099 4099
 		$sql = "SELECT rowid, email, user_mobile, civility, lastname, firstname";
4100 4100
 		$sql .= " FROM " . $dbPrefix . "user";
4101
-		$sql .= " WHERE rowid = " . ((int)$rowid);
4101
+		$sql .= " WHERE rowid = " . ((int) $rowid);
4102 4102
 
4103 4103
 		$resql = $this->db->query($sql);
4104 4104
 		if ($resql) {
@@ -4138,7 +4138,7 @@  discard block
 block discarded – undo
4138 4138
 
4139 4139
 		$encodedsecurekey = dol_hash($conf->file->instance_unique_id . 'uservirtualcard' . $this->id . '-' . $this->login, 'md5');
4140 4140
 		if (isModEnabled('multicompany')) {
4141
-			$entity_qr = '&entity=' . ((int)$conf->entity);
4141
+			$entity_qr = '&entity=' . ((int) $conf->entity);
4142 4142
 		} else {
4143 4143
 			$entity_qr = '';
4144 4144
 		}
@@ -4192,7 +4192,7 @@  discard block
 block discarded – undo
4192 4192
 			return -1;
4193 4193
 		}
4194 4194
 
4195
-		$this->findUserIdByEmailCache[$email] = (int)$obj->rowid;
4195
+		$this->findUserIdByEmailCache[$email] = (int) $obj->rowid;
4196 4196
 
4197 4197
 		return $this->findUserIdByEmailCache[$email];
4198 4198
 	}
Please login to merge, or discard this patch.
Dolibarr/Core/Base/Config.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
         $conf->file->main_force_https = empty($dolibarr_main_force_https) ? '' : $dolibarr_main_force_https; // Force https
166 166
         $conf->file->strict_mode = empty($dolibarr_strict_mode) ? '' : $dolibarr_strict_mode; // Force php strict mode (for debug)
167 167
         $conf->file->instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id; // Unique id of instance
168
-        $conf->file->main_path = $dolibarr_main_document_root ?? BASE_PATH;  // Define htdocs path inside the config file
169
-        $conf->file->main_url = $dolibarr_main_url_root ?? BASE_URL;    // Define url inside the config file
168
+        $conf->file->main_path = $dolibarr_main_document_root ?? BASE_PATH; // Define htdocs path inside the config file
169
+        $conf->file->main_url = $dolibarr_main_url_root ?? BASE_URL; // Define url inside the config file
170 170
         $conf->file->main_doc = $dolibarr_main_data_root ?? static::getDataDir($conf->file->main_path);
171 171
         $conf->file->path = ['main' => $conf->file->main_path];
172 172
         $conf->file->url = ['main' => '/'];
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
             $i = 0;
183 183
             foreach ($path as $value) {
184
-                $conf->file->path['alt' . ($i++)] = (string)$value;
184
+                $conf->file->path['alt' . ($i++)] = (string) $value;
185 185
             }
186 186
             $values = preg_split('/[;,]/', $dolibarr_main_url_root_alt);
187 187
             $i = 0;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
                     print "\"/custom\"<br>\n";
202 202
                     exit;
203 203
                 }
204
-                $conf->file->url['alt' . ($i++)] = (string)$value;
204
+                $conf->file->url['alt' . ($i++)] = (string) $value;
205 205
             }
206 206
         }
207 207
 
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
             }
444 444
             if (!class_exists('MenuManager')) {
445 445
                 $menufound = 0;
446
-                $dirmenus = array_merge(["/core/menus/"], (array)$conf->modules_parts['menus']);
446
+                $dirmenus = array_merge(["/core/menus/"], (array) $conf->modules_parts['menus']);
447 447
                 foreach ($dirmenus as $dirmenu) {
448 448
                     $menufound = dol_include_once($dirmenu . "standard/" . $file_menu);
449 449
                     if (class_exists('MenuManager')) {
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
     private static function loadDb()
511 511
     {
512 512
         $conf = static::$dolibarrConfig;
513
-        static::$db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int)$conf->db->port);
513
+        static::$db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port);
514 514
         static::$dolibarrConfig->setValues(static::$db);
515 515
 
516 516
         return static::$db;
Please login to merge, or discard this patch.
htdocs/master.inc.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
 $conf->file->main_force_https = empty($dolibarr_main_force_https) ? '' : $dolibarr_main_force_https; // Force https
90 90
 $conf->file->strict_mode = empty($dolibarr_strict_mode) ? '' : $dolibarr_strict_mode; // Force php strict mode (for debug)
91 91
 $conf->file->instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id; // Unique id of instance
92
-$conf->file->dol_main_url_root = $dolibarr_main_url_root;   // Define url inside the config file
93
-$conf->file->dol_document_root = array('main' => (string)DOL_DOCUMENT_ROOT); // Define array of document root directories ('/home/htdocs')
94
-$conf->file->dol_url_root = array('main' => (string)DOL_URL_ROOT); // Define array of url root path ('' or '/dolibarr')
92
+$conf->file->dol_main_url_root = $dolibarr_main_url_root; // Define url inside the config file
93
+$conf->file->dol_document_root = array('main' => (string) DOL_DOCUMENT_ROOT); // Define array of document root directories ('/home/htdocs')
94
+$conf->file->dol_url_root = array('main' => (string) DOL_URL_ROOT); // Define array of url root path ('' or '/dolibarr')
95 95
 if (!empty($dolibarr_main_document_root_alt)) {
96 96
     // dolibarr_main_document_root_alt can contains several directories
97 97
     $values = preg_split('/[;,]/', $dolibarr_main_document_root_alt);
98 98
     $i = 0;
99 99
     foreach ($values as $value) {
100
-        $conf->file->dol_document_root['alt' . ($i++)] = (string)$value;
100
+        $conf->file->dol_document_root['alt' . ($i++)] = (string) $value;
101 101
     }
102 102
     $values = preg_split('/[;,]/', $dolibarr_main_url_root_alt);
103 103
     $i = 0;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             print "\"/custom\"<br>\n";
118 118
             exit;
119 119
         }
120
-        $conf->file->dol_url_root['alt' . ($i++)] = (string)$value;
120
+        $conf->file->dol_url_root['alt' . ($i++)] = (string) $value;
121 121
     }
122 122
 }
123 123
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
  */
139 139
 //$db = null;
140 140
 if (!isset($db) && !defined('NOREQUIREDB')) {
141
-    $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int)$conf->db->port);
141
+    $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port);
142 142
 
143 143
     if ($db->error) {
144 144
         // If we were into a website context
Please login to merge, or discard this patch.
htdocs/core/modules/DolibarrModules.class.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		if ($pathoffile) {     // Mostly for external modules
453 453
 			$content = file_get_contents($pathoffile);
454 454
 
455
-			if ((float)DOL_VERSION >= 6.0) {
455
+			if ((float) DOL_VERSION >= 6.0) {
456 456
 				@include_once BASE_PATH . '/../Dolibarr/Lib/ParseMd.php';
457 457
 
458 458
 				$content = dolMd2Html(
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 		if ($filefound) {     // Mostly for external modules
555 555
 			$content = file_get_contents($pathoffile);
556 556
 
557
-			if ((float)DOL_VERSION >= 6.0) {
557
+			if ((float) DOL_VERSION >= 6.0) {
558 558
 				@include_once BASE_PATH . '/../Dolibarr/Lib/ParseMd.php';
559 559
 
560 560
 				$content = dolMd2Html($content, 'parsedown', ['doc/' => dol_buildpath(strtolower($this->name) . '/doc/', 1)]);
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 
673 673
 		$sql = "SELECT tms FROM " . $dbPrefix . "const";
674 674
 		$sql .= " WHERE " . $this->db->decrypt('name') . " = '" . $this->db->escape($this->const_name) . "'";
675
-		$sql .= " AND entity IN (0, " . ((int)$conf->entity) . ")";
675
+		$sql .= " AND entity IN (0, " . ((int) $conf->entity) . ")";
676 676
 
677 677
 		dol_syslog(get_class($this) . "::getLastActiveDate", LOG_DEBUG);
678 678
 		$resql = $this->db->query($sql);
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 		$sql = "INSERT INTO " . $dbPrefix . "const (name, value, visible, entity, note) VALUES";
885 885
 		$sql .= " (" . $this->db->encrypt($this->const_name);
886 886
 		$sql .= ", " . $this->db->encrypt('1');
887
-		$sql .= ", 0, " . ((int)$entity);
887
+		$sql .= ", 0, " . ((int) $entity);
888 888
 		$sql .= ", '" . $this->db->escape($note) . "')";
889 889
 
890 890
 		dol_syslog(get_class($this) . "::_active insert activation constant", LOG_DEBUG);
@@ -944,7 +944,7 @@  discard block
 block discarded – undo
944 944
 					$sql .= ", " . $this->db->encrypt($newvalue);
945 945
 					$sql .= ", null";
946 946
 					$sql .= ", '0'";
947
-					$sql .= ", " . ((int)$entity);
947
+					$sql .= ", " . ((int) $entity);
948 948
 					$sql .= ")";
949 949
 
950 950
 					$resql = $this->db->query($sql);
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
 					$sql .= ", " . $this->db->encrypt($newvalue, 1);
1058 1058
 					$sql .= ", null";
1059 1059
 					$sql .= ", '0'";
1060
-					$sql .= ", " . ((int)$entity);
1060
+					$sql .= ", " . ((int) $entity);
1061 1061
 					$sql .= ")";
1062 1062
 
1063 1063
 					dol_syslog(get_class($this) . "::insert_module_parts for key=" . $this->const_name . "_" . strtoupper($key), LOG_DEBUG);
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 			$sql = "SELECT count(*) as nb";
1115 1115
 			$sql .= " FROM " . $dbPrefix . "const";
1116 1116
 			$sql .= " WHERE " . $this->db->decrypt('name') . " = '" . $this->db->escape($name) . "'";
1117
-			$sql .= " AND entity = " . ((int)$entity);
1117
+			$sql .= " AND entity = " . ((int) $entity);
1118 1118
 
1119 1119
 			$result = $this->db->query($sql);
1120 1120
 			if ($result) {
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
 								}
1220 1220
 
1221 1221
 								$sql = "INSERT INTO " . $dbPrefix . "boxes (box_id, position, box_order, fk_user, entity)";
1222
-								$sql .= " VALUES (" . ((int)$lastid) . ", " . ((int)$key2) . ", '0', 0, " . ((int)$conf->entity) . ")";
1222
+								$sql .= " VALUES (" . ((int) $lastid) . ", " . ((int) $key2) . ", '0', 0, " . ((int) $conf->entity) . ")";
1223 1223
 
1224 1224
 								dol_syslog(get_class($this) . "::insert_boxes onto page " . $key2 . "=" . $val2, LOG_DEBUG);
1225 1225
 								$resql = $this->db->query($sql);
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 				if ($parameters) {
1305 1305
 					$sql .= " AND params = '".$this->db->escape($parameters)."'";
1306 1306
 				}*/
1307
-				$sql .= " AND entity = " . ((int)$entity); // Must be exact entity
1307
+				$sql .= " AND entity = " . ((int) $entity); // Must be exact entity
1308 1308
 
1309 1309
 				$now = dol_now();
1310 1310
 
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 								$sql .= "'" . $this->db->escape($priority) . "', ";
1353 1353
 							}
1354 1354
 							if (is_int($status)) {
1355
-								$sql .= ((int)$status) . ", ";
1355
+								$sql .= ((int) $status) . ", ";
1356 1356
 							}
1357 1357
 							$sql .= $entity . ",";
1358 1358
 							$sql .= "'" . $this->db->escape($test) . "'";
@@ -1420,7 +1420,7 @@  discard block
 block discarded – undo
1420 1420
 			if ($obj !== null && !empty($obj->value) && !empty($this->rights)) {
1421 1421
 				// If the module is active
1422 1422
 				foreach ($this->rights as $key => $value) {
1423
-					$r_id = $this->rights[$key][0];   // permission id in llx_rights_def (not unique because primary key is couple id-entity)
1423
+					$r_id = $this->rights[$key][0]; // permission id in llx_rights_def (not unique because primary key is couple id-entity)
1424 1424
 					$r_desc = $this->rights[$key][1];
1425 1425
 					$r_type = isset($this->rights[$key][2]) ? $this->rights[$key][2] : '';
1426 1426
 					$r_def = empty($this->rights[$key][3]) ? 0 : $this->rights[$key][3];
@@ -1434,7 +1434,7 @@  discard block
 block discarded – undo
1434 1434
 
1435 1435
 					// Search if perm already present
1436 1436
 					$sql = "SELECT count(*) as nb FROM " . $dbPrefix . "rights_def";
1437
-					$sql .= " WHERE id = " . ((int)$r_id) . " AND entity = " . ((int)$entity);
1437
+					$sql .= " WHERE id = " . ((int) $r_id) . " AND entity = " . ((int) $entity);
1438 1438
 
1439 1439
 					$resqlselect = $this->db->query($sql);
1440 1440
 					if ($resqlselect) {
@@ -1719,7 +1719,7 @@  discard block
 block discarded – undo
1719 1719
 
1720 1720
 			if ($row[0] == 0) {
1721 1721
 				$sql = "INSERT INTO " . $dbPrefix . "const (name, type, value, note, visible, entity)";
1722
-				$sql .= " VALUES (" . $this->db->encrypt($name) . ", 'chaine', " . $this->db->encrypt($dir) . ", '" . $this->db->escape("Directory for module " . $this->name) . "', '0', " . ((int)$conf->entity) . ")";
1722
+				$sql .= " VALUES (" . $this->db->encrypt($name) . ", 'chaine', " . $this->db->encrypt($dir) . ", '" . $this->db->escape("Directory for module " . $this->name) . "', '0', " . ((int) $conf->entity) . ")";
1723 1723
 
1724 1724
 				dol_syslog(get_class($this) . "::insert_dirs", LOG_DEBUG);
1725 1725
 				$this->db->query($sql);
@@ -1812,7 +1812,7 @@  discard block
 block discarded – undo
1812 1812
 		}
1813 1813
 
1814 1814
 		// Run complementary sql requests
1815
-		$num = count((array)$array_sql);
1815
+		$num = count((array) $array_sql);
1816 1816
 		for ($i = 0; $i < $num; $i++) {
1817 1817
 			if (!$err) {
1818 1818
 				dol_syslog(get_class($this) . "::_remove", LOG_DEBUG);
@@ -1919,7 +1919,7 @@  discard block
 block discarded – undo
1919 1919
 
1920 1920
 				$sql = "DELETE FROM " . $dbPrefix . "const";
1921 1921
 				$sql .= " WHERE " . $this->db->decrypt('name') . " LIKE '" . $this->db->escape($this->const_name) . "_" . strtoupper($key) . "'";
1922
-				$sql .= " AND entity = " . ((int)$entity);
1922
+				$sql .= " AND entity = " . ((int) $entity);
1923 1923
 
1924 1924
 				if (!$this->db->query($sql)) {
1925 1925
 					$this->error = $this->db->lasterror();
@@ -2029,7 +2029,7 @@  discard block
 block discarded – undo
2029 2029
 
2030 2030
 				$sql = "DELETE FROM " . $dbPrefix . "boxes_def";
2031 2031
 				$sql .= " WHERE file = '" . $this->db->escape($file) . "'";
2032
-				$sql .= " AND entity = " . $conf->entity;     // Do not use getEntity here, we want to delete only in current company
2032
+				$sql .= " AND entity = " . $conf->entity; // Do not use getEntity here, we want to delete only in current company
2033 2033
 
2034 2034
 				dol_syslog(get_class($this) . "::delete_boxes", LOG_DEBUG);
2035 2035
 				$resql = $this->db->query($sql);
@@ -2237,7 +2237,7 @@  discard block
 block discarded – undo
2237 2237
 
2238 2238
 		$return .= '<div class="valignmiddle inline-block info-box-more">';
2239 2239
 		//if ($versiontrans) print img_warning($langs->trans("Version").' '.$this->getVersion(1)).' ';
2240
-		$return .= '<a class="valignmiddle inline-block" href="javascript:document_preview(\'' . DOL_URL_ROOT . '/admin/modulehelp.php?id=' . ((int)$this->numero) . '\',\'text/html\',\'' . dol_escape_js($langs->trans("Module")) . '\')">' . img_picto(($this->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule") . ' - ' : '') . $langs->trans("ClickToShowDescription"), $imginfo) . '</a>';
2240
+		$return .= '<a class="valignmiddle inline-block" href="javascript:document_preview(\'' . DOL_URL_ROOT . '/admin/modulehelp.php?id=' . ((int) $this->numero) . '\',\'text/html\',\'' . dol_escape_js($langs->trans("Module")) . '\')">' . img_picto(($this->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule") . ' - ' : '') . $langs->trans("ClickToShowDescription"), $imginfo) . '</a>';
2241 2241
 		$return .= '</div><br>';
2242 2242
 
2243 2243
 		$return .= '<div class="valignmiddle inline-block info-box-actions">';
@@ -2398,7 +2398,7 @@  discard block
 block discarded – undo
2398 2398
 	{
2399 2399
 		require_once BASE_PATH . '/../Dolibarr/Lib/GetUrl.php';
2400 2400
 		if (!empty($this->url_last_version)) {
2401
-			$lastVersion = getURLContent($this->url_last_version, 'GET', '', 1, [], ['http', 'https'], 0);    // Accept http or https links on external remote server only
2401
+			$lastVersion = getURLContent($this->url_last_version, 'GET', '', 1, [], ['http', 'https'], 0); // Accept http or https links on external remote server only
2402 2402
 			if (isset($lastVersion['content']) && strlen($lastVersion['content']) < 30) {
2403 2403
 				// Security warning :  be careful with remote data content, the module editor could be hacked (or evil) so limit to a-z A-Z 0-9 _ . -
2404 2404
 				$this->lastVersion = preg_replace("/[^a-zA-Z0-9_\.\-]+/", "", $lastVersion['content']);
Please login to merge, or discard this patch.
htdocs/core/modules/modApi.class.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
 
144 144
         // Add here list of permission defined by an id, a label, a boolean and two constant strings.
145 145
         // Example:
146
-        $this->rights[$r][0] = $this->numero + $r;  // Permission id (must not be already used)
146
+        $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used)
147 147
         $this->rights[$r][1] = 'Generate/modify users API key'; // Permission label
148
-        $this->rights[$r][3] = 0;                   // Permission by default for new user (0/1)
149
-        $this->rights[$r][4] = 'apikey';                // In php code, permission will be checked by test if ($user->hasRight('permkey','level1','level2'))
150
-        $this->rights[$r][5] = 'generate';              // In php code, permission will be checked by test if ($user->hasRight('permkey','level1','level2'))
148
+        $this->rights[$r][3] = 0; // Permission by default for new user (0/1)
149
+        $this->rights[$r][4] = 'apikey'; // In php code, permission will be checked by test if ($user->hasRight('permkey','level1','level2'))
150
+        $this->rights[$r][5] = 'generate'; // In php code, permission will be checked by test if ($user->hasRight('permkey','level1','level2'))
151 151
         $r++;
152 152
 
153 153
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
         // Remove old constants with entity fields different of 0
235 235
         $sql = array(
236
-            "DELETE FROM " . $dbPrefix . "const WHERE name = " . $this->db->encrypt('MAIN_MODULE_API'),      // API can't be enabled per environment. Why ?
236
+            "DELETE FROM " . $dbPrefix . "const WHERE name = " . $this->db->encrypt('MAIN_MODULE_API'), // API can't be enabled per environment. Why ?
237 237
             "DELETE FROM " . $dbPrefix . "const WHERE name = " . $this->db->encrypt('API_PRODUCTION_MODE')   // Not in production mode by default at activation
238 238
         );
239 239
 
Please login to merge, or discard this patch.