Test Failed
Push — master ( ed0f4f...3aebc2 )
by Alxarafe
43:14
created
index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 define('BASE_PATH', __DIR__);
10 10
 define('DEBUG', true);
11 11
 
12
-require_once BASE_PATH . '/vendor/autoload.php';
12
+require_once BASE_PATH.'/vendor/autoload.php';
13 13
 
14 14
 use Alixar\Helpers\AlixarDispatcher;
15 15
 
Please login to merge, or discard this patch.
dolibarr/htdocs/filefunc.inc.php 2 patches
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 }
36 36
 
37 37
 if (!defined('DOL_VERSION')) {
38
-    define('DOL_VERSION', '10.0.0-alpha');  // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
38
+    define('DOL_VERSION', '10.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
39 39
 }
40 40
 
41 41
 if (!defined('EURO')) {
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 $result = @include_once $conffile; // Keep @ because with some error reporting this break the redirect done when file not found
79 79
 
80 80
 if (!$result && !empty($_SERVER["GATEWAY_INTERFACE"])) {    // If install not done and we are in a web session
81
-    header('Location: ' . BASE_URI . '?controller=install&method=index'); // Changed for Alixar
81
+    header('Location: '.BASE_URI.'?controller=install&method=index'); // Changed for Alixar
82 82
     exit;
83 83
 
84 84
     if (!empty($_SERVER["CONTEXT_PREFIX"])) {    // CONTEXT_PREFIX and CONTEXT_DOCUMENT_ROOT are not defined on all apache versions
85
-        $path = $_SERVER["CONTEXT_PREFIX"];       // example '/dolibarr/' when using an apache alias.
85
+        $path = $_SERVER["CONTEXT_PREFIX"]; // example '/dolibarr/' when using an apache alias.
86 86
         if (!preg_match('/\/$/', $path))
87 87
             $path .= '/';
88 88
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
         }
112 112
     }
113 113
 
114
-    header("Location: " . $path . "install/index.php");
114
+    header("Location: ".$path."install/index.php");
115 115
     exit;
116 116
 }
117 117
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 $dolibarr_main_document_root_alt = (empty($dolibarr_main_document_root_alt) ? '' : trim($dolibarr_main_document_root_alt));
136 136
 
137 137
 if (empty($dolibarr_main_db_port)) {
138
-    $dolibarr_main_db_port = 3306;  // For compatibility with old configs, if not defined, we take 'mysql' type
138
+    $dolibarr_main_db_port = 3306; // For compatibility with old configs, if not defined, we take 'mysql' type
139 139
 }
140 140
 
141 141
 if (empty($dolibarr_main_db_type)) {
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     $dolibarr_main_db_prefix = 'llx_';
151 151
 }
152 152
 if (empty($dolibarr_main_db_character_set)) {
153
-    $dolibarr_main_db_character_set = ($dolibarr_main_db_type == 'mysqli' ? 'utf8' : '');  // Old installation
153
+    $dolibarr_main_db_character_set = ($dolibarr_main_db_type == 'mysqli' ? 'utf8' : ''); // Old installation
154 154
 }
155 155
 if (empty($dolibarr_main_db_collation)) {
156 156
     $dolibarr_main_db_collation = ($dolibarr_main_db_type == 'mysqli' ? 'utf8_unicode_ci' : ''); // Old installation
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
     // Another test is done later on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on.
200 200
 }
201 201
 if (empty($dolibarr_main_db_host)) {
202
-    print '<div align="center">Dolibarr setup is not yet complete.<br><br>' . "\n";
203
-    print '<a href="install/index.php">Click here to finish Dolibarr install process</a> ...</div>' . "\n";
202
+    print '<div align="center">Dolibarr setup is not yet complete.<br><br>'."\n";
203
+    print '<a href="install/index.php">Click here to finish Dolibarr install process</a> ...</div>'."\n";
204 204
     die;
205 205
 }
206 206
 if (empty($dolibarr_main_url_root)) {
207
-    print 'Value for parameter \'dolibarr_main_url_root\' is not defined in your \'htdocs\conf\conf.php\' file.<br>' . "\n";
208
-    print 'You must add this parameter with your full Dolibarr root Url (Example: http://myvirtualdomain/ or http://mydomain/mydolibarrurl/)' . "\n";
207
+    print 'Value for parameter \'dolibarr_main_url_root\' is not defined in your \'htdocs\conf\conf.php\' file.<br>'."\n";
208
+    print 'You must add this parameter with your full Dolibarr root Url (Example: http://myvirtualdomain/ or http://mydomain/mydolibarrurl/)'."\n";
209 209
     die;
210 210
 }
211 211
 if (empty($dolibarr_main_data_root)) {
@@ -215,30 +215,30 @@  discard block
 block discarded – undo
215 215
 }
216 216
 
217 217
 // Define some constants
218
-define('DOL_CLASS_PATH', 'class/');         // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter)
219
-define('DOL_DATA_ROOT', $dolibarr_main_data_root);     // Filesystem data (documents)
220
-define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root);   // Filesystem core php (htdocs)
218
+define('DOL_CLASS_PATH', 'class/'); // Filesystem path to class dir (defined only for some code that want to be compatible with old versions without this parameter)
219
+define('DOL_DATA_ROOT', $dolibarr_main_data_root); // Filesystem data (documents)
220
+define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root); // Filesystem core php (htdocs)
221 221
 // Try to autodetect DOL_MAIN_URL_ROOT and DOL_URL_ROOT.
222 222
 // Note: autodetect works only in case 1, 2, 3 and 4 of phpunit test CoreTest.php. For case 5, 6, only setting value into conf.php will works.
223 223
 $tmp = '';
224 224
 $found = 0;
225 225
 $real_dolibarr_main_document_root = str_replace('\\', '/', realpath($dolibarr_main_document_root)); // A) Value found into config file, to say where are store htdocs files. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
226 226
 if (!empty($_SERVER["DOCUMENT_ROOT"])) {
227
-    $pathroot = $_SERVER["DOCUMENT_ROOT"];                                                      // B) Value reported by web server setup (not defined on CLI mode), to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
227
+    $pathroot = $_SERVER["DOCUMENT_ROOT"]; // B) Value reported by web server setup (not defined on CLI mode), to say where is root of web server instance. Ex: C:/xxx/dolibarr, C:/xxx/dolibarr/htdocs
228 228
 } else {
229 229
     $pathroot = 'NOTDEFINED';
230 230
 }
231
-$paths = explode('/', str_replace('\\', '/', $_SERVER["SCRIPT_NAME"]));        // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php
231
+$paths = explode('/', str_replace('\\', '/', $_SERVER["SCRIPT_NAME"])); // C) Value reported by web server, to say full path on filesystem of a file. Ex: /dolibarr/htdocs/admin/system/phpinfo.php
232 232
 // Try to detect if $_SERVER["DOCUMENT_ROOT"]+start of $_SERVER["SCRIPT_NAME"] is $dolibarr_main_document_root. If yes, relative url to add before dol files is this start part.
233 233
 $concatpath = '';
234 234
 foreach ($paths as $tmppath) { // We check to find (B+start of C)=A
235 235
     if (empty($tmppath)) {
236 236
         continue;
237 237
     }
238
-    $concatpath .= '/' . $tmppath;
238
+    $concatpath .= '/'.$tmppath;
239 239
     //if ($tmppath) $concatpath.='/'.$tmppath;
240 240
     //print $_SERVER["SCRIPT_NAME"].'-'.$pathroot.'-'.$concatpath.'-'.$real_dolibarr_main_document_root.'-'.realpath($pathroot.$concatpath).'<br>';
241
-    if ($real_dolibarr_main_document_root == @realpath($pathroot . $concatpath)) {    // @ avoid warning when safe_mode is on.
241
+    if ($real_dolibarr_main_document_root == @realpath($pathroot.$concatpath)) {    // @ avoid warning when safe_mode is on.
242 242
         //print "Found relative url = ".$concatpath;
243 243
         $tmp3 = $concatpath;
244 244
         $found = 1;
@@ -250,19 +250,19 @@  discard block
 block discarded – undo
250 250
 if (!$found) {
251 251
     $tmp = $dolibarr_main_url_root; // If autodetect fails (Ie: when using apache alias that point outside default DOCUMENT_ROOT).
252 252
 } else {
253
-    $tmp = 'http' . (((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] != 443)) ? '' : 's') . '://' . $_SERVER["SERVER_NAME"] . ((empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == 80 || $_SERVER["SERVER_PORT"] == 443) ? '' : ':' . $_SERVER["SERVER_PORT"]) . ($tmp3 ? (preg_match('/^\//', $tmp3) ? '' : '/') . $tmp3 : '');
253
+    $tmp = 'http'.(((empty($_SERVER["HTTPS"]) || $_SERVER["HTTPS"] != 'on') && (empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] != 443)) ? '' : 's').'://'.$_SERVER["SERVER_NAME"].((empty($_SERVER["SERVER_PORT"]) || $_SERVER["SERVER_PORT"] == 80 || $_SERVER["SERVER_PORT"] == 443) ? '' : ':'.$_SERVER["SERVER_PORT"]).($tmp3 ? (preg_match('/^\//', $tmp3) ? '' : '/').$tmp3 : '');
254 254
 }
255 255
 //print "tmp1=".$tmp1." tmp2=".$tmp2." tmp3=".$tmp3." tmp=".$tmp."\n";
256 256
 if (!empty($dolibarr_main_force_https)) {
257 257
     $tmp = preg_replace('/^http:/i', 'https:', $tmp);
258 258
 }
259
-define('DOL_MAIN_URL_ROOT', $tmp);           // URL absolute root (https://sss/dolibarr, ...)
259
+define('DOL_MAIN_URL_ROOT', $tmp); // URL absolute root (https://sss/dolibarr, ...)
260 260
 $uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http*
261
-$suburi = strstr($uri, '/');            // $suburi contains url without domain:port
261
+$suburi = strstr($uri, '/'); // $suburi contains url without domain:port
262 262
 if ($suburi == '/') {
263
-    $suburi = '';           // If $suburi is /, it is now ''
263
+    $suburi = ''; // If $suburi is /, it is now ''
264 264
 }
265
-define('DOL_URL_ROOT', $suburi);           // URL relative root ('', '/dolibarr', ...)
265
+define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...)
266 266
 //print DOL_MAIN_URL_ROOT.'-'.DOL_URL_ROOT."\n";
267 267
 // Define prefix MAIN_DB_PREFIX
268 268
 define('MAIN_DB_PREFIX', $dolibarr_main_db_prefix);
@@ -274,46 +274,46 @@  discard block
 block discarded – undo
274 274
  */
275 275
 // Path to root libraries
276 276
 if (!defined('ADODB_PATH')) {
277
-    define('ADODB_PATH', (!isset($dolibarr_lib_ADODB_PATH)) ? DOL_BASE_PATH . '/includes/adodbtime/' : (empty($dolibarr_lib_ADODB_PATH) ? '' : $dolibarr_lib_ADODB_PATH . '/'));
277
+    define('ADODB_PATH', (!isset($dolibarr_lib_ADODB_PATH)) ? DOL_BASE_PATH . '/includes/adodbtime/' : (empty($dolibarr_lib_ADODB_PATH) ? '' : $dolibarr_lib_ADODB_PATH.'/'));
278 278
 }
279 279
 if (!defined('FPDF_PATH')) {
280
-    define('FPDF_PATH', (empty($dolibarr_lib_FPDF_PATH)) ? DOL_BASE_PATH . '/includes/fpdf/' : $dolibarr_lib_FPDF_PATH . '/');
280
+    define('FPDF_PATH', (empty($dolibarr_lib_FPDF_PATH)) ? DOL_BASE_PATH . '/includes/fpdf/' : $dolibarr_lib_FPDF_PATH.'/');
281 281
 } // Used only for package that can't include tcpdf
282 282
 if (!defined('TCPDF_PATH')) {
283
-    define('TCPDF_PATH', (empty($dolibarr_lib_TCPDF_PATH)) ? DOL_BASE_PATH . '/includes/tecnickcom/tcpdf/' : $dolibarr_lib_TCPDF_PATH . '/');
283
+    define('TCPDF_PATH', (empty($dolibarr_lib_TCPDF_PATH)) ? DOL_BASE_PATH . '/includes/tecnickcom/tcpdf/' : $dolibarr_lib_TCPDF_PATH.'/');
284 284
 }
285 285
 if (!defined('FPDI_PATH')) {
286
-    define('FPDI_PATH', (empty($dolibarr_lib_FPDI_PATH)) ? DOL_BASE_PATH . '/includes/fpdfi/' : $dolibarr_lib_FPDI_PATH . '/');
286
+    define('FPDI_PATH', (empty($dolibarr_lib_FPDI_PATH)) ? DOL_BASE_PATH . '/includes/fpdfi/' : $dolibarr_lib_FPDI_PATH.'/');
287 287
 }
288 288
 if (!defined('TCPDI_PATH')) {
289
-    define('TCPDI_PATH', (empty($dolibarr_lib_TCPDI_PATH)) ? DOL_BASE_PATH . '/includes/tcpdi/' : $dolibarr_lib_TCPDI_PATH . '/');
289
+    define('TCPDI_PATH', (empty($dolibarr_lib_TCPDI_PATH)) ? DOL_BASE_PATH . '/includes/tcpdi/' : $dolibarr_lib_TCPDI_PATH.'/');
290 290
 }
291 291
 if (!defined('NUSOAP_PATH')) {
292
-    define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH)) ? DOL_BASE_PATH . '/includes/nusoap/lib/' : (empty($dolibarr_lib_NUSOAP_PATH) ? '' : $dolibarr_lib_NUSOAP_PATH . '/'));
292
+    define('NUSOAP_PATH', (!isset($dolibarr_lib_NUSOAP_PATH)) ? DOL_BASE_PATH . '/includes/nusoap/lib/' : (empty($dolibarr_lib_NUSOAP_PATH) ? '' : $dolibarr_lib_NUSOAP_PATH.'/'));
293 293
 }
294 294
 if (!defined('PHPEXCEL_PATH')) {
295
-    define('PHPEXCEL_PATH', (!isset($dolibarr_lib_PHPEXCEL_PATH)) ? DOL_BASE_PATH . '/includes/phpoffice/phpexcel/Classes/' : (empty($dolibarr_lib_PHPEXCEL_PATH) ? '' : $dolibarr_lib_PHPEXCEL_PATH . '/'));
295
+    define('PHPEXCEL_PATH', (!isset($dolibarr_lib_PHPEXCEL_PATH)) ? DOL_BASE_PATH . '/includes/phpoffice/phpexcel/Classes/' : (empty($dolibarr_lib_PHPEXCEL_PATH) ? '' : $dolibarr_lib_PHPEXCEL_PATH.'/'));
296 296
 }
297 297
 if (!defined('GEOIP_PATH')) {
298
-    define('GEOIP_PATH', (!isset($dolibarr_lib_GEOIP_PATH)) ? DOL_BASE_PATH . '/includes/geoip/' : (empty($dolibarr_lib_GEOIP_PATH) ? '' : $dolibarr_lib_GEOIP_PATH . '/'));
298
+    define('GEOIP_PATH', (!isset($dolibarr_lib_GEOIP_PATH)) ? DOL_BASE_PATH . '/includes/geoip/' : (empty($dolibarr_lib_GEOIP_PATH) ? '' : $dolibarr_lib_GEOIP_PATH.'/'));
299 299
 }
300 300
 if (!defined('ODTPHP_PATH')) {
301
-    define('ODTPHP_PATH', (!isset($dolibarr_lib_ODTPHP_PATH)) ? DOL_BASE_PATH . '/includes/odtphp/' : (empty($dolibarr_lib_ODTPHP_PATH) ? '' : $dolibarr_lib_ODTPHP_PATH . '/'));
301
+    define('ODTPHP_PATH', (!isset($dolibarr_lib_ODTPHP_PATH)) ? DOL_BASE_PATH . '/includes/odtphp/' : (empty($dolibarr_lib_ODTPHP_PATH) ? '' : $dolibarr_lib_ODTPHP_PATH.'/'));
302 302
 }
303 303
 if (!defined('ODTPHP_PATHTOPCLZIP')) {
304
-    define('ODTPHP_PATHTOPCLZIP', (!isset($dolibarr_lib_ODTPHP_PATHTOPCLZIP)) ? DOL_BASE_PATH . '/includes/odtphp/zip/pclzip/' : (empty($dolibarr_lib_ODTPHP_PATHTOPCLZIP) ? '' : $dolibarr_lib_ODTPHP_PATHTOPCLZIP . '/'));
304
+    define('ODTPHP_PATHTOPCLZIP', (!isset($dolibarr_lib_ODTPHP_PATHTOPCLZIP)) ? DOL_BASE_PATH . '/includes/odtphp/zip/pclzip/' : (empty($dolibarr_lib_ODTPHP_PATHTOPCLZIP) ? '' : $dolibarr_lib_ODTPHP_PATHTOPCLZIP.'/'));
305 305
 }
306 306
 if (!defined('JS_CKEDITOR')) {
307
-    define('JS_CKEDITOR', (!isset($dolibarr_js_CKEDITOR)) ? '' : (empty($dolibarr_js_CKEDITOR) ? '' : $dolibarr_js_CKEDITOR . '/'));
307
+    define('JS_CKEDITOR', (!isset($dolibarr_js_CKEDITOR)) ? '' : (empty($dolibarr_js_CKEDITOR) ? '' : $dolibarr_js_CKEDITOR.'/'));
308 308
 }
309 309
 if (!defined('JS_JQUERY')) {
310
-    define('JS_JQUERY', (!isset($dolibarr_js_JQUERY)) ? '' : (empty($dolibarr_js_JQUERY) ? '' : $dolibarr_js_JQUERY . '/'));
310
+    define('JS_JQUERY', (!isset($dolibarr_js_JQUERY)) ? '' : (empty($dolibarr_js_JQUERY) ? '' : $dolibarr_js_JQUERY.'/'));
311 311
 }
312 312
 if (!defined('JS_JQUERY_UI')) {
313
-    define('JS_JQUERY_UI', (!isset($dolibarr_js_JQUERY_UI)) ? '' : (empty($dolibarr_js_JQUERY_UI) ? '' : $dolibarr_js_JQUERY_UI . '/'));
313
+    define('JS_JQUERY_UI', (!isset($dolibarr_js_JQUERY_UI)) ? '' : (empty($dolibarr_js_JQUERY_UI) ? '' : $dolibarr_js_JQUERY_UI.'/'));
314 314
 }
315 315
 if (!defined('JS_JQUERY_FLOT')) {
316
-    define('JS_JQUERY_FLOT', (!isset($dolibarr_js_JQUERY_FLOT)) ? '' : (empty($dolibarr_js_JQUERY_FLOT) ? '' : $dolibarr_js_JQUERY_FLOT . '/'));
316
+    define('JS_JQUERY_FLOT', (!isset($dolibarr_js_JQUERY_FLOT)) ? '' : (empty($dolibarr_js_JQUERY_FLOT) ? '' : $dolibarr_js_JQUERY_FLOT.'/'));
317 317
 }
318 318
 // Other required path
319 319
 if (!defined('DOL_DEFAULT_TTF')) {
@@ -329,10 +329,10 @@  discard block
 block discarded – undo
329 329
  */
330 330
 
331 331
 if (!defined('ADODB_DATE_VERSION')) {
332
-    include_once ADODB_PATH . 'adodb-time.inc.php';
332
+    include_once ADODB_PATH.'adodb-time.inc.php';
333 333
 }
334 334
 
335
-if (!file_exists(DOL_BASE_PATH . "/core/lib/functions.lib.php")) {
335
+if (!file_exists(DOL_BASE_PATH."/core/lib/functions.lib.php")) {
336 336
     print "Error: Dolibarr config file content seems to be not correctly defined.<br>\n";
337 337
     print "Please run dolibarr setup by calling page <b>/install</b>.<br>\n";
338 338
     exit;
@@ -340,8 +340,8 @@  discard block
 block discarded – undo
340 340
 
341 341
 
342 342
 // Included by default
343
-include_once DOL_BASE_PATH . '/core/lib/functions.lib.php';
344
-include_once DOL_BASE_PATH . '/core/lib/security.lib.php';
343
+include_once DOL_BASE_PATH.'/core/lib/functions.lib.php';
344
+include_once DOL_BASE_PATH.'/core/lib/security.lib.php';
345 345
 //print memory_get_usage();
346 346
 // If password is encoded, we decode it
347 347
 if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass)) {
Please login to merge, or discard this patch.
Braces   +16 added lines, -12 removed lines patch added patch discarded remove patch
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
 
84 84
     if (!empty($_SERVER["CONTEXT_PREFIX"])) {    // CONTEXT_PREFIX and CONTEXT_DOCUMENT_ROOT are not defined on all apache versions
85 85
         $path = $_SERVER["CONTEXT_PREFIX"];       // example '/dolibarr/' when using an apache alias.
86
-        if (!preg_match('/\/$/', $path))
87
-            $path .= '/';
88
-    }
89
-    else if (preg_match('/index\.php/', $_SERVER['PHP_SELF'])) {
86
+        if (!preg_match('/\/$/', $path)) {
87
+                    $path .= '/';
88
+        }
89
+    } else if (preg_match('/index\.php/', $_SERVER['PHP_SELF'])) {
90 90
         // When we ask index.php, we MUST BE SURE that $path is '' at the end. This is required to make install process
91 91
         // when using apache alias like '/dolibarr/' that point to htdocs.
92 92
         // Note: If calling page was an index.php not into htdocs (ie comm/index.php, ...), then this redirect will fails,
@@ -100,12 +100,15 @@  discard block
 block discarded – undo
100 100
         $path = '';
101 101
         $i = count($TDir);
102 102
         while ($i--) {
103
-            if (empty($TDir[$i]) || $TDir[$i] == 'htdocs')
104
-                break;
105
-            if ($TDir[$i] == 'dolibarr')
106
-                break;
107
-            if (substr($TDir[$i], -4, 4) == '.php')
108
-                continue;
103
+            if (empty($TDir[$i]) || $TDir[$i] == 'htdocs') {
104
+                            break;
105
+            }
106
+            if ($TDir[$i] == 'dolibarr') {
107
+                            break;
108
+            }
109
+            if (substr($TDir[$i], -4, 4) == '.php') {
110
+                            continue;
111
+            }
109 112
 
110 113
             $path .= '../';
111 114
         }
@@ -186,8 +189,9 @@  discard block
 block discarded – undo
186 189
         } else {
187 190
             $tmpa = parse_url($_SERVER['HTTP_HOST']);
188 191
             $tmpb = parse_url($_SERVER['HTTP_REFERER']);
189
-            if ((empty($tmpa['host']) ? $tmpa['path'] : $tmpa['host']) != (empty($tmpb['host']) ? $tmpb['path'] : $tmpb['host']))
190
-                $csrfattack = true;
192
+            if ((empty($tmpa['host']) ? $tmpa['path'] : $tmpa['host']) != (empty($tmpb['host']) ? $tmpb['path'] : $tmpb['host'])) {
193
+                            $csrfattack = true;
194
+            }
191 195
         }
192 196
         if ($csrfattack) {
193 197
             //print 'NOCSRFCHECK='.defined('NOCSRFCHECK').' REQUEST_METHOD='.$_SERVER['REQUEST_METHOD'].' HTTP_HOST='.$_SERVER['HTTP_HOST'].' HTTP_REFERER='.$_SERVER['HTTP_REFERER'];
Please login to merge, or discard this patch.
dolibarr/htdocs/home/home.php 1 patch
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
 
32 32
 
33 33
 // Copyright (C) 2018 Alxarafe/Alixar  <[email protected]>
34
-require DOL_BASE_PATH . '/main.inc.php';
35
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php';
34
+require DOL_BASE_PATH.'/main.inc.php';
35
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
36 36
 
37 37
 // If not defined, we select menu "home"
38 38
 $_GET['mainmenu'] = GETPOST('mainmenu', 'aZ09') ? GETPOST('mainmenu', 'aZ09') : 'home';
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 // Check if company name is defined (first install)
48 48
 if (!isset($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_NOM)) {
49 49
     //header("Location: " . DOL_URL_ROOT . "/admin/index.php?mainmenu=home&leftmenu=setup&mesg=setupnotcomplete");
50
-    header('Location: ' . BASE_URI . '?controller=admin&method=index&mainmenu=home&leftmenu=setup&mesg=setupnotcomplete');
50
+    header('Location: '.BASE_URI.'?controller=admin&method=index&mainmenu=home&leftmenu=setup&mesg=setupnotcomplete');
51 51
     exit;
52 52
 }
53 53
 /*
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
   }
62 62
  */
63 63
 if (GETPOST('addbox')) { // Add box (when submit is done from a form when ajax disabled)
64
-    require_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';
64
+    require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
65 65
     $zone = GETPOST('areacode', 'aZ09');
66 66
     $userid = GETPOST('userid', 'int');
67 67
     $boxorder = GETPOST('boxorder', 'aZ09');
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
     $form = new Form($db);
82 82
 
83 83
 // Title
84
-$title = $langs->trans("HomeArea") . ' - Dolibarr ' . DOL_VERSION;
84
+$title = $langs->trans("HomeArea").' - Dolibarr '.DOL_VERSION;
85 85
 if (!empty($conf->global->MAIN_APPLICATION_TITLE))
86
-    $title = $langs->trans("HomeArea") . ' - ' . $conf->global->MAIN_APPLICATION_TITLE;
86
+    $title = $langs->trans("HomeArea").' - '.$conf->global->MAIN_APPLICATION_TITLE;
87 87
 
88 88
 llxHeader('', $title);
89 89
 
90 90
 
91
-$resultboxes = FormOther::getBoxesArea($user, "0");    // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
91
+$resultboxes = FormOther::getBoxesArea($user, "0"); // Load $resultboxes (selectboxlist + boxactivated + boxlista + boxlistb)
92 92
 
93 93
 
94 94
 print load_fiche_titre($langs->trans("HomeArea"), $resultboxes['selectboxlist'], 'title_home');
@@ -123,16 +123,16 @@  discard block
 block discarded – undo
123 123
 
124 124
 if (empty($user->societe_id)) {
125 125
     $boxstat .= '<div class="box">';
126
-    $boxstat .= '<table summary="' . dol_escape_htmltag($langs->trans("DolibarrStateBoard")) . '" class="noborder boxtable boxtablenobottom nohover" width="100%">';
126
+    $boxstat .= '<table summary="'.dol_escape_htmltag($langs->trans("DolibarrStateBoard")).'" class="noborder boxtable boxtablenobottom nohover" width="100%">';
127 127
     $boxstat .= '<tr class="liste_titre">';
128
-    $boxstat .= '<th class="liste_titre">' . $langs->trans("DolibarrStateBoard") . '</th>';
128
+    $boxstat .= '<th class="liste_titre">'.$langs->trans("DolibarrStateBoard").'</th>';
129 129
     $boxstat .= '</tr>';
130 130
     $boxstat .= '<tr class="impair"><td class="tdboxstats nohover flexcontainer">';
131 131
 
132 132
     $object = new stdClass();
133 133
     $parameters = array();
134 134
     $action = '';
135
-    $reshook = $hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action);    // Note that $action and $object may have been modified by some hooks
135
+    $reshook = $hookmanager->executeHooks('addStatisticLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
136 136
     $boxstat .= $hookmanager->resPrint;
137 137
 
138 138
     if (empty($reshook)) {
@@ -160,25 +160,25 @@  discard block
 block discarded – undo
160 160
         );
161 161
         // Class file containing the method load_state_board for each line
162 162
         $includes = array(
163
-            DOL_DOCUMENT_ROOT . "/user/class/user.class.php",
164
-            DOL_DOCUMENT_ROOT . "/societe/class/client.class.php",
165
-            DOL_DOCUMENT_ROOT . "/societe/class/client.class.php",
166
-            DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.class.php",
167
-            DOL_DOCUMENT_ROOT . "/contact/class/contact.class.php",
168
-            DOL_DOCUMENT_ROOT . "/adherents/class/adherent.class.php",
169
-            DOL_DOCUMENT_ROOT . "/product/class/product.class.php",
170
-            DOL_DOCUMENT_ROOT . "/product/class/product.class.php",
171
-            DOL_DOCUMENT_ROOT . "/comm/propal/class/propal.class.php",
172
-            DOL_DOCUMENT_ROOT . "/commande/class/commande.class.php",
173
-            DOL_DOCUMENT_ROOT . "/compta/facture/class/facture.class.php",
174
-            DOL_DOCUMENT_ROOT . "/contrat/class/contrat.class.php",
175
-            DOL_DOCUMENT_ROOT . "/fichinter/class/fichinter.class.php",
176
-            DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.commande.class.php",
177
-            DOL_DOCUMENT_ROOT . "/fourn/class/fournisseur.facture.class.php",
178
-            DOL_DOCUMENT_ROOT . "/supplier_proposal/class/supplier_proposal.class.php",
179
-            DOL_DOCUMENT_ROOT . "/projet/class/project.class.php",
180
-            DOL_DOCUMENT_ROOT . "/expensereport/class/expensereport.class.php",
181
-            DOL_DOCUMENT_ROOT . "/don/class/don.class.php"
163
+            DOL_DOCUMENT_ROOT."/user/class/user.class.php",
164
+            DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
165
+            DOL_DOCUMENT_ROOT."/societe/class/client.class.php",
166
+            DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php",
167
+            DOL_DOCUMENT_ROOT."/contact/class/contact.class.php",
168
+            DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php",
169
+            DOL_DOCUMENT_ROOT."/product/class/product.class.php",
170
+            DOL_DOCUMENT_ROOT."/product/class/product.class.php",
171
+            DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php",
172
+            DOL_DOCUMENT_ROOT."/commande/class/commande.class.php",
173
+            DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php",
174
+            DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php",
175
+            DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php",
176
+            DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php",
177
+            DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php",
178
+            DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php",
179
+            DOL_DOCUMENT_ROOT."/projet/class/project.class.php",
180
+            DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php",
181
+            DOL_DOCUMENT_ROOT."/don/class/don.class.php"
182 182
         );
183 183
         // Name class containing the method load_state_board for each line
184 184
         $classes = array('User',
@@ -289,25 +289,25 @@  discard block
 block discarded – undo
289 289
           );
290 290
          */
291 291
         $links = array(
292
-            BASE_URI . '/?controller=user&method=list',
293
-            BASE_URI . '/?controller=societe&method=list&type=c&mainmenu=companies',
294
-            BASE_URI . '/?controller=societe&method=list&type=p&mainmenu=companies',
295
-            BASE_URI . '/?controller=societe&method=list&type=f&mainmenu=companies',
296
-            BASE_URI . '/?controller=contact&method=list&mainmenu=companies',
297
-            BASE_URI . '/?controller=adherents&method=list&statut=1&mainmenu=members',
298
-            BASE_URI . '/?controller=product&method=list&type=0&mainmenu=products',
299
-            BASE_URI . '/?controller=product&method=list&type=1&mainmenu=products',
300
-            BASE_URI . '/?controller=comm/propal&method=list&mainmenu=commercial&leftmenu=propals',
301
-            BASE_URI . '/?controller=commande&method=list&mainmenu=commercial&leftmenu=orders',
302
-            BASE_URI . '/?controller=compta/facture&method=list&mainmenu=billing&leftmenu=customers_bills',
303
-            BASE_URI . '/?controller=contrat&method=list&mainmenu=commercial&leftmenu=contracts',
304
-            BASE_URI . '/?controller=fichinter&method=list&mainmenu=commercial&leftmenu=ficheinter',
305
-            BASE_URI . '/?controller=fourn/commande&method=list&mainmenu=commercial&leftmenu=orders_suppliers',
306
-            BASE_URI . '/?controller=fourn/facture&method=list&mainmenu=billing&leftmenu=suppliers_bills',
307
-            BASE_URI . '/?controller=supplier_proposal&method=list&mainmenu=commercial&leftmenu=',
308
-            BASE_URI . '/?controller=projet&method=list&mainmenu=project',
309
-            BASE_URI . '/?controller=expensereport&method=list&mainmenu=hrm&leftmenu=expensereport',
310
-            BASE_URI . '/?controller=don&method=list&leftmenu=donations'
292
+            BASE_URI.'/?controller=user&method=list',
293
+            BASE_URI.'/?controller=societe&method=list&type=c&mainmenu=companies',
294
+            BASE_URI.'/?controller=societe&method=list&type=p&mainmenu=companies',
295
+            BASE_URI.'/?controller=societe&method=list&type=f&mainmenu=companies',
296
+            BASE_URI.'/?controller=contact&method=list&mainmenu=companies',
297
+            BASE_URI.'/?controller=adherents&method=list&statut=1&mainmenu=members',
298
+            BASE_URI.'/?controller=product&method=list&type=0&mainmenu=products',
299
+            BASE_URI.'/?controller=product&method=list&type=1&mainmenu=products',
300
+            BASE_URI.'/?controller=comm/propal&method=list&mainmenu=commercial&leftmenu=propals',
301
+            BASE_URI.'/?controller=commande&method=list&mainmenu=commercial&leftmenu=orders',
302
+            BASE_URI.'/?controller=compta/facture&method=list&mainmenu=billing&leftmenu=customers_bills',
303
+            BASE_URI.'/?controller=contrat&method=list&mainmenu=commercial&leftmenu=contracts',
304
+            BASE_URI.'/?controller=fichinter&method=list&mainmenu=commercial&leftmenu=ficheinter',
305
+            BASE_URI.'/?controller=fourn/commande&method=list&mainmenu=commercial&leftmenu=orders_suppliers',
306
+            BASE_URI.'/?controller=fourn/facture&method=list&mainmenu=billing&leftmenu=suppliers_bills',
307
+            BASE_URI.'/?controller=supplier_proposal&method=list&mainmenu=commercial&leftmenu=',
308
+            BASE_URI.'/?controller=projet&method=list&mainmenu=project',
309
+            BASE_URI.'/?controller=expensereport&method=list&mainmenu=hrm&leftmenu=expensereport',
310
+            BASE_URI.'/?controller=don&method=list&leftmenu=donations'
311 311
         );
312 312
         // Translation lang files
313 313
         $langfile = array("users",
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
                     $langs->load($langfile[$key]);
353 353
                 $text = $langs->trans($titres[$key]);
354 354
                 //$sep=($conf->dol_use_jmobile?'<br>':' ');
355
-                $boxstat .= '<a href="' . $links[$key] . '" class="boxstatsindicator thumbstat nobold nounderline">';
355
+                $boxstat .= '<a href="'.$links[$key].'" class="boxstatsindicator thumbstat nobold nounderline">';
356 356
                 $boxstat .= '<div class="boxstats">';
357
-                $boxstat .= '<span class="boxstatstext" title="' . dol_escape_htmltag($text) . '">' . $text . '</span><br>';
358
-                $boxstat .= '<span class="boxstatsindicator">' . img_object("", $icons[$key], 'class="inline-block"') . ' ' . ($board->nb[$val] ? $board->nb[$val] : 0) . '</span>';
357
+                $boxstat .= '<span class="boxstatstext" title="'.dol_escape_htmltag($text).'">'.$text.'</span><br>';
358
+                $boxstat .= '<span class="boxstatsindicator">'.img_object("", $icons[$key], 'class="inline-block"').' '.($board->nb[$val] ? $board->nb[$val] : 0).'</span>';
359 359
                 $boxstat .= '</div>';
360 360
                 $boxstat .= '</a>';
361 361
             }
@@ -389,11 +389,11 @@  discard block
 block discarded – undo
389 389
 $dashboardlines = array();
390 390
 
391 391
 // Do not include sections without management permission
392
-require_once DOL_DOCUMENT_ROOT . '/core/class/workboardresponse.class.php';
392
+require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
393 393
 
394 394
 // Number of actions to do (late)
395 395
 if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read) {
396
-    include_once DOL_DOCUMENT_ROOT . '/comm/action/class/actioncomm.class.php';
396
+    include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
397 397
     $board = new ActionComm($db);
398 398
 
399 399
     $dashboardlines[] = $board->load_board($user);
@@ -401,21 +401,21 @@  discard block
 block discarded – undo
401 401
 
402 402
 // Number of project opened
403 403
 if (!empty($conf->projet->enabled) && $user->rights->projet->lire) {
404
-    include_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
404
+    include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
405 405
     $board = new Project($db);
406 406
     $dashboardlines[] = $board->load_board($user);
407 407
 }
408 408
 
409 409
 // Number of tasks to do (late)
410 410
 if (!empty($conf->projet->enabled) && empty($conf->global->PROJECT_HIDE_TASKS) && $user->rights->projet->lire) {
411
-    include_once DOL_DOCUMENT_ROOT . '/projet/class/task.class.php';
411
+    include_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php';
412 412
     $board = new Task($db);
413 413
     $dashboardlines[] = $board->load_board($user);
414 414
 }
415 415
 
416 416
 // Number of commercial proposals opened (expired)
417 417
 if (!empty($conf->propal->enabled) && $user->rights->propale->lire) {
418
-    include_once DOL_DOCUMENT_ROOT . '/comm/propal/class/propal.class.php';
418
+    include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
419 419
     $board = new Propal($db);
420 420
     $dashboardlines[] = $board->load_board($user, "opened");
421 421
     // Number of commercial proposals CLOSED signed (billed)
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
 
425 425
 // Number of commercial proposals opened (expired)
426 426
 if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire) {
427
-    include_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php';
427
+    include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php';
428 428
     $board = new SupplierProposal($db);
429 429
     $dashboardlines[] = $board->load_board($user, "opened");
430 430
     // Number of commercial proposals CLOSED signed (billed)
@@ -433,21 +433,21 @@  discard block
 block discarded – undo
433 433
 
434 434
 // Number of customer orders a deal
435 435
 if (!empty($conf->commande->enabled) && $user->rights->commande->lire) {
436
-    include_once DOL_DOCUMENT_ROOT . '/commande/class/commande.class.php';
436
+    include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
437 437
     $board = new Commande($db);
438 438
     $dashboardlines[] = $board->load_board($user);
439 439
 }
440 440
 
441 441
 // Number of suppliers orders a deal
442 442
 if (!empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire) {
443
-    include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.commande.class.php';
443
+    include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
444 444
     $board = new CommandeFournisseur($db);
445 445
     $dashboardlines[] = $board->load_board($user);
446 446
 }
447 447
 
448 448
 // Number of services enabled (delayed)
449 449
 if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) {
450
-    include_once DOL_DOCUMENT_ROOT . '/contrat/class/contrat.class.php';
450
+    include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
451 451
     $board = new Contrat($db);
452 452
     $dashboardlines[] = $board->load_board($user, "inactives");
453 453
     // Number of active services (expired)
@@ -455,23 +455,23 @@  discard block
 block discarded – undo
455 455
 }
456 456
 // Number of invoices customers (has paid)
457 457
 if (!empty($conf->facture->enabled) && $user->rights->facture->lire) {
458
-    include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
458
+    include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
459 459
     $board = new Facture($db);
460 460
     $dashboardlines[] = $board->load_board($user);
461 461
 }
462 462
 
463 463
 // Number of supplier invoices (has paid)
464 464
 if (!empty($conf->supplier_invoice->enabled) && !empty($user->rights->fournisseur->facture->lire)) {
465
-    include_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
465
+    include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
466 466
     $board = new FactureFournisseur($db);
467 467
     $dashboardlines[] = $board->load_board($user);
468 468
 }
469 469
 
470 470
 // Number of transactions to conciliate
471 471
 if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id) {
472
-    include_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
472
+    include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
473 473
     $board = new Account($db);
474
-    $nb = $board::countAccountToReconcile();    // Get nb of account to reconciliate
474
+    $nb = $board::countAccountToReconcile(); // Get nb of account to reconciliate
475 475
     if ($nb > 0) {
476 476
         $dashboardlines[] = $board->load_board($user);
477 477
     }
@@ -479,28 +479,28 @@  discard block
 block discarded – undo
479 479
 
480 480
 // Number of cheque to send
481 481
 if (!empty($conf->banque->enabled) && $user->rights->banque->lire && !$user->societe_id && empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT)) {
482
-    include_once DOL_DOCUMENT_ROOT . '/compta/paiement/cheque/class/remisecheque.class.php';
482
+    include_once DOL_DOCUMENT_ROOT.'/compta/paiement/cheque/class/remisecheque.class.php';
483 483
     $board = new RemiseCheque($db);
484 484
     $dashboardlines[] = $board->load_board($user);
485 485
 }
486 486
 
487 487
 // Number of foundation members
488 488
 if (!empty($conf->adherent->enabled) && $user->rights->adherent->lire && !$user->societe_id) {
489
-    include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
489
+    include_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
490 490
     $board = new Adherent($db);
491 491
     $dashboardlines[] = $board->load_board($user);
492 492
 }
493 493
 
494 494
 // Number of expense reports to approve
495 495
 if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->approve) {
496
-    include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
496
+    include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
497 497
     $board = new ExpenseReport($db);
498 498
     $dashboardlines[] = $board->load_board($user, 'toapprove');
499 499
 }
500 500
 
501 501
 // Number of expense reports to pay
502 502
 if (!empty($conf->expensereport->enabled) && $user->rights->expensereport->to_paid) {
503
-    include_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php';
503
+    include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
504 504
     $board = new ExpenseReport($db);
505 505
     $dashboardlines[] = $board->load_board($user, 'topay');
506 506
 }
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 $object = new stdClass();
509 509
 $parameters = array();
510 510
 $action = '';
511
-$reshook = $hookmanager->executeHooks('addOpenElementsDashboardLine', $parameters, $object, $action);    // Note that $action and $object may have been modified by some hooks
511
+$reshook = $hookmanager->executeHooks('addOpenElementsDashboardLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
512 512
 if ($reshook == 0) {
513 513
     $dashboardlines = array_merge($dashboardlines, $hookmanager->resArray);
514 514
 }
@@ -538,20 +538,20 @@  discard block
 block discarded – undo
538 538
 //var_dump($totallate);
539 539
 $boxwork = '';
540 540
 $boxwork .= '<div class="box">';
541
-$boxwork .= '<table summary="' . dol_escape_htmltag($langs->trans("WorkingBoard")) . '" class="noborder boxtable boxtablenobottom boxworkingboard" width="100%">' . "\n";
541
+$boxwork .= '<table summary="'.dol_escape_htmltag($langs->trans("WorkingBoard")).'" class="noborder boxtable boxtablenobottom boxworkingboard" width="100%">'."\n";
542 542
 $boxwork .= '<tr class="liste_titre">';
543
-$boxwork .= '<th class="liste_titre">' . $langs->trans("DolibarrWorkBoard") . '</th>';
544
-$boxwork .= '</tr>' . "\n";
543
+$boxwork .= '<th class="liste_titre">'.$langs->trans("DolibarrWorkBoard").'</th>';
544
+$boxwork .= '</tr>'."\n";
545 545
 
546 546
 if ($showweather) {
547 547
     $boxwork .= '<tr class="nohover">';
548
-    $boxwork .= '<td class="nohover' . ($conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '') . ' center valignmiddle">';
548
+    $boxwork .= '<td class="nohover'.($conf->global->MAIN_DISABLE_METEO == 2 ? ' hideonsmartphone' : '').' center valignmiddle">';
549 549
     $text = '';
550 550
     if ($totallate > 0)
551
-        $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate") . ' (' . $langs->transnoentitiesnoconv("NActionsLate", $totallate . (!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')) . ')';
551
+        $text = $langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate", $totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')';
552 552
     else
553 553
         $text = $langs->transnoentitiesnoconv("NoItemLate");
554
-    $text .= '. ' . $langs->transnoentitiesnoconv("LateDesc");
554
+    $text .= '. '.$langs->transnoentitiesnoconv("LateDesc");
555 555
     //$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
556 556
     $options = 'height="64px"';
557 557
     $boxwork .= showWeather($totallate, $text, $options);
@@ -569,23 +569,23 @@  discard block
 block discarded – undo
569 569
             $nbworkboardempty++;
570 570
 
571 571
         $textlate = $langs->trans("NActionsLate", $board->nbtodolate);
572
-        $textlate .= ' (' . $langs->trans("Late") . ' = ' . $langs->trans("DateReference") . ' > ' . $langs->trans("DateToday") . ' ' . (ceil($board->warning_delay) >= 0 ? '+' : '') . ceil($board->warning_delay) . ' ' . $langs->trans("days") . ')';
572
+        $textlate .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';
573 573
 
574 574
         $boxwork .= '<div class="boxstatsindicator thumbstat150 nobold nounderline"><div class="boxstats130 boxstatsborder">';
575 575
         $boxwork .= '<div class="boxstatscontent">';
576 576
         $sep = ($conf->dol_use_jmobile ? '<br>' : ' ');
577
-        $boxwork .= '<span class="boxstatstext" title="' . dol_escape_htmltag($board->label) . '">' . $board->img . ' ' . $board->label . '</span><br>';
578
-        $boxwork .= '<a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . $board->nbtodo . '</span></a>';
577
+        $boxwork .= '<span class="boxstatstext" title="'.dol_escape_htmltag($board->label).'">'.$board->img.' '.$board->label.'</span><br>';
578
+        $boxwork .= '<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.$board->nbtodo.'</span></a>';
579 579
         if ($board->total > 0 && !empty($conf->global->MAIN_WORKBOARD_SHOW_TOTAL_WO_TAX)) {
580
-            $boxwork .= '&nbsp;/&nbsp;<a class="valignmiddle dashboardlineindicator" href="' . $board->url . '"><span class="dashboardlineindicator' . (($board->nbtodo == 0) ? ' dashboardlineok' : '') . '">' . price($board->total) . '</span></a>';
580
+            $boxwork .= '&nbsp;/&nbsp;<a class="valignmiddle dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator'.(($board->nbtodo == 0) ? ' dashboardlineok' : '').'">'.price($board->total).'</span></a>';
581 581
         }
582 582
         $boxwork .= '</div>';
583 583
         if ($board->nbtodolate > 0) {
584 584
             $boxwork .= '<div class="dashboardlinelatecoin nowrap">';
585
-            $boxwork .= '<a title="' . dol_escape_htmltag($textlate) . '" class="valignmiddle dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '" href="' . ((!$board->url_late) ? $board->url : $board->url_late ) . '">';
585
+            $boxwork .= '<a title="'.dol_escape_htmltag($textlate).'" class="valignmiddle dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'" href="'.((!$board->url_late) ? $board->url : $board->url_late).'">';
586 586
             //$boxwork .= img_picto($textlate, "warning_white", 'class="valigntextbottom"').'';
587
-            $boxwork .= img_picto($textlate, "warning_white", 'class="inline-block hideonsmartphone valigntextbottom"') . '';
588
-            $boxwork .= '<span class="dashboardlineindicatorlate' . ($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok') . '">';
587
+            $boxwork .= img_picto($textlate, "warning_white", 'class="inline-block hideonsmartphone valigntextbottom"').'';
588
+            $boxwork .= '<span class="dashboardlineindicatorlate'.($board->nbtodolate > 0 ? ' dashboardlineko' : ' dashboardlineok').'">';
589 589
             $boxwork .= $board->nbtodolate;
590 590
             $boxwork .= '</span>';
591 591
             $boxwork .= '</a>';
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
 
615 615
 $boxwork .= '</td></tr>';
616 616
 
617
-$boxwork .= '</table>';   // End table array of working board
617
+$boxwork .= '</table>'; // End table array of working board
618 618
 $boxwork .= '</div>';
619 619
 
620 620
 print '</div></div></div><div class="clearboth"></div>';
@@ -660,11 +660,11 @@  discard block
 block discarded – undo
660 660
     $message = '';
661 661
 
662 662
     // Check if install lock file is present
663
-    $lockfile = DOL_DATA_ROOT . '/install.lock';
664
-    if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT . "/install")) {
663
+    $lockfile = DOL_DATA_ROOT.'/install.lock';
664
+    if (!empty($lockfile) && !file_exists($lockfile) && is_dir(DOL_DOCUMENT_ROOT."/install")) {
665 665
         $langs->load("errors");
666 666
         //if (! empty($message)) $message.='<br>';
667
-        $message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT) . ' ' . $langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth');
667
+        $message .= info_admin($langs->trans("WarningLockFileDoesNotExists", DOL_DATA_ROOT).' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
668 668
     }
669 669
 
670 670
     // Conf files must be in read only mode
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
         $langs->load("errors");
673 673
         //$langs->load("other");
674 674
         //if (! empty($message)) $message.='<br>';
675
-        $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly") . ' ' . $langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT . "/install"), 0, 0, '1', 'clearboth');
675
+        $message .= info_admin($langs->transnoentities("WarningConfFileMustBeReadOnly").' '.$langs->trans("WarningUntilDirRemoved", DOL_DOCUMENT_ROOT."/install"), 0, 0, '1', 'clearboth');
676 676
     }
677 677
 
678 678
     if ($message) {
@@ -707,20 +707,20 @@  discard block
 block discarded – undo
707 707
     $used_conf = !empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? 'MAIN_METEO_PERCENTAGE_LEVEL' : 'MAIN_METEO_LEVEL';
708 708
 
709 709
     $level0 = $offset;
710
-    if (!empty($conf->global->{$used_conf . '0'})) {
711
-        $level0 = $conf->global->{$used_conf . '0'};
710
+    if (!empty($conf->global->{$used_conf.'0'})) {
711
+        $level0 = $conf->global->{$used_conf.'0'};
712 712
     }
713 713
     $level1 = $offset + 1 * $factor;
714
-    if (!empty($conf->global->{$used_conf . '1'})) {
715
-        $level1 = $conf->global->{$used_conf . '1'};
714
+    if (!empty($conf->global->{$used_conf.'1'})) {
715
+        $level1 = $conf->global->{$used_conf.'1'};
716 716
     }
717 717
     $level2 = $offset + 2 * $factor;
718
-    if (!empty($conf->global->{$used_conf . '2'})) {
719
-        $level2 = $conf->global->{$used_conf . '2'};
718
+    if (!empty($conf->global->{$used_conf.'2'})) {
719
+        $level2 = $conf->global->{$used_conf.'2'};
720 720
     }
721 721
     $level3 = $offset + 3 * $factor;
722
-    if (!empty($conf->global->{$used_conf . '3'})) {
723
-        $level3 = $conf->global->{$used_conf . '3'};
722
+    if (!empty($conf->global->{$used_conf.'3'})) {
723
+        $level3 = $conf->global->{$used_conf.'3'};
724 724
     }
725 725
 
726 726
     if ($totallate <= $level0)
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/functions.lib.php 1 patch
Spacing   +546 added lines, -546 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
  * 	\brief			A set of functions for Dolibarr
37 37
  * 					This file contains all frequently used functions.
38 38
  */
39
-include_once DOL_BASE_PATH . '/core/lib/json.lib.php';
39
+include_once DOL_BASE_PATH.'/core/lib/json.lib.php';
40 40
 
41 41
 /**
42 42
  * Function to return value of a static property when class
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function getStaticMember($class, $member)
53 53
 {
54
-    dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
54
+    dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING);
55 55
 
56 56
     // This part is deprecated. Uncomment if for php 5.2.*, and comment next isset class::member
57 57
     /* if (version_compare(phpversion(), '5.3.0', '<'))
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
     if (isset($class::$member))
78 78
         return $class::$member;
79
-    dol_print_error('', 'Try to get a static member "' . $member . '" in class "' . $class . '" that does not exists or is not static.');
79
+    dol_print_error('', 'Try to get a static member "'.$member.'" in class "'.$class.'" that does not exists or is not static.');
80 80
     return null;
81 81
 }
82 82
 
@@ -93,9 +93,9 @@  discard block
 block discarded – undo
93 93
  */
94 94
 function getDoliDBInstance($type, $host, $user, $pass, $name, $port)
95 95
 {
96
-    require_once DOL_BASE_PATH . "/core/db/" . $type . '.class.php';
96
+    require_once DOL_BASE_PATH."/core/db/".$type.'.class.php';
97 97
 
98
-    $class = 'DoliDB' . ucfirst($type);
98
+    $class = 'DoliDB'.ucfirst($type);
99 99
     $dolidb = new $class($type, $host, $user, $pass, $name, $port);
100 100
     return $dolidb;
101 101
 }
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
  */
152 152
 function getBrowserInfo($user_agent)
153 153
 {
154
-    include_once DOL_BASE_PATH . '/includes/mobiledetect/mobiledetectlib/Mobile_Detect.php';
154
+    include_once DOL_BASE_PATH.'/includes/mobiledetect/mobiledetectlib/Mobile_Detect.php';
155 155
 
156 156
     $name = 'unknown';
157 157
     $version = '';
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
         $depth = $db->transaction_opened;
265 265
         $disconnectdone = $db->close();
266 266
     }
267
-    dol_syslog("--- End access to " . $_SERVER["PHP_SELF"] . (($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was ' . $depth . ')' : ''), (($disconnectdone && $depth) ? LOG_WARNING : LOG_INFO));
267
+    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 268
 }
269 269
 
270 270
 /**
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     if (empty($paramname))
310 310
         return 'BadFirstParameterForGETPOST';
311 311
     if (empty($check)) {
312
-        dol_syslog("Deprecated use of GETPOST, called with 1st param = " . $paramname . " and 2nd param is '', when calling page " . $_SERVER["PHP_SELF"], LOG_WARNING);
312
+        dol_syslog("Deprecated use of GETPOST, called with 1st param = ".$paramname." and 2nd param is '', when calling page ".$_SERVER["PHP_SELF"], LOG_WARNING);
313 313
         // Enable this line to know who call the GETPOST with '' $check parameter.
314 314
         //var_dump(debug_backtrace()[0]);
315 315
     }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
         $relativepathstring = $_SERVER["PHP_SELF"];
332 332
         // Clean $relativepathstring
333 333
         if (constant('DOL_URL_ROOT'))
334
-            $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring);
334
+            $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring);
335 335
         $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
336 336
         $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
337 337
         //var_dump($relativepathstring);
@@ -339,8 +339,8 @@  discard block
 block discarded – undo
339 339
         // Code for search criteria persistence.
340 340
         // Retrieve values if restore_lastsearch_values
341 341
         if (!empty($_GET['restore_lastsearch_values'])) {        // Use $_GET here and not GETPOST
342
-            if (!empty($_SESSION['lastsearch_values_' . $relativepathstring])) { // If there is saved values
343
-                $tmp = json_decode($_SESSION['lastsearch_values_' . $relativepathstring], true);
342
+            if (!empty($_SESSION['lastsearch_values_'.$relativepathstring])) { // If there is saved values
343
+                $tmp = json_decode($_SESSION['lastsearch_values_'.$relativepathstring], true);
344 344
                 if (is_array($tmp)) {
345 345
                     foreach ($tmp as $key => $val) {
346 346
                         if ($key == $paramname) { // We are on the requested parameter
@@ -351,12 +351,12 @@  discard block
 block discarded – undo
351 351
                 }
352 352
             }
353 353
             // If there is saved contextpage, page or limit
354
-            if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_' . $relativepathstring])) {
355
-                $out = $_SESSION['lastsearch_contextpage_' . $relativepathstring];
356
-            } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_' . $relativepathstring])) {
357
-                $out = $_SESSION['lastsearch_page_' . $relativepathstring];
358
-            } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_' . $relativepathstring])) {
359
-                $out = $_SESSION['lastsearch_limit_' . $relativepathstring];
354
+            if ($paramname == 'contextpage' && !empty($_SESSION['lastsearch_contextpage_'.$relativepathstring])) {
355
+                $out = $_SESSION['lastsearch_contextpage_'.$relativepathstring];
356
+            } elseif ($paramname == 'page' && !empty($_SESSION['lastsearch_page_'.$relativepathstring])) {
357
+                $out = $_SESSION['lastsearch_page_'.$relativepathstring];
358
+            } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring])) {
359
+                $out = $_SESSION['lastsearch_limit_'.$relativepathstring];
360 360
             }
361 361
         }
362 362
         // Else, retreive default values if we are not doing a sort
@@ -424,7 +424,7 @@  discard block
 block discarded – undo
424 424
                                         $qualified = 1;
425 425
 
426 426
                                     if ($qualified) {
427
-                                        $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "=");  // we accept _, -, . and ,
427
+                                        $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
428 428
                                         foreach ($user->default_values[$relativepathstring]['sortorder'][$defkey] as $key => $val) {
429 429
                                             if ($out)
430 430
                                                 $out .= ', ';
@@ -460,11 +460,11 @@  discard block
 block discarded – undo
460 460
                                     if (isset($_POST['sall']) || isset($_POST['search_all']) || isset($_GET['sall']) || isset($_GET['search_all'])) {
461 461
                                         // We made a search from quick search menu, do we still use default filter ?
462 462
                                         if (empty($conf->global->MAIN_DISABLE_DEFAULT_FILTER_FOR_QUICK_SEARCH)) {
463
-                                            $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "=");  // we accept _, -, . and ,
463
+                                            $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
464 464
                                             $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
465 465
                                         }
466 466
                                     } else {
467
-                                        $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "=");  // we accept _, -, . and ,
467
+                                        $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ";", "="); // we accept _, -, . and ,
468 468
                                         $out = dol_string_nospecial($user->default_values[$relativepathstring]['filters'][$defkey][$paramname], '', $forbidden_chars_to_replace);
469 469
                                     }
470 470
                                     break;
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
     // 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.
483 483
     if (!is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) {
484 484
         $maxloop = 20;
485
-        $loopnb = 0;    // Protection against infinite loop
485
+        $loopnb = 0; // Protection against infinite loop
486 486
         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.
487 487
             $loopnb++;
488 488
             $newout = '';
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
             } elseif ($reg[1] == 'ENTITY_ID' || $reg[1] == 'ENTITYID') {
528 528
                 $newout = $conf->entity;
529 529
             } else
530
-                $newout = '';     // Key not found, we replace with empty string
530
+                $newout = ''; // Key not found, we replace with empty string
531 531
 
532 532
 
533 533
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 
546 546
                 
547 547
 //var_dump('__'.$reg[1].'__ -> '.$newout);
548
-            $out = preg_replace('/__' . preg_quote($reg[1], '/') . '__/', $newout, $out);
548
+            $out = preg_replace('/__'.preg_quote($reg[1], '/').'__/', $newout, $out);
549 549
         }
550 550
     }
551 551
 
@@ -663,15 +663,15 @@  discard block
 block discarded – undo
663 663
                 else if (isset($_SERVER["SERVER_NAME"]))
664 664
                     return $_SERVER["SERVER_NAME"];
665 665
             }
666
-            return dol_hash(DOL_DOCUMENT_ROOT . DOL_URL_ROOT);
666
+            return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
667 667
         }
668 668
 
669 669
         if (isset($_SERVER["SERVER_NAME"]) && isset($_SERVER["DOCUMENT_ROOT"])) {
670
-            return dol_hash($_SERVER["SERVER_NAME"] . $_SERVER["DOCUMENT_ROOT"] . DOL_DOCUMENT_ROOT . DOL_URL_ROOT);
670
+            return dol_hash($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
671 671
             // Use this for a "readable" cookie name
672 672
             //return dol_sanitizeFileName($_SERVER["SERVER_NAME"].$_SERVER["DOCUMENT_ROOT"].DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
673 673
         }
674
-        return dol_hash(DOL_DOCUMENT_ROOT . DOL_URL_ROOT);
674
+        return dol_hash(DOL_DOCUMENT_ROOT.DOL_URL_ROOT);
675 675
     }
676 676
 }
677 677
 
@@ -687,12 +687,12 @@  discard block
 block discarded – undo
687 687
  */
688 688
 function dol_include_once($relpath, $classname = '')
689 689
 {
690
-    global $conf, $langs, $user, $mysoc;   // Do not remove this. They must be defined for files we include. Other globals var must be retreived with $GLOBALS['var']
690
+    global $conf, $langs, $user, $mysoc; // Do not remove this. They must be defined for files we include. Other globals var must be retreived with $GLOBALS['var']
691 691
 
692 692
     $fullpath = dol_buildpath($relpath);
693 693
 
694 694
     if (!file_exists($fullpath)) {
695
-        dol_syslog('functions::dol_include_once Tried to load unexisting file: ' . $relpath, LOG_ERR);
695
+        dol_syslog('functions::dol_include_once Tried to load unexisting file: '.$relpath, LOG_ERR);
696 696
         return false;
697 697
     }
698 698
 
@@ -721,14 +721,14 @@  discard block
 block discarded – undo
721 721
 
722 722
     if ($type == 0 /* empty($type) */) { // For a filesystem path
723 723
         //$res = DOL_BASE_PATH . '' . $path;  // Standard default path
724
-        $res = DOL_BASE_PATH . '/' . $path;  // Standard default path
724
+        $res = DOL_BASE_PATH.'/'.$path; // Standard default path
725 725
         if (isset($conf->file->dol_document_root)) {
726 726
             foreach ($conf->file->dol_document_root as $key => $dirroot) { // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
727 727
                 if ($key == 'main') {
728 728
                     continue;
729 729
                 }
730
-                if (file_exists($dirroot . '/' . $path)) {
731
-                    $res = $dirroot . '/' . $path;
730
+                if (file_exists($dirroot.'/'.$path)) {
731
+                    $res = $dirroot.'/'.$path;
732 732
                     return $res;
733 733
                 }
734 734
             }
@@ -745,11 +745,11 @@  discard block
 block discarded – undo
745 745
         // using proxy, rewriting, virtual path, etc...
746 746
         $res = '';
747 747
         if ($type == 1)
748
-            $res = /* DOL_URL_ROOT */ DOL_BASE_URI . '/' . $path;   // Standard value
748
+            $res = /* DOL_URL_ROOT */ DOL_BASE_URI.'/'.$path; // Standard value
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
         if ($type == 3)
752
-            $res = DOL_URL_ROOT . '/' . $path;
752
+            $res = DOL_URL_ROOT.'/'.$path;
753 753
 
754 754
         foreach ($conf->file->dol_document_root as $key => $dirroot) { // ex: array(["main"]=>"/home/main/htdocs", ["alt0"]=>"/home/dirmod/htdocs", ...)
755 755
             if ($key == 'main') {
@@ -757,33 +757,33 @@  discard block
 block discarded – undo
757 757
                     global $dolibarr_main_url_root;
758 758
 
759 759
                     // Define $urlwithroot
760
-                    $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root));
761
-                    $urlwithroot = $urlwithouturlroot . DOL_URL_ROOT;  // This is to use external domain name found into config file
760
+                    $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
761
+                    $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
762 762
                     //$urlwithroot=DOL_MAIN_URL_ROOT;					// This is to use same domain name than current
763 763
 
764
-                    $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : $urlwithroot) . '/' . $path;     // Test on start with http is for old conf syntax
764
+                    $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : $urlwithroot).'/'.$path; // Test on start with http is for old conf syntax
765 765
                 }
766 766
                 continue;
767 767
             }
768
-            preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i', $path, $regs);    // Take part before '?'
768
+            preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i', $path, $regs); // Take part before '?'
769 769
             if (!empty($regs[1])) {
770 770
                 //print $key.'-'.$dirroot.'/'.$path.'-'.$conf->file->dol_url_root[$type].'<br>'."\n";
771
-                if (file_exists($dirroot . '/' . $regs[1])) {
771
+                if (file_exists($dirroot.'/'.$regs[1])) {
772 772
                     if ($type == 1) {
773
-                        $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_URL_ROOT) . $conf->file->dol_url_root[$key] . '/' . $path;
773
+                        $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path;
774 774
                     }
775 775
                     if ($type == 2) {
776
-                        $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_MAIN_URL_ROOT) . $conf->file->dol_url_root[$key] . '/' . $path;
776
+                        $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : DOL_MAIN_URL_ROOT).$conf->file->dol_url_root[$key].'/'.$path;
777 777
                     }
778 778
                     if ($type == 3) {
779 779
                         global $dolibarr_main_url_root;
780 780
 
781 781
                         // Define $urlwithroot
782
-                        $urlwithouturlroot = preg_replace('/' . preg_quote(DOL_URL_ROOT, '/') . '$/i', '', trim($dolibarr_main_url_root));
783
-                        $urlwithroot = $urlwithouturlroot . DOL_URL_ROOT;  // This is to use external domain name found into config file
782
+                        $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
783
+                        $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
784 784
                         //$urlwithroot=DOL_MAIN_URL_ROOT;					// This is to use same domain name than current
785 785
 
786
-                        $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : $urlwithroot) . $conf->file->dol_url_root[$key] . '/' . $path;     // Test on start with http is for old conf syntax
786
+                        $res = (preg_match('/^http/i', $conf->file->dol_url_root[$key]) ? '' : $urlwithroot).$conf->file->dol_url_root[$key].'/'.$path; // Test on start with http is for old conf syntax
787 787
                     }
788 788
                     break;
789 789
                 }
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
     if (empty($native)) {
812 812
         $myclone = unserialize(serialize($object));
813 813
     } else {
814
-        $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)
814
+        $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)
815 815
     }
816 816
 
817 817
     return $myclone;
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
  */
933 933
 function dol_string_nospecial($str, $newstr = '_', $badcharstoreplace = '')
934 934
 {
935
-    $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°');  // more complete than dol_sanitizeFileName
935
+    $forbidden_chars_to_replace = array(" ", "'", "/", "\\", ":", "*", "?", "\"", "<", ">", "|", "[", "]", ",", ";", "=", '°'); // more complete than dol_sanitizeFileName
936 936
     $forbidden_chars_to_remove = array();
937 937
     if (is_array($badcharstoreplace))
938 938
         $forbidden_chars_to_replace = $badcharstoreplace;
@@ -995,12 +995,12 @@  discard block
 block discarded – undo
995 995
 function dol_escape_htmltag($stringtoescape, $keepb = 0, $keepn = 0)
996 996
 {
997 997
     // escape quotes and backslashes, newlines, etc.
998
-    $tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8');  // TODO Use htmlspecialchars_decode instead, that make only required change for html tags
998
+    $tmp = html_entity_decode($stringtoescape, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars_decode instead, that make only required change for html tags
999 999
     if (!$keepb)
1000 1000
         $tmp = strtr($tmp, array("<b>" => '', '</b>' => ''));
1001 1001
     if (!$keepn)
1002 1002
         $tmp = strtr($tmp, array("\r" => '\\r', "\n" => '\\n'));
1003
-    return htmlentities($tmp, ENT_COMPAT, 'UTF-8');      // TODO Use htmlspecialchars instead, that make only required change for html tags
1003
+    return htmlentities($tmp, ENT_COMPAT, 'UTF-8'); // TODO Use htmlspecialchars instead, that make only required change for html tags
1004 1004
 }
1005 1005
 
1006 1006
 /**
@@ -1071,14 +1071,14 @@  discard block
 block discarded – undo
1071 1071
         $message = preg_replace('/password=\'[^\']*\'/', 'password=\'hidden\'', $message); // protection to avoid to have value of password in log
1072 1072
         // If adding log inside HTML page is required
1073 1073
         if (!empty($_REQUEST['logtohtml']) && (!empty($conf->global->MAIN_ENABLE_LOG_TO_HTML) || !empty($conf->global->MAIN_LOGTOHTML))) {   // MAIN_LOGTOHTML kept for backward compatibility
1074
-            $conf->logbuffer[] = dol_print_date(time(), "%Y-%m-%d %H:%M:%S") . " " . $message;
1074
+            $conf->logbuffer[] = dol_print_date(time(), "%Y-%m-%d %H:%M:%S")." ".$message;
1075 1075
         }
1076 1076
 
1077 1077
         //TODO: Remove this. MAIN_ENABLE_LOG_INLINE_HTML should be deprecated and use a log handler dedicated to HTML output
1078 1078
         // If html log tag enabled and url parameter log defined, we show output log on HTML comments
1079 1079
         if (!empty($conf->global->MAIN_ENABLE_LOG_INLINE_HTML) && !empty($_GET["log"])) {
1080 1080
             print "\n\n<!-- Log start\n";
1081
-            print $message . "\n";
1081
+            print $message."\n";
1082 1082
             print "Log end -->\n";
1083 1083
         }
1084 1084
 
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
 
1093 1093
         // This is when server run behind a reverse proxy
1094 1094
         if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
1095
-            $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'] . (empty($_SERVER["REMOTE_ADDR"]) ? '' : '->' . $_SERVER['REMOTE_ADDR']);
1095
+            $data['ip'] = $_SERVER['HTTP_X_FORWARDED_FOR'].(empty($_SERVER["REMOTE_ADDR"]) ? '' : '->'.$_SERVER['REMOTE_ADDR']);
1096 1096
         // This is when server run normally on a server
1097 1097
         else if (!empty($_SERVER["REMOTE_ADDR"]))
1098 1098
             $data['ip'] = $_SERVER['REMOTE_ADDR'];
@@ -1101,10 +1101,10 @@  discard block
 block discarded – undo
1101 1101
             $data['ip'] = $_SERVER['SERVER_ADDR'];
1102 1102
         // 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).
1103 1103
         else if (!empty($_SERVER['COMPUTERNAME']))
1104
-            $data['ip'] = $_SERVER['COMPUTERNAME'] . (empty($_SERVER['USERNAME']) ? '' : '@' . $_SERVER['USERNAME']);
1104
+            $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME']) ? '' : '@'.$_SERVER['USERNAME']);
1105 1105
         // 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).
1106 1106
         else if (!empty($_SERVER['LOGNAME']))
1107
-            $data['ip'] = '???@' . $_SERVER['LOGNAME'];
1107
+            $data['ip'] = '???@'.$_SERVER['LOGNAME'];
1108 1108
         // Loop on each log handler and send output
1109 1109
         foreach ($conf->loghandlers as $loghandlerinstance) {
1110 1110
             if ($restricttologhandler && $loghandlerinstance->code != $restricttologhandler)
@@ -1156,10 +1156,10 @@  discard block
 block discarded – undo
1156 1156
 {
1157 1157
     global $conf, $langs, $hookmanager;
1158 1158
 
1159
-    $out = "\n" . '<div class="tabs" data-role="controlgroup" data-type="horizontal">' . "\n";
1159
+    $out = "\n".'<div class="tabs" data-role="controlgroup" data-type="horizontal">'."\n";
1160 1160
 
1161 1161
     if ($morehtmlright) {
1162
-        $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.
1162
+        $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 1163
     }
1164 1164
 
1165 1165
     // Show title
@@ -1170,8 +1170,8 @@  discard block
 block discarded – undo
1170 1170
         $limittitle = 30;
1171 1171
         $out .= '<a class="tabTitle">';
1172 1172
         if ($picto)
1173
-            $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_') . $picto, '', $pictoisfullpath) . ' ';
1174
-        $out .= '<span class="tabTitleText">' . dol_trunc($title, $limittitle) . '</span>';
1173
+            $out .= img_picto($title, ($pictoisfullpath ? '' : 'object_').$picto, '', $pictoisfullpath).' ';
1174
+        $out .= '<span class="tabTitleText">'.dol_trunc($title, $limittitle).'</span>';
1175 1175
         $out .= '</a>';
1176 1176
     }
1177 1177
 
@@ -1211,23 +1211,23 @@  discard block
 block discarded – undo
1211 1211
         }
1212 1212
 
1213 1213
         if ($i < $limittoshow || $isactive) {
1214
-            $out .= '<div class="inline-block tabsElem' . ($isactive ? ' tabsElemActive' : '') . ((!$isactive && !empty($conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT)) ? ' hideonprint' : '') . '"><!-- id tab = ' . (empty($links[$i][2]) ? '' : $links[$i][2]) . ' -->';
1214
+            $out .= '<div class="inline-block tabsElem'.($isactive ? ' tabsElemActive' : '').((!$isactive && !empty($conf->global->MAIN_HIDE_INACTIVETAB_ON_PRINT)) ? ' hideonprint' : '').'"><!-- id tab = '.(empty($links[$i][2]) ? '' : $links[$i][2]).' -->';
1215 1215
             if (isset($links[$i][2]) && $links[$i][2] == 'image') {
1216 1216
                 if (!empty($links[$i][0])) {
1217
-                    $out .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n";
1217
+                    $out .= '<a class="tabimage'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
1218 1218
                 } else {
1219
-                    $out .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n";
1219
+                    $out .= '<span class="tabspan">'.$links[$i][1].'</span>'."\n";
1220 1220
                 }
1221 1221
             } else if (!empty($links[$i][1])) {
1222 1222
                 //print "x $i $active ".$links[$i][2]." z";
1223 1223
                 if ($isactive) {
1224
-                    $out .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="tabactive tab inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">';
1224
+                    $out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tabactive tab inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">';
1225 1225
                     $out .= $links[$i][1];
1226
-                    $out .= '</a>' . "\n";
1226
+                    $out .= '</a>'."\n";
1227 1227
                 } else {
1228
-                    $out .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="tabunactive tab inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">';
1228
+                    $out .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="tabunactive tab inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">';
1229 1229
                     $out .= $links[$i][1];
1230
-                    $out .= '</a>' . "\n";
1230
+                    $out .= '</a>'."\n";
1231 1231
                 }
1232 1232
             }
1233 1233
             $out .= '</div>';
@@ -1240,14 +1240,14 @@  discard block
 block discarded – undo
1240 1240
             $outmore .= '<div class="popuptab wordwrap" style="display:inherit;">';
1241 1241
             if (isset($links[$i][2]) && $links[$i][2] == 'image') {
1242 1242
                 if (!empty($links[$i][0]))
1243
-                    $outmore .= '<a class="tabimage' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">' . $links[$i][1] . '</a>' . "\n";
1243
+                    $outmore .= '<a class="tabimage'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">'.$links[$i][1].'</a>'."\n";
1244 1244
                 else
1245
-                    $outmore .= '<span class="tabspan">' . $links[$i][1] . '</span>' . "\n";
1245
+                    $outmore .= '<span class="tabspan">'.$links[$i][1].'</span>'."\n";
1246 1246
             }
1247 1247
             else if (!empty($links[$i][1])) {
1248
-                $outmore .= '<a' . (!empty($links[$i][2]) ? ' id="' . $links[$i][2] . '"' : '') . ' class="wordwrap inline-block' . ($morecss ? ' ' . $morecss : '') . '" href="' . $links[$i][0] . '">';
1248
+                $outmore .= '<a'.(!empty($links[$i][2]) ? ' id="'.$links[$i][2].'"' : '').' class="wordwrap inline-block'.($morecss ? ' '.$morecss : '').'" href="'.$links[$i][0].'">';
1249 1249
                 $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.
1250
-                $outmore .= '</a>' . "\n";
1250
+                $outmore .= '</a>'."\n";
1251 1251
             }
1252 1252
             $outmore .= '</div>';
1253 1253
 
@@ -1263,24 +1263,24 @@  discard block
 block discarded – undo
1263 1263
         $right = ($langs->trans("DIRECTION") == 'rtl' ? 'left' : 'right');
1264 1264
 
1265 1265
         $tabsname = str_replace("@", "", $picto);
1266
-        $out .= '<div id="moretabs' . $tabsname . '" class="inline-block tabsElem">';
1267
-        $out .= '<a href="#" class="tab moretab inline-block tabunactive reposition">' . $langs->trans("More") . '... (' . $nbintab . ')</a>';
1268
-        $out .= '<div id="moretabsList' . $tabsname . '" style="position: absolute; ' . $left . ': -999em; text-align: ' . $left . '; margin:0px; padding:2px">';
1266
+        $out .= '<div id="moretabs'.$tabsname.'" class="inline-block tabsElem">';
1267
+        $out .= '<a href="#" class="tab moretab inline-block tabunactive reposition">'.$langs->trans("More").'... ('.$nbintab.')</a>';
1268
+        $out .= '<div id="moretabsList'.$tabsname.'" style="position: absolute; '.$left.': -999em; text-align: '.$left.'; margin:0px; padding:2px">';
1269 1269
         $out .= $outmore;
1270 1270
         $out .= '</div>';
1271 1271
         $out .= '<div></div>';
1272 1272
         $out .= "</div>\n";
1273 1273
 
1274 1274
         $out .= "<script>";
1275
-        $out .= "$('#moretabs" . $tabsname . "').mouseenter( function() { console.log('mouseenter " . $left . "'); $('#moretabsList" . $tabsname . "').css('" . $left . "','auto');});";
1276
-        $out .= "$('#moretabs" . $tabsname . "').mouseleave( function() { console.log('mouseleave " . $left . "'); $('#moretabsList" . $tabsname . "').css('" . $left . "','-999em');});";
1275
+        $out .= "$('#moretabs".$tabsname."').mouseenter( function() { console.log('mouseenter ".$left."'); $('#moretabsList".$tabsname."').css('".$left."','auto');});";
1276
+        $out .= "$('#moretabs".$tabsname."').mouseleave( function() { console.log('mouseleave ".$left."'); $('#moretabsList".$tabsname."').css('".$left."','-999em');});";
1277 1277
         $out .= "</script>";
1278 1278
     }
1279 1279
 
1280 1280
     $out .= "</div>\n";
1281 1281
 
1282 1282
     if (!$notab || $notab == -1)
1283
-        $out .= "\n" . '<div class="tabBar' . ($notab == -1 ? '' : ' tabBarWithBottom') . '">' . "\n";
1283
+        $out .= "\n".'<div class="tabBar'.($notab == -1 ? '' : ' tabBarWithBottom').'">'."\n";
1284 1284
 
1285 1285
     $parameters = array('tabname' => $active, 'out' => $out);
1286 1286
     $reshook = $hookmanager->executeHooks('printTabsHead', $parameters); // This hook usage is called just before output the head of tabs. Take also a look at "completeTabsHead"
@@ -1389,7 +1389,7 @@  discard block
 block discarded – undo
1389 1389
         if ($conf->browser->layout == 'phone')
1390 1390
             $maxvisiblephotos = 1;
1391 1391
         if ($showimage)
1392
-            $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>';
1392
+            $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>';
1393 1393
         else {
1394 1394
             if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
1395 1395
                 $nophoto = '';
@@ -1398,18 +1398,18 @@  discard block
 block discarded – undo
1398 1398
             //elseif ($conf->browser->layout != 'phone') {    // Show no photo link
1399 1399
             $nophoto = '/public/theme/common/nophoto.png';
1400 1400
             // $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '"></div>';
1401
-            $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>';
1401
+            $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>';
1402 1402
             //}
1403 1403
         }
1404 1404
     } elseif ($object->element == 'ticket') {
1405 1405
         $width = 80;
1406 1406
         $cssclass = 'photoref';
1407
-        $showimage = $object->is_photo_available($conf->ticket->multidir_output[$entity] . '/' . $object->track_id);
1407
+        $showimage = $object->is_photo_available($conf->ticket->multidir_output[$entity].'/'.$object->track_id);
1408 1408
         $maxvisiblephotos = (isset($conf->global->TICKETSUP_MAX_VISIBLE_PHOTO) ? $conf->global->TICKETSUP_MAX_VISIBLE_PHOTO : 2);
1409 1409
         if ($conf->browser->layout == 'phone')
1410 1410
             $maxvisiblephotos = 1;
1411 1411
         if ($showimage)
1412
-            $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $object->show_photos('ticket', $conf->ticket->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0) . '</div>';
1412
+            $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('ticket', $conf->ticket->multidir_output[$entity], 'small', $maxvisiblephotos, 0, 0, 0, $width, 0).'</div>';
1413 1413
         else {
1414 1414
             if (!empty($conf->global->TICKETSUP_NODISPLAYIFNOPHOTO)) {
1415 1415
                 $nophoto = '';
@@ -1418,7 +1418,7 @@  discard block
 block discarded – undo
1418 1418
             //elseif ($conf->browser->layout != 'phone') {    // Show no photo link
1419 1419
             $nophoto = '/public/theme/common/nophoto.png';
1420 1420
             //$morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo' . $modulepart . ($cssclass ? ' ' . $cssclass : '') . '" alt="No photo" border="0"' . ($width ? ' width="' . $width . '"' : '') . ' src="' . DOL_URL_ROOT . $nophoto . '"></div>';
1421
-            $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>';
1421
+            $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>';
1422 1422
             //}
1423 1423
         }
1424 1424
     } else {
@@ -1428,25 +1428,25 @@  discard block
 block discarded – undo
1428 1428
                 // Check if a preview file is available
1429 1429
                 if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice', 'expensereport')) && class_exists("Imagick")) {
1430 1430
                     $objectref = dol_sanitizeFileName($object->ref);
1431
-                    $dir_output = (empty($conf->$modulepart->multidir_output[$entity]) ? $conf->$modulepart->dir_output : $conf->$modulepart->multidir_output[$entity]) . "/";
1431
+                    $dir_output = (empty($conf->$modulepart->multidir_output[$entity]) ? $conf->$modulepart->dir_output : $conf->$modulepart->multidir_output[$entity])."/";
1432 1432
                     if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice'))) {
1433 1433
                         $subdir = get_exdir($object->id, 2, 0, 1, $object, $modulepart);
1434
-                        $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
1434
+                        $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
1435 1435
                     } else {
1436 1436
                         $subdir = get_exdir($object->id, 0, 0, 1, $object, $modulepart);
1437 1437
                     }
1438 1438
                     if (empty($subdir))
1439 1439
                         $subdir = 'errorgettingsubdirofobject'; // Protection to avoid to return empty path
1440 1440
 
1441
-                    $filepath = $dir_output . $subdir . "/";
1441
+                    $filepath = $dir_output.$subdir."/";
1442 1442
 
1443
-                    $file = $filepath . $objectref . ".pdf";
1444
-                    $relativepath = $subdir . '/' . $objectref . '.pdf';
1443
+                    $file = $filepath.$objectref.".pdf";
1444
+                    $relativepath = $subdir.'/'.$objectref.'.pdf';
1445 1445
 
1446 1446
                     // Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
1447
-                    $fileimage = $file . '_preview.png';              // If PDF has 1 page
1448
-                    $fileimagebis = $file . '_preview-0.png';         // If PDF has more than one page
1449
-                    $relativepathimage = $relativepath . '_preview.png';
1447
+                    $fileimage = $file.'_preview.png'; // If PDF has 1 page
1448
+                    $fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page
1449
+                    $relativepathimage = $relativepath.'_preview.png';
1450 1450
 
1451 1451
                     // Si fichier PDF existe
1452 1452
                     if (file_exists($file)) {
@@ -1455,7 +1455,7 @@  discard block
 block discarded – undo
1455 1455
                         if ((!file_exists($fileimage) || (filemtime($fileimage) < filemtime($file))) && (!file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file)))
1456 1456
                         ) {
1457 1457
                             if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) {  // If you experienc trouble with pdf thumb generation and imagick, you can disable here.
1458
-                                include_once DOL_BASE_PATH . '/core/lib/files.lib.php';
1458
+                                include_once DOL_BASE_PATH.'/core/lib/files.lib.php';
1459 1459
                                 $ret = dol_convert_file($file, 'png', $fileimage);
1460 1460
                                 if ($ret < 0)
1461 1461
                                     $error++;
@@ -1468,14 +1468,14 @@  discard block
 block discarded – undo
1468 1468
                         // Si fichier png PDF d'1 page trouve
1469 1469
                         if (file_exists($fileimage)) {
1470 1470
                             $phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
1471
-                            $phototoshow .= '<img height="' . $heightforphotref . '" class="photo photowithmargin photowithborder" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=apercu' . $modulepart . '&amp;file=' . urlencode($relativepathimage) . '">';
1471
+                            $phototoshow .= '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($relativepathimage).'">';
1472 1472
                             $phototoshow .= '</div></div>';
1473 1473
                         }
1474 1474
                         // Si fichier png PDF de plus d'1 page trouve
1475 1475
                         elseif (file_exists($fileimagebis)) {
1476
-                            $preview = preg_replace('/\.png/', '', $relativepathimage) . "-0.png";
1476
+                            $preview = preg_replace('/\.png/', '', $relativepathimage)."-0.png";
1477 1477
                             $phototoshow = '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref">';
1478
-                            $phototoshow .= '<img height="' . $heightforphotref . '" class="photo photowithmargin photowithborder" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=apercu' . $modulepart . '&amp;file=' . urlencode($preview) . '"><p>';
1478
+                            $phototoshow .= '<img height="'.$heightforphotref.'" class="photo photowithmargin photowithborder" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=apercu'.$modulepart.'&amp;file='.urlencode($preview).'"><p>';
1479 1479
                             $phototoshow .= '</div></div>';
1480 1480
                         }
1481 1481
                     }
@@ -1502,10 +1502,10 @@  discard block
 block discarded – undo
1502 1502
                     $picto = $object->picto;
1503 1503
                     if ($object->element == 'project' && !$object->public)
1504 1504
                         $picto = 'project'; // instead of projectpub
1505
-                    $nophoto = img_picto('', 'object_' . $picto, '', false, 1);
1505
+                    $nophoto = img_picto('', 'object_'.$picto, '', false, 1);
1506 1506
                 }
1507 1507
                 $morehtmlleft .= '<!-- No photo to show -->';
1508
-                $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>';
1508
+                $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>';
1509 1509
 
1510 1510
                 $morehtmlleft .= '</div>';
1511 1511
             }
@@ -1513,7 +1513,7 @@  discard block
 block discarded – undo
1513 1513
     }
1514 1514
 
1515 1515
     if ($showbarcode)
1516
-        $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">' . $form->showbarcode($object) . '</div>';
1516
+        $morehtmlleft .= '<div class="floatleft inline-block valignmiddle divphotoref">'.$form->showbarcode($object).'</div>';
1517 1517
 
1518 1518
     if ($object->element == 'societe') {
1519 1519
         if (!empty($conf->use_javascript_ajax) && $user->rights->societe->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
@@ -1526,14 +1526,14 @@  discard block
 block discarded – undo
1526 1526
         if (!empty($conf->use_javascript_ajax) && $user->rights->produit->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
1527 1527
             $morehtmlstatus .= ajax_object_onoff($object, 'status', 'tosell', 'ProductStatusOnSell', 'ProductStatusNotOnSell');
1528 1528
         } else {
1529
-            $morehtmlstatus .= '<span class="statusrefsell">' . $object->getLibStatut(5, 0) . '</span>';
1529
+            $morehtmlstatus .= '<span class="statusrefsell">'.$object->getLibStatut(5, 0).'</span>';
1530 1530
         }
1531 1531
         $morehtmlstatus .= ' &nbsp; ';
1532 1532
         //$morehtmlstatus.=$langs->trans("Status").' ('.$langs->trans("Buy").') ';
1533 1533
         if (!empty($conf->use_javascript_ajax) && $user->rights->produit->creer && !empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) {
1534 1534
             $morehtmlstatus .= ajax_object_onoff($object, 'status_buy', 'tobuy', 'ProductStatusOnBuy', 'ProductStatusNotOnBuy');
1535 1535
         } else {
1536
-            $morehtmlstatus .= '<span class="statusrefbuy">' . $object->getLibStatut(5, 1) . '</span>';
1536
+            $morehtmlstatus .= '<span class="statusrefbuy">'.$object->getLibStatut(5, 1).'</span>';
1537 1537
         }
1538 1538
     } elseif (in_array($object->element, array('facture', 'invoice', 'invoice_supplier', 'chargesociales', 'loan'))) {
1539 1539
         $tmptxt = $object->getLibStatut(6, $object->totalpaye);
@@ -1560,7 +1560,7 @@  discard block
 block discarded – undo
1560 1560
         if ($object->progress >= 100)
1561 1561
             $object->fk_statut = 3;
1562 1562
         $tmptxt = $object->getLibStatut(5);
1563
-        $morehtmlstatus .= $tmptxt;  // No status on task
1563
+        $morehtmlstatus .= $tmptxt; // No status on task
1564 1564
     }
1565 1565
     else { // Generic case
1566 1566
         $tmptxt = $object->getLibStatut(6);
@@ -1574,18 +1574,18 @@  discard block
 block discarded – undo
1574 1574
         if (method_exists($object, 'getVentilExportCompta')) {
1575 1575
             $accounted = $object->getVentilExportCompta();
1576 1576
             $langs->load("accountancy");
1577
-            $morehtmlstatus .= '</div><div class="statusref statusrefbis">' . ($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted"));
1577
+            $morehtmlstatus .= '</div><div class="statusref statusrefbis">'.($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted"));
1578 1578
         }
1579 1579
     }
1580 1580
 
1581 1581
     // Add alias for thirdparty
1582 1582
     if (!empty($object->name_alias))
1583
-        $morehtmlref .= '<div class="refidno">' . $object->name_alias . '</div>';
1583
+        $morehtmlref .= '<div class="refidno">'.$object->name_alias.'</div>';
1584 1584
 
1585 1585
     // Add label
1586 1586
     if ($object->element == 'product' || $object->element == 'bank_account' || $object->element == 'project_task') {
1587 1587
         if (!empty($object->label))
1588
-            $morehtmlref .= '<div class="refidno">' . $object->label . '</div>';
1588
+            $morehtmlref .= '<div class="refidno">'.$object->label.'</div>';
1589 1589
     }
1590 1590
 
1591 1591
     if (method_exists($object, 'getBannerAddress') && $object->element != 'product' && $object->element != 'bookmark' && $object->element != 'ecm_directories' && $object->element != 'ecm_files') {
@@ -1595,11 +1595,11 @@  discard block
 block discarded – undo
1595 1595
     }
1596 1596
     if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && in_array($object->element, array('societe', 'contact', 'member', 'product'))) {
1597 1597
         $morehtmlref .= '<div style="clear: both;"></div><div class="refidno">';
1598
-        $morehtmlref .= $langs->trans("TechnicalID") . ': ' . $object->id;
1598
+        $morehtmlref .= $langs->trans("TechnicalID").': '.$object->id;
1599 1599
         $morehtmlref .= '</div>';
1600 1600
     }
1601 1601
 
1602
-    print '<div class="' . ($onlybanner ? 'arearefnobottom ' : 'arearef ') . 'heightref valignmiddle" width="100%">';
1602
+    print '<div class="'.($onlybanner ? 'arearefnobottom ' : 'arearef ').'heightref valignmiddle" width="100%">';
1603 1603
     print $form->showrefnav($object, $paramid, $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlstatus, $morehtmlright);
1604 1604
     print '</div>';
1605 1605
     print '<div class="underrefbanner clearboth"></div>';
@@ -1621,7 +1621,7 @@  discard block
 block discarded – undo
1621 1621
     if ($fieldrequired)
1622 1622
         $ret .= '<span class="fieldrequired">';
1623 1623
     if (($conf->dol_use_jmobile != 4))
1624
-        $ret .= '<label for="' . $fieldkey . '">';
1624
+        $ret .= '<label for="'.$fieldkey.'">';
1625 1625
     $ret .= $langs->trans($langkey);
1626 1626
     if (($conf->dol_use_jmobile != 4))
1627 1627
         $ret .= '</label>';
@@ -1640,9 +1640,9 @@  discard block
 block discarded – undo
1640 1640
 function dol_bc($var, $moreclass = '')
1641 1641
 {
1642 1642
     global $bc;
1643
-    $ret = ' ' . $bc[$var];
1643
+    $ret = ' '.$bc[$var];
1644 1644
     if ($moreclass)
1645
-        $ret = preg_replace('/class=\"/', 'class="' . $moreclass . ' ', $ret);
1645
+        $ret = preg_replace('/class=\"/', 'class="'.$moreclass.' ', $ret);
1646 1646
     return $ret;
1647 1647
 }
1648 1648
 
@@ -1662,50 +1662,50 @@  discard block
 block discarded – undo
1662 1662
     global $conf, $langs;
1663 1663
 
1664 1664
     $ret = '';
1665
-    $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR');    // See also MAIN_FORCE_STATE_INTO_ADDRESS
1665
+    $countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
1666 1666
     // Address
1667 1667
     if (empty($mode)) {
1668 1668
         $ret .= $object->address;
1669 1669
     }
1670 1670
     // Zip/Town/State
1671 1671
     if (in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) {    // US: title firstname name \n address lines \n town, state, zip \n country
1672
-        $ret .= ($ret ? $sep : '' ) . $object->town;
1672
+        $ret .= ($ret ? $sep : '').$object->town;
1673 1673
         if ($object->state) {
1674
-            $ret .= ($ret ? ", " : '') . $object->state;
1674
+            $ret .= ($ret ? ", " : '').$object->state;
1675 1675
         }
1676 1676
         if ($object->zip)
1677
-            $ret .= ($ret ? ", " : '') . $object->zip;
1677
+            $ret .= ($ret ? ", " : '').$object->zip;
1678 1678
     }
1679 1679
     else if (in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country
1680
-        $ret .= ($ret ? $sep : '' ) . $object->town;
1680
+        $ret .= ($ret ? $sep : '').$object->town;
1681 1681
         if ($object->state) {
1682
-            $ret .= ($ret ? ", " : '') . $object->state;
1682
+            $ret .= ($ret ? ", " : '').$object->state;
1683 1683
         }
1684 1684
         if ($object->zip)
1685
-            $ret .= ($ret ? $sep : '' ) . $object->zip;
1685
+            $ret .= ($ret ? $sep : '').$object->zip;
1686 1686
     }
1687 1687
     else if (in_array($object->country_code, array('ES', 'TR'))) { // ES: title firstname name \n address lines \n zip town \n state \n country
1688
-        $ret .= ($ret ? $sep : '' ) . $object->zip;
1689
-        $ret .= ($object->town ? (($object->zip ? ' ' : '') . $object->town) : '');
1688
+        $ret .= ($ret ? $sep : '').$object->zip;
1689
+        $ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : '');
1690 1690
         if ($object->state) {
1691
-            $ret .= "\n" . $object->state;
1691
+            $ret .= "\n".$object->state;
1692 1692
         }
1693 1693
     } else if (in_array($object->country_code, array('IT'))) { // IT: tile firstname name\n address lines \n zip (Code Departement) \n country
1694
-        $ret .= ($ret ? $sep : '' ) . $object->zip;
1695
-        $ret .= ($object->town ? (($object->zip ? ' ' : '') . $object->town) : '');
1696
-        $ret .= ($object->departement_id ? (' (' . ($object->departement_id) . ')') : '');
1694
+        $ret .= ($ret ? $sep : '').$object->zip;
1695
+        $ret .= ($object->town ? (($object->zip ? ' ' : '').$object->town) : '');
1696
+        $ret .= ($object->departement_id ? (' ('.($object->departement_id).')') : '');
1697 1697
     } else {                                          // Other: title firstname name \n address lines \n zip town \n country
1698
-        $ret .= $object->zip ? (($ret ? $sep : '' ) . $object->zip) : '';
1699
-        $ret .= ($object->town ? (($object->zip ? ' ' : ($ret ? $sep : '' )) . $object->town) : '');
1698
+        $ret .= $object->zip ? (($ret ? $sep : '').$object->zip) : '';
1699
+        $ret .= ($object->town ? (($object->zip ? ' ' : ($ret ? $sep : '')).$object->town) : '');
1700 1700
         if ($object->state && in_array($object->country_code, $countriesusingstate)) {
1701
-            $ret .= ($ret ? ", " : '') . $object->state;
1701
+            $ret .= ($ret ? ", " : '').$object->state;
1702 1702
         }
1703 1703
     }
1704 1704
     if (!is_object($outputlangs))
1705 1705
         $outputlangs = $langs;
1706 1706
     if ($withcountry) {
1707 1707
         $langs->load("dict");
1708
-        $ret .= ($object->country_code ? ($ret ? $sep : '') . $outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country" . $object->country_code)) : '');
1708
+        $ret .= ($object->country_code ? ($ret ? $sep : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)) : '');
1709 1709
     }
1710 1710
 
1711 1711
     return $ret;
@@ -1760,13 +1760,13 @@  discard block
 block discarded – undo
1760 1760
         if (is_string($tzoutput)) {
1761 1761
             if ($tzoutput == 'tzserver') {
1762 1762
                 $to_gmt = false;
1763
-                $offsettzstring = @date_default_timezone_get();  // Example 'Europe/Berlin' or 'Indian/Reunion'
1763
+                $offsettzstring = @date_default_timezone_get(); // Example 'Europe/Berlin' or 'Indian/Reunion'
1764 1764
                 $offsettz = 0;
1765 1765
                 $offsetdst = 0;
1766 1766
             } elseif ($tzoutput == 'tzuser' || $tzoutput == 'tzuserrel') {
1767 1767
                 $to_gmt = true;
1768 1768
                 $offsettzstring = (empty($_SESSION['dol_tz_string']) ? 'UTC' : $_SESSION['dol_tz_string']); // Example 'Europe/Berlin' or 'Indian/Reunion'
1769
-                $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60;  // Will not be used anymore
1769
+                $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; // Will not be used anymore
1770 1770
                 $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; // Will not be used anymore
1771 1771
             }
1772 1772
         }
@@ -1812,9 +1812,9 @@  discard block
 block discarded – undo
1812 1812
     else if ($format == 'dayxcard')
1813 1813
         $format = '%Y%m%d';
1814 1814
     else if ($format == 'dayrfc')
1815
-        $format = '%Y-%m-%d';             // DATE_RFC3339
1815
+        $format = '%Y-%m-%d'; // DATE_RFC3339
1816 1816
     else if ($format == 'dayhourrfc')
1817
-        $format = '%Y-%m-%dT%H:%M:%SZ';   // DATETIME RFC3339
1817
+        $format = '%Y-%m-%dT%H:%M:%SZ'; // DATETIME RFC3339
1818 1818
     else if ($format == 'standard')
1819 1819
         $format = '%Y-%m-%d %H:%M:%S';
1820 1820
 
@@ -1825,7 +1825,7 @@  discard block
 block discarded – undo
1825 1825
 
1826 1826
     // If date undefined or "", we return ""
1827 1827
     if (dol_strlen($time) == 0)
1828
-        return '';  // $time=0 allowed (it means 01/01/1970 00:00:00)
1828
+        return ''; // $time=0 allowed (it means 01/01/1970 00:00:00)
1829 1829
 
1830 1830
 
1831 1831
 
@@ -1859,7 +1859,7 @@  discard block
 block discarded – undo
1859 1859
     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
1860 1860
         // TODO Remove this.
1861 1861
         // This part of code should not be used.
1862
-        dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page " . $_SERVER["PHP_SELF"], LOG_ERR);
1862
+        dol_syslog("Functions.lib::dol_print_date function call with deprecated value of time in page ".$_SERVER["PHP_SELF"], LOG_ERR);
1863 1863
         // Date has format 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' or 'YYYYMMDDHHMMSS'
1864 1864
         $syear = (!empty($reg[1]) ? $reg[1] : '');
1865 1865
         $smonth = (!empty($reg[2]) ? $reg[2] : '');
@@ -1877,7 +1877,7 @@  discard block
 block discarded – undo
1877 1877
 
1878 1878
             $ret = adodb_strftime($format, $timetouse, $to_gmt);
1879 1879
         } else
1880
-            $ret = 'Bad value ' . $time . ' for date';
1880
+            $ret = 'Bad value '.$time.' for date';
1881 1881
     }
1882 1882
 
1883 1883
     if (preg_match('/__b__/i', $format)) {
@@ -1886,11 +1886,11 @@  discard block
 block discarded – undo
1886 1886
         $month = adodb_strftime('%m', $timetouse);
1887 1887
         $month = sprintf("%02d", $month); // $month may be return with format '06' on some installation and '6' on other, so we force it to '06'.
1888 1888
         if ($encodetooutput) {
1889
-            $monthtext = $outputlangs->transnoentities('Month' . $month);
1890
-            $monthtextshort = $outputlangs->transnoentities('MonthShort' . $month);
1889
+            $monthtext = $outputlangs->transnoentities('Month'.$month);
1890
+            $monthtextshort = $outputlangs->transnoentities('MonthShort'.$month);
1891 1891
         } else {
1892
-            $monthtext = $outputlangs->transnoentitiesnoconv('Month' . $month);
1893
-            $monthtextshort = $outputlangs->transnoentitiesnoconv('MonthShort' . $month);
1892
+            $monthtext = $outputlangs->transnoentitiesnoconv('Month'.$month);
1893
+            $monthtextshort = $outputlangs->transnoentitiesnoconv('MonthShort'.$month);
1894 1894
         }
1895 1895
         //print 'monthtext='.$monthtext.' monthtextshort='.$monthtextshort;
1896 1896
         $ret = str_replace('__b__', $monthtextshort, $ret);
@@ -1901,8 +1901,8 @@  discard block
 block discarded – undo
1901 1901
     if (preg_match('/__a__/i', $format)) {
1902 1902
         $timetouse = $time + $offsettz + $offsetdst; // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
1903 1903
 
1904
-        $w = adodb_strftime('%w', $timetouse);      // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
1905
-        $dayweek = $outputlangs->transnoentitiesnoconv('Day' . $w);
1904
+        $w = adodb_strftime('%w', $timetouse); // TODO Replace this with function Date PHP. We also should not use anymore offsettz and offsetdst but only offsettzstring.
1905
+        $dayweek = $outputlangs->transnoentitiesnoconv('Day'.$w);
1906 1906
         $ret = str_replace('__A__', $dayweek, $ret);
1907 1907
         $ret = str_replace('__a__', dol_substr($dayweek, 0, 3), $ret);
1908 1908
     }
@@ -1949,9 +1949,9 @@  discard block
 block discarded – undo
1949 1949
 
1950 1950
     $usealternatemethod = false;
1951 1951
     if ($timestamp <= 0)
1952
-        $usealternatemethod = true;    // <= 1970
1952
+        $usealternatemethod = true; // <= 1970
1953 1953
     if ($timestamp >= 2145913200)
1954
-        $usealternatemethod = true;  // >= 2038
1954
+        $usealternatemethod = true; // >= 2038
1955 1955
 
1956 1956
     if ($usealternatemethod) {
1957 1957
         $arrayinfo = adodb_getdate($timestamp, $fast);
@@ -2011,23 +2011,23 @@  discard block
 block discarded – undo
2011 2011
 
2012 2012
     if (method_exists('DateTime', 'getTimestamp')) {
2013 2013
         if (empty($gm) || $gm === 'server') {
2014
-            $default_timezone = @date_default_timezone_get();  // Example 'Europe/Berlin'
2014
+            $default_timezone = @date_default_timezone_get(); // Example 'Europe/Berlin'
2015 2015
             $localtz = new DateTimeZone($default_timezone);
2016 2016
         } else if ($gm === 'user') {
2017 2017
             // We use dol_tz_string first because it is more reliable.
2018
-            $default_timezone = (empty($_SESSION["dol_tz_string"]) ? @date_default_timezone_get() : $_SESSION["dol_tz_string"]);  // Example 'Europe/Berlin'
2018
+            $default_timezone = (empty($_SESSION["dol_tz_string"]) ? @date_default_timezone_get() : $_SESSION["dol_tz_string"]); // Example 'Europe/Berlin'
2019 2019
             try {
2020 2020
                 $localtz = new DateTimeZone($default_timezone);
2021 2021
             } catch (Exception $e) {
2022
-                dol_syslog("Warning dol_tz_string contains an invalid value " . $_SESSION["dol_tz_string"], LOG_WARNING);
2022
+                dol_syslog("Warning dol_tz_string contains an invalid value ".$_SESSION["dol_tz_string"], LOG_WARNING);
2023 2023
                 $default_timezone = @date_default_timezone_get();
2024 2024
             }
2025 2025
         } else if (strrpos($gm, "tz,") !== false) {
2026
-            $timezone = str_replace("tz,", "", $gm);  // Example 'tz,Europe/Berlin'
2026
+            $timezone = str_replace("tz,", "", $gm); // Example 'tz,Europe/Berlin'
2027 2027
             try {
2028 2028
                 $localtz = new DateTimeZone($timezone);
2029 2029
             } catch (Exception $e) {
2030
-                dol_syslog("Warning passed timezone contains an invalid value " . $timezone, LOG_WARNING);
2030
+                dol_syslog("Warning passed timezone contains an invalid value ".$timezone, LOG_WARNING);
2031 2031
             }
2032 2032
         }
2033 2033
 
@@ -2066,8 +2066,8 @@  discard block
 block discarded – undo
2066 2066
     if ($mode == 'gmt')
2067 2067
         $ret = time(); // Time for now at greenwich.
2068 2068
     else if ($mode == 'tzserver') {  // Time for now with PHP server timezone added
2069
-        require_once DOL_BASE_PATH . '/core/lib/date.lib.php';
2070
-        $tzsecond = getServerTimeZoneInt('now');    // Contains tz+dayling saving time
2069
+        require_once DOL_BASE_PATH.'/core/lib/date.lib.php';
2070
+        $tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time
2071 2071
         $ret = (int) (dol_now('gmt') + ($tzsecond * 3600));
2072 2072
     }
2073 2073
     /* else if ($mode == 'tzref')				// Time for now with parent company timezone is added
@@ -2113,9 +2113,9 @@  discard block
 block discarded – undo
2113 2113
     }
2114 2114
     // Use long or short text unit
2115 2115
     if (empty($shortunit)) {
2116
-        $ret .= ' ' . $textunitlong;
2116
+        $ret .= ' '.$textunitlong;
2117 2117
     } else {
2118
-        $ret .= ' ' . $textunitshort;
2118
+        $ret .= ' '.$textunitshort;
2119 2119
     }
2120 2120
 
2121 2121
     return $ret;
@@ -2143,13 +2143,13 @@  discard block
 block discarded – undo
2143 2143
     $link .= $url;
2144 2144
     $link .= '"';
2145 2145
     if ($target)
2146
-        $link .= ' target="' . $target . '"';
2146
+        $link .= ' target="'.$target.'"';
2147 2147
     $link .= '>';
2148 2148
     if (!preg_match('/^http/i', $url))
2149 2149
         $link .= 'http://';
2150 2150
     $link .= dol_trunc($url, $max);
2151 2151
     $link .= '</a>';
2152
-    return '<div class="nospan float" style="margin-right: 10px">' . ($withpicto ? img_picto($langs->trans("Url"), 'object_globe.png') . ' ' : '') . $link . '</div>';
2152
+    return '<div class="nospan float" style="margin-right: 10px">'.($withpicto ? img_picto($langs->trans("Url"), 'object_globe.png').' ' : '').$link.'</div>';
2153 2153
 }
2154 2154
 
2155 2155
 /**
@@ -2190,9 +2190,9 @@  discard block
 block discarded – undo
2190 2190
             $type = 'AC_EMAIL';
2191 2191
             $link = '';
2192 2192
             if (!empty($conf->global->AGENDA_ADDACTIONFOREMAIL))
2193
-                $link = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode=' . $type . '&amp;contactid=' . $cid . '&amp;socid=' . $socid . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>';
2193
+                $link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode='.$type.'&amp;contactid='.$cid.'&amp;socid='.$socid.'">'.img_object($langs->trans("AddAction"), "calendar").'</a>';
2194 2194
             if ($link)
2195
-                $newemail = '<div>' . $newemail . ' ' . $link . '</div>';
2195
+                $newemail = '<div>'.$newemail.' '.$link.'</div>';
2196 2196
         }
2197 2197
     }
2198 2198
     else {
@@ -2202,7 +2202,7 @@  discard block
 block discarded – undo
2202 2202
         }
2203 2203
     }
2204 2204
 
2205
-    $rep = '<div class="nospan float" style="margin-right: 10px">' . ($withpicto ? img_picto($langs->trans("EMail"), 'object_email.png') . ' ' : '') . $newemail . '</div>';
2205
+    $rep = '<div class="nospan float" style="margin-right: 10px">'.($withpicto ? img_picto($langs->trans("EMail"), 'object_email.png').' ' : '').$newemail.'</div>';
2206 2206
     if ($hookmanager) {
2207 2207
         $parameters = array('cid' => $cid, 'socid' => $socid, 'addlink' => $addlink, 'picto' => $withpicto);
2208 2208
         $reshook = $hookmanager->executeHooks('printEmail', $parameters, $email);
@@ -2232,26 +2232,26 @@  discard block
 block discarded – undo
2232 2232
 
2233 2233
     if (!empty($type)) {
2234 2234
         $newskype = '<div class="divsocialnetwork inline-block valignmiddle">';
2235
-        $newskype .= img_picto($langs->trans(strtoupper($type)), $type . '.png', '', false, 0, 0, '', 'paddingright');
2235
+        $newskype .= img_picto($langs->trans(strtoupper($type)), $type.'.png', '', false, 0, 0, '', 'paddingright');
2236 2236
         $newskype .= $value;
2237 2237
         if ($type == 'skype') {
2238 2238
             $newskype .= '&nbsp;';
2239 2239
             $newskype .= '<a href="skype:';
2240 2240
             $newskype .= $value;
2241
-            $newskype .= '?call" alt="' . $langs->trans("Call") . '&nbsp;' . $value . '" title="' . $langs->trans("Call") . '&nbsp;' . $value . '">';
2242
-            $newskype .= '<img src="' . DOL_URL_ROOT . '/theme/common/skype_callbutton.png" border="0">';
2241
+            $newskype .= '?call" alt="'.$langs->trans("Call").'&nbsp;'.$value.'" title="'.$langs->trans("Call").'&nbsp;'.$value.'">';
2242
+            $newskype .= '<img src="'.DOL_URL_ROOT.'/theme/common/skype_callbutton.png" border="0">';
2243 2243
             $newskype .= '</a><a href="skype:';
2244 2244
             $newskype .= $value;
2245
-            $newskype .= '?chat" alt="' . $langs->trans("Chat") . '&nbsp;' . $value . '" title="' . $langs->trans("Chat") . '&nbsp;' . $value . '">';
2246
-            $newskype .= '<img class="paddingleft" src="' . DOL_URL_ROOT . '/theme/common/skype_chatbutton.png" border="0">';
2245
+            $newskype .= '?chat" alt="'.$langs->trans("Chat").'&nbsp;'.$value.'" title="'.$langs->trans("Chat").'&nbsp;'.$value.'">';
2246
+            $newskype .= '<img class="paddingleft" src="'.DOL_URL_ROOT.'/theme/common/skype_chatbutton.png" border="0">';
2247 2247
             $newskype .= '</a>';
2248 2248
         }
2249 2249
         if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create && $type == 'skype') {
2250 2250
             $addlink = 'AC_SKYPE';
2251 2251
             $link = '';
2252 2252
             if (!empty($conf->global->AGENDA_ADDACTIONFORSKYPE))
2253
-                $link = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode=' . $addlink . '&amp;contactid=' . $cid . '&amp;socid=' . $socid . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>';
2254
-            $newskype .= ($link ? ' ' . $link : '');
2253
+                $link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode='.$addlink.'&amp;contactid='.$cid.'&amp;socid='.$socid.'">'.img_object($langs->trans("AddAction"), "calendar").'</a>';
2254
+            $newskype .= ($link ? ' '.$link : '');
2255 2255
         }
2256 2256
         $newskype .= '</div>';
2257 2257
     }
@@ -2296,165 +2296,165 @@  discard block
 block discarded – undo
2296 2296
     if (strtoupper($countrycode) == "FR") {
2297 2297
         // France
2298 2298
         if (dol_strlen($phone) == 10) {
2299
-            $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);
2299
+            $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);
2300 2300
         } elseif (dol_strlen($phone) == 7) {
2301
-            $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 2) . $separ . substr($newphone, 5, 2);
2301
+            $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 2).$separ.substr($newphone, 5, 2);
2302 2302
         } elseif (dol_strlen($phone) == 9) {
2303
-            $newphone = substr($newphone, 0, 2) . $separ . substr($newphone, 2, 3) . $separ . substr($newphone, 5, 2) . $separ . substr($newphone, 7, 2);
2303
+            $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 3).$separ.substr($newphone, 5, 2).$separ.substr($newphone, 7, 2);
2304 2304
         } elseif (dol_strlen($phone) == 11) {
2305
-            $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);
2305
+            $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);
2306 2306
         } elseif (dol_strlen($phone) == 12) {
2307
-            $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);
2307
+            $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);
2308 2308
         }
2309 2309
     } elseif (strtoupper($countrycode) == "CA") {
2310 2310
         if (dol_strlen($phone) == 10) {
2311
-            $newphone = ($separ != '' ? '(' : '') . substr($newphone, 0, 3) . ($separ != '' ? ')' : '') . $separ . substr($newphone, 3, 3) . ($separ != '' ? '-' : '') . substr($newphone, 6, 4);
2311
+            $newphone = ($separ != '' ? '(' : '').substr($newphone, 0, 3).($separ != '' ? ')' : '').$separ.substr($newphone, 3, 3).($separ != '' ? '-' : '').substr($newphone, 6, 4);
2312 2312
         }
2313 2313
     } elseif (strtoupper($countrycode) == "PT") {//Portugal
2314 2314
         if (dol_strlen($phone) == 13) {//ex: +351_ABC_DEF_GHI
2315
-            $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3);
2315
+            $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3);
2316 2316
         }
2317 2317
     } elseif (strtoupper($countrycode) == "SR") {//Suriname
2318 2318
         if (dol_strlen($phone) == 10) {//ex: +597_ABC_DEF
2319
-            $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3);
2319
+            $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3);
2320 2320
         } elseif (dol_strlen($phone) == 11) {//ex: +597_ABC_DEFG
2321
-            $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 4);
2321
+            $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 4);
2322 2322
         }
2323 2323
     } elseif (strtoupper($countrycode) == "DE") {//Allemagne
2324 2324
         if (dol_strlen($phone) == 14) {//ex:  +49_ABCD_EFGH_IJK
2325
-            $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 4) . $separ . substr($newphone, 7, 4) . $separ . substr($newphone, 11, 3);
2325
+            $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 4).$separ.substr($newphone, 11, 3);
2326 2326
         } elseif (dol_strlen($phone) == 13) {//ex: +49_ABC_DEFG_HIJ
2327
-            $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 4) . $separ . substr($newphone, 10, 3);
2327
+            $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 4).$separ.substr($newphone, 10, 3);
2328 2328
         }
2329 2329
     } elseif (strtoupper($countrycode) == "ES") {//Espagne
2330 2330
         if (dol_strlen($phone) == 12) {//ex:  +34_ABC_DEF_GHI
2331
-            $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3);
2331
+            $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3);
2332 2332
         }
2333 2333
     } elseif (strtoupper($countrycode) == "BF") {// Burkina Faso
2334 2334
         if (dol_strlen($phone) == 12) {//ex :  +22 A BC_DE_FG_HI
2335
-            $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);
2335
+            $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);
2336 2336
         }
2337 2337
     } elseif (strtoupper($countrycode) == "RO") {// Roumanie
2338 2338
         if (dol_strlen($phone) == 12) {//ex :  +40 AB_CDE_FG_HI
2339
-            $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);
2339
+            $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);
2340 2340
         }
2341 2341
     } elseif (strtoupper($countrycode) == "TR") {//Turquie
2342 2342
         if (dol_strlen($phone) == 13) {//ex :  +90 ABC_DEF_GHIJ
2343
-            $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 4);
2343
+            $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 4);
2344 2344
         }
2345 2345
     } elseif (strtoupper($countrycode) == "US") {//Etat-Unis
2346 2346
         if (dol_strlen($phone) == 12) {//ex: +1 ABC_DEF_GHIJ
2347
-            $newphone = substr($newphone, 0, 2) . $separ . substr($newphone, 2, 3) . $separ . substr($newphone, 5, 3) . $separ . substr($newphone, 8, 4);
2347
+            $newphone = substr($newphone, 0, 2).$separ.substr($newphone, 2, 3).$separ.substr($newphone, 5, 3).$separ.substr($newphone, 8, 4);
2348 2348
         }
2349 2349
     } elseif (strtoupper($countrycode) == "MX") {//Mexique
2350 2350
         if (dol_strlen($phone) == 12) {//ex: +52 ABCD_EFG_HI
2351
-            $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 4) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 2);
2351
+            $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 2);
2352 2352
         } elseif (dol_strlen($phone) == 11) {//ex: +52 AB_CD_EF_GH
2353
-            $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);
2353
+            $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);
2354 2354
         } elseif (dol_strlen($phone) == 13) {//ex: +52 ABC_DEF_GHIJ
2355
-            $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 4);
2355
+            $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 4);
2356 2356
         }
2357 2357
     } elseif (strtoupper($countrycode) == "ML") {//Mali
2358 2358
         if (dol_strlen($phone) == 12) {//ex: +223 AB_CD_EF_GH
2359
-            $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
+            $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);
2360 2360
         }
2361 2361
     } elseif (strtoupper($countrycode) == "TH") {//Thaïlande
2362 2362
         if (dol_strlen($phone) == 11) {//ex: +66_ABC_DE_FGH
2363
-            $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 3);
2363
+            $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3);
2364 2364
         } elseif (dol_strlen($phone) == 12) {//ex: +66_A_BCD_EF_GHI
2365
-            $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);
2365
+            $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);
2366 2366
         }
2367 2367
     } elseif (strtoupper($countrycode) == "MU") {//Maurice
2368 2368
         if (dol_strlen($phone) == 11) {//ex: +230_ABC_DE_FG
2369
-            $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 2) . $separ . substr($newphone, 9, 2);
2369
+            $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 2).$separ.substr($newphone, 9, 2);
2370 2370
         } elseif (dol_strlen($phone) == 12) {//ex: +230_ABCD_EF_GH
2371
-            $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 4) . $separ . substr($newphone, 8, 2) . $separ . substr($newphone, 10, 2);
2371
+            $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 2).$separ.substr($newphone, 10, 2);
2372 2372
         }
2373 2373
     } elseif (strtoupper($countrycode) == "ZA") {//Afrique du sud
2374 2374
         if (dol_strlen($phone) == 12) {//ex: +27_AB_CDE_FG_HI
2375
-            $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);
2375
+            $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);
2376 2376
         }
2377 2377
     } elseif (strtoupper($countrycode) == "SY") {//Syrie
2378 2378
         if (dol_strlen($phone) == 12) {//ex: +963_AB_CD_EF_GH
2379
-            $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);
2379
+            $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);
2380 2380
         } elseif (dol_strlen($phone) == 13) {//ex: +963_AB_CD_EF_GHI
2381
-            $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);
2381
+            $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);
2382 2382
         }
2383 2383
     } elseif (strtoupper($countrycode) == "AE") {//Emirats Arabes Unis
2384 2384
         if (dol_strlen($phone) == 12) {//ex: +971_ABC_DEF_GH
2385
-            $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 2);
2385
+            $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 2);
2386 2386
         } elseif (dol_strlen($phone) == 13) {//ex: +971_ABC_DEF_GHI
2387
-            $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3);
2387
+            $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3);
2388 2388
         } elseif (dol_strlen($phone) == 14) {//ex: +971_ABC_DEF_GHIK
2389
-            $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 4);
2389
+            $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 4);
2390 2390
         }
2391 2391
     } elseif (strtoupper($countrycode) == "DZ") {//Algérie
2392 2392
         if (dol_strlen($phone) == 13) {//ex: +213_ABC_DEF_GHI
2393
-            $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 3) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3);
2393
+            $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 3).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3);
2394 2394
         }
2395 2395
     } elseif (strtoupper($countrycode) == "BE") {//Belgique
2396 2396
         if (dol_strlen($phone) == 11) {//ex: +32_ABC_DE_FGH
2397
-            $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 2) . $separ . substr($newphone, 8, 3);
2397
+            $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 2).$separ.substr($newphone, 8, 3);
2398 2398
         } elseif (dol_strlen($phone) == 12) {//ex: +32_ABC_DEF_GHI
2399
-            $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3);
2399
+            $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3);
2400 2400
         }
2401 2401
     } elseif (strtoupper($countrycode) == "PF") {//Polynésie française
2402 2402
         if (dol_strlen($phone) == 12) {//ex: +689_AB_CD_EF_GH
2403
-            $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);
2403
+            $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);
2404 2404
         }
2405 2405
     } elseif (strtoupper($countrycode) == "CO") {//Colombie
2406 2406
         if (dol_strlen($phone) == 13) {//ex: +57_ABC_DEF_GH_IJ
2407
-            $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);
2407
+            $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);
2408 2408
         }
2409 2409
     } elseif (strtoupper($countrycode) == "JO") {//Jordanie
2410 2410
         if (dol_strlen($phone) == 12) {//ex: +962_A_BCD_EF_GH
2411
-            $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);
2411
+            $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);
2412 2412
         }
2413 2413
     } elseif (strtoupper($countrycode) == "MG") {//Madagascar
2414 2414
         if (dol_strlen($phone) == 13) {//ex: +261_AB_CD_EF_GHI
2415
-            $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);
2415
+            $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);
2416 2416
         }
2417 2417
     } elseif (strtoupper($countrycode) == "GB") {//Royaume uni
2418 2418
         if (dol_strlen($phone) == 13) {//ex: +44_ABCD_EFG_HIJ
2419
-            $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 4) . $separ . substr($newphone, 7, 3) . $separ . substr($newphone, 10, 3);
2419
+            $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 4).$separ.substr($newphone, 7, 3).$separ.substr($newphone, 10, 3);
2420 2420
         }
2421 2421
     } elseif (strtoupper($countrycode) == "CH") {//Suisse
2422 2422
         if (dol_strlen($phone) == 12) {//ex: +41_AB_CDE_FG_HI
2423
-            $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);
2423
+            $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);
2424 2424
         } elseif (dol_strlen($phone) == 15) {// +41_AB_CDE_FGH_IJKL
2425
-            $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);
2425
+            $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);
2426 2426
         }
2427 2427
     } elseif (strtoupper($countrycode) == "TN") {//Tunisie
2428 2428
         if (dol_strlen($phone) == 12) {//ex: +216_AB_CDE_FGH
2429
-            $newphone = substr($newphone, 0, 4) . $separ . substr($newphone, 4, 2) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3);
2429
+            $newphone = substr($newphone, 0, 4).$separ.substr($newphone, 4, 2).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3);
2430 2430
         }
2431 2431
     } elseif (strtoupper($countrycode) == "GF") {//Guyane francaise
2432 2432
         if (dol_strlen($phone) == 13) {//ex: +594_ABC_DE_FG_HI  (ABC=594 de nouveau)
2433
-            $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);
2433
+            $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);
2434 2434
         }
2435 2435
     } elseif (strtoupper($countrycode) == "GP") {//Guadeloupe
2436 2436
         if (dol_strlen($phone) == 13) {//ex: +590_ABC_DE_FG_HI  (ABC=590 de nouveau)
2437
-            $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);
2437
+            $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);
2438 2438
         }
2439 2439
     } elseif (strtoupper($countrycode) == "MQ") {//Martinique
2440 2440
         if (dol_strlen($phone) == 13) {//ex: +596_ABC_DE_FG_HI  (ABC=596 de nouveau)
2441
-            $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);
2441
+            $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);
2442 2442
         }
2443 2443
     } elseif (strtoupper($countrycode) == "IT") {//Italie
2444 2444
         if (dol_strlen($phone) == 12) {//ex: +39_ABC_DEF_GHI
2445
-            $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 3) . $separ . substr($newphone, 6, 3) . $separ . substr($newphone, 9, 3);
2445
+            $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 3).$separ.substr($newphone, 6, 3).$separ.substr($newphone, 9, 3);
2446 2446
         } elseif (dol_strlen($phone) == 13) {//ex: +39_ABC_DEF_GH_IJ
2447
-            $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);
2447
+            $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);
2448 2448
         }
2449 2449
     } elseif (strtoupper($countrycode) == "AU") {//Australie
2450 2450
         if (dol_strlen($phone) == 12) {//ex: +61_A_BCDE_FGHI
2451
-            $newphone = substr($newphone, 0, 3) . $separ . substr($newphone, 3, 1) . $separ . substr($newphone, 4, 4) . $separ . substr($newphone, 8, 4);
2451
+            $newphone = substr($newphone, 0, 3).$separ.substr($newphone, 3, 1).$separ.substr($newphone, 4, 4).$separ.substr($newphone, 8, 4);
2452 2452
         }
2453 2453
     }
2454 2454
     if (!empty($addlink)) { // Link on phone number (+ link to add action if conf->global->AGENDA_ADDACTIONFORPHONE set)
2455 2455
         if ($conf->browser->layout == 'phone' || (!empty($conf->clicktodial->enabled) && !empty($conf->global->CLICKTODIAL_USE_TEL_LINK_ON_PHONE_NUMBERS))) { // If phone or option for, we use link of phone
2456
-            $newphone = '<a href="tel:' . $phone . '"';
2457
-            $newphone .= '>' . $phone . '</a>';
2456
+            $newphone = '<a href="tel:'.$phone.'"';
2457
+            $newphone .= '>'.$phone.'</a>';
2458 2458
         } else if (!empty($conf->clicktodial->enabled) && $addlink == 'AC_TEL') {  // If click to dial, we use click to dial url
2459 2459
             if (empty($user->clicktodial_loaded))
2460 2460
                 $user->fetch_clicktodial();
@@ -2478,10 +2478,10 @@  discard block
 block discarded – undo
2478 2478
                 '__PASS__' => $clicktodial_password);
2479 2479
             $url = make_substitutions($url, $substitarray);
2480 2480
             $newphonesav = $newphone;
2481
-            $newphone = '<a href="' . $url . '"';
2481
+            $newphone = '<a href="'.$url.'"';
2482 2482
             if (!empty($conf->global->CLICKTODIAL_FORCENEWTARGET))
2483 2483
                 $newphone .= ' target="_blank"';
2484
-            $newphone .= '>' . $newphonesav . '</a>';
2484
+            $newphone .= '>'.$newphonesav.'</a>';
2485 2485
         }
2486 2486
 
2487 2487
         //if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
@@ -2491,9 +2491,9 @@  discard block
 block discarded – undo
2491 2491
             if ($addlink == 'AC_FAX')
2492 2492
                 $type = 'AC_FAX';
2493 2493
             if (!empty($conf->global->AGENDA_ADDACTIONFORPHONE))
2494
-                $link = '<a href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode=' . $type . ($cid ? '&amp;contactid=' . $cid : '') . ($socid ? '&amp;socid=' . $socid : '') . '">' . img_object($langs->trans("AddAction"), "calendar") . '</a>';
2494
+                $link = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&amp;backtopage=1&amp;actioncode='.$type.($cid ? '&amp;contactid='.$cid : '').($socid ? '&amp;socid='.$socid : '').'">'.img_object($langs->trans("AddAction"), "calendar").'</a>';
2495 2495
             if ($link)
2496
-                $newphone = '<div>' . $newphone . ' ' . $link . '</div>';
2496
+                $newphone = '<div>'.$newphone.' '.$link.'</div>';
2497 2497
         }
2498 2498
     }
2499 2499
 
@@ -2524,7 +2524,7 @@  discard block
 block discarded – undo
2524 2524
             $rep .= '<div class="nospan float" style="margin-right: 10px">';
2525 2525
         else
2526 2526
             $rep .= '<span style="margin-right: 10px;">';
2527
-        $rep .= ($withpicto ? img_picto($titlealt, 'object_' . $picto . '.png') . ' ' : '') . $newphone;
2527
+        $rep .= ($withpicto ? img_picto($titlealt, 'object_'.$picto.'.png').' ' : '').$newphone;
2528 2528
         if ($adddivfloat)
2529 2529
             $rep .= '</div>';
2530 2530
         else
@@ -2553,10 +2553,10 @@  discard block
 block discarded – undo
2553 2553
     if ($mode != 2) {
2554 2554
         $countrycode = dolGetCountryCodeFromIp($ip);
2555 2555
         if ($countrycode) { // If success, countrycode is us, fr, ...
2556
-            if (file_exists(DOL_BASE_PATH . 'theme/common/flags/' . $countrycode . '.png')) {
2557
-                $ret .= ' ' . img_picto($countrycode . ' ' . $langs->trans("AccordingToGeoIPDatabase"), /* DOL_URL_ROOT */ DOL_BASE_URI . '/theme/common/flags/' . $countrycode . '.png', '', 1);
2556
+            if (file_exists(DOL_BASE_PATH.'theme/common/flags/'.$countrycode.'.png')) {
2557
+                $ret .= ' '.img_picto($countrycode.' '.$langs->trans("AccordingToGeoIPDatabase"), /* DOL_URL_ROOT */ DOL_BASE_URI.'/theme/common/flags/'.$countrycode.'.png', '', 1);
2558 2558
             } else
2559
-                $ret .= ' (' . $countrycode . ')';
2559
+                $ret .= ' ('.$countrycode.')';
2560 2560
         }
2561 2561
     }
2562 2562
 
@@ -2594,7 +2594,7 @@  discard block
 block discarded – undo
2594 2594
         //$ip='24.24.24.24';
2595 2595
         //$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)
2596 2596
 
2597
-        include_once DOL_BASE_PATH . '/core/class/dolgeoip.class.php';
2597
+        include_once DOL_BASE_PATH.'/core/class/dolgeoip.class.php';
2598 2598
         $geoip = new DolGeoIP('country', $datafile);
2599 2599
         //print 'ip='.$ip.' databaseType='.$geoip->gi->databaseType." GEOIP_CITY_EDITION_REV1=".GEOIP_CITY_EDITION_REV1."\n";
2600 2600
         //print "geoip_country_id_by_addr=".geoip_country_id_by_addr($geoip->gi,$ip)."\n";
@@ -2621,7 +2621,7 @@  discard block
 block discarded – undo
2621 2621
         $datafile = $conf->global->GEOIPMAXMIND_COUNTRY_DATAFILE;
2622 2622
         //$ip='24.24.24.24';
2623 2623
         //$datafile='E:\Mes Sites\Web\Admin1\awstats\maxmind\GeoIP.dat';
2624
-        include_once DOL_BASE_PATH . '/core/class/dolgeoip.class.php';
2624
+        include_once DOL_BASE_PATH.'/core/class/dolgeoip.class.php';
2625 2625
         $geoip = new DolGeoIP('country', $datafile);
2626 2626
         $countrycode = $geoip->getCountryCodeFromIP($ip);
2627 2627
         $ret = $countrycode;
@@ -2676,12 +2676,12 @@  discard block
 block discarded – undo
2676 2676
                 $showomap = 1;
2677 2677
 
2678 2678
             if ($showgmap) {
2679
-                $url = dol_buildpath('/google/gmaps.php?mode=' . $mode . '&id=' . $id, 1);
2680
-                $out .= ' <a href="' . $url . '" target="_gmaps"><img id="' . $htmlid . '" class="valigntextbottom" src="' . DOL_URL_ROOT . '/theme/common/gmap.png"></a>';
2679
+                $url = dol_buildpath('/google/gmaps.php?mode='.$mode.'&id='.$id, 1);
2680
+                $out .= ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'" class="valigntextbottom" src="'.DOL_URL_ROOT.'/theme/common/gmap.png"></a>';
2681 2681
             }
2682 2682
             if ($showomap) {
2683
-                $url = dol_buildpath('/openstreetmap/maps.php?mode=' . $mode . '&id=' . $id, 1);
2684
-                $out .= ' <a href="' . $url . '" target="_gmaps"><img id="' . $htmlid . '_openstreetmap" class="valigntextbottom" src="' . DOL_URL_ROOT . '/theme/common/gmap.png"></a>';
2683
+                $url = dol_buildpath('/openstreetmap/maps.php?mode='.$mode.'&id='.$id, 1);
2684
+                $out .= ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'_openstreetmap" class="valigntextbottom" src="'.DOL_URL_ROOT.'/theme/common/gmap.png"></a>';
2685 2685
             }
2686 2686
         }
2687 2687
     }
@@ -2827,7 +2827,7 @@  discard block
 block discarded – undo
2827 2827
     if ($trunc == 'right') {
2828 2828
         $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string;
2829 2829
         if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3)))    // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
2830
-            return dol_substr($newstring, 0, $size, $stringencoding) . ($nodot ? '' : '...');
2830
+            return dol_substr($newstring, 0, $size, $stringencoding).($nodot ? '' : '...');
2831 2831
         else
2832 2832
         //return 'u'.$size.'-'.$newstring.'-'.dol_strlen($newstring,$stringencoding).'-'.$string;
2833 2833
             return $string;
@@ -2837,21 +2837,21 @@  discard block
 block discarded – undo
2837 2837
         if (dol_strlen($newstring, $stringencoding) > 2 && dol_strlen($newstring, $stringencoding) > ($size + 1)) {
2838 2838
             $size1 = round($size / 2);
2839 2839
             $size2 = round($size / 2);
2840
-            return dol_substr($newstring, 0, $size1, $stringencoding) . '...' . dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding);
2840
+            return dol_substr($newstring, 0, $size1, $stringencoding).'...'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size2, $size2, $stringencoding);
2841 2841
         } else
2842 2842
             return $string;
2843 2843
     }
2844 2844
     elseif ($trunc == 'left') {
2845 2845
         $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string;
2846 2846
         if (dol_strlen($newstring, $stringencoding) > ($size + ($nodot ? 0 : 3)))    // If nodot is 0 and size is 1,2 or 3 chars more, we don't trunc and don't add ...
2847
-            return '...' . dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding);
2847
+            return '...'.dol_substr($newstring, dol_strlen($newstring, $stringencoding) - $size, $size, $stringencoding);
2848 2848
         else
2849 2849
             return $string;
2850 2850
     }
2851 2851
     elseif ($trunc == 'wrap') {
2852 2852
         $newstring = dol_textishtml($string) ? dol_string_nohtmltag($string, 1) : $string;
2853 2853
         if (dol_strlen($newstring, $stringencoding) > ($size + 1))
2854
-            return dol_substr($newstring, 0, $size, $stringencoding) . "\n" . dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc);
2854
+            return dol_substr($newstring, 0, $size, $stringencoding)."\n".dol_trunc(dol_substr($newstring, $size, dol_strlen($newstring, $stringencoding) - $size, $stringencoding), $size, $trunc);
2855 2855
         else
2856 2856
             return $string;
2857 2857
     } else
@@ -2885,7 +2885,7 @@  discard block
 block discarded – undo
2885 2885
     $url = DOL_BASE_URI;
2886 2886
 
2887 2887
     $theme = $conf->theme;
2888
-    $path = 'theme/' . $theme;
2888
+    $path = 'theme/'.$theme;
2889 2889
 
2890 2890
     // Define fullpathpicto to use into src
2891 2891
     if ($pictoisfullpath) {
@@ -2934,7 +2934,7 @@  discard block
 block discarded – undo
2934 2934
                 $fakey = 'fa-pencil';
2935 2935
                 $facolor = '#444';
2936 2936
             } elseif ($pictowithoutext == 'filter') {
2937
-                $fakey = 'fa-' . $pictowithoutext;
2937
+                $fakey = 'fa-'.$pictowithoutext;
2938 2938
             } elseif ($pictowithoutext == 'grip_title' || $pictowithoutext == 'grip') {
2939 2939
                 $fakey = 'fa-arrows';
2940 2940
             } elseif ($pictowithoutext == 'listlight') {
@@ -2973,15 +2973,15 @@  discard block
 block discarded – undo
2973 2973
             } elseif ($pictowithoutext == 'jabber') {
2974 2974
                 $fakey = 'fa-comment-o';
2975 2975
             } else {
2976
-                $fakey = 'fa-' . $pictowithoutext;
2976
+                $fakey = 'fa-'.$pictowithoutext;
2977 2977
                 $facolor = '#444';
2978 2978
                 $marginleftonlyshort = 0;
2979 2979
             }
2980 2980
 
2981 2981
             if (preg_match('/class="([^"]+)"/', $moreatt, $reg)) {
2982
-                $morecss .= ($morecss ? ' ' : '') . $reg[1];
2982
+                $morecss .= ($morecss ? ' ' : '').$reg[1];
2983 2983
             }
2984
-            $enabledisablehtml = '<span class="fa ' . $fakey . ' ' . ($marginleftonlyshort ? ($marginleftonlyshort == 1 ? 'marginleftonlyshort' : 'marginleftonly') : '') . ' valignmiddle' . ($morecss ? ' ' . $morecss : '') . '" style="' . ($fasize ? ('font-size: ' . $fasize . ';') : '') . ($facolor ? (' color: ' . $facolor . ';') : '') . '" alt="' . dol_escape_htmltag($titlealt) . '"' . (($notitle || empty($title)) ? '' : ' title="' . dol_escape_htmltag($title) . '"') . ($moreatt ? ' ' . $moreatt : '') . '>';
2984
+            $enabledisablehtml = '<span class="fa '.$fakey.' '.($marginleftonlyshort ? ($marginleftonlyshort == 1 ? 'marginleftonlyshort' : 'marginleftonly') : '').' valignmiddle'.($morecss ? ' '.$morecss : '').'" style="'.($fasize ? ('font-size: '.$fasize.';') : '').($facolor ? (' color: '.$facolor.';') : '').'" alt="'.dol_escape_htmltag($titlealt).'"'.(($notitle || empty($title)) ? '' : ' title="'.dol_escape_htmltag($title).'"').($moreatt ? ' '.$moreatt : '').'>';
2985 2985
             if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
2986 2986
                 $enabledisablehtml .= $titlealt;
2987 2987
             }
@@ -2991,11 +2991,11 @@  discard block
 block discarded – undo
2991 2991
         }
2992 2992
 
2993 2993
         if (!empty($conf->global->MAIN_OVERWRITE_THEME_PATH)) {
2994
-            $path = $conf->global->MAIN_OVERWRITE_THEME_PATH . '/theme/' . $theme; // If the theme does not have the same name as the module
2994
+            $path = $conf->global->MAIN_OVERWRITE_THEME_PATH.'/theme/'.$theme; // If the theme does not have the same name as the module
2995 2995
         } else if (!empty($conf->global->MAIN_OVERWRITE_THEME_RES)) {
2996
-            $path = $conf->global->MAIN_OVERWRITE_THEME_RES . '/theme/' . $conf->global->MAIN_OVERWRITE_THEME_RES;  // To allow an external module to overwrite image resources whatever is activated theme
2996
+            $path = $conf->global->MAIN_OVERWRITE_THEME_RES.'/theme/'.$conf->global->MAIN_OVERWRITE_THEME_RES; // To allow an external module to overwrite image resources whatever is activated theme
2997 2997
         } else if (!empty($conf->modules_parts['theme']) && array_key_exists($theme, $conf->modules_parts['theme'])) {
2998
-            $path = $theme . '/theme/' . $theme; // If the theme have the same name as the module
2998
+            $path = $theme.'/theme/'.$theme; // If the theme have the same name as the module
2999 2999
         }
3000 3000
 
3001 3001
         // If we ask an image into $url/$mymodule/img (instead of default path)
@@ -3015,22 +3015,22 @@  discard block
 block discarded – undo
3015 3015
                 continue;
3016 3016
             }
3017 3017
             // This need a lot of time, that's why enabling alternative dir like "custom" dir is not recommanded
3018
-            if (file_exists($dirroot . '/' . $path . '/img/' . $picto)) {
3018
+            if (file_exists($dirroot.'/'.$path.'/img/'.$picto)) {
3019 3019
                 //$url = DOL_URL_ROOT . $conf->file->dol_url_root[$type];
3020
-                $url = DOL_BASE_URI . $conf->file->dol_url_root[$type];
3020
+                $url = DOL_BASE_URI.$conf->file->dol_url_root[$type];
3021 3021
                 break;
3022 3022
             }
3023 3023
         }
3024 3024
 
3025 3025
         // $url is '' or '/custom', $path is current theme or
3026
-        $fullpathpicto = $url . '/' . $path . '/img/' . $picto;
3026
+        $fullpathpicto = $url.'/'.$path.'/img/'.$picto;
3027 3027
     }
3028 3028
 
3029 3029
     if ($srconly) {
3030 3030
         return $fullpathpicto;
3031 3031
     }
3032 3032
     // tag title is used for tooltip on <a>, tag alt can be used with very simple text on image for bind people
3033
-    return '<img src="' . $fullpathpicto . '" alt="' . dol_escape_htmltag($alt) . '"' . (($notitle || empty($titlealt)) ? '' : ' title="' . dol_escape_htmltag($titlealt) . '"') . ($moreatt ? ' ' . $moreatt : ' class="inline-block' . ($morecss ? ' ' . $morecss : '') . '"') . '>'; // Alt is used for accessibility, title for popup
3033
+    return '<img src="'.$fullpathpicto.'" alt="'.dol_escape_htmltag($alt).'"'.(($notitle || empty($titlealt)) ? '' : ' title="'.dol_escape_htmltag($titlealt).'"').($moreatt ? ' '.$moreatt : ' class="inline-block'.($morecss ? ' '.$morecss : '').'"').'>'; // Alt is used for accessibility, title for popup
3034 3034
 }
3035 3035
 
3036 3036
 /**
@@ -3048,7 +3048,7 @@  discard block
 block discarded – undo
3048 3048
  */
3049 3049
 function img_object($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $srconly = 0, $notitle = 0)
3050 3050
 {
3051
-    return img_picto($titlealt, 'object_' . $picto, $moreatt, $pictoisfullpath, $srconly, $notitle);
3051
+    return img_picto($titlealt, 'object_'.$picto, $moreatt, $pictoisfullpath, $srconly, $notitle);
3052 3052
 }
3053 3053
 
3054 3054
 /**
@@ -3069,7 +3069,7 @@  discard block
 block discarded – undo
3069 3069
         $picto .= '.png';
3070 3070
 
3071 3071
     //$path = DOL_URL_ROOT . '/theme/' . $conf->theme . '/img/weather/' . $picto;
3072
-    $path = DOL_BASE_URI . '/theme/' . $conf->theme . '/img/weather/' . $picto;
3072
+    $path = DOL_BASE_URI.'/theme/'.$conf->theme.'/img/weather/'.$picto;
3073 3073
 
3074 3074
     return img_picto($titlealt, $path, $moreatt, 1);
3075 3075
 }
@@ -3094,10 +3094,10 @@  discard block
 block discarded – undo
3094 3094
     if ($pictoisfullpath)
3095 3095
         $path = $picto;
3096 3096
     else {
3097
-        $path = DOL_URL_ROOT . '/theme/common/' . $picto;
3097
+        $path = DOL_URL_ROOT.'/theme/common/'.$picto;
3098 3098
 
3099 3099
         if (!empty($conf->global->MAIN_MODULE_CAN_OVERWRITE_COMMONICONS)) {
3100
-            $themepath = DOL_BASE_PATH . 'theme/' . $conf->theme . '/img/' . $picto;
3100
+            $themepath = DOL_BASE_PATH.'theme/'.$conf->theme.'/img/'.$picto;
3101 3101
 
3102 3102
             if (file_exists($themepath))
3103 3103
                 $path = $themepath;
@@ -3135,14 +3135,14 @@  discard block
 block discarded – undo
3135 3135
             $numaction = 3;
3136 3136
             $titlealt = $langs->transnoentitiesnoconv('ChangeContactDone');
3137 3137
         } else {
3138
-            $titlealt = $langs->transnoentitiesnoconv('ChangeStatus ' . $numaction);
3138
+            $titlealt = $langs->transnoentitiesnoconv('ChangeStatus '.$numaction);
3139 3139
             $numaction = 0;
3140 3140
         }
3141 3141
     }
3142 3142
     if (!is_numeric($numaction))
3143 3143
         $numaction = 0;
3144 3144
 
3145
-    return img_picto($titlealt, 'stcomm' . $numaction . '.png');
3145
+    return img_picto($titlealt, 'stcomm'.$numaction.'.png');
3146 3146
 }
3147 3147
 
3148 3148
 /**
@@ -3159,7 +3159,7 @@  discard block
 block discarded – undo
3159 3159
     if ($titlealt == 'default')
3160 3160
         $titlealt = $langs->trans('Show');
3161 3161
 
3162
-    return img_picto($titlealt, 'pdf' . $size . '.png');
3162
+    return img_picto($titlealt, 'pdf'.$size.'.png');
3163 3163
 }
3164 3164
 
3165 3165
 /**
@@ -3211,7 +3211,7 @@  discard block
 block discarded – undo
3211 3211
     if ($titlealt == 'default')
3212 3212
         $titlealt = $langs->trans('Modify');
3213 3213
 
3214
-    return img_picto($titlealt, 'edit.png', ($float ? 'style="float: ' . ($langs->tab_translate["DIRECTION"] == 'rtl' ? 'left' : 'right') . '"' : "") . ($other ? ' ' . $other : ''));
3214
+    return img_picto($titlealt, 'edit.png', ($float ? 'style="float: '.($langs->tab_translate["DIRECTION"] == 'rtl' ? 'left' : 'right').'"' : "").($other ? ' '.$other : ''));
3215 3215
 }
3216 3216
 
3217 3217
 /**
@@ -3229,7 +3229,7 @@  discard block
 block discarded – undo
3229 3229
     if ($titlealt == 'default')
3230 3230
         $titlealt = $langs->trans('View');
3231 3231
 
3232
-    $moreatt = ($float ? 'style="float: right" ' : '') . $other;
3232
+    $moreatt = ($float ? 'style="float: right" ' : '').$other;
3233 3233
 
3234 3234
     return img_picto($titlealt, 'view.png', $moreatt);
3235 3235
 }
@@ -3302,7 +3302,7 @@  discard block
 block discarded – undo
3302 3302
             $usealttitle = $langs->trans('Info');
3303 3303
     }
3304 3304
 
3305
-    return img_picto($usealttitle, 'info.png', 'style="vertical-align: middle;' . ($usehelpcursor == 1 ? ' cursor: help' : ($usehelpcursor == 2 ? ' cursor: pointer' : '')) . '"');
3305
+    return img_picto($usealttitle, 'info.png', 'style="vertical-align: middle;'.($usehelpcursor == 1 ? ' cursor: help' : ($usehelpcursor == 2 ? ' cursor: pointer' : '')).'"');
3306 3306
 }
3307 3307
 
3308 3308
 /**
@@ -3336,7 +3336,7 @@  discard block
 block discarded – undo
3336 3336
         $titlealt = $langs->trans('Warning');
3337 3337
 
3338 3338
     //return '<div class="imglatecoin">'.img_picto($titlealt, 'warning_white.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt): '')).'</div>';
3339
-    return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"' . ($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' ' . $moreatt) : ''));
3339
+    return img_picto($titlealt, 'warning.png', 'class="pictowarning valignmiddle"'.($moreatt ? ($moreatt == '1' ? ' style="float: right"' : ' '.$moreatt) : ''));
3340 3340
 }
3341 3341
 
3342 3342
 /**
@@ -3370,7 +3370,7 @@  discard block
 block discarded – undo
3370 3370
         $titlealt = $langs->trans('Next');
3371 3371
 
3372 3372
     //return img_picto($titlealt, 'next.png', $moreatt);
3373
-    return '<span class="fa fa-chevron-right paddingright paddingleft" title="' . dol_escape_htmltag($titlealt) . '"></span>';
3373
+    return '<span class="fa fa-chevron-right paddingright paddingleft" title="'.dol_escape_htmltag($titlealt).'"></span>';
3374 3374
 }
3375 3375
 
3376 3376
 /**
@@ -3388,7 +3388,7 @@  discard block
 block discarded – undo
3388 3388
         $titlealt = $langs->trans('Previous');
3389 3389
 
3390 3390
     //return img_picto($titlealt, 'previous.png', $moreatt);
3391
-    return '<span class="fa fa-chevron-left paddingright paddingleft" title="' . dol_escape_htmltag($titlealt) . '"></span>';
3391
+    return '<span class="fa fa-chevron-left paddingright paddingleft" title="'.dol_escape_htmltag($titlealt).'"></span>';
3392 3392
 }
3393 3393
 
3394 3394
 /**
@@ -3406,7 +3406,7 @@  discard block
 block discarded – undo
3406 3406
     if ($titlealt == 'default')
3407 3407
         $titlealt = $langs->trans('Down');
3408 3408
 
3409
-    return img_picto($titlealt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown' . ($moreclass ? " " . $moreclass : "") . '"');
3409
+    return img_picto($titlealt, ($selected ? '1downarrow_selected.png' : '1downarrow.png'), 'class="imgdown'.($moreclass ? " ".$moreclass : "").'"');
3410 3410
 }
3411 3411
 
3412 3412
 /**
@@ -3424,7 +3424,7 @@  discard block
 block discarded – undo
3424 3424
     if ($titlealt == 'default')
3425 3425
         $titlealt = $langs->trans('Up');
3426 3426
 
3427
-    return img_picto($titlealt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup' . ($moreclass ? " " . $moreclass : "") . '"');
3427
+    return img_picto($titlealt, ($selected ? '1uparrow_selected.png' : '1uparrow.png'), 'class="imgup'.($moreclass ? " ".$moreclass : "").'"');
3428 3428
 }
3429 3429
 
3430 3430
 /**
@@ -3507,7 +3507,7 @@  discard block
 block discarded – undo
3507 3507
         $brand = 'credit-card';
3508 3508
     }
3509 3509
 
3510
-    return '<span class="fa fa-' . $brand . ' fa-2x fa-fw"></span>';
3510
+    return '<span class="fa fa-'.$brand.' fa-2x fa-fw"></span>';
3511 3511
 }
3512 3512
 
3513 3513
 /**
@@ -3520,17 +3520,17 @@  discard block
 block discarded – undo
3520 3520
  */
3521 3521
 function img_mime($file, $titlealt = '', $morecss = '')
3522 3522
 {
3523
-    require_once DOL_BASE_PATH . '/core/lib/files.lib.php';
3523
+    require_once DOL_BASE_PATH.'/core/lib/files.lib.php';
3524 3524
 
3525 3525
     $mimetype = dol_mimetype($file, '', 1);
3526 3526
     $mimeimg = dol_mimetype($file, '', 2);
3527 3527
     $mimefa = dol_mimetype($file, '', 4);
3528 3528
 
3529 3529
     if (empty($titlealt))
3530
-        $titlealt = 'Mime type: ' . $mimetype;
3530
+        $titlealt = 'Mime type: '.$mimetype;
3531 3531
 
3532 3532
     //return img_picto_common($titlealt, 'mime/'.$mimeimg, 'class="'.$morecss.'"');
3533
-    return '<i class="fa fa-' . $mimefa . ' paddingright"></i>';
3533
+    return '<i class="fa fa-'.$mimefa.' paddingright"></i>';
3534 3534
 }
3535 3535
 
3536 3536
 /**
@@ -3545,7 +3545,7 @@  discard block
 block discarded – undo
3545 3545
  */
3546 3546
 function img_phone($titlealt = 'default', $option = 0)
3547 3547
 {
3548
-    dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
3548
+    dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING);
3549 3549
 
3550 3550
     global $conf, $langs;
3551 3551
 
@@ -3576,8 +3576,8 @@  discard block
 block discarded – undo
3576 3576
 
3577 3577
     $img = img_picto($titlealt, 'search.png', $other, false, 1);
3578 3578
 
3579
-    $input = '<input type="image" class="liste_titre" name="button_search" src="' . $img . '" ';
3580
-    $input .= 'value="' . dol_escape_htmltag($titlealt) . '" title="' . dol_escape_htmltag($titlealt) . '" >';
3579
+    $input = '<input type="image" class="liste_titre" name="button_search" src="'.$img.'" ';
3580
+    $input .= 'value="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'" >';
3581 3581
 
3582 3582
     return $input;
3583 3583
 }
@@ -3598,8 +3598,8 @@  discard block
 block discarded – undo
3598 3598
 
3599 3599
     $img = img_picto($titlealt, 'searchclear.png', $other, false, 1);
3600 3600
 
3601
-    $input = '<input type="image" class="liste_titre" name="button_removefilter" src="' . $img . '" ';
3602
-    $input .= 'value="' . dol_escape_htmltag($titlealt) . '" title="' . dol_escape_htmltag($titlealt) . '" >';
3601
+    $input = '<input type="image" class="liste_titre" name="button_removefilter" src="'.$img.'" ';
3602
+    $input .= 'value="'.dol_escape_htmltag($titlealt).'" title="'.dol_escape_htmltag($titlealt).'" >';
3603 3603
 
3604 3604
     return $input;
3605 3605
 }
@@ -3619,10 +3619,10 @@  discard block
 block discarded – undo
3619 3619
     global $conf, $langs;
3620 3620
 
3621 3621
     if ($infoonimgalt) {
3622
-        return img_picto($text, 'info', 'class="hideonsmartphone' . ($morecss ? ' ' . $morecss : '') . '"');
3622
+        return img_picto($text, 'info', 'class="hideonsmartphone'.($morecss ? ' '.$morecss : '').'"');
3623 3623
     }
3624 3624
 
3625
-    return ($nodiv ? '' : '<div class="' . (empty($admin) ? '' : ($admin == '1' ? 'info' : $admin)) . ' hideonsmartphone' . ($morecss ? ' ' . $morecss : '') . '">') . '<span class="fa fa-info-circle" title="' . dol_escape_htmltag($admin ? $langs->trans('InfoAdmin') : $langs->trans('Note')) . '"></span> ' . $text . ($nodiv ? '' : '</div>');
3625
+    return ($nodiv ? '' : '<div class="'.(empty($admin) ? '' : ($admin == '1' ? 'info' : $admin)).' hideonsmartphone'.($morecss ? ' '.$morecss : '').'">').'<span class="fa fa-info-circle" title="'.dol_escape_htmltag($admin ? $langs->trans('InfoAdmin') : $langs->trans('Note')).'"></span> '.$text.($nodiv ? '' : '</div>');
3626 3626
 }
3627 3627
 
3628 3628
 /**
@@ -3647,7 +3647,7 @@  discard block
 block discarded – undo
3647 3647
 
3648 3648
     // Si erreur intervenue avant chargement langue
3649 3649
     if (!$langs) {
3650
-        require_once DOL_BASE_PATH . '/core/class/translate.class.php';
3650
+        require_once DOL_BASE_PATH.'/core/class/translate.class.php';
3651 3651
         $langs = new Translate('', $conf);
3652 3652
         $langs->load("main");
3653 3653
     }
@@ -3655,51 +3655,51 @@  discard block
 block discarded – undo
3655 3655
     $langs->loadLangs(array('main', 'errors'));
3656 3656
 
3657 3657
     if ($_SERVER['DOCUMENT_ROOT']) {    // Mode web
3658
-        $out .= $langs->trans("DolibarrHasDetectedError") . ".<br>\n";
3658
+        $out .= $langs->trans("DolibarrHasDetectedError").".<br>\n";
3659 3659
         if (!empty($conf->global->MAIN_FEATURES_LEVEL))
3660 3660
             $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";
3661
-        $out .= $langs->trans("InformationToHelpDiagnose") . ":<br>\n";
3661
+        $out .= $langs->trans("InformationToHelpDiagnose").":<br>\n";
3662 3662
 
3663
-        $out .= "<b>" . $langs->trans("Date") . ":</b> " . dol_print_date(time(), 'dayhourlog') . "<br>\n";
3664
-        $out .= "<b>" . $langs->trans("Dolibarr") . ":</b> " . DOL_VERSION . "<br>\n";
3663
+        $out .= "<b>".$langs->trans("Date").":</b> ".dol_print_date(time(), 'dayhourlog')."<br>\n";
3664
+        $out .= "<b>".$langs->trans("Dolibarr").":</b> ".DOL_VERSION."<br>\n";
3665 3665
         if (isset($conf->global->MAIN_FEATURES_LEVEL))
3666
-            $out .= "<b>" . $langs->trans("LevelOfFeature") . ":</b> " . $conf->global->MAIN_FEATURES_LEVEL . "<br>\n";
3666
+            $out .= "<b>".$langs->trans("LevelOfFeature").":</b> ".$conf->global->MAIN_FEATURES_LEVEL."<br>\n";
3667 3667
         if (function_exists("phpversion")) {
3668
-            $out .= "<b>" . $langs->trans("PHP") . ":</b> " . phpversion() . "<br>\n";
3668
+            $out .= "<b>".$langs->trans("PHP").":</b> ".phpversion()."<br>\n";
3669 3669
         }
3670
-        $out .= "<b>" . $langs->trans("Server") . ":</b> " . $_SERVER["SERVER_SOFTWARE"] . "<br>\n";
3670
+        $out .= "<b>".$langs->trans("Server").":</b> ".$_SERVER["SERVER_SOFTWARE"]."<br>\n";
3671 3671
         if (function_exists("php_uname")) {
3672
-            $out .= "<b>" . $langs->trans("OS") . ":</b> " . php_uname() . "<br>\n";
3672
+            $out .= "<b>".$langs->trans("OS").":</b> ".php_uname()."<br>\n";
3673 3673
         }
3674
-        $out .= "<b>" . $langs->trans("UserAgent") . ":</b> " . $_SERVER["HTTP_USER_AGENT"] . "<br>\n";
3674
+        $out .= "<b>".$langs->trans("UserAgent").":</b> ".$_SERVER["HTTP_USER_AGENT"]."<br>\n";
3675 3675
         $out .= "<br>\n";
3676
-        $out .= "<b>" . $langs->trans("RequestedUrl") . ":</b> " . dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT, 'UTF-8') . "<br>\n";
3677
-        $out .= "<b>" . $langs->trans("Referer") . ":</b> " . (isset($_SERVER["HTTP_REFERER"]) ? dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT, 'UTF-8') : '') . "<br>\n";
3678
-        $out .= "<b>" . $langs->trans("MenuManager") . ":</b> " . (isset($conf->standard_menu) ? $conf->standard_menu : '') . "<br>\n";
3676
+        $out .= "<b>".$langs->trans("RequestedUrl").":</b> ".dol_htmlentities($_SERVER["REQUEST_URI"], ENT_COMPAT, 'UTF-8')."<br>\n";
3677
+        $out .= "<b>".$langs->trans("Referer").":</b> ".(isset($_SERVER["HTTP_REFERER"]) ? dol_htmlentities($_SERVER["HTTP_REFERER"], ENT_COMPAT, 'UTF-8') : '')."<br>\n";
3678
+        $out .= "<b>".$langs->trans("MenuManager").":</b> ".(isset($conf->standard_menu) ? $conf->standard_menu : '')."<br>\n";
3679 3679
         $out .= "<br>\n";
3680
-        $syslog .= "url=" . dol_escape_htmltag($_SERVER["REQUEST_URI"]);
3681
-        $syslog .= ", query_string=" . dol_escape_htmltag($_SERVER["QUERY_STRING"]);
3680
+        $syslog .= "url=".dol_escape_htmltag($_SERVER["REQUEST_URI"]);
3681
+        $syslog .= ", query_string=".dol_escape_htmltag($_SERVER["QUERY_STRING"]);
3682 3682
     } else {                              // Mode CLI
3683
-        $out .= '> ' . $langs->transnoentities("ErrorInternalErrorDetected") . ":\n" . $argv[0] . "\n";
3684
-        $syslog .= "pid=" . dol_getmypid();
3683
+        $out .= '> '.$langs->transnoentities("ErrorInternalErrorDetected").":\n".$argv[0]."\n";
3684
+        $syslog .= "pid=".dol_getmypid();
3685 3685
     }
3686 3686
 
3687 3687
     if (is_object($db)) {
3688 3688
         if ($_SERVER['DOCUMENT_ROOT']) {  // Mode web
3689
-            $out .= "<b>" . $langs->trans("DatabaseTypeManager") . ":</b> " . $db->type . "<br>\n";
3690
-            $out .= "<b>" . $langs->trans("RequestLastAccessInError") . ":</b> " . ($db->lastqueryerror() ? dol_escape_htmltag($db->lastqueryerror()) : $langs->trans("ErrorNoRequestInError")) . "<br>\n";
3691
-            $out .= "<b>" . $langs->trans("ReturnCodeLastAccessInError") . ":</b> " . ($db->lasterrno() ? dol_escape_htmltag($db->lasterrno()) : $langs->trans("ErrorNoRequestInError")) . "<br>\n";
3692
-            $out .= "<b>" . $langs->trans("InformationLastAccessInError") . ":</b> " . ($db->lasterror() ? dol_escape_htmltag($db->lasterror()) : $langs->trans("ErrorNoRequestInError")) . "<br>\n";
3689
+            $out .= "<b>".$langs->trans("DatabaseTypeManager").":</b> ".$db->type."<br>\n";
3690
+            $out .= "<b>".$langs->trans("RequestLastAccessInError").":</b> ".($db->lastqueryerror() ? dol_escape_htmltag($db->lastqueryerror()) : $langs->trans("ErrorNoRequestInError"))."<br>\n";
3691
+            $out .= "<b>".$langs->trans("ReturnCodeLastAccessInError").":</b> ".($db->lasterrno() ? dol_escape_htmltag($db->lasterrno()) : $langs->trans("ErrorNoRequestInError"))."<br>\n";
3692
+            $out .= "<b>".$langs->trans("InformationLastAccessInError").":</b> ".($db->lasterror() ? dol_escape_htmltag($db->lasterror()) : $langs->trans("ErrorNoRequestInError"))."<br>\n";
3693 3693
             $out .= "<br>\n";
3694 3694
         } else {                            // Mode CLI
3695 3695
             // No dol_escape_htmltag for output, we are in CLI mode
3696
-            $out .= '> ' . $langs->transnoentities("DatabaseTypeManager") . ":\n" . $db->type . "\n";
3697
-            $out .= '> ' . $langs->transnoentities("RequestLastAccessInError") . ":\n" . ($db->lastqueryerror() ? $db->lastqueryerror() : $langs->transnoentities("ErrorNoRequestInError")) . "\n";
3698
-            $out .= '> ' . $langs->transnoentities("ReturnCodeLastAccessInError") . ":\n" . ($db->lasterrno() ? $db->lasterrno() : $langs->transnoentities("ErrorNoRequestInError")) . "\n";
3699
-            $out .= '> ' . $langs->transnoentities("InformationLastAccessInError") . ":\n" . ($db->lasterror() ? $db->lasterror() : $langs->transnoentities("ErrorNoRequestInError")) . "\n";
3696
+            $out .= '> '.$langs->transnoentities("DatabaseTypeManager").":\n".$db->type."\n";
3697
+            $out .= '> '.$langs->transnoentities("RequestLastAccessInError").":\n".($db->lastqueryerror() ? $db->lastqueryerror() : $langs->transnoentities("ErrorNoRequestInError"))."\n";
3698
+            $out .= '> '.$langs->transnoentities("ReturnCodeLastAccessInError").":\n".($db->lasterrno() ? $db->lasterrno() : $langs->transnoentities("ErrorNoRequestInError"))."\n";
3699
+            $out .= '> '.$langs->transnoentities("InformationLastAccessInError").":\n".($db->lasterror() ? $db->lasterror() : $langs->transnoentities("ErrorNoRequestInError"))."\n";
3700 3700
         }
3701
-        $syslog .= ", sql=" . $db->lastquery();
3702
-        $syslog .= ", db_error=" . $db->lasterror();
3701
+        $syslog .= ", sql=".$db->lastquery();
3702
+        $syslog .= ", db_error=".$db->lasterror();
3703 3703
     }
3704 3704
 
3705 3705
     if ($error || $errors) {
@@ -3719,31 +3719,31 @@  discard block
 block discarded – undo
3719 3719
             if (empty($msg))
3720 3720
                 continue;
3721 3721
             if ($_SERVER['DOCUMENT_ROOT']) {  // Mode web
3722
-                $out .= "<b>" . $langs->trans("Message") . ":</b> " . dol_escape_htmltag($msg) . "<br>\n";
3722
+                $out .= "<b>".$langs->trans("Message").":</b> ".dol_escape_htmltag($msg)."<br>\n";
3723 3723
             } else {                        // Mode CLI
3724
-                $out .= '> ' . $langs->transnoentities("Message") . ":\n" . $msg . "\n";
3724
+                $out .= '> '.$langs->transnoentities("Message").":\n".$msg."\n";
3725 3725
             }
3726
-            $syslog .= ", msg=" . $msg;
3726
+            $syslog .= ", msg=".$msg;
3727 3727
         }
3728 3728
     }
3729 3729
     if (empty($dolibarr_main_prod) && $_SERVER['DOCUMENT_ROOT'] && function_exists('xdebug_print_function_stack') && function_exists('xdebug_call_file')) {
3730 3730
         xdebug_print_function_stack();
3731
-        $out .= '<b>XDebug informations:</b>' . "<br>\n";
3732
-        $out .= 'File: ' . xdebug_call_file() . "<br>\n";
3733
-        $out .= 'Line: ' . xdebug_call_line() . "<br>\n";
3734
-        $out .= 'Function: ' . xdebug_call_function() . "<br>\n";
3731
+        $out .= '<b>XDebug informations:</b>'."<br>\n";
3732
+        $out .= 'File: '.xdebug_call_file()."<br>\n";
3733
+        $out .= 'Line: '.xdebug_call_line()."<br>\n";
3734
+        $out .= 'Function: '.xdebug_call_function()."<br>\n";
3735 3735
         $out .= "<br>\n";
3736 3736
     }
3737 3737
 
3738 3738
     if (empty($dolibarr_main_prod))
3739 3739
         print $out;
3740 3740
     else {
3741
-        print $langs->trans("DolibarrHasDetectedError") . '. ';
3741
+        print $langs->trans("DolibarrHasDetectedError").'. ';
3742 3742
         print $langs->trans("YouCanSetOptionDolibarrMainProdToZero");
3743 3743
         define("MAIN_CORE_ERROR", 1);
3744 3744
     }
3745 3745
     //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.';
3746
-    dol_syslog("Error " . $syslog, LOG_ERR);
3746
+    dol_syslog("Error ".$syslog, LOG_ERR);
3747 3747
 }
3748 3748
 
3749 3749
 /**
@@ -3766,13 +3766,13 @@  discard block
 block discarded – undo
3766 3766
     $langs->load("errors");
3767 3767
     $now = dol_now();
3768 3768
 
3769
-    print '<br><div class="center login_main_message"><div class="' . $morecss . '">';
3770
-    print $langs->trans("ErrorContactEMail", $email, $prefixcode . dol_print_date($now, '%Y%m%d'));
3769
+    print '<br><div class="center login_main_message"><div class="'.$morecss.'">';
3770
+    print $langs->trans("ErrorContactEMail", $email, $prefixcode.dol_print_date($now, '%Y%m%d'));
3771 3771
     if ($errormessage)
3772
-        print '<br><br>' . $errormessage;
3772
+        print '<br><br>'.$errormessage;
3773 3773
     if (is_array($errormessages) && count($errormessages)) {
3774 3774
         foreach ($errormessages as $mesgtoshow) {
3775
-            print '<br><br>' . $mesgtoshow;
3775
+            print '<br><br>'.$mesgtoshow;
3776 3776
         }
3777 3777
     }
3778 3778
     print '</div></div>';
@@ -3830,16 +3830,16 @@  discard block
 block discarded – undo
3830 3830
     }
3831 3831
 
3832 3832
     $tmpsortfield = explode(',', $sortfield);
3833
-    $sortfield1 = trim($tmpsortfield[0]);    // If $sortfield is 'd.datep,d.id', it becomes 'd.datep'
3833
+    $sortfield1 = trim($tmpsortfield[0]); // If $sortfield is 'd.datep,d.id', it becomes 'd.datep'
3834 3834
     $tmpfield = explode(',', $field);
3835
-    $field1 = trim($tmpfield[0]);            // If $field is 'd.datep,d.id', it becomes 'd.datep'
3835
+    $field1 = trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep'
3836 3836
     //var_dump('field='.$field.' field1='.$field1.' sortfield='.$sortfield.' sortfield1='.$sortfield1);
3837 3837
     // If field is used as sort criteria we use a specific css class liste_titre_sel
3838 3838
     // Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom")
3839 3839
     if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./", "", $field1))) {
3840
-        $out .= '<' . $tag . ' class="' . $prefix . 'liste_titre_sel" ' . $moreattrib . '>';
3840
+        $out .= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '.$moreattrib.'>';
3841 3841
     } else {
3842
-        $out .= '<' . $tag . ' class="' . $prefix . 'liste_titre" ' . $moreattrib . '>';
3842
+        $out .= '<'.$tag.' class="'.$prefix.'liste_titre" '.$moreattrib.'>';
3843 3843
     }
3844 3844
 
3845 3845
     if (empty($thead) && $field && empty($disablesortlink)) {    // If this is a sort field
@@ -3847,7 +3847,7 @@  discard block
 block discarded – undo
3847 3847
         $options = preg_replace('/sortorder=([a-zA-Z0-9,\s\.]+)/i', '', $options);
3848 3848
         $options = preg_replace('/&+/i', '&', $options);
3849 3849
         if (!preg_match('/^&/', $options)) {
3850
-            $options = '&' . $options;
3850
+            $options = '&'.$options;
3851 3851
         }
3852 3852
 
3853 3853
         $sortordertouseinlink = '';
@@ -3865,7 +3865,7 @@  discard block
 block discarded – undo
3865 3865
             }
3866 3866
         }
3867 3867
         $sortordertouseinlink = preg_replace('/,$/', '', $sortordertouseinlink);
3868
-        $out .= '<a class="reposition" href="' . $file . '?sortfield=' . $field . '&sortorder=' . $sortordertouseinlink . '&begin=' . $begin . $options . '">';
3868
+        $out .= '<a class="reposition" href="'.$file.'?sortfield='.$field.'&sortorder='.$sortordertouseinlink.'&begin='.$begin.$options.'">';
3869 3869
     }
3870 3870
 
3871 3871
     if ($tooltip) {
@@ -3883,7 +3883,7 @@  discard block
 block discarded – undo
3883 3883
         $options = preg_replace('/sortorder=([a-zA-Z0-9,\s\.]+)/i', '', $options);
3884 3884
         $options = preg_replace('/&+/i', '&', $options);
3885 3885
         if (!preg_match('/^&/', $options)) {
3886
-            $options = '&' . $options;
3886
+            $options = '&'.$options;
3887 3887
         }
3888 3888
 
3889 3889
         if (!$sortorder || $field1 != $sortfield1) {
@@ -3893,19 +3893,19 @@  discard block
 block discarded – undo
3893 3893
             if (preg_match('/^DESC/', $sortorder)) {
3894 3894
                 //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",0).'</a>';
3895 3895
                 //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'.img_up("Z-A",1).'</a>';
3896
-                $sortimg .= '<span class="nowrap">' . img_up("Z-A", 0) . '</span>';
3896
+                $sortimg .= '<span class="nowrap">'.img_up("Z-A", 0).'</span>';
3897 3897
             }
3898 3898
             if (preg_match('/^ASC/', $sortorder)) {
3899 3899
                 //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=asc&begin='.$begin.$options.'">'.img_down("A-Z",1).'</a>';
3900 3900
                 //$out.= '<a href="'.$file.'?sortfield='.$field.'&sortorder=desc&begin='.$begin.$options.'">'.img_up("Z-A",0).'</a>';
3901
-                $sortimg .= '<span class="nowrap">' . img_down("A-Z", 0) . '</span>';
3901
+                $sortimg .= '<span class="nowrap">'.img_down("A-Z", 0).'</span>';
3902 3902
             }
3903 3903
         }
3904 3904
     }
3905 3905
 
3906 3906
     $out .= $sortimg;
3907 3907
 
3908
-    $out .= '</' . $tag . '>';
3908
+    $out .= '</'.$tag.'>';
3909 3909
 
3910 3910
     return $out;
3911 3911
 }
@@ -3920,9 +3920,9 @@  discard block
 block discarded – undo
3920 3920
  */
3921 3921
 function print_titre($title)
3922 3922
 {
3923
-    dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
3923
+    dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING);
3924 3924
 
3925
-    print '<div class="titre">' . $title . '</div>';
3925
+    print '<div class="titre">'.$title.'</div>';
3926 3926
 }
3927 3927
 
3928 3928
 /**
@@ -3965,20 +3965,20 @@  discard block
 block discarded – undo
3965 3965
     }
3966 3966
 
3967 3967
     $return .= "\n";
3968
-    $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
3968
+    $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
3969 3969
     if ($picto) {
3970
-        $return .= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">' . img_picto('', $picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath) . '</td>';
3970
+        $return .= '<td class="nobordernopadding widthpictotitle opacityhigh" valign="middle">'.img_picto('', $picto, 'class="valignmiddle widthpictotitle pictotitle"', $pictoisfullpath).'</td>';
3971 3971
     }
3972 3972
     $return .= '<td class="nobordernopadding valignmiddle">';
3973
-    $return .= '<div class="titre inline-block">' . $titre . '</div>';
3973
+    $return .= '<div class="titre inline-block">'.$titre.'</div>';
3974 3974
     $return .= '</td>';
3975 3975
     if (dol_strlen($morehtmlcenter)) {
3976
-        $return .= '<td class="nobordernopadding" align="center" valign="middle">' . $morehtmlcenter . '</td>';
3976
+        $return .= '<td class="nobordernopadding" align="center" valign="middle">'.$morehtmlcenter.'</td>';
3977 3977
     }
3978 3978
     if (dol_strlen($morehtmlright)) {
3979
-        $return .= '<td class="nobordernopadding titre_right wordbreak" align="right" valign="middle">' . $morehtmlright . '</td>';
3979
+        $return .= '<td class="nobordernopadding titre_right wordbreak" align="right" valign="middle">'.$morehtmlright.'</td>';
3980 3980
     }
3981
-    $return .= '</tr></table>' . "\n";
3981
+    $return .= '</tr></table>'."\n";
3982 3982
 
3983 3983
     return $return;
3984 3984
 }
@@ -4026,29 +4026,29 @@  discard block
 block discarded – undo
4026 4026
     //print 'totalnboflines='.$totalnboflines.'-savlimit='.$savlimit.'-limit='.$limit.'-num='.$num.'-nextpage='.$nextpage;
4027 4027
 
4028 4028
     print "\n";
4029
-    print "<!-- Begin title '" . $titre . "' -->\n";
4030
-    print '<table border="0" class="centpercent notopnoleftnoright' . ($morecss ? ' ' . $morecss : '') . '" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into load_fiche_tire
4029
+    print "<!-- Begin title '".$titre."' -->\n";
4030
+    print '<table border="0" class="centpercent notopnoleftnoright'.($morecss ? ' '.$morecss : '').'" style="margin-bottom: 6px;"><tr>'; // maring bottom must be same than into load_fiche_tire
4031 4031
     // Left
4032 4032
     //if ($picto && $titre) print '<td class="nobordernopadding hideonsmartphone" width="40" align="left" valign="middle">'.img_picto('', $picto, 'id="pictotitle"', $pictoisfullpath).'</td>';
4033 4033
     print '<td class="nobordernopadding valignmiddle">';
4034 4034
     if ($picto && $titre)
4035 4035
         print img_picto('', $picto, 'class="hideonsmartphone valignmiddle opacityhigh pictotitle widthpictotitle"', $pictoisfullpath);
4036
-    print '<div class="titre inline-block">' . $titre;
4036
+    print '<div class="titre inline-block">'.$titre;
4037 4037
     if (!empty($titre) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '')
4038
-        print ' (' . $totalnboflines . ')';
4038
+        print ' ('.$totalnboflines.')';
4039 4039
     print '</div></td>';
4040 4040
 
4041 4041
     // Center
4042 4042
     if ($morehtmlcenter) {
4043
-        print '<td class="nobordernopadding center valignmiddle">' . $morehtmlcenter . '</td>';
4043
+        print '<td class="nobordernopadding center valignmiddle">'.$morehtmlcenter.'</td>';
4044 4044
     }
4045 4045
 
4046 4046
     // Right
4047 4047
     print '<td class="nobordernopadding valignmiddle" align="right">';
4048 4048
     if ($sortfield)
4049
-        $options .= "&sortfield=" . urlencode($sortfield);
4049
+        $options .= "&sortfield=".urlencode($sortfield);
4050 4050
     if ($sortorder)
4051
-        $options .= "&sortorder=" . urlencode($sortorder);
4051
+        $options .= "&sortorder=".urlencode($sortorder);
4052 4052
     // Show navigation bar
4053 4053
     $pagelist = '';
4054 4054
     if ($savlimit != 0 && ($page > 0 || $num > $limit)) {
@@ -4066,40 +4066,40 @@  discard block
 block discarded – undo
4066 4066
             }
4067 4067
 
4068 4068
             if ($cpt >= 1) {
4069
-                $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=0' . $options . '">1</a></li>';
4069
+                $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page=0'.$options.'">1</a></li>';
4070 4070
                 if ($cpt > 2)
4071
-                    $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . (($conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>';
4071
+                    $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.(($conf->dol_use_jmobile != 4) ? 'class="inactive"' : '').'>...</span></li>';
4072 4072
                 else if ($cpt == 2)
4073
-                    $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=1' . $options . '">2</a></li>';
4073
+                    $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page=1'.$options.'">2</a></li>';
4074 4074
             }
4075 4075
 
4076 4076
             do {
4077 4077
                 if ($cpt == $page) {
4078
-                    $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . (($conf->dol_use_jmobile != 4) ? 'class="active"' : '') . '>' . ($page + 1) . '</span></li>';
4078
+                    $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.(($conf->dol_use_jmobile != 4) ? 'class="active"' : '').'>'.($page + 1).'</span></li>';
4079 4079
                 } else {
4080
-                    $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . $cpt . $options . '">' . ($cpt + 1) . '</a></li>';
4080
+                    $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page='.$cpt.$options.'">'.($cpt + 1).'</a></li>';
4081 4081
                 }
4082 4082
                 $cpt++;
4083 4083
             } while ($cpt < $nbpages && $cpt <= $page + $maxnbofpage);
4084 4084
 
4085 4085
             if ($cpt < $nbpages) {
4086 4086
                 if ($cpt < $nbpages - 2)
4087
-                    $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . (($conf->dol_use_jmobile != 4) ? 'class="inactive"' : '') . '>...</span></li>';
4087
+                    $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.(($conf->dol_use_jmobile != 4) ? 'class="inactive"' : '').'>...</span></li>';
4088 4088
                 else if ($cpt == $nbpages - 2)
4089
-                    $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 2) . $options . '">' . ($nbpages - 1) . '</a></li>';
4090
-                $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><a href="' . $file . '?page=' . ($nbpages - 1) . $options . '">' . $nbpages . '</a></li>';
4089
+                    $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page='.($nbpages - 2).$options.'">'.($nbpages - 1).'</a></li>';
4090
+                $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><a href="'.$file.'?page='.($nbpages - 1).$options.'">'.$nbpages.'</a></li>';
4091 4091
             }
4092 4092
         }
4093 4093
         else {
4094
-            $pagelist .= '<li' . (($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '') . '><span ' . (($conf->dol_use_jmobile != 4) ? 'class="active"' : '') . '>' . ($page + 1) . "</li>";
4094
+            $pagelist .= '<li'.(($conf->dol_use_jmobile != 4) ? ' class="pagination"' : '').'><span '.(($conf->dol_use_jmobile != 4) ? 'class="active"' : '').'>'.($page + 1)."</li>";
4095 4095
         }
4096 4096
     }
4097 4097
 
4098
-    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
4098
+    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
4099 4099
 
4100 4100
     print '</td>';
4101 4101
 
4102
-    print '</tr></table>' . "\n";
4102
+    print '</tr></table>'."\n";
4103 4103
     print "<!-- End title -->\n\n";
4104 4104
 }
4105 4105
 
@@ -4130,12 +4130,12 @@  discard block
 block discarded – undo
4130 4130
             $pagesizechoices = $conf->global->MAIN_PAGESIZE_CHOICES;
4131 4131
 
4132 4132
         print '<li class="pagination">';
4133
-        print '<select class="flat selectlimit" name="limit" title="' . dol_escape_htmltag($langs->trans("MaxNbOfRecordPerPage")) . '">';
4133
+        print '<select class="flat selectlimit" name="limit" title="'.dol_escape_htmltag($langs->trans("MaxNbOfRecordPerPage")).'">';
4134 4134
         $tmpchoice = explode(',', $pagesizechoices);
4135
-        $tmpkey = $limit . ':' . $limit;
4135
+        $tmpkey = $limit.':'.$limit;
4136 4136
         if (!in_array($tmpkey, $tmpchoice))
4137 4137
             $tmpchoice[] = $tmpkey;
4138
-        $tmpkey = $conf->liste_limit . ':' . $conf->liste_limit;
4138
+        $tmpkey = $conf->liste_limit.':'.$conf->liste_limit;
4139 4139
         if (!in_array($tmpkey, $tmpchoice))
4140 4140
             $tmpchoice[] = $tmpkey;
4141 4141
         asort($tmpchoice, SORT_NUMERIC);
@@ -4150,7 +4150,7 @@  discard block
 block discarded – undo
4150 4150
                     $selected = ' selected="selected"';
4151 4151
                     $found = true;
4152 4152
                 }
4153
-                print '<option name="' . $key . '"' . $selected . '>' . dol_escape_htmltag($val) . '</option>' . "\n";
4153
+                print '<option name="'.$key.'"'.$selected.'>'.dol_escape_htmltag($val).'</option>'."\n";
4154 4154
             }
4155 4155
         }
4156 4156
         print '</select>';
@@ -4169,20 +4169,20 @@  discard block
 block discarded – undo
4169 4169
         print '</li>';
4170 4170
     }
4171 4171
     if ($page > 0) {
4172
-        print '<li class="pagination"><a class="paginationprevious" href="' . $file . '?page=' . ($page - 1) . $options . '"><i class="fa fa-chevron-left" title="' . dol_escape_htmltag($langs->trans("Previous")) . '"></i></a></li>';
4172
+        print '<li class="pagination"><a class="paginationprevious" href="'.$file.'?page='.($page - 1).$options.'"><i class="fa fa-chevron-left" title="'.dol_escape_htmltag($langs->trans("Previous")).'"></i></a></li>';
4173 4173
     }
4174 4174
     if ($betweenarrows) {
4175 4175
         print $betweenarrows;
4176 4176
     }
4177 4177
     if ($nextpage > 0) {
4178
-        print '<li class="pagination"><a class="paginationnext" href="' . $file . '?page=' . ($page + 1) . $options . '"><i class="fa fa-chevron-right" title="' . dol_escape_htmltag($langs->trans("Next")) . '"></i></a></li>';
4178
+        print '<li class="pagination"><a class="paginationnext" href="'.$file.'?page='.($page + 1).$options.'"><i class="fa fa-chevron-right" title="'.dol_escape_htmltag($langs->trans("Next")).'"></i></a></li>';
4179 4179
     }
4180 4180
     if ($afterarrows) {
4181 4181
         print '<li class="paginationafterarrows">';
4182 4182
         print $afterarrows;
4183 4183
         print '</li>';
4184 4184
     }
4185
-    print '</ul></div>' . "\n";
4185
+    print '</ul></div>'."\n";
4186 4186
 }
4187 4187
 
4188 4188
 /**
@@ -4204,8 +4204,8 @@  discard block
 block discarded – undo
4204 4204
         $addpercent = true;
4205 4205
     }
4206 4206
     if (preg_match('/\((.*)\)/', $rate, $reg)) {
4207
-        $morelabel = ' (' . $reg[1] . ')';
4208
-        $rate = preg_replace('/\s*' . preg_quote($morelabel, '/') . '/', '', $rate);
4207
+        $morelabel = ' ('.$reg[1].')';
4208
+        $rate = preg_replace('/\s*'.preg_quote($morelabel, '/').'/', '', $rate);
4209 4209
     }
4210 4210
     if (preg_match('/\*/', $rate)) {
4211 4211
         $rate = str_replace('*', '', $rate);
@@ -4214,10 +4214,10 @@  discard block
 block discarded – undo
4214 4214
 
4215 4215
     // If rate is '9/9/9' we don't change it.  If rate is '9.000' we apply price()
4216 4216
     if (!preg_match('/\//', $rate))
4217
-        $ret = price($rate, 0, '', 0, 0) . ($addpercent ? '%' : '');
4217
+        $ret = price($rate, 0, '', 0, 0).($addpercent ? '%' : '');
4218 4218
     else {
4219 4219
         // TODO Split on / and output with a price2num to have clean numbers without ton of 000.
4220
-        $ret = $rate . ($addpercent ? '%' : '');
4220
+        $ret = $rate.($addpercent ? '%' : '');
4221 4221
     }
4222 4222
     if (($info_bits & 1) && $usestarfornpr >= 0)
4223 4223
         $ret .= ' *';
@@ -4311,10 +4311,10 @@  discard block
 block discarded – undo
4311 4311
             $cursymbolbefore .= $outlangs->getCurrencySymbol($currency_code);
4312 4312
         else {
4313 4313
             $tmpcur = $outlangs->getCurrencySymbol($currency_code);
4314
-            $cursymbolafter .= ($tmpcur == $currency_code ? ' ' . $tmpcur : $tmpcur);
4314
+            $cursymbolafter .= ($tmpcur == $currency_code ? ' '.$tmpcur : $tmpcur);
4315 4315
         }
4316 4316
     }
4317
-    $output = $cursymbolbefore . $output . $end . ($cursymbolafter ? ' ' : '') . $cursymbolafter;
4317
+    $output = $cursymbolbefore.$output.$end.($cursymbolafter ? ' ' : '').$cursymbolafter;
4318 4318
 
4319 4319
     return $output;
4320 4320
 }
@@ -4368,7 +4368,7 @@  discard block
 block discarded – undo
4368 4368
         // Now make replace (the main goal of function)
4369 4369
         if ($thousand != ',' && $thousand != '.')
4370 4370
             $amount = str_replace(',', '.', $amount); // To accept 2 notations for french users
4371
-        $amount = str_replace(' ', '', $amount);  // To avoid spaces
4371
+        $amount = str_replace(' ', '', $amount); // To avoid spaces
4372 4372
         $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is .
4373 4373
         $amount = str_replace($dec, '.', $amount);
4374 4374
     }
@@ -4397,14 +4397,14 @@  discard block
 block discarded – undo
4397 4397
             $temps = sprintf("%0.10F", $amount - intval($amount)); // temps=0.0000000000 or 0.0000200000 or 9999.1000000000
4398 4398
             $temps = preg_replace('/([\.1-9])0+$/', '\\1', $temps); // temps=0. or 0.00002 or 9999.1
4399 4399
             $nbofdec = max(0, dol_strlen($temps) - 2); // -2 to remove "0."
4400
-            $amount = number_format($amount, min($nbofdec, $nbofdectoround), $dec, $thousand);  // Convert amount to format with dolibarr dec and thousand
4400
+            $amount = number_format($amount, min($nbofdec, $nbofdectoround), $dec, $thousand); // Convert amount to format with dolibarr dec and thousand
4401 4401
         }
4402 4402
         //print "TT".$amount.'<br>';
4403 4403
         // Always make replace because each math function (like round) replace
4404 4404
         // with local values and we want a number that has a SQL string format x.y
4405 4405
         if ($thousand != ',' && $thousand != '.')
4406 4406
             $amount = str_replace(',', '.', $amount); // To accept 2 notations for french users
4407
-        $amount = str_replace(' ', '', $amount);  // To avoid spaces
4407
+        $amount = str_replace(' ', '', $amount); // To avoid spaces
4408 4408
         $amount = str_replace($thousand, '', $amount); // Replace of thousand before replace of dec to avoid pb if thousand is .
4409 4409
         $amount = str_replace($dec, '.', $amount);
4410 4410
     }
@@ -4425,7 +4425,7 @@  discard block
 block discarded – undo
4425 4425
  */
4426 4426
 function showDimensionInBestUnit($dimension, $unit, $type, $outputlangs, $round = -1, $forceunitoutput = 'no')
4427 4427
 {
4428
-    require_once DOL_BASE_PATH . '/core/lib/product.lib.php';
4428
+    require_once DOL_BASE_PATH.'/core/lib/product.lib.php';
4429 4429
 
4430 4430
     if (($forceunitoutput == 'no' && $dimension < 1 / 10000) || (is_numeric($forceunitoutput) && $forceunitoutput == -6)) {
4431 4431
         $dimension = $dimension * 1000000;
@@ -4441,7 +4441,7 @@  discard block
 block discarded – undo
4441 4441
         $unit = $unit + 3;
4442 4442
     }
4443 4443
 
4444
-    $ret = price($dimension, 0, $outputlangs, 0, 0, $round) . ' ' . measuring_units_string($unit, $type);
4444
+    $ret = price($dimension, 0, $outputlangs, 0, 0, $round).' '.measuring_units_string($unit, $type);
4445 4445
 
4446 4446
     return $ret;
4447 4447
 }
@@ -4465,7 +4465,7 @@  discard block
 block discarded – undo
4465 4465
     if (empty($thirdparty_seller) || !is_object($thirdparty_seller))
4466 4466
         $thirdparty_seller = $mysoc;
4467 4467
 
4468
-    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);
4468
+    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);
4469 4469
 
4470 4470
     $vatratecleaned = $vatrate;
4471 4471
     if (preg_match('/^(.*)\s*\((.*)\)$/', $vatrate, $reg)) {      // If vat is "xx (yy)"
@@ -4496,7 +4496,7 @@  discard block
 block discarded – undo
4496 4496
         if ($local == 2) {
4497 4497
             //if (! $mysoc->localtax2_assuj || (string) $vatratecleaned == "0") return 0;
4498 4498
             if (!$mysoc->localtax2_assuj)
4499
-                return 0;  // If main vat is 0, IRPF may be different than 0.
4499
+                return 0; // If main vat is 0, IRPF may be different than 0.
4500 4500
             if ($thirdparty_seller->id == $mysoc->id) {
4501 4501
                 if (!$thirdparty_buyer->localtax2_assuj)
4502 4502
                     return 0;
@@ -4550,13 +4550,13 @@  discard block
 block discarded – undo
4550 4550
 
4551 4551
     // By default, search value of local tax on line of common tax
4552 4552
     $sql = "SELECT t.localtax1, t.localtax2, t.localtax1_type, t.localtax2_type";
4553
-    $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c";
4554
-    $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $thirdparty_seller->country_code . "'";
4555
-    $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1";
4553
+    $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
4554
+    $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$thirdparty_seller->country_code."'";
4555
+    $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
4556 4556
     if ($vatratecode)
4557
-        $sql .= " AND t.code ='" . $vatratecode . "'";  // If we have the code, we use it in priority
4557
+        $sql .= " AND t.code ='".$vatratecode."'"; // If we have the code, we use it in priority
4558 4558
     else
4559
-        $sql .= " AND t.recuperableonly ='" . $vatnpr . "'";
4559
+        $sql .= " AND t.recuperableonly ='".$vatnpr."'";
4560 4560
     dol_syslog("get_localtax", LOG_DEBUG);
4561 4561
     $resql = $db->query($sql);
4562 4562
 
@@ -4602,10 +4602,10 @@  discard block
 block discarded – undo
4602 4602
 {
4603 4603
     global $db, $mysoc;
4604 4604
     $sql = "SELECT t.localtax1, t.localtax2 ";
4605
-    $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t inner join " . MAIN_DB_PREFIX . "c_country as c ON c.rowid=t.fk_pays";
4606
-    $sql .= " WHERE c.code = '" . $mysoc->country_code . "' AND t.active = 1 AND t.taux=(";
4607
-    $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";
4608
-    $sql .= "  WHERE c.code = '" . $mysoc->country_code . "' AND tt.active = 1";
4605
+    $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t inner join ".MAIN_DB_PREFIX."c_country as c ON c.rowid=t.fk_pays";
4606
+    $sql .= " WHERE c.code = '".$mysoc->country_code."' AND t.active = 1 AND t.taux=(";
4607
+    $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";
4608
+    $sql .= "  WHERE c.code = '".$mysoc->country_code."' AND tt.active = 1";
4609 4609
     $sql .= "  )";
4610 4610
 
4611 4611
     $resql = $db->query($sql);
@@ -4635,13 +4635,13 @@  discard block
 block discarded – undo
4635 4635
 {
4636 4636
     global $db, $mysoc;
4637 4637
 
4638
-    dol_syslog("getTaxesFromId vat id or rate = " . $vatrate);
4638
+    dol_syslog("getTaxesFromId vat id or rate = ".$vatrate);
4639 4639
 
4640 4640
     // Search local taxes
4641 4641
     $sql = "SELECT t.rowid, t.code, t.taux as rate, t.recuperableonly as npr, t.accountancy_code_sell, t.accountancy_code_buy";
4642
-    $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t";
4642
+    $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
4643 4643
     if ($firstparamisid)
4644
-        $sql .= " WHERE t.rowid = " . (int) $vatrate;
4644
+        $sql .= " WHERE t.rowid = ".(int) $vatrate;
4645 4645
     else {
4646 4646
         $vatratecleaned = $vatrate;
4647 4647
         $vatratecode = '';
@@ -4650,13 +4650,13 @@  discard block
 block discarded – undo
4650 4650
             $vatratecode = $reg[2];
4651 4651
         }
4652 4652
 
4653
-        $sql .= ", " . MAIN_DB_PREFIX . "c_country as c";
4653
+        $sql .= ", ".MAIN_DB_PREFIX."c_country as c";
4654 4654
         /* 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 ??
4655 4655
           else $sql.= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'"; */
4656
-        $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'";
4657
-        $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1";
4656
+        $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'";
4657
+        $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
4658 4658
         if ($vatratecode)
4659
-            $sql .= " AND t.code = '" . $vatratecode . "'";
4659
+            $sql .= " AND t.code = '".$vatratecode."'";
4660 4660
     }
4661 4661
 
4662 4662
     $resql = $db->query($sql);
@@ -4692,13 +4692,13 @@  discard block
 block discarded – undo
4692 4692
 {
4693 4693
     global $db, $mysoc;
4694 4694
 
4695
-    dol_syslog("getLocalTaxesFromRate vatrate=" . $vatrate . " local=" . $local);
4695
+    dol_syslog("getLocalTaxesFromRate vatrate=".$vatrate." local=".$local);
4696 4696
 
4697 4697
     // Search local taxes
4698 4698
     $sql = "SELECT t.localtax1, t.localtax1_type, t.localtax2, t.localtax2_type, t.accountancy_code_sell, t.accountancy_code_buy";
4699
-    $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t";
4699
+    $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t";
4700 4700
     if ($firstparamisid)
4701
-        $sql .= " WHERE t.rowid = " . (int) $vatrate;
4701
+        $sql .= " WHERE t.rowid = ".(int) $vatrate;
4702 4702
     else {
4703 4703
         $vatratecleaned = $vatrate;
4704 4704
         $vatratecode = '';
@@ -4707,14 +4707,14 @@  discard block
 block discarded – undo
4707 4707
             $vatratecode = $reg[2];
4708 4708
         }
4709 4709
 
4710
-        $sql .= ", " . MAIN_DB_PREFIX . "c_country as c";
4710
+        $sql .= ", ".MAIN_DB_PREFIX."c_country as c";
4711 4711
         if ($mysoc->country_code == 'ES')
4712
-            $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $buyer->country_code . "'";    // local tax in spain use the buyer country ??
4712
+            $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$buyer->country_code."'"; // local tax in spain use the buyer country ??
4713 4713
         else
4714
-            $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '" . $seller->country_code . "'";
4715
-        $sql .= " AND t.taux = " . ((float) $vatratecleaned) . " AND t.active = 1";
4714
+            $sql .= " WHERE t.fk_pays = c.rowid AND c.code = '".$seller->country_code."'";
4715
+        $sql .= " AND t.taux = ".((float) $vatratecleaned)." AND t.active = 1";
4716 4716
         if ($vatratecode)
4717
-            $sql .= " AND t.code = '" . $vatratecode . "'";
4717
+            $sql .= " AND t.code = '".$vatratecode."'";
4718 4718
     }
4719 4719
 
4720 4720
     $resql = $db->query($sql);
@@ -4746,7 +4746,7 @@  discard block
 block discarded – undo
4746 4746
 {
4747 4747
     global $db, $conf, $mysoc;
4748 4748
 
4749
-    require_once DOL_BASE_PATH . '/product/class/product.class.php';
4749
+    require_once DOL_BASE_PATH.'/product/class/product.class.php';
4750 4750
 
4751 4751
     $ret = 0;
4752 4752
     $found = 0;
@@ -4761,12 +4761,12 @@  discard block
 block discarded – undo
4761 4761
                 $product->get_buyprice($idprodfournprice, 0, 0, 0);
4762 4762
                 $ret = $product->vatrate_supplier;
4763 4763
                 if ($product->default_vat_code)
4764
-                    $ret .= ' (' . $product->default_vat_code . ')';
4764
+                    $ret .= ' ('.$product->default_vat_code.')';
4765 4765
             }
4766 4766
             else {
4767
-                $ret = $product->tva_tx;    // Default vat of product we defined
4767
+                $ret = $product->tva_tx; // Default vat of product we defined
4768 4768
                 if ($product->default_vat_code)
4769
-                    $ret .= ' (' . $product->default_vat_code . ')';
4769
+                    $ret .= ' ('.$product->default_vat_code.')';
4770 4770
             }
4771 4771
             $found = 1;
4772 4772
         }
@@ -4780,8 +4780,8 @@  discard block
 block discarded – undo
4780 4780
         if (empty($conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS)) {
4781 4781
             // If vat of product for the country not found or not defined, we return the first higher vat of country.
4782 4782
             $sql = "SELECT t.taux as vat_rate, t.code as default_vat_code";
4783
-            $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c";
4784
-            $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='" . $thirdparty_seller->country_code . "'";
4783
+            $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
4784
+            $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'";
4785 4785
             $sql .= " ORDER BY t.taux DESC, t.code ASC, t.recuperableonly ASC";
4786 4786
             $sql .= $db->plimit(1);
4787 4787
 
@@ -4791,16 +4791,16 @@  discard block
 block discarded – undo
4791 4791
                 if ($obj) {
4792 4792
                     $ret = $obj->vat_rate;
4793 4793
                     if ($obj->default_vat_code)
4794
-                        $ret .= ' (' . $obj->default_vat_code . ')';
4794
+                        $ret .= ' ('.$obj->default_vat_code.')';
4795 4795
                 }
4796 4796
                 $db->free($sql);
4797 4797
             } else
4798 4798
                 dol_print_error($db);
4799 4799
         } else
4800
-            $ret = $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS;    // Forced value if autodetect fails
4800
+            $ret = $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS; // Forced value if autodetect fails
4801 4801
     }
4802 4802
 
4803
-    dol_syslog("get_product_vat_for_country: ret=" . $ret);
4803
+    dol_syslog("get_product_vat_for_country: ret=".$ret);
4804 4804
     return $ret;
4805 4805
 }
4806 4806
 
@@ -4818,7 +4818,7 @@  discard block
 block discarded – undo
4818 4818
     global $db, $mysoc;
4819 4819
 
4820 4820
     if (!class_exists('Product')) {
4821
-        require_once DOL_BASE_PATH . 'product/class/product.class.php';
4821
+        require_once DOL_BASE_PATH.'product/class/product.class.php';
4822 4822
     }
4823 4823
 
4824 4824
     $ret = 0;
@@ -4843,8 +4843,8 @@  discard block
 block discarded – undo
4843 4843
     if (!$found) {
4844 4844
         // If vat of product for the country not found or not defined, we return higher vat of country.
4845 4845
         $sql = "SELECT taux as vat_rate, localtax1, localtax2";
4846
-        $sql .= " FROM " . MAIN_DB_PREFIX . "c_tva as t, " . MAIN_DB_PREFIX . "c_country as c";
4847
-        $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='" . $thirdparty_seller->country_code . "'";
4846
+        $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_country as c";
4847
+        $sql .= " WHERE t.active=1 AND t.fk_pays = c.rowid AND c.code='".$thirdparty_seller->country_code."'";
4848 4848
         $sql .= " ORDER BY t.taux DESC, t.recuperableonly ASC";
4849 4849
         $sql .= $db->plimit(1);
4850 4850
 
@@ -4861,7 +4861,7 @@  discard block
 block discarded – undo
4861 4861
             dol_print_error($db);
4862 4862
     }
4863 4863
 
4864
-    dol_syslog("get_product_localtax_for_country: ret=" . $ret);
4864
+    dol_syslog("get_product_localtax_for_country: ret=".$ret);
4865 4865
     return $ret;
4866 4866
 }
4867 4867
 
@@ -4885,7 +4885,7 @@  discard block
 block discarded – undo
4885 4885
 {
4886 4886
     global $conf;
4887 4887
 
4888
-    require_once DOL_BASE_PATH . '/core/lib/company.lib.php';
4888
+    require_once DOL_BASE_PATH.'/core/lib/company.lib.php';
4889 4889
 
4890 4890
     // Note: possible values for tva_assuj are 0/1 or franchise/reel
4891 4891
     $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;
@@ -4896,7 +4896,7 @@  discard block
 block discarded – undo
4896 4896
     $buyer_country_code = $thirdparty_buyer->country_code;
4897 4897
     $buyer_in_cee = isInEEC($thirdparty_buyer);
4898 4898
 
4899
-    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($conf->global->SERVICES_ARE_ECOMMERCE_200238EC) ? $conf->global->SERVICES_ARE_ECOMMERCE_200238EC : ''));
4899
+    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($conf->global->SERVICES_ARE_ECOMMERCE_200238EC) ? $conf->global->SERVICES_ARE_ECOMMERCE_200238EC : ''));
4900 4900
 
4901 4901
     // 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)
4902 4902
     // we use the buyer VAT.
@@ -4962,14 +4962,14 @@  discard block
 block discarded – undo
4962 4962
 
4963 4963
     if ($idprodfournprice > 0) {
4964 4964
         if (!class_exists('ProductFournisseur'))
4965
-            require_once DOL_BASE_PATH . '/fourn/class/fournisseur.product.class.php';
4965
+            require_once DOL_BASE_PATH.'/fourn/class/fournisseur.product.class.php';
4966 4966
         $prodprice = new ProductFournisseur($db);
4967 4967
         $prodprice->fetch_product_fournisseur_price($idprodfournprice);
4968 4968
         return $prodprice->fourn_tva_npr;
4969 4969
     }
4970 4970
     elseif ($idprod > 0) {
4971 4971
         if (!class_exists('Product'))
4972
-            require_once DOL_BASE_PATH . 'product/class/product.class.php';
4972
+            require_once DOL_BASE_PATH.'product/class/product.class.php';
4973 4973
         $prod = new Product($db);
4974 4974
         $prod->fetch($idprod);
4975 4975
         return $prod->tva_npr;
@@ -5048,7 +5048,7 @@  discard block
 block discarded – undo
5048 5048
         if ($case == 2)
5049 5049
             $result = '<input type="checkbox" value="1" checked disabled>';
5050 5050
         if ($case == 3)
5051
-            $result = '<input type="checkbox" value="1" checked disabled> ' . $result;
5051
+            $result = '<input type="checkbox" value="1" checked disabled> '.$result;
5052 5052
 
5053 5053
         $classname = 'ok';
5054 5054
     }
@@ -5059,7 +5059,7 @@  discard block
 block discarded – undo
5059 5059
         if ($case == 2)
5060 5060
             $result = '<input type="checkbox" value="0" disabled>';
5061 5061
         if ($case == 3)
5062
-            $result = '<input type="checkbox" value="0" disabled> ' . $result;
5062
+            $result = '<input type="checkbox" value="0" disabled> '.$result;
5063 5063
 
5064 5064
         if ($color == 2)
5065 5065
             $classname = 'ok';
@@ -5067,7 +5067,7 @@  discard block
 block discarded – undo
5067 5067
             $classname = 'error';
5068 5068
     }
5069 5069
     if ($color)
5070
-        return '<font class="' . $classname . '">' . $result . '</font>';
5070
+        return '<font class="'.$classname.'">'.$result.'</font>';
5071 5071
     return $result;
5072 5072
 }
5073 5073
 
@@ -5101,13 +5101,13 @@  discard block
 block discarded – undo
5101 5101
             $num = preg_replace('/([^0-9])/i', '', $num);
5102 5102
         else
5103 5103
             $num = preg_replace('/^.*\-/i', '', $num);
5104
-        $num = substr("000" . $num, -$level);
5104
+        $num = substr("000".$num, -$level);
5105 5105
         if ($level == 1)
5106 5106
             $path = substr($num, 0, 1);
5107 5107
         if ($level == 2)
5108
-            $path = substr($num, 1, 1) . '/' . substr($num, 0, 1);
5108
+            $path = substr($num, 1, 1).'/'.substr($num, 0, 1);
5109 5109
         if ($level == 3)
5110
-            $path = substr($num, 2, 1) . '/' . substr($num, 1, 1) . '/' . substr($num, 0, 1);
5110
+            $path = substr($num, 2, 1).'/'.substr($num, 1, 1).'/'.substr($num, 0, 1);
5111 5111
     }
5112 5112
     else {
5113 5113
         // TODO
@@ -5138,7 +5138,7 @@  discard block
 block discarded – undo
5138 5138
 {
5139 5139
     global $conf;
5140 5140
 
5141
-    dol_syslog("functions.lib::dol_mkdir: dir=" . $dir, LOG_INFO);
5141
+    dol_syslog("functions.lib::dol_mkdir: dir=".$dir, LOG_INFO);
5142 5142
 
5143 5143
     $dir_osencoded = dol_osencode($dir);
5144 5144
     if (@is_dir($dir_osencoded))
@@ -5150,15 +5150,15 @@  discard block
 block discarded – undo
5150 5150
     $ccdir = '';
5151 5151
     if (!empty($dataroot)) {
5152 5152
         // Remove data root from loop
5153
-        $dir = str_replace($dataroot . '/', '', $dir);
5154
-        $ccdir = $dataroot . '/';
5153
+        $dir = str_replace($dataroot.'/', '', $dir);
5154
+        $ccdir = $dataroot.'/';
5155 5155
     }
5156 5156
 
5157 5157
     $cdir = explode("/", $dir);
5158 5158
     $num = count($cdir);
5159 5159
     for ($i = 0; $i < $num; $i++) {
5160 5160
         if ($i > 0)
5161
-            $ccdir .= '/' . $cdir[$i];
5161
+            $ccdir .= '/'.$cdir[$i];
5162 5162
         else
5163 5163
             $ccdir .= $cdir[$i];
5164 5164
         if (preg_match("/^.:$/", $ccdir, $regs))
@@ -5185,20 +5185,20 @@  discard block
 block discarded – undo
5185 5185
         if ($ccdir) {
5186 5186
             $ccdir_osencoded = dol_osencode($ccdir);
5187 5187
             if (!@is_dir($ccdir_osencoded)) {
5188
-                dol_syslog("functions.lib::dol_mkdir: Directory '" . $ccdir . "' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG);
5188
+                dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' does not exists or is outside open_basedir PHP setting.", LOG_DEBUG);
5189 5189
 
5190 5190
                 umask(0);
5191 5191
                 $dirmaskdec = octdec($newmask);
5192 5192
                 if (empty($newmask)) {
5193 5193
                     $dirmaskdec = empty($conf->global->MAIN_UMASK) ? octdec('0755') : octdec($conf->global->MAIN_UMASK);
5194 5194
                 }
5195
-                $dirmaskdec |= octdec('0111');  // Set x bit required for directories
5195
+                $dirmaskdec |= octdec('0111'); // Set x bit required for directories
5196 5196
                 if (!@mkdir($ccdir_osencoded, $dirmaskdec)) {
5197 5197
                     // Si le is_dir a renvoye une fausse info, alors on passe ici.
5198
-                    dol_syslog("functions.lib::dol_mkdir: Fails to create directory '" . $ccdir . "' or directory already exists.", LOG_WARNING);
5198
+                    dol_syslog("functions.lib::dol_mkdir: Fails to create directory '".$ccdir."' or directory already exists.", LOG_WARNING);
5199 5199
                     $nberr++;
5200 5200
                 } else {
5201
-                    dol_syslog("functions.lib::dol_mkdir: Directory '" . $ccdir . "' created", LOG_DEBUG);
5201
+                    dol_syslog("functions.lib::dol_mkdir: Directory '".$ccdir."' created", LOG_DEBUG);
5202 5202
                     $nberr = 0; // On remet a zero car si on arrive ici, cela veut dire que les echecs precedents peuvent etre ignore
5203 5203
                     $nbcreated++;
5204 5204
                 }
@@ -5246,9 +5246,9 @@  discard block
 block discarded – undo
5246 5246
     } else {
5247 5247
         $pattern = "/<[^<>]+>/";
5248 5248
         // Exemple of $temp: <a href="/myurl" title="<u>A title</u>">0000-021</a>
5249
-        $temp = preg_replace($pattern, "", $temp);    // pass 1
5249
+        $temp = preg_replace($pattern, "", $temp); // pass 1
5250 5250
         // $temp after pass 1: <a href="/myurl" title="A title">0000-021
5251
-        $temp = preg_replace($pattern, "", $temp);    // pass 2
5251
+        $temp = preg_replace($pattern, "", $temp); // pass 2
5252 5252
         // $temp after pass 2: 0000-021
5253 5253
     }
5254 5254
 
@@ -5304,8 +5304,8 @@  discard block
 block discarded – undo
5304 5304
 {
5305 5305
     $temp = $stringtoclean;
5306 5306
     foreach ($disallowed_tags as $tagtoremove) {
5307
-        $temp = preg_replace('/<\/?' . $tagtoremove . '>/', '', $temp);
5308
-        $temp = preg_replace('/<\/?' . $tagtoremove . '\s+[^>]*>/', '', $temp);
5307
+        $temp = preg_replace('/<\/?'.$tagtoremove.'>/', '', $temp);
5308
+        $temp = preg_replace('/<\/?'.$tagtoremove.'\s+[^>]*>/', '', $temp);
5309 5309
     }
5310 5310
     return $temp;
5311 5311
 }
@@ -5322,12 +5322,12 @@  discard block
 block discarded – undo
5322 5322
 {
5323 5323
     if ($nboflines == 1) {
5324 5324
         if (dol_textishtml($text)) {
5325
-            $firstline = preg_replace('/<br[^>]*>.*$/s', '', $text);  // The s pattern modifier means the . can match newline characters
5325
+            $firstline = preg_replace('/<br[^>]*>.*$/s', '', $text); // The s pattern modifier means the . can match newline characters
5326 5326
             $firstline = preg_replace('/<div[^>]*>.*$/s', '', $firstline); // The s pattern modifier means the . can match newline characters
5327 5327
         } else {
5328 5328
             $firstline = preg_replace('/[\n\r].*/', '', $text);
5329 5329
         }
5330
-        return $firstline . ((strlen($firstline) != strlen($text)) ? '...' : '');
5330
+        return $firstline.((strlen($firstline) != strlen($text)) ? '...' : '');
5331 5331
     } else {
5332 5332
         $ishtml = 0;
5333 5333
         if (dol_textishtml($text)) {
@@ -5343,7 +5343,7 @@  discard block
 block discarded – undo
5343 5343
             $pattern = '/(<br[^>]*>)/Uu';
5344 5344
         } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
5345 5345
         else
5346
-            $pattern = '/(<br[^>]*>)/U';       // /U is to have UNGREEDY regex to limit to one html tag.
5346
+            $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag.
5347 5347
         $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
5348 5348
 
5349 5349
         $firstline = '';
@@ -5357,7 +5357,7 @@  discard block
 block discarded – undo
5357 5357
             $i++;
5358 5358
         }
5359 5359
         unset($a);
5360
-        return $firstline . (($i < $nba) ? '...' : '');
5360
+        return $firstline.(($i < $nba) ? '...' : '');
5361 5361
     }
5362 5362
 }
5363 5363
 
@@ -5428,9 +5428,9 @@  discard block
 block discarded – undo
5428 5428
 function dol_htmlentitiesbr_decode($stringtodecode, $pagecodeto = 'UTF-8')
5429 5429
 {
5430 5430
     $ret = dol_html_entity_decode($stringtodecode, ENT_COMPAT, $pagecodeto);
5431
-    $ret = preg_replace('/' . "\r\n" . '<br(\s[\sa-zA-Z_="]*)?\/?>/i', "<br>", $ret);
5432
-    $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>' . "\r\n" . '/i', "\r\n", $ret);
5433
-    $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>' . "\n" . '/i', "\n", $ret);
5431
+    $ret = preg_replace('/'."\r\n".'<br(\s[\sa-zA-Z_="]*)?\/?>/i', "<br>", $ret);
5432
+    $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>'."\r\n".'/i', "\r\n", $ret);
5433
+    $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>'."\n".'/i', "\n", $ret);
5434 5434
     $ret = preg_replace('/<br(\s[\sa-zA-Z_="]*)?\/?>/i', "\n", $ret);
5435 5435
     return $ret;
5436 5436
 }
@@ -5443,7 +5443,7 @@  discard block
 block discarded – undo
5443 5443
  */
5444 5444
 function dol_htmlcleanlastbr($stringtodecode)
5445 5445
 {
5446
-    $ret = preg_replace('/(<br>|<br(\s[\sa-zA-Z_="]*)?\/?>|' . "\n" . '|' . "\r" . ')+$/i', "", $stringtodecode);
5446
+    $ret = preg_replace('/(<br>|<br(\s[\sa-zA-Z_="]*)?\/?>|'."\n".'|'."\r".')+$/i', "", $stringtodecode);
5447 5447
     return $ret;
5448 5448
 }
5449 5449
 
@@ -5540,7 +5540,7 @@  discard block
 block discarded – undo
5540 5540
         $pattern = '/(<br[^>]*>)/Uu';
5541 5541
     } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support
5542 5542
     else
5543
-        $pattern = '/(<br[^>]*>)/U';       // /U is to have UNGREEDY regex to limit to one html tag.
5543
+        $pattern = '/(<br[^>]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag.
5544 5544
     $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
5545 5545
 
5546 5546
     $nblines = (int) floor((count($a) + 1) / 2);
@@ -5571,7 +5571,7 @@  discard block
 block discarded – undo
5571 5571
  */
5572 5572
 function dol_microtime_float()
5573 5573
 {
5574
-    dol_syslog(__FUNCTION__ . " is deprecated", LOG_WARNING);
5574
+    dol_syslog(__FUNCTION__." is deprecated", LOG_WARNING);
5575 5575
 
5576 5576
     return microtime(true);
5577 5577
 }
@@ -5617,9 +5617,9 @@  discard block
 block discarded – undo
5617 5617
         elseif (preg_match('/<h[0-9]>/i', $msg))
5618 5618
             return true;
5619 5619
         elseif (preg_match('/&[A-Z0-9]{1,6};/i', $msg))
5620
-            return true;    // Html entities names (http://www.w3schools.com/tags/ref_entities.asp)
5620
+            return true; // Html entities names (http://www.w3schools.com/tags/ref_entities.asp)
5621 5621
         elseif (preg_match('/&#[0-9]{2,3};/i', $msg))
5622
-            return true;    // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp)
5622
+            return true; // Html entities numbers (http://www.w3schools.com/tags/ref_entities.asp)
5623 5623
 
5624 5624
         return false;
5625 5625
     }
@@ -5844,7 +5844,7 @@  discard block
 block discarded – undo
5844 5844
                 if ($object->fetch_optionals() > 0) {
5845 5845
                     if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) {
5846 5846
                         foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) {
5847
-                            $substitutionarray['__EXTRAFIELD_' . strtoupper($key) . '__'] = $object->array_options['options_' . $key];
5847
+                            $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = $object->array_options['options_'.$key];
5848 5848
                         }
5849 5849
                     }
5850 5850
                 }
@@ -5856,7 +5856,7 @@  discard block
 block discarded – undo
5856 5856
                 $paymenturl = '';
5857 5857
             } else {
5858 5858
                 // Set the online payment url link into __ONLINE_PAYMENT_URL__ key
5859
-                require_once DOL_BASE_PATH . '/core/lib/payments.lib.php';
5859
+                require_once DOL_BASE_PATH.'/core/lib/payments.lib.php';
5860 5860
                 $outputlangs->loadLangs(array('paypal', 'other'));
5861 5861
                 $typeforonlinepayment = 'free';
5862 5862
                 if (is_object($object) && $object->element == 'commande')
@@ -5917,7 +5917,7 @@  discard block
 block discarded – undo
5917 5917
 
5918 5918
     //var_dump($substitutionarray['__AMOUNT_FORMATED__']);
5919 5919
     if (empty($exclude) || !in_array('date', $exclude)) {
5920
-        include_once DOL_BASE_PATH . '/core/lib/date.lib.php';
5920
+        include_once DOL_BASE_PATH.'/core/lib/date.lib.php';
5921 5921
 
5922 5922
         $tmp = dol_getdate(dol_now(), true);
5923 5923
         $tmp2 = dol_get_prev_day($tmp['mday'], $tmp['mon'], $tmp['year']);
@@ -5927,13 +5927,13 @@  discard block
 block discarded – undo
5927 5927
 
5928 5928
         $substitutionarray = array_merge($substitutionarray, array(
5929 5929
             '__DAY__' => (string) $tmp['mday'],
5930
-            '__DAY_TEXT__' => $outputlangs->trans('Day' . $tmp['wday']), // Monday
5931
-            '__DAY_TEXT_SHORT__' => $outputlangs->trans($tmp['weekday'] . 'Min'), // Mon
5932
-            '__DAY_TEXT_MIN__' => $outputlangs->trans('Short' . $tmp['weekday']), // M
5930
+            '__DAY_TEXT__' => $outputlangs->trans('Day'.$tmp['wday']), // Monday
5931
+            '__DAY_TEXT_SHORT__' => $outputlangs->trans($tmp['weekday'].'Min'), // Mon
5932
+            '__DAY_TEXT_MIN__' => $outputlangs->trans('Short'.$tmp['weekday']), // M
5933 5933
             '__MONTH__' => (string) $tmp['mon'],
5934
-            '__MONTH_TEXT__' => $outputlangs->trans('Month' . sprintf("%02d", $tmp['mon'])),
5935
-            '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort' . sprintf("%02d", $tmp['mon'])),
5936
-            '__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort' . sprintf("%02d", $tmp['mon'])),
5934
+            '__MONTH_TEXT__' => $outputlangs->trans('Month'.sprintf("%02d", $tmp['mon'])),
5935
+            '__MONTH_TEXT_SHORT__' => $outputlangs->trans('MonthShort'.sprintf("%02d", $tmp['mon'])),
5936
+            '__MONTH_TEXT_MIN__' => $outputlangs->trans('MonthVeryShort'.sprintf("%02d", $tmp['mon'])),
5937 5937
             '__YEAR__' => (string) $tmp['year'],
5938 5938
             '__PREVIOUS_DAY__' => (string) $tmp2['day'],
5939 5939
             '__PREVIOUS_MONTH__' => (string) $tmp3['month'],
@@ -5992,7 +5992,7 @@  discard block
 block discarded – undo
5992 5992
             if (!empty($tmp[1]))
5993 5993
                 $outputlangs->load($tmp[1]);
5994 5994
 
5995
-            $text = preg_replace('/__\(' . preg_quote($reg[1], '/') . '\)__/', $msgishtml ? dol_htmlentitiesbr($outputlangs->transnoentitiesnoconv($reg[1])) : $outputlangs->transnoentitiesnoconv($reg[1]), $text);
5995
+            $text = preg_replace('/__\('.preg_quote($reg[1], '/').'\)__/', $msgishtml ? dol_htmlentitiesbr($outputlangs->transnoentitiesnoconv($reg[1])) : $outputlangs->transnoentitiesnoconv($reg[1]), $text);
5996 5996
         }
5997 5997
     }
5998 5998
 
@@ -6008,13 +6008,13 @@  discard block
 block discarded – undo
6008 6008
             $newval = '*****forbidden*****';
6009 6009
         else
6010 6010
             $newval = empty($conf->global->$keyfound) ? '' : $conf->global->$keyfound;
6011
-        $text = preg_replace('/__\[' . preg_quote($keyfound, '/') . '\]__/', $msgishtml ? dol_htmlentitiesbr($newval) : $newval, $text);
6011
+        $text = preg_replace('/__\['.preg_quote($keyfound, '/').'\]__/', $msgishtml ? dol_htmlentitiesbr($newval) : $newval, $text);
6012 6012
     }
6013 6013
 
6014 6014
     // Make substitition for array $substitutionarray
6015 6015
     foreach ($substitutionarray as $key => $value) {
6016 6016
         if ($key == '__SIGNATURE__' && (!empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)))
6017
-            $value = '';  // Protection
6017
+            $value = ''; // Protection
6018 6018
         if ($key == '__USER_SIGNATURE__' && (!empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)))
6019 6019
             $value = ''; // Protection
6020 6020
 
@@ -6040,7 +6040,7 @@  discard block
 block discarded – undo
6040 6040
 {
6041 6041
     global $conf, $user;
6042 6042
 
6043
-    require_once DOL_BASE_PATH . '/core/lib/files.lib.php';
6043
+    require_once DOL_BASE_PATH.'/core/lib/files.lib.php';
6044 6044
 
6045 6045
     // Add a substitution key for each extrafields, using key __EXTRA_XXX__
6046 6046
     // TODO Remove this. Already available into the getCommonSubstitutionArray used to build the substitution array.
@@ -6070,11 +6070,11 @@  discard block
 block discarded – undo
6070 6070
             if (preg_match('/functions_(.*)\.lib\.php/i', $substitfile['name'], $reg)) {
6071 6071
                 $module = $reg[1];
6072 6072
 
6073
-                dol_syslog("Library " . $substitfile['name'] . " found into " . $dir);
6073
+                dol_syslog("Library ".$substitfile['name']." found into ".$dir);
6074 6074
                 // Include the user's functions file
6075
-                require_once $dir . $substitfile['name'];
6075
+                require_once $dir.$substitfile['name'];
6076 6076
                 // Call the user's function, and only if it is defined
6077
-                $function_name = $module . "_" . $callfunc;
6077
+                $function_name = $module."_".$callfunc;
6078 6078
                 if (function_exists($function_name))
6079 6079
                     $function_name($substitutionarray, $outputlangs, $object, $parameters);
6080 6080
             }
@@ -6116,13 +6116,13 @@  discard block
 block discarded – undo
6116 6116
         $outputlangs = $langs;
6117 6117
 
6118 6118
     if ($date_start && $date_end) {
6119
-        $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateFromTo', dol_print_date($date_start, $format, false, $outputlangs), dol_print_date($date_end, $format, false, $outputlangs)) . ($withparenthesis ? ')' : '');
6119
+        $out .= ($withparenthesis ? ' (' : '').$outputlangs->transnoentitiesnoconv('DateFromTo', dol_print_date($date_start, $format, false, $outputlangs), dol_print_date($date_end, $format, false, $outputlangs)).($withparenthesis ? ')' : '');
6120 6120
     }
6121 6121
     if ($date_start && !$date_end) {
6122
-        $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateFrom', dol_print_date($date_start, $format, false, $outputlangs)) . ($withparenthesis ? ')' : '');
6122
+        $out .= ($withparenthesis ? ' (' : '').$outputlangs->transnoentitiesnoconv('DateFrom', dol_print_date($date_start, $format, false, $outputlangs)).($withparenthesis ? ')' : '');
6123 6123
     }
6124 6124
     if (!$date_start && $date_end) {
6125
-        $out .= ($withparenthesis ? ' (' : '') . $outputlangs->transnoentitiesnoconv('DateUntil', dol_print_date($date_end, $format, false, $outputlangs)) . ($withparenthesis ? ')' : '');
6125
+        $out .= ($withparenthesis ? ' (' : '').$outputlangs->transnoentitiesnoconv('DateUntil', dol_print_date($date_end, $format, false, $outputlangs)).($withparenthesis ? ')' : '');
6126 6126
     }
6127 6127
 
6128 6128
     return $out;
@@ -6202,7 +6202,7 @@  discard block
 block discarded – undo
6202 6202
         dol_syslog("Try to add a message in stack with empty message", LOG_WARNING);
6203 6203
     } else {
6204 6204
         if (!in_array((string) $style, array('mesgs', 'warnings', 'errors')))
6205
-            dol_print_error('', 'Bad parameter style=' . $style . ' for setEventMessages');
6205
+            dol_print_error('', 'Bad parameter style='.$style.' for setEventMessages');
6206 6206
         if (empty($mesgs))
6207 6207
             setEventMessage($mesg, $style);
6208 6208
         else {
@@ -6271,7 +6271,7 @@  discard block
 block discarded – undo
6271 6271
 
6272 6272
     // If inline message with no format, we add it.
6273 6273
     if ((empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) || $keepembedded) && !preg_match('/<div class=".*">/i', $out)) {
6274
-        $divstart = '<div class="' . $style . ' clearboth">';
6274
+        $divstart = '<div class="'.$style.' clearboth">';
6275 6275
         $divend = '</div>';
6276 6276
     }
6277 6277
 
@@ -6298,14 +6298,14 @@  discard block
 block discarded – undo
6298 6298
         if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && empty($keepembedded)) {
6299 6299
             $return = '<script type="text/javascript">
6300 6300
 					$(document).ready(function() {
6301
-						var block = ' . (!empty($conf->global->MAIN_USE_JQUERY_BLOCKUI) ? "true" : "false") . '
6301
+						var block = ' . (!empty($conf->global->MAIN_USE_JQUERY_BLOCKUI) ? "true" : "false").'
6302 6302
 						if (block) {
6303
-							$.dolEventValid("","' . dol_escape_js($out) . '");
6303
+							$.dolEventValid("","' . dol_escape_js($out).'");
6304 6304
 						} else {
6305 6305
 							/* jnotify(message, preset of message type, keepmessage) */
6306
-							$.jnotify("' . dol_escape_js($out) . '",
6307
-							"' . ($style == "ok" ? 3000 : $style) . '",
6308
-							' . ($style == "ok" ? "false" : "true") . ',
6306
+							$.jnotify("' . dol_escape_js($out).'",
6307
+							"' . ($style == "ok" ? 3000 : $style).'",
6308
+							' . ($style == "ok" ? "false" : "true").',
6309 6309
 							{ remove: function (){} } );
6310 6310
 						}
6311 6311
 					});
@@ -6500,11 +6500,11 @@  discard block
 block discarded – undo
6500 6500
 {
6501 6501
     global $conf;
6502 6502
 
6503
-    $tmp = ini_get("unicode.filesystem_encoding");      // Disponible avec PHP 6.0
6503
+    $tmp = ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
6504 6504
     if (empty($tmp) && !empty($_SERVER["WINDIR"]))
6505 6505
         $tmp = 'iso-8859-1'; // By default for windows
6506 6506
     if (empty($tmp))
6507
-        $tmp = 'utf-8';          // By default for other
6507
+        $tmp = 'utf-8'; // By default for other
6508 6508
     if (!empty($conf->global->MAIN_FILESYSTEM_ENCODING))
6509 6509
         $tmp = $conf->global->MAIN_FILESYSTEM_ENCODING;
6510 6510
 
@@ -6536,16 +6536,16 @@  discard block
 block discarded – undo
6536 6536
 
6537 6537
     // Check in cache
6538 6538
     if (isset($cache_codes[$tablename][$key][$fieldid])) { // Can be defined to 0 or ''
6539
-        return $cache_codes[$tablename][$key][$fieldid];   // Found in cache
6539
+        return $cache_codes[$tablename][$key][$fieldid]; // Found in cache
6540 6540
     }
6541 6541
 
6542 6542
     dol_syslog('dol_getIdFromCode (value not found into cache)', LOG_DEBUG);
6543 6543
 
6544
-    $sql = "SELECT " . $fieldid . " as valuetoget";
6545
-    $sql .= " FROM " . MAIN_DB_PREFIX . $tablename;
6546
-    $sql .= " WHERE " . $fieldkey . " = '" . $db->escape($key) . "'";
6544
+    $sql = "SELECT ".$fieldid." as valuetoget";
6545
+    $sql .= " FROM ".MAIN_DB_PREFIX.$tablename;
6546
+    $sql .= " WHERE ".$fieldkey." = '".$db->escape($key)."'";
6547 6547
     if (!empty($entityfilter))
6548
-        $sql .= " AND entity IN (" . getEntity($tablename) . ")";
6548
+        $sql .= " AND entity IN (".getEntity($tablename).")";
6549 6549
 
6550 6550
     $resql = $db->query($sql);
6551 6551
     if ($resql) {
@@ -6572,12 +6572,12 @@  discard block
 block discarded – undo
6572 6572
 {
6573 6573
     global $user, $conf, $langs;
6574 6574
     global $leftmenu;
6575
-    global $rights;    // To export to dol_eval function
6575
+    global $rights; // To export to dol_eval function
6576 6576
     //print $strRights."<br>\n";
6577 6577
     $rights = true;
6578 6578
     if ($strRights != '') {
6579
-        $str = 'if(!(' . $strRights . ')) { $rights = false; }';
6580
-        dol_eval($str);  // The dol_eval must contains all the global $xxx used into a condition
6579
+        $str = 'if(!('.$strRights.')) { $rights = false; }';
6580
+        dol_eval($str); // The dol_eval must contains all the global $xxx used into a condition
6581 6581
     }
6582 6582
     return $rights;
6583 6583
 }
@@ -6600,14 +6600,14 @@  discard block
 block discarded – undo
6600 6600
     global $object;
6601 6601
     global $mysoc;
6602 6602
 
6603
-    global $obj;       // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object
6604
-    global $soc;       // For backward compatibility
6603
+    global $obj; // To get $obj used into list when dol_eval is used for computed fields and $obj is not yet $object
6604
+    global $soc; // For backward compatibility
6605 6605
     //print $s."<br>\n";
6606 6606
     if ($returnvalue) {
6607 6607
         if ($hideerrors)
6608
-            return @eval('return ' . $s . ';');
6608
+            return @eval('return '.$s.';');
6609 6609
         else
6610
-            return eval('return ' . $s . ';');
6610
+            return eval('return '.$s.';');
6611 6611
     }
6612 6612
     else {
6613 6613
         if ($hideerrors)
@@ -6661,7 +6661,7 @@  discard block
 block discarded – undo
6661 6661
         $flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1];
6662 6662
     }
6663 6663
 
6664
-    return img_picto_common($codelang, 'flags/' . strtolower($flagImage) . '.png', $moreatt);
6664
+    return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt);
6665 6665
 }
6666 6666
 
6667 6667
 /**
@@ -6859,16 +6859,16 @@  discard block
 block discarded – undo
6859 6859
         'zu-ZA',
6860 6860
     );
6861 6861
 
6862
-    $buildprimarykeytotest = strtolower($countrycode) . '-' . strtoupper($countrycode);
6862
+    $buildprimarykeytotest = strtolower($countrycode).'-'.strtoupper($countrycode);
6863 6863
     if (in_array($buildprimarykeytotest, $locales))
6864
-        return strtolower($countrycode) . '_' . strtoupper($countrycode);
6864
+        return strtolower($countrycode).'_'.strtoupper($countrycode);
6865 6865
 
6866 6866
     foreach ($locales as $locale) {
6867 6867
         $locale_language = locale_get_primary_language($locale);
6868 6868
         $locale_region = locale_get_region($locale);
6869 6869
         if (strtoupper($countrycode) == $locale_region) {
6870 6870
             //var_dump($locale.'-'.$locale_language.'-'.$locale_region);
6871
-            return strtolower($locale_language) . '_' . strtoupper($locale_region);
6871
+            return strtolower($locale_language).'_'.strtoupper($locale_region);
6872 6872
         }
6873 6873
     }
6874 6874
 
@@ -6929,7 +6929,7 @@  discard block
 block discarded – undo
6929 6929
                             $label = $langs->trans($values[2]);
6930 6930
 
6931 6931
                         //$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]), 1);
6932
-                        $head[$h][0] = BASE_URI . preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]);
6932
+                        $head[$h][0] = BASE_URI.preg_replace('/__ID__/i', ((is_object($object) && !empty($object->id)) ? $object->id : ''), $values[5]);
6933 6933
                         $head[$h][1] = $label;
6934 6934
                         $head[$h][2] = str_replace('+', '', $values[1]);
6935 6935
                         $h++;
@@ -7000,43 +7000,43 @@  discard block
 block discarded – undo
7000 7000
     global $micro_start_time;
7001 7001
 
7002 7002
     if ($zone == 'private')
7003
-        print "\n" . '<!-- Common footer for private page -->' . "\n";
7003
+        print "\n".'<!-- Common footer for private page -->'."\n";
7004 7004
     else
7005
-        print "\n" . '<!-- Common footer for public page -->' . "\n";
7005
+        print "\n".'<!-- Common footer for public page -->'."\n";
7006 7006
 
7007 7007
     // A div to store page_y POST parameter so we can read it using javascript
7008 7008
     print "\n<!-- A div to store page_y POST paramater -->\n";
7009
-    print '<div id="page_y" style="display: none;">' . $_POST['page_y'] . '</div>' . "\n";
7009
+    print '<div id="page_y" style="display: none;">'.$_POST['page_y'].'</div>'."\n";
7010 7010
 
7011 7011
     $parameters = array();
7012
-    $reshook = $hookmanager->executeHooks('printCommonFooter', $parameters);    // Note that $action and $object may have been modified by some hooks
7012
+    $reshook = $hookmanager->executeHooks('printCommonFooter', $parameters); // Note that $action and $object may have been modified by some hooks
7013 7013
     if (empty($reshook)) {
7014 7014
         if (!empty($conf->global->MAIN_HTML_FOOTER))
7015
-            print $conf->global->MAIN_HTML_FOOTER . "\n";
7015
+            print $conf->global->MAIN_HTML_FOOTER."\n";
7016 7016
 
7017 7017
         print "\n";
7018 7018
         if (!empty($conf->use_javascript_ajax)) {
7019
-            print '<script type="text/javascript" language="javascript">' . "\n";
7020
-            print 'jQuery(document).ready(function() {' . "\n";
7019
+            print '<script type="text/javascript" language="javascript">'."\n";
7020
+            print 'jQuery(document).ready(function() {'."\n";
7021 7021
 
7022 7022
             if ($zone == 'private' && empty($conf->dol_use_jmobile)) {
7023 7023
                 print "\n";
7024
-                print '/* JS CODE TO ENABLE to manage handler to switch left menu page (menuhider) */' . "\n";
7024
+                print '/* JS CODE TO ENABLE to manage handler to switch left menu page (menuhider) */'."\n";
7025 7025
                 print 'jQuery(".menuhider").click(function() {';
7026
-                print '  console.log("We click on .menuhider");' . "\n";
7026
+                print '  console.log("We click on .menuhider");'."\n";
7027 7027
                 //print "  $('.side-nav').animate({width:'toggle'},200);\n";     // OK with eldy theme but not with md
7028 7028
                 print "  $('.side-nav').toggle()\n";
7029 7029
                 print "  $('.login_block').toggle()\n";
7030
-                print '});' . "\n";
7030
+                print '});'."\n";
7031 7031
             }
7032 7032
 
7033 7033
             // Management of focus and mandatory for fields
7034 7034
             if ($action == 'create' || $action == 'edit' || (empty($action) && (preg_match('/new\.php/', $_SERVER["PHP_SELF"])))) {
7035
-                print '/* JS CODE TO ENABLE to manage focus and mandatory form fields */' . "\n";
7035
+                print '/* JS CODE TO ENABLE to manage focus and mandatory form fields */'."\n";
7036 7036
                 $relativepathstring = $_SERVER["PHP_SELF"];
7037 7037
                 // Clean $relativepathstring
7038 7038
                 if (constant('DOL_URL_ROOT'))
7039
-                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_URL_ROOT'), '/') . '/', '', $relativepathstring);
7039
+                    $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_URL_ROOT'), '/').'/', '', $relativepathstring);
7040 7040
                 $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
7041 7041
                 $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
7042 7042
                 $tmpqueryarraywehave = explode('&', dol_string_nohtmltag($_SERVER['QUERY_STRING']));
@@ -7059,9 +7059,9 @@  discard block
 block discarded – undo
7059 7059
                         if ($qualified) {
7060 7060
                             foreach ($defval as $paramkey => $paramval) {
7061 7061
                                 // Set focus on field
7062
-                                print 'jQuery("input[name=\'' . $paramkey . '\']").focus();' . "\n";
7063
-                                print 'jQuery("textarea[name=\'' . $paramkey . '\']").focus();' . "\n";
7064
-                                print 'jQuery("select[name=\'' . $paramkey . '\']").focus();' . "\n";  // Not really usefull, but we keep it in case of.
7062
+                                print 'jQuery("input[name=\''.$paramkey.'\']").focus();'."\n";
7063
+                                print 'jQuery("textarea[name=\''.$paramkey.'\']").focus();'."\n";
7064
+                                print 'jQuery("select[name=\''.$paramkey.'\']").focus();'."\n"; // Not really usefull, but we keep it in case of.
7065 7065
                             }
7066 7066
                         }
7067 7067
                     }
@@ -7085,16 +7085,16 @@  discard block
 block discarded – undo
7085 7085
                         if ($qualified) {
7086 7086
                             foreach ($defval as $paramkey => $paramval) {
7087 7087
                                 // Add property 'required' on input
7088
-                                print 'jQuery("input[name=\'' . $paramkey . '\']").prop(\'required\',true);' . "\n";
7089
-                                print 'jQuery("textarea[name=\'' . $paramkey . '\']").prop(\'required\',true);' . "\n";
7090
-                                print 'jQuery("select[name=\'' . $paramkey . '\']").prop(\'required\',true);' . "\n";  // required on a select works only if key is "", this does not happen in Dolibarr
7088
+                                print 'jQuery("input[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n";
7089
+                                print 'jQuery("textarea[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n";
7090
+                                print 'jQuery("select[name=\''.$paramkey.'\']").prop(\'required\',true);'."\n"; // required on a select works only if key is "", this does not happen in Dolibarr
7091 7091
                             }
7092 7092
                         }
7093 7093
                     }
7094 7094
                 }
7095 7095
             }
7096 7096
 
7097
-            print '});' . "\n";
7097
+            print '});'."\n";
7098 7098
 
7099 7099
             // Google Analytics
7100 7100
             // TODO Add a hook here
@@ -7102,15 +7102,15 @@  discard block
 block discarded – undo
7102 7102
                 if (($conf->dol_use_jmobile != 4)) {
7103 7103
                     print "\n";
7104 7104
                     print "/* JS CODE TO ENABLE for google analtics tag */\n";
7105
-                    print '  var _gaq = _gaq || [];' . "\n";
7106
-                    print '  _gaq.push([\'_setAccount\', \'' . $conf->global->MAIN_GOOGLE_AN_ID . '\']);' . "\n";
7107
-                    print '  _gaq.push([\'_trackPageview\']);' . "\n";
7108
-                    print '' . "\n";
7109
-                    print '  (function() {' . "\n";
7110
-                    print '    var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;' . "\n";
7111
-                    print '    ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';' . "\n";
7112
-                    print '    var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);' . "\n";
7113
-                    print '  })();' . "\n";
7105
+                    print '  var _gaq = _gaq || [];'."\n";
7106
+                    print '  _gaq.push([\'_setAccount\', \''.$conf->global->MAIN_GOOGLE_AN_ID.'\']);'."\n";
7107
+                    print '  _gaq.push([\'_trackPageview\']);'."\n";
7108
+                    print ''."\n";
7109
+                    print '  (function() {'."\n";
7110
+                    print '    var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;'."\n";
7111
+                    print '    ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';'."\n";
7112
+                    print '    var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);'."\n";
7113
+                    print '  })();'."\n";
7114 7114
                 }
7115 7115
             }
7116 7116
 
@@ -7120,27 +7120,27 @@  discard block
 block discarded – undo
7120 7120
                 print "/* JS CODE TO ENABLE to add memory info */\n";
7121 7121
                 print 'window.console && console.log("';
7122 7122
                 if (!empty($conf->global->MEMCACHED_SERVER))
7123
-                    print 'MEMCACHED_SERVER=' . $conf->global->MEMCACHED_SERVER . ' - ';
7124
-                print 'MAIN_OPTIMIZE_SPEED=' . (isset($conf->global->MAIN_OPTIMIZE_SPEED) ? $conf->global->MAIN_OPTIMIZE_SPEED : 'off');
7123
+                    print 'MEMCACHED_SERVER='.$conf->global->MEMCACHED_SERVER.' - ';
7124
+                print 'MAIN_OPTIMIZE_SPEED='.(isset($conf->global->MAIN_OPTIMIZE_SPEED) ? $conf->global->MAIN_OPTIMIZE_SPEED : 'off');
7125 7125
                 if (!empty($micro_start_time)) {   // Works only if MAIN_SHOW_TUNING_INFO is defined at $_SERVER level. Not in global variable.
7126 7126
                     $micro_end_time = microtime(true);
7127
-                    print ' - Build time: ' . ceil(1000 * ($micro_end_time - $micro_start_time)) . ' ms';
7127
+                    print ' - Build time: '.ceil(1000 * ($micro_end_time - $micro_start_time)).' ms';
7128 7128
                 }
7129 7129
                 if (function_exists("memory_get_usage")) {
7130
-                    print ' - Mem: ' . memory_get_usage();
7130
+                    print ' - Mem: '.memory_get_usage();
7131 7131
                 }
7132 7132
                 if (function_exists("xdebug_memory_usage")) {
7133
-                    print ' - XDebug time: ' . ceil(1000 * xdebug_time_index()) . ' ms';
7134
-                    print ' - XDebug mem: ' . xdebug_memory_usage();
7135
-                    print ' - XDebug mem peak: ' . xdebug_peak_memory_usage();
7133
+                    print ' - XDebug time: '.ceil(1000 * xdebug_time_index()).' ms';
7134
+                    print ' - XDebug mem: '.xdebug_memory_usage();
7135
+                    print ' - XDebug mem peak: '.xdebug_peak_memory_usage();
7136 7136
                 }
7137 7137
                 if (function_exists("zend_loader_file_encoded")) {
7138
-                    print ' - Zend encoded file: ' . (zend_loader_file_encoded() ? 'yes' : 'no');
7138
+                    print ' - Zend encoded file: '.(zend_loader_file_encoded() ? 'yes' : 'no');
7139 7139
                 }
7140
-                print '");' . "\n";
7140
+                print '");'."\n";
7141 7141
             }
7142 7142
 
7143
-            print "\n" . '</script>' . "\n";
7143
+            print "\n".'</script>'."\n";
7144 7144
         }
7145 7145
 
7146 7146
         // Add Xdebug coverage of code
@@ -7154,7 +7154,7 @@  discard block
 block discarded – undo
7154 7154
             print "<!-- Start of log output\n";
7155 7155
             //print '<div class="hidden">'."\n";
7156 7156
             foreach ($conf->logbuffer as $logline) {
7157
-                print $logline . "<br>\n";
7157
+                print $logline."<br>\n";
7158 7158
             }
7159 7159
             //print '</div>'."\n";
7160 7160
             print "End of log output -->\n";
@@ -7197,8 +7197,8 @@  discard block
 block discarded – undo
7197 7197
  */
7198 7198
 function dol_set_focus($selector)
7199 7199
 {
7200
-    print "\n" . '<!-- Set focus onto a specific field -->' . "\n";
7201
-    print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("' . dol_escape_js($selector) . '").focus(); });</script>' . "\n";
7200
+    print "\n".'<!-- Set focus onto a specific field -->'."\n";
7201
+    print '<script type="text/javascript" language="javascript">jQuery(document).ready(function() { jQuery("'.dol_escape_js($selector).'").focus(); });</script>'."\n";
7202 7202
 }
7203 7203
 
7204 7204
 /**
@@ -7243,7 +7243,7 @@  discard block
 block discarded – undo
7243 7243
         $value = preg_replace('/\*/', '%', $value); // Replace * with %
7244 7244
     }
7245 7245
     if ($mode == 1) {
7246
-        $value = preg_replace('/([<>=]+)\s+([0-9' . preg_quote($langs->trans("DecimalSeparator"), '/') . '\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
7246
+        $value = preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
7247 7247
     }
7248 7248
 
7249 7249
     $value = preg_replace('/\s*\|\s*/', '|', $value);
@@ -7272,14 +7272,14 @@  discard block
 block discarded – undo
7272 7272
                 if ($newcrit != '') {
7273 7273
                     $numnewcrit = price2num($newcrit);
7274 7274
                     if (is_numeric($numnewcrit)) {
7275
-                        $newres .= ($i2 > 0 ? ' OR ' : '') . $field . ' ' . $operator . ' ' . $numnewcrit;
7275
+                        $newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.$numnewcrit;
7276 7276
                     } else {
7277
-                        $newres .= ($i2 > 0 ? ' OR ' : '') . '1 = 2'; // force false
7277
+                        $newres .= ($i2 > 0 ? ' OR ' : '').'1 = 2'; // force false
7278 7278
                     }
7279 7279
                     $i2++; // a criteria was added to string
7280 7280
                 }
7281 7281
             } else if ($mode == 2) {
7282
-                $newres .= ($i2 > 0 ? ' OR ' : '') . $field . " IN (" . $db->escape(trim($crit)) . ")";
7282
+                $newres .= ($i2 > 0 ? ' OR ' : '').$field." IN (".$db->escape(trim($crit)).")";
7283 7283
                 $i2++; // a criteria was added to string
7284 7284
             } else if ($mode == 3) {
7285 7285
                 $tmparray = explode(',', trim($crit));
@@ -7288,10 +7288,10 @@  discard block
 block discarded – undo
7288 7288
                     foreach ($tmparray as $val) {
7289 7289
                         if ($val) {
7290 7290
                             $listofcodes .= ($listofcodes ? ',' : '');
7291
-                            $listofcodes .= "'" . $db->escape(trim($val)) . "'";
7291
+                            $listofcodes .= "'".$db->escape(trim($val))."'";
7292 7292
                         }
7293 7293
                     }
7294
-                    $newres .= ($i2 > 0 ? ' OR ' : '') . $field . " IN (" . $listofcodes . ")";
7294
+                    $newres .= ($i2 > 0 ? ' OR ' : '').$field." IN (".$listofcodes.")";
7295 7295
                     $i2++; // a criteria was added to string
7296 7296
                 }
7297 7297
             } else if ($mode == 4) {
@@ -7300,10 +7300,10 @@  discard block
 block discarded – undo
7300 7300
                     $listofcodes = '';
7301 7301
                     foreach ($tmparray as $val) {
7302 7302
                         if ($val) {
7303
-                            $newres .= ($i2 > 0 ? ' OR (' : '(') . $field . ' LIKE \'' . $db->escape(trim($val)) . ',%\'';
7304
-                            $newres .= ' OR ' . $field . ' = \'' . $db->escape(trim($val)) . '\'';
7305
-                            $newres .= ' OR ' . $field . ' LIKE \'%,' . $db->escape(trim($val)) . '\'';
7306
-                            $newres .= ' OR ' . $field . ' LIKE \'%,' . $db->escape(trim($val)) . ',%\'';
7303
+                            $newres .= ($i2 > 0 ? ' OR (' : '(').$field.' LIKE \''.$db->escape(trim($val)).',%\'';
7304
+                            $newres .= ' OR '.$field.' = \''.$db->escape(trim($val)).'\'';
7305
+                            $newres .= ' OR '.$field.' LIKE \'%,'.$db->escape(trim($val)).'\'';
7306
+                            $newres .= ' OR '.$field.' LIKE \'%,'.$db->escape(trim($val)).',%\'';
7307 7307
                             $newres .= ')';
7308 7308
                             $i2++;
7309 7309
                         }
@@ -7320,9 +7320,9 @@  discard block
 block discarded – undo
7320 7320
                     $newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : '');
7321 7321
 
7322 7322
                     if (preg_match('/\.(id|rowid)$/', $field)) { // Special case for rowid that is sometimes a ref so used as a search field
7323
-                        $newres .= $field . " = " . (is_numeric(trim($tmpcrit)) ? trim($tmpcrit) : '0');
7323
+                        $newres .= $field." = ".(is_numeric(trim($tmpcrit)) ? trim($tmpcrit) : '0');
7324 7324
                     } else {
7325
-                        $newres .= $field . " LIKE '";
7325
+                        $newres .= $field." LIKE '";
7326 7326
 
7327 7327
                         $tmpcrit = trim($tmpcrit);
7328 7328
                         $tmpcrit2 = $tmpcrit;
@@ -7341,7 +7341,7 @@  discard block
 block discarded – undo
7341 7341
                         $newres .= $tmpafter;
7342 7342
                         $newres .= "'";
7343 7343
                         if ($tmpcrit2 == '') {
7344
-                            $newres .= ' OR ' . $field . " IS NULL";
7344
+                            $newres .= ' OR '.$field." IS NULL";
7345 7345
                         }
7346 7346
                     }
7347 7347
 
@@ -7352,10 +7352,10 @@  discard block
 block discarded – undo
7352 7352
             $i++;
7353 7353
         }
7354 7354
         if ($newres)
7355
-            $res = $res . ($res ? ' AND ' : '') . ($i2 > 1 ? '(' : '') . $newres . ($i2 > 1 ? ')' : '');
7355
+            $res = $res.($res ? ' AND ' : '').($i2 > 1 ? '(' : '').$newres.($i2 > 1 ? ')' : '');
7356 7356
         $j++;
7357 7357
     }
7358
-    $res = ($nofirstand ? "" : " AND ") . "(" . $res . ")";
7358
+    $res = ($nofirstand ? "" : " AND ")."(".$res.")";
7359 7359
     //print 'xx'.$res.'yy';
7360 7360
     return $res;
7361 7361
 }
@@ -7374,8 +7374,8 @@  discard block
 block discarded – undo
7374 7374
     $url = $object->getLastMainDocLink($object->element);
7375 7375
 
7376 7376
     if ($url) {
7377
-        $out .= img_picto('', 'object_globe.png') . ' ' . $langs->trans("DirectDownloadLink") . '<br>';
7378
-        $out .= '<input type="text" id="directdownloadlink" class="quatrevingtpercent" value="' . $url . '">';
7377
+        $out .= img_picto('', 'object_globe.png').' '.$langs->trans("DirectDownloadLink").'<br>';
7378
+        $out .= '<input type="text" id="directdownloadlink" class="quatrevingtpercent" value="'.$url.'">';
7379 7379
         $out .= ajax_autoselect("directdownloadlink", 0);
7380 7380
     }
7381 7381
     return $out;
@@ -7416,7 +7416,7 @@  discard block
 block discarded – undo
7416 7416
     if ($extName)
7417 7417
         $subdir = 'thumbs/';
7418 7418
 
7419
-    return ($dirName ? $dirName . '/' : '') . $subdir . $fileName . $extName . $extImgTarget; // New filename for thumb
7419
+    return ($dirName ? $dirName.'/' : '').$subdir.$fileName.$extName.$extImgTarget; // New filename for thumb
7420 7420
 }
7421 7421
 
7422 7422
 /**
@@ -7442,14 +7442,14 @@  discard block
 block discarded – undo
7442 7442
 
7443 7443
     if ($alldata == 1) {
7444 7444
         if ($num_mime !== false)
7445
-            return array('target' => '_blank', 'css' => 'documentpreview', 'url' => DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : ''), 'mime' => dol_mimetype($relativepath),);
7445
+            return array('target' => '_blank', 'css' => 'documentpreview', 'url' => DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : ''), 'mime' => dol_mimetype($relativepath),);
7446 7446
         else
7447 7447
             return array();
7448 7448
     }
7449 7449
 
7450 7450
     // old behavior
7451 7451
     if ($num_mime !== false)
7452
-        return 'javascript:document_preview(\'' . dol_escape_js(DOL_URL_ROOT . '/document.php?modulepart=' . $modulepart . '&attachment=0&file=' . urlencode($relativepath) . ($param ? '&' . $param : '')) . '\', \'' . dol_mimetype($relativepath) . '\', \'' . dol_escape_js($langs->trans('Preview')) . '\')';
7452
+        return 'javascript:document_preview(\''.dol_escape_js(DOL_URL_ROOT.'/document.php?modulepart='.$modulepart.'&attachment=0&file='.urlencode($relativepath).($param ? '&'.$param : '')).'\', \''.dol_mimetype($relativepath).'\', \''.dol_escape_js($langs->trans('Preview')).'\')';
7453 7453
     else
7454 7454
         return '';
7455 7455
 }
@@ -7466,11 +7466,11 @@  discard block
 block discarded – undo
7466 7466
     global $langs;
7467 7467
     $out = '<script type="text/javascript">
7468 7468
                jQuery(document).ready(function () {
7469
-				    jQuery("#' . $htmlname . '").click(function() { jQuery(this).select(); } );
7469
+				    jQuery("#' . $htmlname.'").click(function() { jQuery(this).select(); } );
7470 7470
 				});
7471 7471
 		    </script>';
7472 7472
     if ($addlink)
7473
-        $out .= ' <a href="' . $addlink . '" target="_blank">' . $langs->trans("Link") . '</a>';
7473
+        $out .= ' <a href="'.$addlink.'" target="_blank">'.$langs->trans("Link").'</a>';
7474 7474
     return $out;
7475 7475
 }
7476 7476
 
@@ -7851,9 +7851,9 @@  discard block
 block discarded – undo
7851 7851
 
7852 7852
     if (!isset($dictvalues[$tablename])) {
7853 7853
         $dictvalues[$tablename] = array();
7854
-        $sql = 'SELECT * FROM ' . $tablename . ' WHERE 1';
7854
+        $sql = 'SELECT * FROM '.$tablename.' WHERE 1';
7855 7855
         if ($checkentity)
7856
-            $sql .= ' AND entity IN (0,' . getEntity($tablename) . ')';
7856
+            $sql .= ' AND entity IN (0,'.getEntity($tablename).')';
7857 7857
 
7858 7858
         $resql = $db->query($sql);
7859 7859
         if ($resql) {
@@ -7891,14 +7891,14 @@  discard block
 block discarded – undo
7891 7891
             $g = $tmp[1];
7892 7892
             $b = $tmp[2];
7893 7893
         } else {
7894
-            $hexr = $stringcolor[0] . $stringcolor[1];
7895
-            $hexg = $stringcolor[2] . $stringcolor[3];
7896
-            $hexb = $stringcolor[4] . $stringcolor[5];
7894
+            $hexr = $stringcolor[0].$stringcolor[1];
7895
+            $hexg = $stringcolor[2].$stringcolor[3];
7896
+            $hexb = $stringcolor[4].$stringcolor[5];
7897 7897
             $r = hexdec($hexr);
7898 7898
             $g = hexdec($hexg);
7899 7899
             $b = hexdec($hexb);
7900 7900
         }
7901
-        $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0;    // HSL algorithm
7901
+        $bright = (max($r, $g, $b) + min($r, $g, $b)) / 510.0; // HSL algorithm
7902 7902
         if ($bright > 0.6)
7903 7903
             $res = 1;
7904 7904
     }
@@ -7934,11 +7934,11 @@  discard block
 block discarded – undo
7934 7934
             return 0; // Entry is for menus all excluded to external users
7935 7935
     }
7936 7936
     if (!$menuentry['perms'] && $type_user)
7937
-        return 0;            // No permissions and user is external
7937
+        return 0; // No permissions and user is external
7938 7938
     if (!$menuentry['perms'] && !empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED))
7939 7939
         return 0; // No permissions and option to hide when not allowed, even for internal user, is on
7940 7940
     if (!$menuentry['perms'])
7941
-        return 2;               // No permissions and user is external
7941
+        return 2; // No permissions and user is external
7942 7942
     return 1;
7943 7943
 }
7944 7944
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/lib/security2.lib.php 2 patches
Indentation   +361 added lines, -361 removed lines patch added patch discarded remove patch
@@ -51,70 +51,70 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmode)
53 53
 {
54
-	global $conf,$langs;
54
+    global $conf,$langs;
55 55
     //global $dolauthmode;    // To return authentication finally used
56 56
 
57
-	// Check parameters
58
-	if ($entitytotest == '') $entitytotest=1;
57
+    // Check parameters
58
+    if ($entitytotest == '') $entitytotest=1;
59 59
 
60 60
     dol_syslog("checkLoginPassEntity usertotest=".$usertotest." entitytotest=".$entitytotest." authmode=".join(',',$authmode));
61
-	$login = '';
62
-
63
-	// Validation of login/pass/entity with standard modules
64
-	if (empty($login))
65
-	{
66
-	    $test=true;
67
-    	foreach($authmode as $mode)
68
-    	{
69
-    		if ($test && $mode && ! $login)
70
-    		{
71
-    		    // Validation of login/pass/entity for mode $mode
72
-    		    $mode=trim($mode);
73
-        		$authfile='functions_'.$mode.'.php';
74
-        		$fullauthfile='';
75
-
76
-    		    $dirlogin=array_merge(array("/core/login"),(array) $conf->modules_parts['login']);
77
-    		    foreach($dirlogin as $reldir)
78
-    		    {
79
-    		        $dir=dol_buildpath($reldir,0);
80
-    		        $newdir=dol_osencode($dir);
81
-
82
-    		        // Check if file found (do not use dol_is_file to avoid loading files.lib.php)
83
-    		        $tmpnewauthfile = $newdir.(preg_match('/\/$/',$newdir)?'':'/').$authfile;
84
-    		        if (is_file($tmpnewauthfile)) $fullauthfile=$tmpnewauthfile;
85
-    		    }
86
-
87
-    		    $result=false;
88
-    		    if ($fullauthfile) $result=include_once $fullauthfile;
89
-    			if ($fullauthfile && $result)
90
-    			{
91
-    				// Call function to check user/password
92
-    				$function='check_user_password_'.$mode;
93
-    				$login=call_user_func($function, $usertotest, $passwordtotest, $entitytotest);
94
-    				if ($login)	// Login is successfull
95
-    				{
96
-    					$test=false;            // To stop once at first login success
97
-    					$conf->authmode=$mode;	// This properties is defined only when logged to say what mode was successfully used
98
-    					$dol_tz=GETPOST('tz');
99
-    					$dol_dst=GETPOST('dst');
100
-    					$dol_screenwidth=GETPOST('screenwidth');
101
-    					$dol_screenheight=GETPOST('screenheight');
102
-    				}
103
-    			}
104
-    			else
105
-    			{
106
-    				dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR);
107
-    				sleep(1);
108
-    				// Load translation files required by the page
61
+    $login = '';
62
+
63
+    // Validation of login/pass/entity with standard modules
64
+    if (empty($login))
65
+    {
66
+        $test=true;
67
+        foreach($authmode as $mode)
68
+        {
69
+            if ($test && $mode && ! $login)
70
+            {
71
+                // Validation of login/pass/entity for mode $mode
72
+                $mode=trim($mode);
73
+                $authfile='functions_'.$mode.'.php';
74
+                $fullauthfile='';
75
+
76
+                $dirlogin=array_merge(array("/core/login"),(array) $conf->modules_parts['login']);
77
+                foreach($dirlogin as $reldir)
78
+                {
79
+                    $dir=dol_buildpath($reldir,0);
80
+                    $newdir=dol_osencode($dir);
81
+
82
+                    // Check if file found (do not use dol_is_file to avoid loading files.lib.php)
83
+                    $tmpnewauthfile = $newdir.(preg_match('/\/$/',$newdir)?'':'/').$authfile;
84
+                    if (is_file($tmpnewauthfile)) $fullauthfile=$tmpnewauthfile;
85
+                }
86
+
87
+                $result=false;
88
+                if ($fullauthfile) $result=include_once $fullauthfile;
89
+                if ($fullauthfile && $result)
90
+                {
91
+                    // Call function to check user/password
92
+                    $function='check_user_password_'.$mode;
93
+                    $login=call_user_func($function, $usertotest, $passwordtotest, $entitytotest);
94
+                    if ($login)	// Login is successfull
95
+                    {
96
+                        $test=false;            // To stop once at first login success
97
+                        $conf->authmode=$mode;	// This properties is defined only when logged to say what mode was successfully used
98
+                        $dol_tz=GETPOST('tz');
99
+                        $dol_dst=GETPOST('dst');
100
+                        $dol_screenwidth=GETPOST('screenwidth');
101
+                        $dol_screenheight=GETPOST('screenheight');
102
+                    }
103
+                }
104
+                else
105
+                {
106
+                    dol_syslog("Authentification ko - failed to load file '".$authfile."'", LOG_ERR);
107
+                    sleep(1);
108
+                    // Load translation files required by the page
109 109
                     $langs->loadLangs(array('other', 'main', 'errors'));
110 110
 
111
-    				$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode", $mode);
112
-    			}
113
-    		}
114
-    	}
115
-	}
111
+                    $_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode", $mode);
112
+                }
113
+            }
114
+        }
115
+    }
116 116
 
117
-	return $login;
117
+    return $login;
118 118
 }
119 119
 
120 120
 
@@ -130,29 +130,29 @@  discard block
 block discarded – undo
130 130
      * @return      void
131 131
      */
132 132
     function dol_loginfunction($langs,$conf,$mysoc)
133
-	{
134
-		global $dolibarr_main_demo,$db;
135
-		global $smartphone,$hookmanager;
133
+    {
134
+        global $dolibarr_main_demo,$db;
135
+        global $smartphone,$hookmanager;
136 136
 
137
-		$langs->loadLangs(array("main","other","help","admin"));
137
+        $langs->loadLangs(array("main","other","help","admin"));
138 138
 
139
-		// Instantiate hooks of thirdparty module only if not already define
139
+        // Instantiate hooks of thirdparty module only if not already define
140 140
         $hookmanager->initHooks(array('mainloginpage'));
141 141
 
142 142
         $main_authentication = $conf->file->main_authentication;
143 143
 
144 144
         $session_name=session_name();	// Get current session name
145 145
 
146
-		$dol_url_root = DOL_URL_ROOT;
146
+        $dol_url_root = DOL_URL_ROOT;
147 147
 
148
-		// Title
149
-		$appli=constant('DOL_APPLICATION_TITLE');
150
-		$title=$appli.' '.constant('DOL_VERSION');
151
-		if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
152
-		$titletruedolibarrversion=constant('DOL_VERSION');	// $title used by login template after the @ to inform of true Dolibarr version
148
+        // Title
149
+        $appli=constant('DOL_APPLICATION_TITLE');
150
+        $title=$appli.' '.constant('DOL_VERSION');
151
+        if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
152
+        $titletruedolibarrversion=constant('DOL_VERSION');	// $title used by login template after the @ to inform of true Dolibarr version
153 153
 
154
-		// Note: $conf->css looks like '/theme/eldy/style.css.php'
155
-		/*
154
+        // Note: $conf->css looks like '/theme/eldy/style.css.php'
155
+        /*
156 156
 		$conf->css = "/theme/".(GETPOST('theme','alpha')?GETPOST('theme','alpha'):$conf->theme)."/style.css.php";
157 157
 		$themepath=dol_buildpath($conf->css,1);
158 158
 		if (! empty($conf->modules_parts['theme']))		// Using this feature slow down application
@@ -169,138 +169,138 @@  discard block
 block discarded – undo
169 169
 		$conf_css = $themepath."?lang=".$langs->defaultlang;
170 170
 		*/
171 171
 
172
-		// Select templates dir
173
-		if (! empty($conf->modules_parts['tpl']))	// Using this feature slow down application
174
-		{
175
-			$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl/'));
176
-			foreach($dirtpls as $reldir)
177
-			{
178
-				$tmp=dol_buildpath($reldir.'login.tpl.php');
179
-				if (file_exists($tmp)) { $template_dir=preg_replace('/login\.tpl\.php$/','',$tmp); break; }
180
-			}
181
-		}
182
-		else
183
-		{
184
-			$template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
185
-		}
172
+        // Select templates dir
173
+        if (! empty($conf->modules_parts['tpl']))	// Using this feature slow down application
174
+        {
175
+            $dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl/'));
176
+            foreach($dirtpls as $reldir)
177
+            {
178
+                $tmp=dol_buildpath($reldir.'login.tpl.php');
179
+                if (file_exists($tmp)) { $template_dir=preg_replace('/login\.tpl\.php$/','',$tmp); break; }
180
+            }
181
+        }
182
+        else
183
+        {
184
+            $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/";
185
+        }
186 186
 
187
-		// Set cookie for timeout management
188
-		$prefix=dol_getprefix('');
189
-		$sessiontimeout='DOLSESSTIMEOUT_'.$prefix;
190
-		if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true);
187
+        // Set cookie for timeout management
188
+        $prefix=dol_getprefix('');
189
+        $sessiontimeout='DOLSESSTIMEOUT_'.$prefix;
190
+        if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true);
191 191
 
192
-		if (GETPOST('urlfrom','alpha')) $_SESSION["urlfrom"]=GETPOST('urlfrom','alpha');
193
-		else unset($_SESSION["urlfrom"]);
192
+        if (GETPOST('urlfrom','alpha')) $_SESSION["urlfrom"]=GETPOST('urlfrom','alpha');
193
+        else unset($_SESSION["urlfrom"]);
194 194
 
195
-		if (! GETPOST("username",'alpha')) $focus_element='username';
196
-		else $focus_element='password';
195
+        if (! GETPOST("username",'alpha')) $focus_element='username';
196
+        else $focus_element='password';
197 197
 
198
-		$demologin='';
199
-		$demopassword='';
200
-		if (! empty($dolibarr_main_demo))
201
-		{
202
-			$tab=explode(',',$dolibarr_main_demo);
203
-			$demologin=$tab[0];
204
-			$demopassword=$tab[1];
205
-		}
198
+        $demologin='';
199
+        $demopassword='';
200
+        if (! empty($dolibarr_main_demo))
201
+        {
202
+            $tab=explode(',',$dolibarr_main_demo);
203
+            $demologin=$tab[0];
204
+            $demopassword=$tab[1];
205
+        }
206 206
 
207
-		// Execute hook getLoginPageOptions (for table)
208
-		$parameters=array('entity' => GETPOST('entity','int'));
209
-		$reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters);    // Note that $action and $object may have been modified by some hooks.
210
-		if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) {
211
-			$morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility
212
-		} else {
213
-			$morelogincontent = $hookmanager->resPrint;
214
-		}
207
+        // Execute hook getLoginPageOptions (for table)
208
+        $parameters=array('entity' => GETPOST('entity','int'));
209
+        $reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters);    // Note that $action and $object may have been modified by some hooks.
210
+        if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) {
211
+            $morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility
212
+        } else {
213
+            $morelogincontent = $hookmanager->resPrint;
214
+        }
215 215
 
216
-		// Execute hook getLoginPageExtraOptions (eg for js)
217
-		$parameters=array('entity' => GETPOST('entity','int'));
218
-		$reshook = $hookmanager->executeHooks('getLoginPageExtraOptions',$parameters);    // Note that $action and $object may have been modified by some hooks.
219
-		$moreloginextracontent = $hookmanager->resPrint;
216
+        // Execute hook getLoginPageExtraOptions (eg for js)
217
+        $parameters=array('entity' => GETPOST('entity','int'));
218
+        $reshook = $hookmanager->executeHooks('getLoginPageExtraOptions',$parameters);    // Note that $action and $object may have been modified by some hooks.
219
+        $moreloginextracontent = $hookmanager->resPrint;
220 220
 
221
-		// Login
222
-		$login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username","alpha") ? GETPOST("username","alpha") : $demologin));
223
-		$password = $demopassword;
221
+        // Login
222
+        $login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username","alpha") ? GETPOST("username","alpha") : $demologin));
223
+        $password = $demopassword;
224 224
 
225
-		// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
226
-		$width=0;
227
-		$urllogo = DOL_BASE_URI . '/theme/login_logo.png';
225
+        // Show logo (search in order: small company logo, large company logo, theme logo, common logo)
226
+        $width=0;
227
+        $urllogo = DOL_BASE_URI . '/theme/login_logo.png';
228 228
 
229 229
         if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
230
-		{
231
-			$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
232
-		}
233
-		elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
234
-		{
235
-			$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
236
-			$width=128;
237
-		}
238
-		elseif (is_readable(DOL_BASE_URI . '/theme/' . $conf->theme . '/img/dolibarr_logo.png')) {
239
-			$urllogo = DOL_BASE_URI . '/theme/' . $conf->theme . '/img/dolibarr_logo.png';
230
+        {
231
+            $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
240 232
         }
241
-		elseif (is_readable(DOL_BASE_URI . '/theme/dolibarr_logo.png')) {
242
-			$urllogo = DOL_BASE_URI . '/theme/dolibarr_logo.png';
233
+        elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
234
+        {
235
+            $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
236
+            $width=128;
237
+        }
238
+        elseif (is_readable(DOL_BASE_URI . '/theme/' . $conf->theme . '/img/dolibarr_logo.png')) {
239
+            $urllogo = DOL_BASE_URI . '/theme/' . $conf->theme . '/img/dolibarr_logo.png';
240
+        }
241
+        elseif (is_readable(DOL_BASE_URI . '/theme/dolibarr_logo.png')) {
242
+            $urllogo = DOL_BASE_URI . '/theme/dolibarr_logo.png';
243 243
         }
244 244
 
245
-		// Security graphical code
246
-		$captcha=0;
247
-		$captcha_refresh='';
248
-		if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
249
-		{
250
-			$captcha=1;
251
-			$captcha_refresh=img_picto($langs->trans("Refresh"),'refresh','id="captcha_refresh_img"');
252
-		}
253
-
254
-		// Extra link
255
-		$forgetpasslink=0;
256
-		$helpcenterlink=0;
257
-		if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
258
-		{
259
-			if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
260
-			{
261
-				$forgetpasslink=1;
262
-			}
245
+        // Security graphical code
246
+        $captcha=0;
247
+        $captcha_refresh='';
248
+        if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
249
+        {
250
+            $captcha=1;
251
+            $captcha_refresh=img_picto($langs->trans("Refresh"),'refresh','id="captcha_refresh_img"');
252
+        }
263 253
 
264
-			if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
265
-			{
266
-				$helpcenterlink=1;
267
-			}
268
-		}
254
+        // Extra link
255
+        $forgetpasslink=0;
256
+        $helpcenterlink=0;
257
+        if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
258
+        {
259
+            if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
260
+            {
261
+                $forgetpasslink=1;
262
+            }
263
+
264
+            if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
265
+            {
266
+                $helpcenterlink=1;
267
+            }
268
+        }
269 269
 
270
-		// Home message
271
-		$main_home='';
272
-		if (! empty($conf->global->MAIN_HOME))
273
-		{
274
-		    $substitutionarray=getCommonSubstitutionArray($langs);
275
-		    complete_substitutions_array($substitutionarray, $langs);
276
-		    $texttoshow = make_substitutions($conf->global->MAIN_HOME, $substitutionarray, $langs);
270
+        // Home message
271
+        $main_home='';
272
+        if (! empty($conf->global->MAIN_HOME))
273
+        {
274
+            $substitutionarray=getCommonSubstitutionArray($langs);
275
+            complete_substitutions_array($substitutionarray, $langs);
276
+            $texttoshow = make_substitutions($conf->global->MAIN_HOME, $substitutionarray, $langs);
277 277
 
278
-			$main_home=dol_htmlcleanlastbr($texttoshow);
279
-		}
278
+            $main_home=dol_htmlcleanlastbr($texttoshow);
279
+        }
280 280
 
281
-		// Google AD
282
-		$main_google_ad_client = ((! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))?1:0);
281
+        // Google AD
282
+        $main_google_ad_client = ((! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))?1:0);
283 283
 
284
-		// Set jquery theme
285
-		$dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:'');
286
-		$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
287
-		if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
288
-		$jquerytheme = 'base';
289
-		if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
284
+        // Set jquery theme
285
+        $dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:'');
286
+        $favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
287
+        if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
288
+        $jquerytheme = 'base';
289
+        if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
290 290
 
291
-		// Set dol_hide_topmenu, dol_hide_leftmenu, dol_optimize_smallscreen, dol_no_mouse_hover
292
-		$dol_hide_topmenu=GETPOST('dol_hide_topmenu','int');
293
-		$dol_hide_leftmenu=GETPOST('dol_hide_leftmenu','int');
294
-		$dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen','int');
295
-		$dol_no_mouse_hover=GETPOST('dol_no_mouse_hover','int');
296
-		$dol_use_jmobile=GETPOST('dol_use_jmobile','int');
291
+        // Set dol_hide_topmenu, dol_hide_leftmenu, dol_optimize_smallscreen, dol_no_mouse_hover
292
+        $dol_hide_topmenu=GETPOST('dol_hide_topmenu','int');
293
+        $dol_hide_leftmenu=GETPOST('dol_hide_leftmenu','int');
294
+        $dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen','int');
295
+        $dol_no_mouse_hover=GETPOST('dol_no_mouse_hover','int');
296
+        $dol_use_jmobile=GETPOST('dol_use_jmobile','int');
297 297
 
298
-		// Include login page template
299
-		include $template_dir.'login.tpl.php';
298
+        // Include login page template
299
+        include $template_dir.'login.tpl.php';
300 300
 
301 301
 
302
-		$_SESSION["dol_loginmesg"] = '';
303
-	}
302
+        $_SESSION["dol_loginmesg"] = '';
303
+    }
304 304
 }
305 305
 
306 306
 /**
@@ -313,23 +313,23 @@  discard block
 block discarded – undo
313 313
  */
314 314
 function makesalt($type=CRYPT_SALT_LENGTH)
315 315
 {
316
-	dol_syslog("makesalt type=".$type);
317
-	switch($type)
318
-	{
319
-		case 12:	// 8 + 4
320
-			$saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break;
321
-		case 8:		// 8 (Pour compatibilite, ne devrait pas etre utilise)
322
-			$saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break;
323
-		case 2:		// 2
324
-		default: 	// by default, fall back on Standard DES (should work everywhere)
325
-			$saltlen=2; $saltprefix=''; $saltsuffix=''; break;
326
-	}
327
-	$salt='';
328
-	while(dol_strlen($salt) < $saltlen) $salt.=chr(mt_rand(64,126));
329
-
330
-	$result=$saltprefix.$salt.$saltsuffix;
331
-	dol_syslog("makesalt return=".$result);
332
-	return $result;
316
+    dol_syslog("makesalt type=".$type);
317
+    switch($type)
318
+    {
319
+        case 12:	// 8 + 4
320
+            $saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break;
321
+        case 8:		// 8 (Pour compatibilite, ne devrait pas etre utilise)
322
+            $saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break;
323
+        case 2:		// 2
324
+        default: 	// by default, fall back on Standard DES (should work everywhere)
325
+            $saltlen=2; $saltprefix=''; $saltsuffix=''; break;
326
+    }
327
+    $salt='';
328
+    while(dol_strlen($salt) < $saltlen) $salt.=chr(mt_rand(64,126));
329
+
330
+    $result=$saltprefix.$salt.$saltsuffix;
331
+    dol_syslog("makesalt return=".$result);
332
+    return $result;
333 333
 }
334 334
 
335 335
 /**
@@ -340,102 +340,102 @@  discard block
 block discarded – undo
340 340
  */
341 341
 function encodedecode_dbpassconf($level=0)
342 342
 {
343
-	dol_syslog("encodedecode_dbpassconf level=".$level, LOG_DEBUG);
344
-	$config = '';
345
-	$passwd='';
346
-	$passwd_crypted='';
347
-
348
-	if ($fp = fopen(DOL_DOCUMENT_ROOT.'/conf/conf.php','r'))
349
-	{
350
-		while(!feof($fp))
351
-		{
352
-			$buffer = fgets($fp,4096);
353
-
354
-			$lineofpass=0;
355
-
356
-			if (preg_match('/^[^#]*dolibarr_main_db_encrypted_pass[\s]*=[\s]*(.*)/i',$buffer,$reg))	// Old way to save crypted value
357
-			{
358
-				$val = trim($reg[1]);	// This also remove CR/LF
359
-				$val=preg_replace('/^["\']/','',$val);
360
-				$val=preg_replace('/["\'][\s;]*$/','',$val);
361
-				if (! empty($val))
362
-				{
363
-					$passwd_crypted = $val;
364
-					$val = dol_decode($val);
365
-					$passwd = $val;
366
-					$lineofpass=1;
367
-				}
368
-			}
369
-			elseif (preg_match('/^[^#]*dolibarr_main_db_pass[\s]*=[\s]*(.*)/i',$buffer,$reg))
370
-			{
371
-				$val = trim($reg[1]);	// This also remove CR/LF
372
-				$val=preg_replace('/^["\']/','',$val);
373
-				$val=preg_replace('/["\'][\s;]*$/','',$val);
374
-				if (preg_match('/crypted:/i',$buffer))
375
-				{
376
-					$val = preg_replace('/crypted:/i','',$val);
377
-					$passwd_crypted = $val;
378
-					$val = dol_decode($val);
379
-					$passwd = $val;
380
-				}
381
-				else
382
-				{
383
-					$passwd = $val;
384
-					$val = dol_encode($val);
385
-					$passwd_crypted = $val;
386
-				}
387
-				$lineofpass=1;
388
-			}
389
-
390
-			// Output line
391
-			if ($lineofpass)
392
-			{
393
-				// Add value at end of file
394
-				if ($level == 0)
395
-				{
396
-					$config .= '$dolibarr_main_db_pass=\''.$passwd.'\';'."\n";
397
-				}
398
-				if ($level == 1)
399
-				{
400
-					$config .= '$dolibarr_main_db_pass=\'crypted:'.$passwd_crypted.'\';'."\n";
401
-				}
402
-
403
-				//print 'passwd = '.$passwd.' - passwd_crypted = '.$passwd_crypted;
404
-				//exit;
405
-			}
406
-			else
407
-			{
408
-				$config .= $buffer;
409
-			}
410
-		}
411
-		fclose($fp);
412
-
413
-		// Write new conf file
414
-		$file=DOL_DOCUMENT_ROOT.'/conf/conf.php';
415
-		if ($fp = @fopen($file,'w'))
416
-		{
417
-			fputs($fp, $config);
418
-			fflush($fp);
419
-			fclose($fp);
420
-			clearstatcache();
421
-
422
-			// It's config file, so we set read permission for creator only.
423
-			// Should set permission to web user and groups for users used by batch
424
-			//@chmod($file, octdec('0600'));
425
-
426
-			return 1;
427
-		}
428
-		else
429
-		{
430
-			dol_syslog("encodedecode_dbpassconf Failed to open conf.php file for writing", LOG_WARNING);
431
-			return -1;
432
-		}
433
-	}
434
-	else
435
-	{
436
-		dol_syslog("encodedecode_dbpassconf Failed to read conf.php", LOG_ERR);
437
-		return -2;
438
-	}
343
+    dol_syslog("encodedecode_dbpassconf level=".$level, LOG_DEBUG);
344
+    $config = '';
345
+    $passwd='';
346
+    $passwd_crypted='';
347
+
348
+    if ($fp = fopen(DOL_DOCUMENT_ROOT.'/conf/conf.php','r'))
349
+    {
350
+        while(!feof($fp))
351
+        {
352
+            $buffer = fgets($fp,4096);
353
+
354
+            $lineofpass=0;
355
+
356
+            if (preg_match('/^[^#]*dolibarr_main_db_encrypted_pass[\s]*=[\s]*(.*)/i',$buffer,$reg))	// Old way to save crypted value
357
+            {
358
+                $val = trim($reg[1]);	// This also remove CR/LF
359
+                $val=preg_replace('/^["\']/','',$val);
360
+                $val=preg_replace('/["\'][\s;]*$/','',$val);
361
+                if (! empty($val))
362
+                {
363
+                    $passwd_crypted = $val;
364
+                    $val = dol_decode($val);
365
+                    $passwd = $val;
366
+                    $lineofpass=1;
367
+                }
368
+            }
369
+            elseif (preg_match('/^[^#]*dolibarr_main_db_pass[\s]*=[\s]*(.*)/i',$buffer,$reg))
370
+            {
371
+                $val = trim($reg[1]);	// This also remove CR/LF
372
+                $val=preg_replace('/^["\']/','',$val);
373
+                $val=preg_replace('/["\'][\s;]*$/','',$val);
374
+                if (preg_match('/crypted:/i',$buffer))
375
+                {
376
+                    $val = preg_replace('/crypted:/i','',$val);
377
+                    $passwd_crypted = $val;
378
+                    $val = dol_decode($val);
379
+                    $passwd = $val;
380
+                }
381
+                else
382
+                {
383
+                    $passwd = $val;
384
+                    $val = dol_encode($val);
385
+                    $passwd_crypted = $val;
386
+                }
387
+                $lineofpass=1;
388
+            }
389
+
390
+            // Output line
391
+            if ($lineofpass)
392
+            {
393
+                // Add value at end of file
394
+                if ($level == 0)
395
+                {
396
+                    $config .= '$dolibarr_main_db_pass=\''.$passwd.'\';'."\n";
397
+                }
398
+                if ($level == 1)
399
+                {
400
+                    $config .= '$dolibarr_main_db_pass=\'crypted:'.$passwd_crypted.'\';'."\n";
401
+                }
402
+
403
+                //print 'passwd = '.$passwd.' - passwd_crypted = '.$passwd_crypted;
404
+                //exit;
405
+            }
406
+            else
407
+            {
408
+                $config .= $buffer;
409
+            }
410
+        }
411
+        fclose($fp);
412
+
413
+        // Write new conf file
414
+        $file=DOL_DOCUMENT_ROOT.'/conf/conf.php';
415
+        if ($fp = @fopen($file,'w'))
416
+        {
417
+            fputs($fp, $config);
418
+            fflush($fp);
419
+            fclose($fp);
420
+            clearstatcache();
421
+
422
+            // It's config file, so we set read permission for creator only.
423
+            // Should set permission to web user and groups for users used by batch
424
+            //@chmod($file, octdec('0600'));
425
+
426
+            return 1;
427
+        }
428
+        else
429
+        {
430
+            dol_syslog("encodedecode_dbpassconf Failed to open conf.php file for writing", LOG_WARNING);
431
+            return -1;
432
+        }
433
+    }
434
+    else
435
+    {
436
+        dol_syslog("encodedecode_dbpassconf Failed to read conf.php", LOG_ERR);
437
+        return -2;
438
+    }
439 439
 }
440 440
 
441 441
 /**
@@ -448,72 +448,72 @@  discard block
 block discarded – undo
448 448
  */
449 449
 function getRandomPassword($generic=false, $replaceambiguouschars=null)
450 450
 {
451
-	global $db,$conf,$langs,$user;
452
-
453
-	$generated_password='';
454
-	if ($generic)
455
-	{
456
-		$length = 32;
457
-		$lowercase = "qwertyuiopasdfghjklzxcvbnm";
458
-		$uppercase = "ASDFGHJKLZXCVBNMQWERTYUIOP";
459
-		$numbers = "1234567890";
460
-		$randomCode = "";
461
-		$nbofchar = round($length/3);
462
-		$nbofcharlast = ($length - 2*$nbofchar);
463
-		//var_dump($nbofchar.'-'.$nbofcharlast);
464
-		if (function_exists('random_int'))	// Cryptographic random
465
-		{
466
-			$max = strlen($lowercase) - 1;
467
-			for ($x = 0; $x < $nbofchar; $x++) {
468
-				$randomCode .= $lowercase{random_int(0, $max)};
469
-			}
470
-			$max = strlen($uppercase) - 1;
471
-			for ($x = 0; $x < $nbofchar; $x++) {
472
-				$randomCode .= $uppercase{random_int(0, $max)};
473
-			}
474
-			$max = strlen($numbers) - 1;
475
-			for ($x = 0; $x < $nbofcharlast; $x++) {
476
-				$randomCode .= $numbers{random_int(0, $max)};
477
-			}
478
-
479
-			$generated_password=str_shuffle($randomCode);
480
-		}
481
-		else	// Old platform, non cryptographic random
482
-		{
483
-			$max = strlen($lowercase) - 1;
484
-			for ($x = 0; $x < $nbofchar; $x++) {
485
-				$randomCode .= $lowercase{mt_rand(0, $max)};
486
-			}
487
-			$max = strlen($uppercase) - 1;
488
-			for ($x = 0; $x < $nbofchar; $x++) {
489
-				$randomCode .= $uppercase{mt_rand(0, $max)};
490
-			}
491
-			$max = strlen($numbers) - 1;
492
-			for ($x = 0; $x < $nbofcharlast; $x++) {
493
-				$randomCode .= $numbers{mt_rand(0, $max)};
494
-			}
495
-
496
-			$generated_password=str_shuffle($randomCode);
497
-		}
498
-	}
499
-	else if (! empty($conf->global->USER_PASSWORD_GENERATED))
500
-	{
501
-		$nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED);
502
-		$nomfichier=$nomclass.".class.php";
503
-		//print DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomclass;
504
-		require_once DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomfichier;
505
-		$genhandler=new $nomclass($db,$conf,$langs,$user);
506
-		$generated_password=$genhandler->getNewGeneratedPassword();
507
-		unset($genhandler);
508
-	}
509
-
510
-	// Do we have to discard some alphabetic characters ?
511
-	if (is_array($replaceambiguouschars) && count($replaceambiguouschars) > 0)
512
-	{
513
-		$numbers = "ABCDEF";
514
-		$max = strlen($numbers) - 1;
515
-		$generated_password=str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password);
516
-	}
517
-
518
-	return $generated_password;
451
+    global $db,$conf,$langs,$user;
452
+
453
+    $generated_password='';
454
+    if ($generic)
455
+    {
456
+        $length = 32;
457
+        $lowercase = "qwertyuiopasdfghjklzxcvbnm";
458
+        $uppercase = "ASDFGHJKLZXCVBNMQWERTYUIOP";
459
+        $numbers = "1234567890";
460
+        $randomCode = "";
461
+        $nbofchar = round($length/3);
462
+        $nbofcharlast = ($length - 2*$nbofchar);
463
+        //var_dump($nbofchar.'-'.$nbofcharlast);
464
+        if (function_exists('random_int'))	// Cryptographic random
465
+        {
466
+            $max = strlen($lowercase) - 1;
467
+            for ($x = 0; $x < $nbofchar; $x++) {
468
+                $randomCode .= $lowercase{random_int(0, $max)};
469
+            }
470
+            $max = strlen($uppercase) - 1;
471
+            for ($x = 0; $x < $nbofchar; $x++) {
472
+                $randomCode .= $uppercase{random_int(0, $max)};
473
+            }
474
+            $max = strlen($numbers) - 1;
475
+            for ($x = 0; $x < $nbofcharlast; $x++) {
476
+                $randomCode .= $numbers{random_int(0, $max)};
477
+            }
478
+
479
+            $generated_password=str_shuffle($randomCode);
480
+        }
481
+        else	// Old platform, non cryptographic random
482
+        {
483
+            $max = strlen($lowercase) - 1;
484
+            for ($x = 0; $x < $nbofchar; $x++) {
485
+                $randomCode .= $lowercase{mt_rand(0, $max)};
486
+            }
487
+            $max = strlen($uppercase) - 1;
488
+            for ($x = 0; $x < $nbofchar; $x++) {
489
+                $randomCode .= $uppercase{mt_rand(0, $max)};
490
+            }
491
+            $max = strlen($numbers) - 1;
492
+            for ($x = 0; $x < $nbofcharlast; $x++) {
493
+                $randomCode .= $numbers{mt_rand(0, $max)};
494
+            }
495
+
496
+            $generated_password=str_shuffle($randomCode);
497
+        }
498
+    }
499
+    else if (! empty($conf->global->USER_PASSWORD_GENERATED))
500
+    {
501
+        $nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED);
502
+        $nomfichier=$nomclass.".class.php";
503
+        //print DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomclass;
504
+        require_once DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomfichier;
505
+        $genhandler=new $nomclass($db,$conf,$langs,$user);
506
+        $generated_password=$genhandler->getNewGeneratedPassword();
507
+        unset($genhandler);
508
+    }
509
+
510
+    // Do we have to discard some alphabetic characters ?
511
+    if (is_array($replaceambiguouschars) && count($replaceambiguouschars) > 0)
512
+    {
513
+        $numbers = "ABCDEF";
514
+        $max = strlen($numbers) - 1;
515
+        $generated_password=str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password);
516
+    }
517
+
518
+    return $generated_password;
519 519
 }
Please login to merge, or discard this patch.
Spacing   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
  */
35 35
 function dol_getwebuser($mode)
36 36
 {
37
-    $t='?';
38
-    if ($mode=='user')  $t=getenv('APACHE_RUN_USER');   // $_ENV['APACHE_RUN_USER'] is empty
39
-    if ($mode=='group') $t=getenv('APACHE_RUN_GROUP');
37
+    $t = '?';
38
+    if ($mode == 'user')  $t = getenv('APACHE_RUN_USER'); // $_ENV['APACHE_RUN_USER'] is empty
39
+    if ($mode == 'group') $t = getenv('APACHE_RUN_GROUP');
40 40
     return $t;
41 41
 }
42 42
 
@@ -49,56 +49,56 @@  discard block
 block discarded – undo
49 49
  *	@param		array	$authmode			Array list of selected authentication mode array('http', 'dolibarr', 'xxx'...)
50 50
  *  @return		string						Login or ''
51 51
  */
52
-function checkLoginPassEntity($usertotest,$passwordtotest,$entitytotest,$authmode)
52
+function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $authmode)
53 53
 {
54
-	global $conf,$langs;
54
+	global $conf, $langs;
55 55
     //global $dolauthmode;    // To return authentication finally used
56 56
 
57 57
 	// Check parameters
58
-	if ($entitytotest == '') $entitytotest=1;
58
+	if ($entitytotest == '') $entitytotest = 1;
59 59
 
60
-    dol_syslog("checkLoginPassEntity usertotest=".$usertotest." entitytotest=".$entitytotest." authmode=".join(',',$authmode));
60
+    dol_syslog("checkLoginPassEntity usertotest=".$usertotest." entitytotest=".$entitytotest." authmode=".join(',', $authmode));
61 61
 	$login = '';
62 62
 
63 63
 	// Validation of login/pass/entity with standard modules
64 64
 	if (empty($login))
65 65
 	{
66
-	    $test=true;
67
-    	foreach($authmode as $mode)
66
+	    $test = true;
67
+    	foreach ($authmode as $mode)
68 68
     	{
69
-    		if ($test && $mode && ! $login)
69
+    		if ($test && $mode && !$login)
70 70
     		{
71 71
     		    // Validation of login/pass/entity for mode $mode
72
-    		    $mode=trim($mode);
73
-        		$authfile='functions_'.$mode.'.php';
74
-        		$fullauthfile='';
72
+    		    $mode = trim($mode);
73
+        		$authfile = 'functions_'.$mode.'.php';
74
+        		$fullauthfile = '';
75 75
 
76
-    		    $dirlogin=array_merge(array("/core/login"),(array) $conf->modules_parts['login']);
77
-    		    foreach($dirlogin as $reldir)
76
+    		    $dirlogin = array_merge(array("/core/login"), (array) $conf->modules_parts['login']);
77
+    		    foreach ($dirlogin as $reldir)
78 78
     		    {
79
-    		        $dir=dol_buildpath($reldir,0);
80
-    		        $newdir=dol_osencode($dir);
79
+    		        $dir = dol_buildpath($reldir, 0);
80
+    		        $newdir = dol_osencode($dir);
81 81
 
82 82
     		        // Check if file found (do not use dol_is_file to avoid loading files.lib.php)
83
-    		        $tmpnewauthfile = $newdir.(preg_match('/\/$/',$newdir)?'':'/').$authfile;
84
-    		        if (is_file($tmpnewauthfile)) $fullauthfile=$tmpnewauthfile;
83
+    		        $tmpnewauthfile = $newdir.(preg_match('/\/$/', $newdir) ? '' : '/').$authfile;
84
+    		        if (is_file($tmpnewauthfile)) $fullauthfile = $tmpnewauthfile;
85 85
     		    }
86 86
 
87
-    		    $result=false;
88
-    		    if ($fullauthfile) $result=include_once $fullauthfile;
87
+    		    $result = false;
88
+    		    if ($fullauthfile) $result = include_once $fullauthfile;
89 89
     			if ($fullauthfile && $result)
90 90
     			{
91 91
     				// Call function to check user/password
92
-    				$function='check_user_password_'.$mode;
93
-    				$login=call_user_func($function, $usertotest, $passwordtotest, $entitytotest);
92
+    				$function = 'check_user_password_'.$mode;
93
+    				$login = call_user_func($function, $usertotest, $passwordtotest, $entitytotest);
94 94
     				if ($login)	// Login is successfull
95 95
     				{
96
-    					$test=false;            // To stop once at first login success
97
-    					$conf->authmode=$mode;	// This properties is defined only when logged to say what mode was successfully used
98
-    					$dol_tz=GETPOST('tz');
99
-    					$dol_dst=GETPOST('dst');
100
-    					$dol_screenwidth=GETPOST('screenwidth');
101
-    					$dol_screenheight=GETPOST('screenheight');
96
+    					$test = false; // To stop once at first login success
97
+    					$conf->authmode = $mode; // This properties is defined only when logged to say what mode was successfully used
98
+    					$dol_tz = GETPOST('tz');
99
+    					$dol_dst = GETPOST('dst');
100
+    					$dol_screenwidth = GETPOST('screenwidth');
101
+    					$dol_screenheight = GETPOST('screenheight');
102 102
     				}
103 103
     			}
104 104
     			else
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     				// Load translation files required by the page
109 109
                     $langs->loadLangs(array('other', 'main', 'errors'));
110 110
 
111
-    				$_SESSION["dol_loginmesg"]=$langs->trans("ErrorFailedToLoadLoginFileForMode", $mode);
111
+    				$_SESSION["dol_loginmesg"] = $langs->trans("ErrorFailedToLoadLoginFileForMode", $mode);
112 112
     			}
113 113
     		}
114 114
     	}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 }
119 119
 
120 120
 
121
-if (! function_exists('dol_loginfunction'))
121
+if (!function_exists('dol_loginfunction'))
122 122
 {
123 123
     /**
124 124
      * Show Dolibarr default login page.
@@ -129,27 +129,27 @@  discard block
 block discarded – undo
129 129
      * @param       Societe     $mysoc      Company object
130 130
      * @return      void
131 131
      */
132
-    function dol_loginfunction($langs,$conf,$mysoc)
132
+    function dol_loginfunction($langs, $conf, $mysoc)
133 133
 	{
134
-		global $dolibarr_main_demo,$db;
135
-		global $smartphone,$hookmanager;
134
+		global $dolibarr_main_demo, $db;
135
+		global $smartphone, $hookmanager;
136 136
 
137
-		$langs->loadLangs(array("main","other","help","admin"));
137
+		$langs->loadLangs(array("main", "other", "help", "admin"));
138 138
 
139 139
 		// Instantiate hooks of thirdparty module only if not already define
140 140
         $hookmanager->initHooks(array('mainloginpage'));
141 141
 
142 142
         $main_authentication = $conf->file->main_authentication;
143 143
 
144
-        $session_name=session_name();	// Get current session name
144
+        $session_name = session_name(); // Get current session name
145 145
 
146 146
 		$dol_url_root = DOL_URL_ROOT;
147 147
 
148 148
 		// Title
149
-		$appli=constant('DOL_APPLICATION_TITLE');
150
-		$title=$appli.' '.constant('DOL_VERSION');
151
-		if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title=$conf->global->MAIN_APPLICATION_TITLE;
152
-		$titletruedolibarrversion=constant('DOL_VERSION');	// $title used by login template after the @ to inform of true Dolibarr version
149
+		$appli = constant('DOL_APPLICATION_TITLE');
150
+		$title = $appli.' '.constant('DOL_VERSION');
151
+		if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $title = $conf->global->MAIN_APPLICATION_TITLE;
152
+		$titletruedolibarrversion = constant('DOL_VERSION'); // $title used by login template after the @ to inform of true Dolibarr version
153 153
 
154 154
 		// Note: $conf->css looks like '/theme/eldy/style.css.php'
155 155
 		/*
@@ -170,13 +170,13 @@  discard block
 block discarded – undo
170 170
 		*/
171 171
 
172 172
 		// Select templates dir
173
-		if (! empty($conf->modules_parts['tpl']))	// Using this feature slow down application
173
+		if (!empty($conf->modules_parts['tpl']))	// Using this feature slow down application
174 174
 		{
175
-			$dirtpls=array_merge($conf->modules_parts['tpl'],array('/core/tpl/'));
176
-			foreach($dirtpls as $reldir)
175
+			$dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl/'));
176
+			foreach ($dirtpls as $reldir)
177 177
 			{
178
-				$tmp=dol_buildpath($reldir.'login.tpl.php');
179
-				if (file_exists($tmp)) { $template_dir=preg_replace('/login\.tpl\.php$/','',$tmp); break; }
178
+				$tmp = dol_buildpath($reldir.'login.tpl.php');
179
+				if (file_exists($tmp)) { $template_dir = preg_replace('/login\.tpl\.php$/', '', $tmp); break; }
180 180
 			}
181 181
 		}
182 182
 		else
@@ -185,115 +185,115 @@  discard block
 block discarded – undo
185 185
 		}
186 186
 
187 187
 		// Set cookie for timeout management
188
-		$prefix=dol_getprefix('');
189
-		$sessiontimeout='DOLSESSTIMEOUT_'.$prefix;
190
-		if (! empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true);
188
+		$prefix = dol_getprefix('');
189
+		$sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix;
190
+		if (!empty($conf->global->MAIN_SESSION_TIMEOUT)) setcookie($sessiontimeout, $conf->global->MAIN_SESSION_TIMEOUT, 0, "/", null, false, true);
191 191
 
192
-		if (GETPOST('urlfrom','alpha')) $_SESSION["urlfrom"]=GETPOST('urlfrom','alpha');
192
+		if (GETPOST('urlfrom', 'alpha')) $_SESSION["urlfrom"] = GETPOST('urlfrom', 'alpha');
193 193
 		else unset($_SESSION["urlfrom"]);
194 194
 
195
-		if (! GETPOST("username",'alpha')) $focus_element='username';
196
-		else $focus_element='password';
195
+		if (!GETPOST("username", 'alpha')) $focus_element = 'username';
196
+		else $focus_element = 'password';
197 197
 
198
-		$demologin='';
199
-		$demopassword='';
200
-		if (! empty($dolibarr_main_demo))
198
+		$demologin = '';
199
+		$demopassword = '';
200
+		if (!empty($dolibarr_main_demo))
201 201
 		{
202
-			$tab=explode(',',$dolibarr_main_demo);
203
-			$demologin=$tab[0];
204
-			$demopassword=$tab[1];
202
+			$tab = explode(',', $dolibarr_main_demo);
203
+			$demologin = $tab[0];
204
+			$demopassword = $tab[1];
205 205
 		}
206 206
 
207 207
 		// Execute hook getLoginPageOptions (for table)
208
-		$parameters=array('entity' => GETPOST('entity','int'));
209
-		$reshook = $hookmanager->executeHooks('getLoginPageOptions',$parameters);    // Note that $action and $object may have been modified by some hooks.
210
-		if (is_array($hookmanager->resArray) && ! empty($hookmanager->resArray)) {
208
+		$parameters = array('entity' => GETPOST('entity', 'int'));
209
+		$reshook = $hookmanager->executeHooks('getLoginPageOptions', $parameters); // Note that $action and $object may have been modified by some hooks.
210
+		if (is_array($hookmanager->resArray) && !empty($hookmanager->resArray)) {
211 211
 			$morelogincontent = $hookmanager->resArray; // (deprecated) For compatibility
212 212
 		} else {
213 213
 			$morelogincontent = $hookmanager->resPrint;
214 214
 		}
215 215
 
216 216
 		// Execute hook getLoginPageExtraOptions (eg for js)
217
-		$parameters=array('entity' => GETPOST('entity','int'));
218
-		$reshook = $hookmanager->executeHooks('getLoginPageExtraOptions',$parameters);    // Note that $action and $object may have been modified by some hooks.
217
+		$parameters = array('entity' => GETPOST('entity', 'int'));
218
+		$reshook = $hookmanager->executeHooks('getLoginPageExtraOptions', $parameters); // Note that $action and $object may have been modified by some hooks.
219 219
 		$moreloginextracontent = $hookmanager->resPrint;
220 220
 
221 221
 		// Login
222
-		$login = (! empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username","alpha") ? GETPOST("username","alpha") : $demologin));
222
+		$login = (!empty($hookmanager->resArray['username']) ? $hookmanager->resArray['username'] : (GETPOST("username", "alpha") ? GETPOST("username", "alpha") : $demologin));
223 223
 		$password = $demopassword;
224 224
 
225 225
 		// Show logo (search in order: small company logo, large company logo, theme logo, common logo)
226
-		$width=0;
227
-		$urllogo = DOL_BASE_URI . '/theme/login_logo.png';
226
+		$width = 0;
227
+		$urllogo = DOL_BASE_URI.'/theme/login_logo.png';
228 228
 
229
-        if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
229
+        if (!empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
230 230
 		{
231
-			$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
231
+			$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/thumbs/'.$mysoc->logo_small);
232 232
 		}
233
-		elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
233
+		elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
234 234
 		{
235
-			$urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
236
-			$width=128;
235
+			$urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('logos/'.$mysoc->logo);
236
+			$width = 128;
237 237
 		}
238
-		elseif (is_readable(DOL_BASE_URI . '/theme/' . $conf->theme . '/img/dolibarr_logo.png')) {
239
-			$urllogo = DOL_BASE_URI . '/theme/' . $conf->theme . '/img/dolibarr_logo.png';
238
+		elseif (is_readable(DOL_BASE_URI.'/theme/'.$conf->theme.'/img/dolibarr_logo.png')) {
239
+			$urllogo = DOL_BASE_URI.'/theme/'.$conf->theme.'/img/dolibarr_logo.png';
240 240
         }
241
-		elseif (is_readable(DOL_BASE_URI . '/theme/dolibarr_logo.png')) {
242
-			$urllogo = DOL_BASE_URI . '/theme/dolibarr_logo.png';
241
+		elseif (is_readable(DOL_BASE_URI.'/theme/dolibarr_logo.png')) {
242
+			$urllogo = DOL_BASE_URI.'/theme/dolibarr_logo.png';
243 243
         }
244 244
 
245 245
 		// Security graphical code
246
-		$captcha=0;
247
-		$captcha_refresh='';
248
-		if (function_exists("imagecreatefrompng") && ! empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
246
+		$captcha = 0;
247
+		$captcha_refresh = '';
248
+		if (function_exists("imagecreatefrompng") && !empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA))
249 249
 		{
250
-			$captcha=1;
251
-			$captcha_refresh=img_picto($langs->trans("Refresh"),'refresh','id="captcha_refresh_img"');
250
+			$captcha = 1;
251
+			$captcha_refresh = img_picto($langs->trans("Refresh"), 'refresh', 'id="captcha_refresh_img"');
252 252
 		}
253 253
 
254 254
 		// Extra link
255
-		$forgetpasslink=0;
256
-		$helpcenterlink=0;
255
+		$forgetpasslink = 0;
256
+		$helpcenterlink = 0;
257 257
 		if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK) || empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
258 258
 		{
259 259
 			if (empty($conf->global->MAIN_SECURITY_DISABLEFORGETPASSLINK))
260 260
 			{
261
-				$forgetpasslink=1;
261
+				$forgetpasslink = 1;
262 262
 			}
263 263
 
264 264
 			if (empty($conf->global->MAIN_HELPCENTER_DISABLELINK))
265 265
 			{
266
-				$helpcenterlink=1;
266
+				$helpcenterlink = 1;
267 267
 			}
268 268
 		}
269 269
 
270 270
 		// Home message
271
-		$main_home='';
272
-		if (! empty($conf->global->MAIN_HOME))
271
+		$main_home = '';
272
+		if (!empty($conf->global->MAIN_HOME))
273 273
 		{
274
-		    $substitutionarray=getCommonSubstitutionArray($langs);
274
+		    $substitutionarray = getCommonSubstitutionArray($langs);
275 275
 		    complete_substitutions_array($substitutionarray, $langs);
276 276
 		    $texttoshow = make_substitutions($conf->global->MAIN_HOME, $substitutionarray, $langs);
277 277
 
278
-			$main_home=dol_htmlcleanlastbr($texttoshow);
278
+			$main_home = dol_htmlcleanlastbr($texttoshow);
279 279
 		}
280 280
 
281 281
 		// Google AD
282
-		$main_google_ad_client = ((! empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && ! empty($conf->global->MAIN_GOOGLE_AD_SLOT))?1:0);
282
+		$main_google_ad_client = ((!empty($conf->global->MAIN_GOOGLE_AD_CLIENT) && !empty($conf->global->MAIN_GOOGLE_AD_SLOT)) ? 1 : 0);
283 283
 
284 284
 		// Set jquery theme
285
-		$dol_loginmesg = (! empty($_SESSION["dol_loginmesg"])?$_SESSION["dol_loginmesg"]:'');
286
-		$favicon=dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico',1);
287
-		if (! empty($conf->global->MAIN_FAVICON_URL)) $favicon=$conf->global->MAIN_FAVICON_URL;
285
+		$dol_loginmesg = (!empty($_SESSION["dol_loginmesg"]) ? $_SESSION["dol_loginmesg"] : '');
286
+		$favicon = dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico', 1);
287
+		if (!empty($conf->global->MAIN_FAVICON_URL)) $favicon = $conf->global->MAIN_FAVICON_URL;
288 288
 		$jquerytheme = 'base';
289
-		if (! empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
289
+		if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
290 290
 
291 291
 		// Set dol_hide_topmenu, dol_hide_leftmenu, dol_optimize_smallscreen, dol_no_mouse_hover
292
-		$dol_hide_topmenu=GETPOST('dol_hide_topmenu','int');
293
-		$dol_hide_leftmenu=GETPOST('dol_hide_leftmenu','int');
294
-		$dol_optimize_smallscreen=GETPOST('dol_optimize_smallscreen','int');
295
-		$dol_no_mouse_hover=GETPOST('dol_no_mouse_hover','int');
296
-		$dol_use_jmobile=GETPOST('dol_use_jmobile','int');
292
+		$dol_hide_topmenu = GETPOST('dol_hide_topmenu', 'int');
293
+		$dol_hide_leftmenu = GETPOST('dol_hide_leftmenu', 'int');
294
+		$dol_optimize_smallscreen = GETPOST('dol_optimize_smallscreen', 'int');
295
+		$dol_no_mouse_hover = GETPOST('dol_no_mouse_hover', 'int');
296
+		$dol_use_jmobile = GETPOST('dol_use_jmobile', 'int');
297 297
 
298 298
 		// Include login page template
299 299
 		include $template_dir.'login.tpl.php';
@@ -311,23 +311,23 @@  discard block
 block discarded – undo
311 311
  *									non defini=>renvoi un salt pour cryptage par defaut
312 312
  *	@return		string				Salt string
313 313
  */
314
-function makesalt($type=CRYPT_SALT_LENGTH)
314
+function makesalt($type = CRYPT_SALT_LENGTH)
315 315
 {
316 316
 	dol_syslog("makesalt type=".$type);
317
-	switch($type)
317
+	switch ($type)
318 318
 	{
319 319
 		case 12:	// 8 + 4
320
-			$saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break;
320
+			$saltlen = 8; $saltprefix = '$1$'; $saltsuffix = '$'; break;
321 321
 		case 8:		// 8 (Pour compatibilite, ne devrait pas etre utilise)
322
-			$saltlen=8; $saltprefix='$1$'; $saltsuffix='$'; break;
322
+			$saltlen = 8; $saltprefix = '$1$'; $saltsuffix = '$'; break;
323 323
 		case 2:		// 2
324 324
 		default: 	// by default, fall back on Standard DES (should work everywhere)
325
-			$saltlen=2; $saltprefix=''; $saltsuffix=''; break;
325
+			$saltlen = 2; $saltprefix = ''; $saltsuffix = ''; break;
326 326
 	}
327
-	$salt='';
328
-	while(dol_strlen($salt) < $saltlen) $salt.=chr(mt_rand(64,126));
327
+	$salt = '';
328
+	while (dol_strlen($salt) < $saltlen) $salt .= chr(mt_rand(64, 126));
329 329
 
330
-	$result=$saltprefix.$salt.$saltsuffix;
330
+	$result = $saltprefix.$salt.$saltsuffix;
331 331
 	dol_syslog("makesalt return=".$result);
332 332
 	return $result;
333 333
 }
@@ -338,42 +338,42 @@  discard block
 block discarded – undo
338 338
  *  @param   	int		$level   	Encode level: 0 no encoding, 1 encoding
339 339
  *	@return		int					<0 if KO, >0 if OK
340 340
  */
341
-function encodedecode_dbpassconf($level=0)
341
+function encodedecode_dbpassconf($level = 0)
342 342
 {
343 343
 	dol_syslog("encodedecode_dbpassconf level=".$level, LOG_DEBUG);
344 344
 	$config = '';
345
-	$passwd='';
346
-	$passwd_crypted='';
345
+	$passwd = '';
346
+	$passwd_crypted = '';
347 347
 
348
-	if ($fp = fopen(DOL_DOCUMENT_ROOT.'/conf/conf.php','r'))
348
+	if ($fp = fopen(DOL_DOCUMENT_ROOT.'/conf/conf.php', 'r'))
349 349
 	{
350
-		while(!feof($fp))
350
+		while (!feof($fp))
351 351
 		{
352
-			$buffer = fgets($fp,4096);
352
+			$buffer = fgets($fp, 4096);
353 353
 
354
-			$lineofpass=0;
354
+			$lineofpass = 0;
355 355
 
356
-			if (preg_match('/^[^#]*dolibarr_main_db_encrypted_pass[\s]*=[\s]*(.*)/i',$buffer,$reg))	// Old way to save crypted value
356
+			if (preg_match('/^[^#]*dolibarr_main_db_encrypted_pass[\s]*=[\s]*(.*)/i', $buffer, $reg))	// Old way to save crypted value
357 357
 			{
358
-				$val = trim($reg[1]);	// This also remove CR/LF
359
-				$val=preg_replace('/^["\']/','',$val);
360
-				$val=preg_replace('/["\'][\s;]*$/','',$val);
361
-				if (! empty($val))
358
+				$val = trim($reg[1]); // This also remove CR/LF
359
+				$val = preg_replace('/^["\']/', '', $val);
360
+				$val = preg_replace('/["\'][\s;]*$/', '', $val);
361
+				if (!empty($val))
362 362
 				{
363 363
 					$passwd_crypted = $val;
364 364
 					$val = dol_decode($val);
365 365
 					$passwd = $val;
366
-					$lineofpass=1;
366
+					$lineofpass = 1;
367 367
 				}
368 368
 			}
369
-			elseif (preg_match('/^[^#]*dolibarr_main_db_pass[\s]*=[\s]*(.*)/i',$buffer,$reg))
369
+			elseif (preg_match('/^[^#]*dolibarr_main_db_pass[\s]*=[\s]*(.*)/i', $buffer, $reg))
370 370
 			{
371
-				$val = trim($reg[1]);	// This also remove CR/LF
372
-				$val=preg_replace('/^["\']/','',$val);
373
-				$val=preg_replace('/["\'][\s;]*$/','',$val);
374
-				if (preg_match('/crypted:/i',$buffer))
371
+				$val = trim($reg[1]); // This also remove CR/LF
372
+				$val = preg_replace('/^["\']/', '', $val);
373
+				$val = preg_replace('/["\'][\s;]*$/', '', $val);
374
+				if (preg_match('/crypted:/i', $buffer))
375 375
 				{
376
-					$val = preg_replace('/crypted:/i','',$val);
376
+					$val = preg_replace('/crypted:/i', '', $val);
377 377
 					$passwd_crypted = $val;
378 378
 					$val = dol_decode($val);
379 379
 					$passwd = $val;
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 					$val = dol_encode($val);
385 385
 					$passwd_crypted = $val;
386 386
 				}
387
-				$lineofpass=1;
387
+				$lineofpass = 1;
388 388
 			}
389 389
 
390 390
 			// Output line
@@ -411,8 +411,8 @@  discard block
 block discarded – undo
411 411
 		fclose($fp);
412 412
 
413 413
 		// Write new conf file
414
-		$file=DOL_DOCUMENT_ROOT.'/conf/conf.php';
415
-		if ($fp = @fopen($file,'w'))
414
+		$file = DOL_DOCUMENT_ROOT.'/conf/conf.php';
415
+		if ($fp = @fopen($file, 'w'))
416 416
 		{
417 417
 			fputs($fp, $config);
418 418
 			fflush($fp);
@@ -446,11 +446,11 @@  discard block
 block discarded – undo
446 446
  * @return		string								New value for password
447 447
  * @see dol_hash
448 448
  */
449
-function getRandomPassword($generic=false, $replaceambiguouschars=null)
449
+function getRandomPassword($generic = false, $replaceambiguouschars = null)
450 450
 {
451
-	global $db,$conf,$langs,$user;
451
+	global $db, $conf, $langs, $user;
452 452
 
453
-	$generated_password='';
453
+	$generated_password = '';
454 454
 	if ($generic)
455 455
 	{
456 456
 		$length = 32;
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
 		$uppercase = "ASDFGHJKLZXCVBNMQWERTYUIOP";
459 459
 		$numbers = "1234567890";
460 460
 		$randomCode = "";
461
-		$nbofchar = round($length/3);
462
-		$nbofcharlast = ($length - 2*$nbofchar);
461
+		$nbofchar = round($length / 3);
462
+		$nbofcharlast = ($length - 2 * $nbofchar);
463 463
 		//var_dump($nbofchar.'-'.$nbofcharlast);
464 464
 		if (function_exists('random_int'))	// Cryptographic random
465 465
 		{
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 				$randomCode .= $numbers{random_int(0, $max)};
477 477
 			}
478 478
 
479
-			$generated_password=str_shuffle($randomCode);
479
+			$generated_password = str_shuffle($randomCode);
480 480
 		}
481 481
 		else	// Old platform, non cryptographic random
482 482
 		{
@@ -493,17 +493,17 @@  discard block
 block discarded – undo
493 493
 				$randomCode .= $numbers{mt_rand(0, $max)};
494 494
 			}
495 495
 
496
-			$generated_password=str_shuffle($randomCode);
496
+			$generated_password = str_shuffle($randomCode);
497 497
 		}
498 498
 	}
499
-	else if (! empty($conf->global->USER_PASSWORD_GENERATED))
499
+	else if (!empty($conf->global->USER_PASSWORD_GENERATED))
500 500
 	{
501
-		$nomclass="modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED);
502
-		$nomfichier=$nomclass.".class.php";
501
+		$nomclass = "modGeneratePass".ucfirst($conf->global->USER_PASSWORD_GENERATED);
502
+		$nomfichier = $nomclass.".class.php";
503 503
 		//print DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomclass;
504 504
 		require_once DOL_DOCUMENT_ROOT."/core/modules/security/generate/".$nomfichier;
505
-		$genhandler=new $nomclass($db,$conf,$langs,$user);
506
-		$generated_password=$genhandler->getNewGeneratedPassword();
505
+		$genhandler = new $nomclass($db, $conf, $langs, $user);
506
+		$generated_password = $genhandler->getNewGeneratedPassword();
507 507
 		unset($genhandler);
508 508
 	}
509 509
 
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 	{
513 513
 		$numbers = "ABCDEF";
514 514
 		$max = strlen($numbers) - 1;
515
-		$generated_password=str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password);
515
+		$generated_password = str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password);
516 516
 	}
517 517
 
518 518
 	return $generated_password;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/class/hookmanager.class.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             $arraycontext = array($arraycontext);
91 91
         }
92 92
 
93
-        $this->contextarray = array_unique(array_merge($arraycontext, $this->contextarray));    // All contexts are concatenated
93
+        $this->contextarray = array_unique(array_merge($arraycontext, $this->contextarray)); // All contexts are concatenated
94 94
 
95 95
         foreach ($conf->modules_parts['hooks'] as $module => $hooks) { // Loop on each module that brings hooks
96 96
             if (empty($conf->$module->enabled)) {
@@ -100,20 +100,20 @@  discard block
 block discarded – undo
100 100
             //dol_syslog(get_class($this).'::initHooks module='.$module.' arraycontext='.join(',',$arraycontext));
101 101
             foreach ($arraycontext as $context) {
102 102
                 if (is_array($hooks)) {
103
-                    $arrayhooks = $hooks;    // New system
103
+                    $arrayhooks = $hooks; // New system
104 104
                 } else {
105
-                    $arrayhooks = explode(':', $hooks);        // Old system (for backward compatibility)
105
+                    $arrayhooks = explode(':', $hooks); // Old system (for backward compatibility)
106 106
                 }
107 107
                 if (in_array($context, $arrayhooks) || in_array('all', $arrayhooks)) {    // We instantiate action class only if initialized hook is handled by module
108 108
                     // Include actions class overwriting hooks
109 109
                     if (!is_object($this->hooks[$context][$module])) { // If set, class was already loaded
110
-                        $path = '/' . $module . '/class/';
111
-                        $actionfile = 'actions_' . $module . '.class.php';
110
+                        $path = '/'.$module.'/class/';
111
+                        $actionfile = 'actions_'.$module.'.class.php';
112 112
 
113
-                        dol_syslog(get_class($this) . '::initHooks Loading hook class for context ' . $context . ": " . $actionfile, LOG_INFO);
114
-                        $resaction = dol_include_once($path . $actionfile);
113
+                        dol_syslog(get_class($this).'::initHooks Loading hook class for context '.$context.": ".$actionfile, LOG_INFO);
114
+                        $resaction = dol_include_once($path.$actionfile);
115 115
                         if ($resaction) {
116
-                            $controlclassname = 'Actions' . ucfirst($module);
116
+                            $controlclassname = 'Actions'.ucfirst($module);
117 117
                             $actionInstance = new $controlclassname($this->db);
118 118
                             $this->hooks[$context][$module] = $actionInstance;
119 119
                         }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
                     $actionclassinstance->error = 0;
237 237
                     $actionclassinstance->errors = array();
238 238
 
239
-                    dol_syslog(get_class($this) . "::executeHooks Qualified hook found (hooktype=" . $hooktype . "). We call method " . $method . " of class " . get_class($actionclassinstance) . ", module=" . $module . ", action=" . $action . " context=" . $context, LOG_DEBUG);
239
+                    dol_syslog(get_class($this)."::executeHooks Qualified hook found (hooktype=".$hooktype."). We call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", action=".$action." context=".$context, LOG_DEBUG);
240 240
 
241 241
                     // Add current context to avoid method execution in bad context, you can add this test in your method : eg if($currentcontext != 'formfile') return;
242 242
                     $parameters['currentcontext'] = $context;
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
                             $error++;
248 248
                             $this->error = $actionclassinstance->error;
249 249
                             $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors);
250
-                            dol_syslog("Error on hook module=" . $module . ", method " . $method . ", class " . get_class($actionclassinstance) . ", hooktype=" . $hooktype . (empty($this->error) ? '' : " " . $this->error) . (empty($this->errors) ? '' : " " . join(",", $this->errors)), LOG_ERR);
250
+                            dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR);
251 251
                         }
252 252
 
253 253
                         if (isset($actionclassinstance->results) && is_array($actionclassinstance->results))
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                             $this->resPrint .= $actionclassinstance->resprints;
271 271
                         // TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string
272 272
                         if (!is_array($resaction) && !is_numeric($resaction)) {
273
-                            dol_syslog('Error: Bug into hook ' . $method . ' of module class ' . get_class($actionclassinstance) . '. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR);
273
+                            dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR);
274 274
                             if (empty($actionclassinstance->resprints)) {
275 275
                                 $this->resPrint .= $resaction;
276 276
                                 $resaction = 0;
Please login to merge, or discard this patch.
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -138,8 +138,9 @@  discard block
 block discarded – undo
138 138
      */
139 139
     function executeHooks($method, $parameters = array(), &$object = '', &$action = '')
140 140
     {
141
-        if (!is_array($this->hooks) || empty($this->hooks))
142
-            return '';
141
+        if (!is_array($this->hooks) || empty($this->hooks)) {
142
+                    return '';
143
+        }
143 144
 
144 145
         $parameters['context'] = join(':', $this->contextarray);
145 146
         //dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']);
@@ -199,8 +200,9 @@  discard block
 block discarded – undo
199 200
                 'setContentSecurityPolicy',
200 201
                 'setHtmlTitle'
201 202
                 )
202
-            ))
203
-            $hooktype = 'addreplace';
203
+            )) {
204
+                    $hooktype = 'addreplace';
205
+        }
204 206
 
205 207
         if ($method == 'insertExtraFields') {
206 208
             $hooktype = 'returnvalue'; // @deprecated. TODO Remove all code with "executeHooks('insertExtraFields'" as soon as there is a trigger available.
@@ -222,12 +224,14 @@  discard block
 block discarded – undo
222 224
                 foreach ($modules as $module => $actionclassinstance) {
223 225
                     //print "Before hook ".get_class($actionclassinstance)." method=".$method." hooktype=".$hooktype." results=".count($actionclassinstance->results)." resprints=".count($actionclassinstance->resprints)." resaction=".$resaction." result=".$result."<br>\n";
224 226
                     // test to avoid running twice a hook, when a module implements several active contexts
225
-                    if (in_array($module, $modulealreadyexecuted))
226
-                        continue;
227
+                    if (in_array($module, $modulealreadyexecuted)) {
228
+                                            continue;
229
+                    }
227 230
 
228 231
                     // jump to next module/class if method does not exist
229
-                    if (!method_exists($actionclassinstance, $method))
230
-                        continue;
232
+                    if (!method_exists($actionclassinstance, $method)) {
233
+                                            continue;
234
+                    }
231 235
 
232 236
                     $this->resNbOfHooks++;
233 237
 
@@ -250,24 +254,29 @@  discard block
 block discarded – undo
250 254
                             dol_syslog("Error on hook module=" . $module . ", method " . $method . ", class " . get_class($actionclassinstance) . ", hooktype=" . $hooktype . (empty($this->error) ? '' : " " . $this->error) . (empty($this->errors) ? '' : " " . join(",", $this->errors)), LOG_ERR);
251 255
                         }
252 256
 
253
-                        if (isset($actionclassinstance->results) && is_array($actionclassinstance->results))
254
-                            $this->resArray = array_merge($this->resArray, $actionclassinstance->results);
255
-                        if (!empty($actionclassinstance->resprints))
256
-                            $this->resPrint .= $actionclassinstance->resprints;
257
+                        if (isset($actionclassinstance->results) && is_array($actionclassinstance->results)) {
258
+                                                    $this->resArray = array_merge($this->resArray, $actionclassinstance->results);
259
+                        }
260
+                        if (!empty($actionclassinstance->resprints)) {
261
+                                                    $this->resPrint .= $actionclassinstance->resprints;
262
+                        }
257 263
                     }
258 264
                     // Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...)
259 265
                     else {
260 266
                         // TODO. this test should be done into the method of hook by returning nothing
261
-                        if (is_array($parameters) && !empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number)
262
-                            continue;
267
+                        if (is_array($parameters) && !empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) {
268
+                                                    continue;
269
+                        }
263 270
 
264 271
                         //dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG);
265 272
                         $resaction = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
266 273
 
267
-                        if (!empty($actionclassinstance->results) && is_array($actionclassinstance->results))
268
-                            $this->resArray = array_merge($this->resArray, $actionclassinstance->results);
269
-                        if (!empty($actionclassinstance->resprints))
270
-                            $this->resPrint .= $actionclassinstance->resprints;
274
+                        if (!empty($actionclassinstance->results) && is_array($actionclassinstance->results)) {
275
+                                                    $this->resArray = array_merge($this->resArray, $actionclassinstance->results);
276
+                        }
277
+                        if (!empty($actionclassinstance->resprints)) {
278
+                                                    $this->resPrint .= $actionclassinstance->resprints;
279
+                        }
271 280
                         // TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string
272 281
                         if (!is_array($resaction) && !is_numeric($resaction)) {
273 282
                             dol_syslog('Error: Bug into hook ' . $method . ' of module class ' . get_class($actionclassinstance) . '. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR);
Please login to merge, or discard this patch.
dolibarr/htdocs/main.inc.php 2 patches
Spacing   +293 added lines, -293 removed lines patch added patch discarded remove patch
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
         $inj += preg_match('/insert\s+into/i', $val);
101 101
         $inj += preg_match('/select\s+from/i', $val);
102 102
         $inj += preg_match('/into\s+(outfile|dumpfile)/i', $val);
103
-        $inj += preg_match('/user\s*\(/i', $val);      // avoid to use function user() that return current database login
104
-        $inj += preg_match('/information_schema/i', $val);    // avoid to use request that read information_schema database
103
+        $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() that return current database login
104
+        $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database
105 105
     }
106 106
     if ($type == 3) {
107 107
         $inj += preg_match('/select|update|delete|replace|group\s+by|concat|count|from/i', $val);
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
         $inj += preg_match('/<style/i', $val);
126 126
     }
127 127
     $inj += preg_match('/base[\s]+href/si', $val);
128
-    $inj += preg_match('/<.*onmouse/si', $val);       // onmousexxx can be set on img or any html tag like <img title='...' onmouseover=alert(1)>
129
-    $inj += preg_match('/onerror\s*=/i', $val);       // onerror can be set on img or any html tag like <img title='...' onerror = alert(1)>
130
-    $inj += preg_match('/onfocus\s*=/i', $val);       // onfocus can be set on input text html tag like <input type='text' value='...' onfocus = alert(1)>
131
-    $inj += preg_match('/onload\s*=/i', $val);        // onload can be set on svg tag <svg/onload=alert(1)> or other tag like body <body onload=alert(1)>
132
-    $inj += preg_match('/onloadstart\s*=/i', $val);   // onload can be set on audio tag <audio onloadstart=alert(1)>
133
-    $inj += preg_match('/onclick\s*=/i', $val);       // onclick can be set on img text html tag like <img onclick = alert(1)>
134
-    $inj += preg_match('/onscroll\s*=/i', $val);      // onscroll can be on textarea
128
+    $inj += preg_match('/<.*onmouse/si', $val); // onmousexxx can be set on img or any html tag like <img title='...' onmouseover=alert(1)>
129
+    $inj += preg_match('/onerror\s*=/i', $val); // onerror can be set on img or any html tag like <img title='...' onerror = alert(1)>
130
+    $inj += preg_match('/onfocus\s*=/i', $val); // onfocus can be set on input text html tag like <input type='text' value='...' onfocus = alert(1)>
131
+    $inj += preg_match('/onload\s*=/i', $val); // onload can be set on svg tag <svg/onload=alert(1)> or other tag like body <body onload=alert(1)>
132
+    $inj += preg_match('/onloadstart\s*=/i', $val); // onload can be set on audio tag <audio onloadstart=alert(1)>
133
+    $inj += preg_match('/onclick\s*=/i', $val); // onclick can be set on img text html tag like <img onclick = alert(1)>
134
+    $inj += preg_match('/onscroll\s*=/i', $val); // onscroll can be on textarea
135 135
     //$inj += preg_match('/on[A-Z][a-z]+\*=/', $val);   // To lock event handlers onAbort(), ...
136
-    $inj += preg_match('/&#58;|&#0000058|&#x3A/i', $val);  // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...'
136
+    $inj += preg_match('/&#58;|&#0000058|&#x3A/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...'
137 137
     //if ($type == 1)
138 138
     //{
139 139
     $inj += preg_match('/javascript:/i', $val);
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
     //}
142 142
     // For XSS Injection done by adding javascript closing html tags like with onmousemove, etc... (closing a src or href tag with not cleaned param)
143 143
     if ($type == 1) {
144
-        $inj += preg_match('/"/i', $val);  // We refused " in GET parameters value
144
+        $inj += preg_match('/"/i', $val); // We refused " in GET parameters value
145 145
     }
146 146
     if ($type == 2) {
147
-        $inj += preg_match('/[;"]/', $val);  // PHP_SELF is a file system path. It can contains spaces.
147
+        $inj += preg_match('/[;"]/', $val); // PHP_SELF is a file system path. It can contains spaces.
148 148
     }
149 149
     return $inj;
150 150
 }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             if (analyseVarsForSqlAndScriptsInjection($key, $type) && analyseVarsForSqlAndScriptsInjection($value, $type)) {
164 164
                 //$var[$key] = $value;	// This is useless
165 165
             } else {
166
-                print 'Access refused by SQL/Script injection protection in main.inc.php (type=' . htmlentities($type) . ' key=' . htmlentities($key) . ' value=' . htmlentities($value) . ' page=' . htmlentities($_SERVER["REQUEST_URI"]) . ')';
166
+                print 'Access refused by SQL/Script injection protection in main.inc.php (type='.htmlentities($type).' key='.htmlentities($key).' value='.htmlentities($value).' page='.htmlentities($_SERVER["REQUEST_URI"]).')';
167 167
                 exit;
168 168
             }
169 169
         }
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 
198 198
 // This is to make Dolibarr working with Plesk
199 199
 if (!empty($_SERVER['DOCUMENT_ROOT']) && substr($_SERVER['DOCUMENT_ROOT'], -6) !== 'htdocs') {
200
-    set_include_path($_SERVER['DOCUMENT_ROOT'] . '/htdocs');
200
+    set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
201 201
 }
202 202
 
203 203
 // Include the conf.php and functions.lib.php
204
-require_once DOL_BASE_PATH . '/filefunc.inc.php';
204
+require_once DOL_BASE_PATH.'/filefunc.inc.php';
205 205
 
206 206
 // If there is a POST parameter to tell to save automatically some POST parameters into cookies, we do it.
207 207
 // This is used for example by form of boxes to save personalization of some options.
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
     $tmplist = explode(',', $tmpautoset[1]);
212 212
     $cookiearrayvalue = array();
213 213
     foreach ($tmplist as $tmpkey) {
214
-        $postkey = $tmpautoset[0] . '_' . $tmpkey;
214
+        $postkey = $tmpautoset[0].'_'.$tmpkey;
215 215
         //var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]);
216 216
         if (!empty($_POST[$postkey]))
217 217
             $cookiearrayvalue[$tmpkey] = $_POST[$postkey];
@@ -229,12 +229,12 @@  discard block
 block discarded – undo
229 229
 // Note: the function dol_getprefix may have been redefined to return a different key to manage another area to protect.
230 230
 $prefix = dol_getprefix('');
231 231
 
232
-$sessionname = 'DOLSESSID_' . $prefix;
233
-$sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix;
232
+$sessionname = 'DOLSESSID_'.$prefix;
233
+$sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix;
234 234
 if (!empty($_COOKIE[$sessiontimeout]))
235 235
     ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
236 236
 session_name($sessionname);
237
-session_set_cookie_params(0, '/', null, false, true);   // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
237
+session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
238 238
 // This create lock, released when session_write_close() or end of page.
239 239
 // We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished.
240 240
 if (!defined('NOSESSION')) {
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     $conf->browser->name = $tmp['browsername'];
261 261
     $conf->browser->os = $tmp['browseros'];
262 262
     $conf->browser->version = $tmp['browserversion'];
263
-    $conf->browser->layout = $tmp['layout'];     // 'classic', 'phone', 'tablet'
263
+    $conf->browser->layout = $tmp['layout']; // 'classic', 'phone', 'tablet'
264 264
     //var_dump($conf->browser);
265 265
 
266 266
     if ($conf->browser->layout == 'phone')
@@ -279,16 +279,16 @@  discard block
 block discarded – undo
279 279
                 $newurl = preg_replace('/^http:/i', 'https:', $_SERVER["SCRIPT_URI"]);
280 280
             }
281 281
         } else { // Check HTTPS environment variable (Apache/mod_ssl only)
282
-            $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT) . $_SERVER["REQUEST_URI"];
282
+            $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT).$_SERVER["REQUEST_URI"];
283 283
         }
284 284
     } else {
285 285
         // Check HTTPS environment variable (Apache/mod_ssl only)
286
-        $newurl = $conf->file->main_force_https . $_SERVER["REQUEST_URI"];
286
+        $newurl = $conf->file->main_force_https.$_SERVER["REQUEST_URI"];
287 287
     }
288 288
     // Start redirect
289 289
     if ($newurl) {
290
-        dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to " . $newurl);
291
-        header("Location: " . $newurl);
290
+        dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl);
291
+        header("Location: ".$newurl);
292 292
         exit;
293 293
     } else {
294 294
         dol_syslog("main.inc: dolibarr_main_force_https is on but we failed to forge new https url so no redirect is done", LOG_WARNING);
@@ -313,9 +313,9 @@  discard block
 block discarded – undo
313 313
 
314 314
 // Loading of additional presentation includes
315 315
 if (!defined('NOREQUIREHTML'))
316
-    require_once DOL_BASE_PATH . '/core/class/html.form.class.php';     // Need 660ko memory (800ko in 2.2)
316
+    require_once DOL_BASE_PATH.'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2)
317 317
 if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax)
318
-    require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php'; // Need 22ko memory
318
+    require_once DOL_BASE_PATH.'/core/lib/ajax.lib.php'; // Need 22ko memory
319 319
 
320 320
 
321 321
 
@@ -324,19 +324,19 @@  discard block
 block discarded – undo
324 324
 // If install or upgrade process not done or not completely finished, we call the install page.
325 325
 if (!empty($conf->global->MAIN_NOT_INSTALLED) || !empty($conf->global->MAIN_NOT_UPGRADED)) {
326 326
     dol_syslog("main.inc: A previous install or upgrade was not complete. Redirect to install page.", LOG_WARNING);
327
-    header("Location: " . DOL_BASE_URI . "/install/index.php");
327
+    header("Location: ".DOL_BASE_URI."/install/index.php");
328 328
     exit;
329 329
 }
330 330
 // If an upgrade process is required, we call the install page.
331 331
 if ((!empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && ($conf->global->MAIN_VERSION_LAST_UPGRADE != DOL_VERSION)) || (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) && !empty($conf->global->MAIN_VERSION_LAST_INSTALL) && ($conf->global->MAIN_VERSION_LAST_INSTALL != DOL_VERSION))) {
332 332
     $versiontocompare = empty($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE;
333
-    require_once DOL_BASE_PATH . '/core/lib/admin.lib.php';
333
+    require_once DOL_BASE_PATH.'/core/lib/admin.lib.php';
334 334
     $dolibarrversionlastupgrade = preg_split('/[.-]/', $versiontocompare);
335 335
     $dolibarrversionprogram = preg_split('/[.-]/', DOL_VERSION);
336 336
     $rescomp = versioncompare($dolibarrversionprogram, $dolibarrversionlastupgrade);
337 337
     if ($rescomp > 0) {   // Programs have a version higher than database. We did not add "&& $rescomp < 3" because we want upgrade process for build upgrades
338
-        dol_syslog("main.inc: database version " . $versiontocompare . " is lower than programs version " . DOL_VERSION . ". Redirect to install page.", LOG_WARNING);
339
-        header("Location: " . DOL_BASE_URI . "/install/index.php");
338
+        dol_syslog("main.inc: database version ".$versiontocompare." is lower than programs version ".DOL_VERSION.". Redirect to install page.", LOG_WARNING);
339
+        header("Location: ".DOL_BASE_URI."/install/index.php");
340 340
         exit;
341 341
     }
342 342
 }
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
     }
360 360
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {  // This test must be after loading $_SESSION['token'].
361 361
         if (GETPOST('token', 'alpha') != $_SESSION['token']) {
362
-            dol_syslog("Invalid token in " . $_SERVER['HTTP_REFERER'] . ", action=" . GETPOST('action', 'aZ09') . ", _POST['token']=" . GETPOST('token', 'alpha') . ", _SESSION['token']=" . $_SESSION['token'], LOG_WARNING);
362
+            dol_syslog("Invalid token in ".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING);
363 363
             //print 'Unset POST by CSRF protection in main.inc.php.';	// Do not output anything because this create problems when using the BACK button on browsers.
364 364
             unset($_POST);
365 365
         }
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
     $test = true;
420 420
     if (!isset($_SESSION["dol_login"])) {
421 421
         // It is not already authenticated and it requests the login / password
422
-        include_once DOL_BASE_PATH . '/core/lib/security2.lib.php';
422
+        include_once DOL_BASE_PATH.'/core/lib/security2.lib.php';
423 423
 
424 424
         $dol_dst_observed = GETPOST("dst_observed", 'int', 3);
425 425
         $dol_dst_first = GETPOST("dst_first", 'int', 3);
@@ -433,17 +433,17 @@  discard block
 block discarded – undo
433 433
         $dol_use_jmobile = GETPOST('dol_use_jmobile', 'int', 3);
434 434
         //dol_syslog("POST key=".join(array_keys($_POST),',').' value='.join($_POST,','));
435 435
         // If in demo mode, we check we go to home page through the public/demo/index.php page
436
-        if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_BASE_URI . '/index.php') {  // We ask index page
436
+        if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_BASE_URI.'/index.php') {  // We ask index page
437 437
             if (empty($_SERVER['HTTP_REFERER']) || !preg_match('/public/', $_SERVER['HTTP_REFERER'])) {
438
-                dol_syslog("Call index page from another url than demo page (call is done from page " . $_SERVER['HTTP_REFERER'] . ")");
438
+                dol_syslog("Call index page from another url than demo page (call is done from page ".$_SERVER['HTTP_REFERER'].")");
439 439
                 $url = '';
440
-                $url .= ($url ? '&' : '') . ($dol_hide_topmenu ? 'dol_hide_topmenu=' . $dol_hide_topmenu : '');
441
-                $url .= ($url ? '&' : '') . ($dol_hide_leftmenu ? 'dol_hide_leftmenu=' . $dol_hide_leftmenu : '');
442
-                $url .= ($url ? '&' : '') . ($dol_optimize_smallscreen ? 'dol_optimize_smallscreen=' . $dol_optimize_smallscreen : '');
443
-                $url .= ($url ? '&' : '') . ($dol_no_mouse_hover ? 'dol_no_mouse_hover=' . $dol_no_mouse_hover : '');
444
-                $url .= ($url ? '&' : '') . ($dol_use_jmobile ? 'dol_use_jmobile=' . $dol_use_jmobile : '');
445
-                $url = DOL_BASE_URI . '/public/demo/index.php' . ($url ? '?' . $url : '');
446
-                header("Location: " . $url);
440
+                $url .= ($url ? '&' : '').($dol_hide_topmenu ? 'dol_hide_topmenu='.$dol_hide_topmenu : '');
441
+                $url .= ($url ? '&' : '').($dol_hide_leftmenu ? 'dol_hide_leftmenu='.$dol_hide_leftmenu : '');
442
+                $url .= ($url ? '&' : '').($dol_optimize_smallscreen ? 'dol_optimize_smallscreen='.$dol_optimize_smallscreen : '');
443
+                $url .= ($url ? '&' : '').($dol_no_mouse_hover ? 'dol_no_mouse_hover='.$dol_no_mouse_hover : '');
444
+                $url .= ($url ? '&' : '').($dol_use_jmobile ? 'dol_use_jmobile='.$dol_use_jmobile : '');
445
+                $url = DOL_BASE_URI.'/public/demo/index.php'.($url ? '?'.$url : '');
446
+                header("Location: ".$url);
447 447
                 exit;
448 448
             }
449 449
         }
@@ -463,9 +463,9 @@  discard block
 block discarded – undo
463 463
                 $test = false;
464 464
 
465 465
                 // Call trigger for the "security events" log
466
-                $user->trigger_mesg = 'ErrorBadValueForCode - login=' . GETPOST("username", "alpha", 2);
466
+                $user->trigger_mesg = 'ErrorBadValueForCode - login='.GETPOST("username", "alpha", 2);
467 467
                 // Call of triggers
468
-                include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
468
+                include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
469 469
                 $interface = new Interfaces($db);
470 470
                 $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf);
471 471
                 if ($result < 0) {
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
                 $action = '';
477 477
                 $hookmanager->initHooks(array('login'));
478 478
                 $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
479
-                $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
479
+                $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
480 480
                 if ($reshook < 0)
481 481
                     $error++;
482 482
 
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
             $goontestloop = true;
502 502
 
503 503
         if (!is_object($langs)) { // This can occurs when calling page with NOREQUIRETRAN defined, however we need langs for error messages.
504
-            include_once DOL_BASE_PATH . '/core/class/translate.class.php';
504
+            include_once DOL_BASE_PATH.'/core/class/translate.class.php';
505 505
             $langs = new Translate("", $conf);
506 506
             $langcode = (GETPOST('lang', 'aZ09', 1) ? GETPOST('lang', 'aZ09', 1) : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT));
507 507
             if (defined('MAIN_LANG_DEFAULT'))
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
                 $dol_tz_string = preg_replace('/\s/', '_', $dol_tz_string);
524 524
                 $dol_dst = 0;
525 525
                 if (isset($_POST["dst_first"]) && isset($_POST["dst_second"])) {
526
-                    include_once DOL_BASE_PATH . '/core/lib/date.lib.php';
526
+                    include_once DOL_BASE_PATH.'/core/lib/date.lib.php';
527 527
                     $datenow = dol_now();
528 528
                     $datefirst = dol_stringtotime($_POST["dst_first"]);
529 529
                     $datesecond = dol_stringtotime($_POST["dst_second"]);
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
                     $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword");
545 545
 
546 546
                 // Call trigger for the "security events" log
547
-                $user->trigger_mesg = $langs->trans("ErrorBadLoginPassword") . ' - login=' . GETPOST("username", "alpha", 2);
547
+                $user->trigger_mesg = $langs->trans("ErrorBadLoginPassword").' - login='.GETPOST("username", "alpha", 2);
548 548
                 // Call of triggers
549
-                include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
549
+                include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
550 550
                 $interface = new Interfaces($db);
551 551
                 $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf, GETPOST("username", "alpha", 2));
552 552
                 if ($result < 0) {
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
                 $action = '';
558 558
                 $hookmanager->initHooks(array('login'));
559 559
                 $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
560
-                $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
560
+                $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
561 561
                 if ($reshook < 0)
562 562
                     $error++;
563 563
 
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
         // End test login / passwords
569 569
         if (!$login || (in_array('ldap', $authmode) && empty($passwordtotest))) { // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success.
570 570
             // No data to test login, so we show the login page
571
-            dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . " showing the login form and exit");
571
+            dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." showing the login form and exit");
572 572
             if (defined('NOREDIRECTBYMAINTOLOGIN'))
573 573
                 return 'ERROR_NOT_LOGGED';
574 574
             else
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
             dol_syslog('User not found, connexion refused');
582 582
             session_destroy();
583 583
             session_name($sessionname);
584
-            session_set_cookie_params(0, '/', null, false, true);   // Add tag httponly on session cookie
585
-            session_start();    // Fixing the bug of register_globals here is useless since session is empty
584
+            session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie
585
+            session_start(); // Fixing the bug of register_globals here is useless since session is empty
586 586
 
587 587
             if ($resultFetchUser == 0) {
588 588
                 // Load translation files required by page
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 
591 591
                 $_SESSION["dol_loginmesg"] = $langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login);
592 592
 
593
-                $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login=' . $login;
593
+                $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
594 594
             }
595 595
             if ($resultFetchUser < 0) {
596 596
                 $_SESSION["dol_loginmesg"] = $user->error;
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
             }
600 600
 
601 601
             // Call triggers for the "security events" log
602
-            include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
602
+            include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
603 603
             $interface = new Interfaces($db);
604 604
             $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf);
605 605
             if ($result < 0) {
@@ -610,18 +610,18 @@  discard block
 block discarded – undo
610 610
             $action = '';
611 611
             $hookmanager->initHooks(array('login'));
612 612
             $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
613
-            $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
613
+            $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
614 614
             if ($reshook < 0)
615 615
                 $error++;
616 616
 
617 617
             $paramsurl = array();
618 618
             if (GETPOST('textbrowser', 'int'))
619
-                $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
619
+                $paramsurl[] = 'textbrowser='.GETPOST('textbrowser', 'int');
620 620
             if (GETPOST('nojs', 'int'))
621
-                $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
621
+                $paramsurl[] = 'nojs='.GETPOST('nojs', 'int');
622 622
             if (GETPOST('lang', 'aZ09'))
623
-                $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
624
-            header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''));
623
+                $paramsurl[] = 'lang='.GETPOST('lang', 'aZ09');
624
+            header('Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : ''));
625 625
             exit;
626 626
         }
627 627
     }
@@ -629,16 +629,16 @@  discard block
 block discarded – undo
629 629
         // We are already into an authenticated session
630 630
         $login = $_SESSION["dol_login"];
631 631
         $entity = $_SESSION["dol_entity"];
632
-        dol_syslog("- This is an already logged session. _SESSION['dol_login']=" . $login . " _SESSION['dol_entity']=" . $entity, LOG_DEBUG);
632
+        dol_syslog("- This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG);
633 633
 
634 634
         $resultFetchUser = $user->fetch('', $login, '', 1, ($entity > 0 ? $entity : -1));
635 635
         if ($resultFetchUser <= 0) {
636 636
             // Account has been removed after login
637
-            dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=" . $login, LOG_WARNING);
637
+            dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING);
638 638
             session_destroy();
639 639
             session_name($sessionname);
640
-            session_set_cookie_params(0, '/', null, false, true);   // Add tag httponly on session cookie
641
-            session_start();    // Fixing the bug of register_globals here is useless since session is empty
640
+            session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie
641
+            session_start(); // Fixing the bug of register_globals here is useless since session is empty
642 642
 
643 643
             if ($resultFetchUser == 0) {
644 644
                 // Load translation files required by page
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 
647 647
                 $_SESSION["dol_loginmesg"] = $langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login);
648 648
 
649
-                $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login=' . $login;
649
+                $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
650 650
             }
651 651
             if ($resultFetchUser < 0) {
652 652
                 $_SESSION["dol_loginmesg"] = $user->error;
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
             }
656 656
 
657 657
             // Call triggers for the "security events" log
658
-            include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
658
+            include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
659 659
             $interface = new Interfaces($db);
660 660
             $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf);
661 661
             if ($result < 0) {
@@ -666,18 +666,18 @@  discard block
 block discarded – undo
666 666
             $action = '';
667 667
             $hookmanager->initHooks(array('login'));
668 668
             $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
669
-            $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
669
+            $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
670 670
             if ($reshook < 0)
671 671
                 $error++;
672 672
 
673 673
             $paramsurl = array();
674 674
             if (GETPOST('textbrowser', 'int'))
675
-                $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
675
+                $paramsurl[] = 'textbrowser='.GETPOST('textbrowser', 'int');
676 676
             if (GETPOST('nojs', 'int'))
677
-                $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
677
+                $paramsurl[] = 'nojs='.GETPOST('nojs', 'int');
678 678
             if (GETPOST('lang', 'aZ09'))
679
-                $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
680
-            header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''));
679
+                $paramsurl[] = 'lang='.GETPOST('lang', 'aZ09');
680
+            header('Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : ''));
681 681
             exit;
682 682
         }
683 683
         else {
@@ -687,29 +687,29 @@  discard block
 block discarded – undo
687 687
             // Code for search criteria persistence.
688 688
             if (!empty($_GET['save_lastsearch_values'])) {    // We must use $_GET here
689 689
                 $relativepathstring = preg_replace('/\?.*$/', '', $_SERVER["HTTP_REFERER"]);
690
-                $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring);     // Get full path except host server
690
+                $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring); // Get full path except host server
691 691
                 // Clean $relativepathstring
692 692
                 if (constant('DOL_BASE_URI'))
693
-                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
693
+                    $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring);
694 694
                 $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
695 695
                 $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
696 696
                 //var_dump($relativepathstring);
697 697
                 // We click on a link that leave a page we have to save search criteria, contextpage, limit and page. We save them from tmp to no tmp
698
-                if (!empty($_SESSION['lastsearch_values_tmp_' . $relativepathstring])) {
699
-                    $_SESSION['lastsearch_values_' . $relativepathstring] = $_SESSION['lastsearch_values_tmp_' . $relativepathstring];
700
-                    unset($_SESSION['lastsearch_values_tmp_' . $relativepathstring]);
698
+                if (!empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) {
699
+                    $_SESSION['lastsearch_values_'.$relativepathstring] = $_SESSION['lastsearch_values_tmp_'.$relativepathstring];
700
+                    unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]);
701 701
                 }
702
-                if (!empty($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring])) {
703
-                    $_SESSION['lastsearch_contextpage_' . $relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring];
704
-                    unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]);
702
+                if (!empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) {
703
+                    $_SESSION['lastsearch_contextpage_'.$relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring];
704
+                    unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]);
705 705
                 }
706
-                if (!empty($_SESSION['lastsearch_page_tmp_' . $relativepathstring]) && $_SESSION['lastsearch_page_tmp_' . $relativepathstring] > 1) {
707
-                    $_SESSION['lastsearch_page_' . $relativepathstring] = $_SESSION['lastsearch_page_tmp_' . $relativepathstring];
708
-                    unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]);
706
+                if (!empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 1) {
707
+                    $_SESSION['lastsearch_page_'.$relativepathstring] = $_SESSION['lastsearch_page_tmp_'.$relativepathstring];
708
+                    unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]);
709 709
                 }
710
-                if (!empty($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]) && $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] != $conf->liste_limit) {
711
-                    $_SESSION['lastsearch_limit_' . $relativepathstring] = $_SESSION['lastsearch_limit_tmp_' . $relativepathstring];
712
-                    unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]);
710
+                if (!empty($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] != $conf->liste_limit) {
711
+                    $_SESSION['lastsearch_limit_'.$relativepathstring] = $_SESSION['lastsearch_limit_tmp_'.$relativepathstring];
712
+                    unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]);
713 713
                 }
714 714
             }
715 715
 
@@ -752,18 +752,18 @@  discard block
 block discarded – undo
752 752
         if (!empty($dol_use_jmobile))
753 753
             $_SESSION['dol_use_jmobile'] = $dol_use_jmobile;
754 754
 
755
-        dol_syslog("This is a new started user session. _SESSION['dol_login']=" . $_SESSION["dol_login"] . " Session id=" . session_id());
755
+        dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"]." Session id=".session_id());
756 756
 
757 757
         $db->begin();
758 758
 
759 759
         $user->update_last_login_date();
760 760
 
761
-        $loginfo = 'TZ=' . $_SESSION["dol_tz"] . ';TZString=' . $_SESSION["dol_tz_string"] . ';Screen=' . $_SESSION["dol_screenwidth"] . 'x' . $_SESSION["dol_screenheight"];
761
+        $loginfo = 'TZ='.$_SESSION["dol_tz"].';TZString='.$_SESSION["dol_tz_string"].';Screen='.$_SESSION["dol_screenwidth"].'x'.$_SESSION["dol_screenheight"];
762 762
 
763 763
         // Call triggers for the "security events" log
764 764
         $user->trigger_mesg = $loginfo;
765 765
         // Call triggers
766
-        include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
766
+        include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
767 767
         $interface = new Interfaces($db);
768 768
         $result = $interface->run_triggers('USER_LOGIN', $user, $user, $langs, $conf);
769 769
         if ($result < 0) {
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
         $action = '';
775 775
         $hookmanager->initHooks(array('login'));
776 776
         $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginfo' => $loginfo);
777
-        $reshook = $hookmanager->executeHooks('afterLogin', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
777
+        $reshook = $hookmanager->executeHooks('afterLogin', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
778 778
         if ($reshook < 0)
779 779
             $error++;
780 780
 
@@ -792,7 +792,7 @@  discard block
 block discarded – undo
792 792
         if (!empty($landingpage)) {    // Example: /index.php
793 793
             $newpath = dol_buildpath($landingpage, 1);
794 794
             if ($_SERVER["PHP_SELF"] != $newpath) {   // not already on landing page (avoid infinite loop)
795
-                header('Location: ' . $newpath);
795
+                header('Location: '.$newpath);
796 796
                 exit;
797 797
             }
798 798
         }
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
     if (empty($conf->global->MAIN_FORCETHEME) && !empty($user->conf->MAIN_THEME)) {
828 828
         $conf->theme = $user->conf->MAIN_THEME;
829 829
         // $conf->css = "/theme/" . $conf->theme . "/style.css.php";
830
-        $conf->css = '?controller=theme/' . $conf->theme . '&method=style.css';
830
+        $conf->css = '?controller=theme/'.$conf->theme.'&method=style.css';
831 831
     }
832 832
 }
833 833
 
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 if (GETPOST('theme', 'alpha')) {
836 836
     $conf->theme = GETPOST('theme', 'alpha', 1);
837 837
     // $conf->css = "/theme/" . $conf->theme . "/style.css.php";
838
-    $conf->css = '?controller=theme/' . $conf->theme . '&method=style.css';
838
+    $conf->css = '?controller=theme/'.$conf->theme.'&method=style.css';
839 839
 }
840 840
 
841 841
 
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
 if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array('bureau2crea', 'cameleo', 'amarok'))) {
878 878
     $conf->theme = 'eldy';
879 879
     // $conf->css = "/theme/" . $conf->theme . "/style.css.php";
880
-    $conf->css = '?controller=theme/' . $conf->theme . '&method=style.css';
880
+    $conf->css = '?controller=theme/'.$conf->theme.'&method=style.css';
881 881
 }
882 882
 
883 883
 if (!defined('NOREQUIRETRAN')) {
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 }
914 914
 
915 915
 
916
-dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . ' - action=' . GETPOST('action', 'az09') . ', massaction=' . GETPOST('massaction', 'az09'));
916
+dol_syslog("--- Access to ".$_SERVER["PHP_SELF"].' - action='.GETPOST('action', 'az09').', massaction='.GETPOST('massaction', 'az09'));
917 917
 //Another call for easy debugg
918 918
 //dol_syslog("Access to ".$_SERVER["PHP_SELF"].' GET='.join(',',array_keys($_GET)).'->'.join(',',$_GET).' POST:'.join(',',array_keys($_POST)).'->'.join(',',$_POST));
919 919
 // Load main languages files
@@ -925,7 +925,7 @@  discard block
 block discarded – undo
925 925
 // Define some constants used for style of arrays
926 926
 $bc = array(0 => 'class="impair"', 1 => 'class="pair"');
927 927
 $bcdd = array(0 => 'class="drag drop oddeven"', 1 => 'class="drag drop oddeven"');
928
-$bcnd = array(0 => 'class="nodrag nodrop nohover"', 1 => 'class="nodrag nodrop nohoverpair"');  // Used for tr to add new lines
928
+$bcnd = array(0 => 'class="nodrag nodrop nohover"', 1 => 'class="nodrag nodrop nohoverpair"'); // Used for tr to add new lines
929 929
 $bctag = array(0 => 'class="impair tagtr"', 1 => 'class="pair tagtr"');
930 930
 
931 931
 // Define messages variables
@@ -973,19 +973,19 @@  discard block
 block discarded – undo
973 973
     // Load the menu manager (only if not already done)
974 974
     $file_menu = $conf->standard_menu;
975 975
     if (GETPOST('menu', 'alpha'))
976
-        $file_menu = GETPOST('menu', 'alpha');     // example: menu=eldy_menu.php
976
+        $file_menu = GETPOST('menu', 'alpha'); // example: menu=eldy_menu.php
977 977
     if (!class_exists('MenuManager')) {
978 978
         $menufound = 0;
979 979
         $dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
980 980
         foreach ($dirmenus as $dirmenu) {
981
-            $menufound = dol_include_once($dirmenu . "standard/" . $file_menu);
981
+            $menufound = dol_include_once($dirmenu."standard/".$file_menu);
982 982
             if (class_exists('MenuManager'))
983 983
                 break;
984 984
         }
985 985
         if (!class_exists('MenuManager')) { // If failed to include, we try with standard eldy_menu.php
986
-            dol_syslog("You define a menu manager '" . $file_menu . "' that can not be loaded.", LOG_WARNING);
986
+            dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
987 987
             $file_menu = 'eldy_menu.php';
988
-            include_once DOL_DOCUMENT_ROOT . "/core/menus/standard/" . $file_menu;
988
+            include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
989 989
         }
990 990
     }
991 991
     $menumanager = new MenuManager($db, empty($user->societe_id) ? 0 : 1);
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
         // html header
1024 1024
         top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
1025 1025
 
1026
-        print '<body id="mainbody"' . ($morecssonbody ? ' class="' . $morecssonbody . '"' : '') . '>' . "\n";
1026
+        print '<body id="mainbody"'.($morecssonbody ? ' class="'.$morecssonbody.'"' : '').'>'."\n";
1027 1027
 
1028 1028
         // top menu and left menu area
1029 1029
         if (empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) {
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
         }
1032 1032
 
1033 1033
         if (empty($conf->dol_hide_leftmenu)) {
1034
-            left_menu('', $help_url, '', '', 1, $title, 1);  // $menumanager is retreived with a global $menumanager inside this function
1034
+            left_menu('', $help_url, '', '', 1, $title, 1); // $menumanager is retreived with a global $menumanager inside this function
1035 1035
         }
1036 1036
 
1037 1037
         // main area
@@ -1055,12 +1055,12 @@  discard block
 block discarded – undo
1055 1055
     global $db, $conf, $hookmanager;
1056 1056
 
1057 1057
     if ($contenttype == 'text/html')
1058
-        header("Content-Type: text/html; charset=" . $conf->file->character_set_client);
1058
+        header("Content-Type: text/html; charset=".$conf->file->character_set_client);
1059 1059
     else
1060
-        header("Content-Type: " . $contenttype);
1060
+        header("Content-Type: ".$contenttype);
1061 1061
     // Security options
1062
-    header("X-Content-Type-Options: nosniff");  // With the nosniff option, if the server says the content is text/html, the browser will render it as text/html (note that most browsers now force this option to on)
1063
-    header("X-Frame-Options: SAMEORIGIN");      // Frames allowed only if on same domain (stop some XSS attacks)
1062
+    header("X-Content-Type-Options: nosniff"); // With the nosniff option, if the server says the content is text/html, the browser will render it as text/html (note that most browsers now force this option to on)
1063
+    header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks)
1064 1064
     //header("X-XSS-Protection: 1");      		// XSS protection of some browsers (note: use of Content-Security-Policy is more efficient). Disabled as deprecated.
1065 1065
     if (!defined('FORCECSP')) {
1066 1066
         //if (! isset($conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY))
@@ -1076,11 +1076,11 @@  discard block
 block discarded – undo
1076 1076
         $hookmanager->initHooks("main");
1077 1077
 
1078 1078
         $parameters = array('contentsecuritypolicy' => $contentsecuritypolicy);
1079
-        $result = $hookmanager->executeHooks('setContentSecurityPolicy', $parameters);    // Note that $action and $object may have been modified by some hooks
1079
+        $result = $hookmanager->executeHooks('setContentSecurityPolicy', $parameters); // Note that $action and $object may have been modified by some hooks
1080 1080
         if ($result > 0)
1081 1081
             $contentsecuritypolicy = $hookmanager->resPrint; // Replace CSP
1082 1082
         else
1083
-            $contentsecuritypolicy .= $hookmanager->resPrint;    // Concat CSP
1083
+            $contentsecuritypolicy .= $hookmanager->resPrint; // Concat CSP
1084 1084
 
1085 1085
         if (!empty($contentsecuritypolicy)) {
1086 1086
             // For example, to restrict 'script', 'object', 'frames' or 'img' to some domains:
@@ -1091,10 +1091,10 @@  discard block
 block discarded – undo
1091 1091
             // default-src 'self'; img-src *;
1092 1092
             // Pre-existing site that uses too much inline code to fix but wants to ensure resources are loaded only over https and disable plugins:
1093 1093
             // default-src http: https: 'unsafe-eval' 'unsafe-inline'; object-src 'none'
1094
-            header("Content-Security-Policy: " . $contentsecuritypolicy);
1094
+            header("Content-Security-Policy: ".$contentsecuritypolicy);
1095 1095
         }
1096 1096
     } elseif (constant('FORCECSP')) {
1097
-        header("Content-Security-Policy: " . constant('FORCECSP'));
1097
+        header("Content-Security-Policy: ".constant('FORCECSP'));
1098 1098
     }
1099 1099
     if ($forcenocache) {
1100 1100
         header("Cache-Control: no-cache, no-store, must-revalidate, max-age=0");
@@ -1125,33 +1125,33 @@  discard block
 block discarded – undo
1125 1125
         // $conf->css = '/theme/eldy/style.css.php'; // If not defined, eldy by default
1126 1126
         $conf->css = '?controller=theme/eldy&method=style.css';
1127 1127
     }
1128
-    print '<!doctype html>' . "\n";
1128
+    print '<!doctype html>'."\n";
1129 1129
 
1130 1130
     if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST))
1131
-        print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_BASE_URI . '/cache.manifest">' . "\n";
1131
+        print '<html lang="'.substr($langs->defaultlang, 0, 2).'" manifest="'.DOL_BASE_URI.'/cache.manifest">'."\n";
1132 1132
     else
1133
-        print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n";
1133
+        print '<html lang="'.substr($langs->defaultlang, 0, 2).'">'."\n";
1134 1134
     //print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'."\n";
1135 1135
     if (empty($disablehead)) {
1136
-        $ext = 'layout=' . $conf->browser->layout . '&version=' . urlencode(DOL_VERSION);
1136
+        $ext = 'layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION);
1137 1137
 
1138 1138
         print "<head>\n";
1139 1139
 
1140 1140
         if (GETPOST('dol_basehref', 'alpha'))
1141
-            print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')) . '">' . "\n";
1141
+            print '<base href="'.dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')).'">'."\n";
1142 1142
 
1143 1143
         // Displays meta
1144
-        print '<meta charset="UTF-8">' . "\n";
1145
-        print '<meta name="robots" content="noindex' . ($disablenofollow ? '' : ',nofollow') . '">' . "\n"; // Do not index
1146
-        print '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\n";  // Scale for mobile device
1147
-        print '<meta name="author" content="Dolibarr Development Team">' . "\n";
1144
+        print '<meta charset="UTF-8">'."\n";
1145
+        print '<meta name="robots" content="noindex'.($disablenofollow ? '' : ',nofollow').'">'."\n"; // Do not index
1146
+        print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n"; // Scale for mobile device
1147
+        print '<meta name="author" content="Dolibarr Development Team">'."\n";
1148 1148
 
1149 1149
         // Favicon
1150
-        $favicon = dol_buildpath('/theme/' . $conf->theme . '/img/favicon.ico', 1);
1150
+        $favicon = dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico', 1);
1151 1151
         if (!empty($conf->global->MAIN_FAVICON_URL))
1152 1152
             $favicon = $conf->global->MAIN_FAVICON_URL;
1153 1153
         if (empty($conf->dol_use_jmobile))
1154
-            print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n"; // Not required into an Android webview
1154
+            print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n"; // Not required into an Android webview
1155 1155
 
1156 1156
 
1157 1157
 
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
         //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="author" title="Dolibarr Development Team" href="https://www.dolibarr.org">'."\n";
1163 1163
         // Auto refresh page
1164 1164
         if (GETPOST('autorefresh', 'int') > 0)
1165
-            print '<meta http-equiv="refresh" content="' . GETPOST('autorefresh', 'int') . '">';
1165
+            print '<meta http-equiv="refresh" content="'.GETPOST('autorefresh', 'int').'">';
1166 1166
 
1167 1167
         // Displays title
1168 1168
         $appli = constant('DOL_APPLICATION_TITLE');
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
         if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE))
1175 1175
             $titletoshow = dol_htmlentities($title);
1176 1176
         else if ($title)
1177
-            $titletoshow = dol_htmlentities($appli . ' - ' . $title);
1177
+            $titletoshow = dol_htmlentities($appli.' - '.$title);
1178 1178
         else
1179 1179
             $titletoshow = dol_htmlentities($appli);
1180 1180
 
@@ -1182,11 +1182,11 @@  discard block
 block discarded – undo
1182 1182
             $hookmanager = new HookManager($db);
1183 1183
         $hookmanager->initHooks("main");
1184 1184
         $parameters = array('title' => $titletoshow);
1185
-        $result = $hookmanager->executeHooks('setHtmlTitle', $parameters);  // Note that $action and $object may have been modified by some hooks
1185
+        $result = $hookmanager->executeHooks('setHtmlTitle', $parameters); // Note that $action and $object may have been modified by some hooks
1186 1186
         if ($result > 0)
1187
-            $titletoshow = $hookmanager->resPrint;    // Replace Title to show
1187
+            $titletoshow = $hookmanager->resPrint; // Replace Title to show
1188 1188
         else
1189
-            $titletoshow .= $hookmanager->resPrint;      // Concat to Title to show
1189
+            $titletoshow .= $hookmanager->resPrint; // Concat to Title to show
1190 1190
 
1191 1191
         print $titletoshow;
1192 1192
         print '</title>';
@@ -1194,61 +1194,61 @@  discard block
 block discarded – undo
1194 1194
         print "\n";
1195 1195
 
1196 1196
         if (GETPOST('version', 'int'))
1197
-            $ext = 'version=' . GETPOST('version', 'int'); // usefull to force no cache on css/js
1197
+            $ext = 'version='.GETPOST('version', 'int'); // usefull to force no cache on css/js
1198 1198
         if (GETPOST('testmenuhider', 'int') || !empty($conf->global->MAIN_TESTMENUHIDER))
1199
-            $ext .= '&testmenuhider=' . (GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER);
1199
+            $ext .= '&testmenuhider='.(GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER);
1200 1200
 
1201
-        $themeparam = '&lang=' . $langs->defaultlang . '&amp;theme=' . $conf->theme . (GETPOST('optioncss', 'aZ09') ? '&amp;optioncss=' . GETPOST('optioncss', 'aZ09', 1) : '') . '&amp;userid=' . $user->id . '&amp;entity=' . $conf->entity;
1202
-        $themeparam .= ($ext ? '&amp;' . $ext : '');
1201
+        $themeparam = '&lang='.$langs->defaultlang.'&amp;theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&amp;optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').'&amp;userid='.$user->id.'&amp;entity='.$conf->entity;
1202
+        $themeparam .= ($ext ? '&amp;'.$ext : '');
1203 1203
         if (!empty($_SESSION['dol_resetcache']))
1204
-            $themeparam .= '&amp;dol_resetcache=' . $_SESSION['dol_resetcache'];
1204
+            $themeparam .= '&amp;dol_resetcache='.$_SESSION['dol_resetcache'];
1205 1205
         if (GETPOST('dol_hide_topmenu', 'int')) {
1206
-            $themeparam .= '&amp;dol_hide_topmenu=' . GETPOST('dol_hide_topmenu', 'int');
1206
+            $themeparam .= '&amp;dol_hide_topmenu='.GETPOST('dol_hide_topmenu', 'int');
1207 1207
         }
1208 1208
         if (GETPOST('dol_hide_leftmenu', 'int')) {
1209
-            $themeparam .= '&amp;dol_hide_leftmenu=' . GETPOST('dol_hide_leftmenu', 'int');
1209
+            $themeparam .= '&amp;dol_hide_leftmenu='.GETPOST('dol_hide_leftmenu', 'int');
1210 1210
         }
1211 1211
         if (GETPOST('dol_optimize_smallscreen', 'int')) {
1212
-            $themeparam .= '&amp;dol_optimize_smallscreen=' . GETPOST('dol_optimize_smallscreen', 'int');
1212
+            $themeparam .= '&amp;dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen', 'int');
1213 1213
         }
1214 1214
         if (GETPOST('dol_no_mouse_hover', 'int')) {
1215
-            $themeparam .= '&amp;dol_no_mouse_hover=' . GETPOST('dol_no_mouse_hover', 'int');
1215
+            $themeparam .= '&amp;dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover', 'int');
1216 1216
         }
1217 1217
         if (GETPOST('dol_use_jmobile', 'int')) {
1218
-            $themeparam .= '&amp;dol_use_jmobile=' . GETPOST('dol_use_jmobile', 'int');
1218
+            $themeparam .= '&amp;dol_use_jmobile='.GETPOST('dol_use_jmobile', 'int');
1219 1219
             $conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int');
1220 1220
         }
1221 1221
 
1222 1222
         if (!defined('DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax) {
1223
-            print '<!-- Includes CSS for JQuery (Ajax library) -->' . "\n";
1223
+            print '<!-- Includes CSS for JQuery (Ajax library) -->'."\n";
1224 1224
             $jquerytheme = 'base';
1225 1225
             if (!empty($conf->global->MAIN_USE_JQUERY_THEME))
1226 1226
                 $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
1227 1227
             if (constant('JS_JQUERY_UI'))
1228
-                print '<link rel="stylesheet" type="text/css" href="' . JS_JQUERY_UI . 'css/' . $jquerytheme . '/jquery-ui.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";  // JQuery
1228
+                print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css'.($ext ? '?'.$ext : '').'">'."\n"; // JQuery
1229 1229
             else
1230
-                print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.css' . ($ext ? '?' . $ext : '') . '">' . "\n";    // JQuery
1230
+                print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui.css'.($ext ? '?'.$ext : '').'">'."\n"; // JQuery
1231 1231
             if (!defined('DISABLE_JQUERY_JNOTIFY'))
1232
-                print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";          // JNotify
1232
+                print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css'.($ext ? '?'.$ext : '').'">'."\n"; // JNotify
1233 1233
             if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) {     // jQuery plugin "mutiselect", "multiple-select", "select2"...
1234 1234
                 $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1235
-                print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/' . $tmpplugin . '/dist/css/' . $tmpplugin . '.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1235
+                print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/includes/jquery/plugins/'.$tmpplugin.'/dist/css/'.$tmpplugin.'.css'.($ext ? '?'.$ext : '').'">'."\n";
1236 1236
             }
1237 1237
         }
1238 1238
 
1239 1239
         if (!defined('DISABLE_FONT_AWSOME')) {
1240
-            print '<!-- Includes CSS for font awesome -->' . "\n";
1241
-            print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/theme/common/fontawesome/css/font-awesome.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1240
+            print '<!-- Includes CSS for font awesome -->'."\n";
1241
+            print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/theme/common/fontawesome/css/font-awesome.min.css'.($ext ? '?'.$ext : '').'">'."\n";
1242 1242
         }
1243 1243
 
1244
-        print '<!-- Includes CSS for Dolibarr theme -->' . "\n";
1244
+        print '<!-- Includes CSS for Dolibarr theme -->'."\n";
1245 1245
         // Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
1246 1246
         $themepath = dol_buildpath($conf->css, 3);
1247 1247
         $themesubdir = '';
1248 1248
         if (!empty($conf->modules_parts['theme'])) { // This slow down
1249 1249
             foreach ($conf->modules_parts['theme'] as $reldir) {
1250
-                if (file_exists(dol_buildpath($reldir . $conf->css, 0))) {
1251
-                    $themepath = dol_buildpath($reldir . $conf->css, 1);
1250
+                if (file_exists(dol_buildpath($reldir.$conf->css, 0))) {
1251
+                    $themepath = dol_buildpath($reldir.$conf->css, 1);
1252 1252
                     $themesubdir = $reldir;
1253 1253
                     break;
1254 1254
                 }
@@ -1256,9 +1256,9 @@  discard block
 block discarded – undo
1256 1256
         }
1257 1257
 
1258 1258
         //print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
1259
-        print '<link rel="stylesheet" type="text/css" href="' . $themepath . $themeparam . '">' . "\n";
1259
+        print '<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.'">'."\n";
1260 1260
         if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME))
1261
-            print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->' . "\n" . '<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">' . "\n";
1261
+            print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->'."\n".'<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">'."\n";
1262 1262
 
1263 1263
         // CSS forced by modules (relative url starting with /)
1264 1264
         if (!empty($conf->modules_parts['css'])) {
@@ -1267,112 +1267,112 @@  discard block
 block discarded – undo
1267 1267
                 $filescss = (array) $filescss; // To be sure filecss is an array
1268 1268
                 foreach ($filescss as $cssfile) {
1269 1269
                     if (empty($cssfile))
1270
-                        dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING);
1270
+                        dol_syslog("Warning: module ".$modcss." declared a css path file into its descriptor that is empty.", LOG_WARNING);
1271 1271
                     // cssfile is a relative path
1272
-                    print '<!-- Includes CSS added by module ' . $modcss . ' -->' . "\n" . '<link rel="stylesheet" type="text/css" href="' . dol_buildpath($cssfile, 1);
1272
+                    print '<!-- Includes CSS added by module '.$modcss.' -->'."\n".'<link rel="stylesheet" type="text/css" href="'.dol_buildpath($cssfile, 1);
1273 1273
                     // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
1274 1274
                     if (!preg_match('/\.css$/i', $cssfile))
1275 1275
                         print $themeparam;
1276
-                    print '">' . "\n";
1276
+                    print '">'."\n";
1277 1277
                 }
1278 1278
             }
1279 1279
         }
1280 1280
         // CSS forced by page in top_htmlhead call (relative url starting with /)
1281 1281
         if (is_array($arrayofcss)) {
1282 1282
             foreach ($arrayofcss as $cssfile) {
1283
-                print '<!-- Includes CSS added by page -->' . "\n" . '<link rel="stylesheet" type="text/css" title="default" href="' . dol_buildpath($cssfile, 1);
1283
+                print '<!-- Includes CSS added by page -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile, 1);
1284 1284
                 // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters and browser cache is not used.
1285 1285
                 if (!preg_match('/\.css$/i', $cssfile))
1286 1286
                     print $themeparam;
1287
-                print '">' . "\n";
1287
+                print '">'."\n";
1288 1288
             }
1289 1289
         }
1290 1290
 
1291 1291
         // Output standard javascript links
1292 1292
         if (!defined('DISABLE_JQUERY') && !$disablejs && !empty($conf->use_javascript_ajax)) {
1293 1293
             // JQuery. Must be before other includes
1294
-            print '<!-- Includes JS for JQuery -->' . "\n";
1294
+            print '<!-- Includes JS for JQuery -->'."\n";
1295 1295
             if (defined('JS_JQUERY') && constant('JS_JQUERY'))
1296
-                print '<script type="text/javascript" src="' . JS_JQUERY . 'jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1296
+                print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1297 1297
             else
1298
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1298
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/js/jquery.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1299 1299
             if (!empty($conf->global->MAIN_FEATURES_LEVEL) && !defined('JS_JQUERY_MIGRATE_DISABLED')) {
1300 1300
                 if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE'))
1301
-                    print '<script type="text/javascript" src="' . JS_JQUERY_MIGRATE . 'jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1301
+                    print '<script type="text/javascript" src="'.JS_JQUERY_MIGRATE.'jquery-migrate.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1302 1302
                 else
1303
-                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1303
+                    print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/js/jquery-migrate.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1304 1304
             }
1305 1305
             if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI'))
1306
-                print '<script type="text/javascript" src="' . JS_JQUERY_UI . 'jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1306
+                print '<script type="text/javascript" src="'.JS_JQUERY_UI.'jquery-ui.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1307 1307
             else
1308
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1308
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/js/jquery-ui.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1309 1309
             if (!defined('DISABLE_JQUERY_TABLEDND'))
1310
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/tablednd/jquery.tablednd.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1310
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/tablednd/jquery.tablednd.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1311 1311
             // jQuery jnotify
1312 1312
             if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) {
1313
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1313
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1314 1314
             }
1315 1315
             // Flot
1316 1316
             if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT) && !defined('DISABLE_JQUERY_FLOT')) {
1317 1317
                 if (constant('JS_JQUERY_FLOT')) {
1318
-                    print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1319
-                    print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.pie.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1320
-                    print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.stack.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1318
+                    print '<script type="text/javascript" src="'.JS_JQUERY_FLOT.'jquery.flot.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1319
+                    print '<script type="text/javascript" src="'.JS_JQUERY_FLOT.'jquery.flot.pie.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1320
+                    print '<script type="text/javascript" src="'.JS_JQUERY_FLOT.'jquery.flot.stack.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1321 1321
                 } else {
1322
-                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/flot/jquery.flot.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1323
-                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/flot/jquery.flot.pie.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1324
-                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/flot/jquery.flot.stack.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1322
+                    print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/flot/jquery.flot.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1323
+                    print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/flot/jquery.flot.pie.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1324
+                    print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/flot/jquery.flot.stack.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1325 1325
                 }
1326 1326
             }
1327 1327
             // jQuery jeditable
1328 1328
             if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !defined('DISABLE_JQUERY_JEDITABLE')) {
1329
-                print '<!-- JS to manage editInPlace feature -->' . "\n";
1330
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1331
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1332
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1333
-                print '<script type="text/javascript">' . "\n";
1334
-                print 'var urlSaveInPlace = \'' . DOL_BASE_URI . '/core/ajax/saveinplace.php\';' . "\n";
1335
-                print 'var urlLoadInPlace = \'' . DOL_BASE_URI . '/core/ajax/loadinplace.php\';' . "\n";
1336
-                print 'var tooltipInPlace = \'' . $langs->transnoentities('ClickToEdit') . '\';' . "\n"; // Added in title attribute of span
1337
-                print 'var placeholderInPlace = \'&nbsp;\';' . "\n"; // If we put another string than $langs->trans("ClickToEdit") here, nothing is shown. If we put empty string, there is error, Why ?
1338
-                print 'var cancelInPlace = \'' . $langs->trans('Cancel') . '\';' . "\n";
1339
-                print 'var submitInPlace = \'' . $langs->trans('Ok') . '\';' . "\n";
1340
-                print 'var indicatorInPlace = \'<img src="' . DOL_BASE_URI . "/theme/" . $conf->theme . "/img/working.gif" . '">\';' . "\n";
1341
-                print 'var withInPlace = 300;';  // width in pixel for default string edit
1342
-                print '</script>' . "\n";
1343
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/editinplace.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1344
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1329
+                print '<!-- JS to manage editInPlace feature -->'."\n";
1330
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1331
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1332
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1333
+                print '<script type="text/javascript">'."\n";
1334
+                print 'var urlSaveInPlace = \''.DOL_BASE_URI.'/core/ajax/saveinplace.php\';'."\n";
1335
+                print 'var urlLoadInPlace = \''.DOL_BASE_URI.'/core/ajax/loadinplace.php\';'."\n";
1336
+                print 'var tooltipInPlace = \''.$langs->transnoentities('ClickToEdit').'\';'."\n"; // Added in title attribute of span
1337
+                print 'var placeholderInPlace = \'&nbsp;\';'."\n"; // If we put another string than $langs->trans("ClickToEdit") here, nothing is shown. If we put empty string, there is error, Why ?
1338
+                print 'var cancelInPlace = \''.$langs->trans('Cancel').'\';'."\n";
1339
+                print 'var submitInPlace = \''.$langs->trans('Ok').'\';'."\n";
1340
+                print 'var indicatorInPlace = \'<img src="'.DOL_BASE_URI."/theme/".$conf->theme."/img/working.gif".'">\';'."\n";
1341
+                print 'var withInPlace = 300;'; // width in pixel for default string edit
1342
+                print '</script>'."\n";
1343
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/core/js/editinplace.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1344
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1345 1345
             }
1346 1346
             // jQuery Timepicker
1347 1347
             if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) {
1348
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/timepicker/jquery-ui-timepicker-addon.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1349
-                print '<script type="text/javascript" src="' . BASE_PATH . '?controller=core/js/&method=timepicker.js&lang=' . $langs->defaultlang . ($ext ? '&amp;' . $ext : '') . '"></script>' . "\n";
1348
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/timepicker/jquery-ui-timepicker-addon.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1349
+                print '<script type="text/javascript" src="'.BASE_PATH.'?controller=core/js/&method=timepicker.js&lang='.$langs->defaultlang.($ext ? '&amp;'.$ext : '').'"></script>'."\n";
1350 1350
             }
1351 1351
             if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) {     // jQuery plugin "mutiselect", "multiple-select", "select2", ...
1352 1352
                 $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1353
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/' . $tmpplugin . '/dist/js/' . $tmpplugin . '.full.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n"; // We include full because we need the support of containerCssClass
1353
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/'.$tmpplugin.'/dist/js/'.$tmpplugin.'.full.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n"; // We include full because we need the support of containerCssClass
1354 1354
             }
1355 1355
             if (!defined('DISABLE_MULTISELECT')) {     // jQuery plugin "mutiselect" to select with checkboxes
1356
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/multiselect/jquery.multi-select.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1356
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/multiselect/jquery.multi-select.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1357 1357
             }
1358 1358
         }
1359 1359
 
1360 1360
         if (!$disablejs && !empty($conf->use_javascript_ajax)) {
1361 1361
             // CKEditor
1362 1362
             if (!empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') && !defined('DISABLE_CKEDITOR')) {
1363
-                print '<!-- Includes JS for CKEditor -->' . "\n";
1364
-                $pathckeditor = DOL_BASE_URI . '/includes/ckeditor/ckeditor/';
1363
+                print '<!-- Includes JS for CKEditor -->'."\n";
1364
+                $pathckeditor = DOL_BASE_URI.'/includes/ckeditor/ckeditor/';
1365 1365
                 $jsckeditor = 'ckeditor.js';
1366 1366
                 if (constant('JS_CKEDITOR')) { // To use external ckeditor 4 js lib
1367 1367
                     $pathckeditor = constant('JS_CKEDITOR');
1368 1368
                 }
1369 1369
                 print '<script type="text/javascript">';
1370
-                print 'var CKEDITOR_BASEPATH = \'' . $pathckeditor . '\';' . "\n";
1371
-                print 'var ckeditorConfig = \'' . dol_buildpath($themesubdir . '/theme/' . $conf->theme . '/ckeditor/config.js' . ($ext ? '?' . $ext : ''), 1) . '\';' . "\n";  // $themesubdir='' in standard usage
1372
-                print 'var ckeditorFilebrowserBrowseUrl = \'' . DOL_BASE_URI . '/core/filemanagerdol/browser/default/browser.php?Connector=' . DOL_BASE_URI . '/core/filemanagerdol/connectors/php/connector.php\';' . "\n";
1373
-                print 'var ckeditorFilebrowserImageBrowseUrl = \'' . DOL_BASE_URI . '/core/filemanagerdol/browser/default/browser.php?Type=Image&Connector=' . DOL_BASE_URI . '/core/filemanagerdol/connectors/php/connector.php\';' . "\n";
1374
-                print '</script>' . "\n";
1375
-                print '<script type="text/javascript" src="' . $pathckeditor . $jsckeditor . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1370
+                print 'var CKEDITOR_BASEPATH = \''.$pathckeditor.'\';'."\n";
1371
+                print 'var ckeditorConfig = \''.dol_buildpath($themesubdir.'/theme/'.$conf->theme.'/ckeditor/config.js'.($ext ? '?'.$ext : ''), 1).'\';'."\n"; // $themesubdir='' in standard usage
1372
+                print 'var ckeditorFilebrowserBrowseUrl = \''.DOL_BASE_URI.'/core/filemanagerdol/browser/default/browser.php?Connector='.DOL_BASE_URI.'/core/filemanagerdol/connectors/php/connector.php\';'."\n";
1373
+                print 'var ckeditorFilebrowserImageBrowseUrl = \''.DOL_BASE_URI.'/core/filemanagerdol/browser/default/browser.php?Type=Image&Connector='.DOL_BASE_URI.'/core/filemanagerdol/connectors/php/connector.php\';'."\n";
1374
+                print '</script>'."\n";
1375
+                print '<script type="text/javascript" src="'.$pathckeditor.$jsckeditor.($ext ? '?'.$ext : '').'"></script>'."\n";
1376 1376
             }
1377 1377
 
1378 1378
             // Browser notifications
@@ -1383,16 +1383,16 @@  discard block
 block discarded – undo
1383 1383
                 if ($conf->browser->layout == 'phone')
1384 1384
                     $enablebrowsernotif = false;
1385 1385
                 if ($enablebrowsernotif) {
1386
-                    print '<!-- Includes JS of Dolibarr (brwoser layout = ' . $conf->browser->layout . ')-->' . "\n";
1386
+                    print '<!-- Includes JS of Dolibarr (brwoser layout = '.$conf->browser->layout.')-->'."\n";
1387 1387
                     //print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/lib_notification.js.php' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1388
-                    print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_notification.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1388
+                    print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_notification.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1389 1389
                 }
1390 1390
             }
1391 1391
 
1392 1392
             // Global js function
1393
-            print '<!-- Includes JS of Dolibarr -->' . "\n";
1393
+            print '<!-- Includes JS of Dolibarr -->'."\n";
1394 1394
             //print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/lib_head.js.php?lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n";
1395
-            print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_head.js&lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n";
1395
+            print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_head.js&lang='.$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n";
1396 1396
 
1397 1397
             // JS forced by modules (relative url starting with /)
1398 1398
             if (!empty($conf->modules_parts['js'])) {  // $conf->modules_parts['js'] is array('module'=>array('file1','file2'))
@@ -1401,27 +1401,27 @@  discard block
 block discarded – undo
1401 1401
                     $filesjs = (array) $filesjs; // To be sure filejs is an array
1402 1402
                     foreach ($filesjs as $jsfile) {
1403 1403
                         // jsfile is a relative path
1404
-                        print '<!-- Include JS added by module ' . $modjs . '-->' . "\n" . '<script type="text/javascript" src="' . dol_buildpath($jsfile, 1) . '"></script>' . "\n";
1404
+                        print '<!-- Include JS added by module '.$modjs.'-->'."\n".'<script type="text/javascript" src="'.dol_buildpath($jsfile, 1).'"></script>'."\n";
1405 1405
                     }
1406 1406
                 }
1407 1407
             }
1408 1408
             // JS forced by page in top_htmlhead (relative url starting with /)
1409 1409
             if (is_array($arrayofjs)) {
1410
-                print '<!-- Includes JS added by page -->' . "\n";
1410
+                print '<!-- Includes JS added by page -->'."\n";
1411 1411
                 foreach ($arrayofjs as $jsfile) {
1412 1412
                     if (preg_match('/^http/i', $jsfile)) {
1413
-                        print '<script type="text/javascript" src="' . $jsfile . '"></script>' . "\n";
1413
+                        print '<script type="text/javascript" src="'.$jsfile.'"></script>'."\n";
1414 1414
                     } else {
1415
-                        print '<script type="text/javascript" src="' . dol_buildpath($jsfile, 1) . '"></script>' . "\n";
1415
+                        print '<script type="text/javascript" src="'.dol_buildpath($jsfile, 1).'"></script>'."\n";
1416 1416
                     }
1417 1417
                 }
1418 1418
             }
1419 1419
         }
1420 1420
 
1421 1421
         if (!empty($head))
1422
-            print $head . "\n";
1422
+            print $head."\n";
1423 1423
         if (!empty($conf->global->MAIN_HTML_HEADER))
1424
-            print $conf->global->MAIN_HTML_HEADER . "\n";
1424
+            print $conf->global->MAIN_HTML_HEADER."\n";
1425 1425
 
1426 1426
         print "<!-- Alixar debugBar header -->";
1427 1427
         print Debug::getRenderHeader(); // Includes Alixar debugBar header
@@ -1472,13 +1472,13 @@  discard block
 block discarded – undo
1472 1472
      * Top menu
1473 1473
      */
1474 1474
     if ((empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) {
1475
-        print "\n" . '<!-- Start top horizontal -->' . "\n";
1475
+        print "\n".'<!-- Start top horizontal -->'."\n";
1476 1476
 
1477
-        print '<div class="side-nav-vert' . (GETPOST('dol_invisible_topmenu', 'int') ? ' hidden' : '') . '"><div id="id-top">';  // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible.
1477
+        print '<div class="side-nav-vert'.(GETPOST('dol_invisible_topmenu', 'int') ? ' hidden' : '').'"><div id="id-top">'; // dol_invisible_topmenu differs from dol_hide_topmenu: dol_invisible_topmenu means we output menu but we make it invisible.
1478 1478
         // Show menu entries
1479
-        print '<div id="tmenu_tooltip' . (empty($conf->global->MAIN_MENU_INVERT) ? '' : 'invert') . '" class="tmenu">' . "\n";
1479
+        print '<div id="tmenu_tooltip'.(empty($conf->global->MAIN_MENU_INVERT) ? '' : 'invert').'" class="tmenu">'."\n";
1480 1480
         $menumanager->atarget = $target;
1481
-        $menumanager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks));      // This contains a \n
1481
+        $menumanager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks)); // This contains a \n
1482 1482
         print "</div>\n";
1483 1483
 
1484 1484
         // Define link to login card
@@ -1486,34 +1486,34 @@  discard block
 block discarded – undo
1486 1486
         if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1487 1487
             $appli = $conf->global->MAIN_APPLICATION_TITLE;
1488 1488
             if (preg_match('/\d\.\d/', $appli)) {
1489
-                if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
1490
-                    $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
1489
+                if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli))
1490
+                    $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
1491 1491
             } else
1492
-                $appli .= " " . DOL_VERSION;
1492
+                $appli .= " ".DOL_VERSION;
1493 1493
         } else
1494
-            $appli .= " " . DOL_VERSION;
1494
+            $appli .= " ".DOL_VERSION;
1495 1495
 
1496 1496
         if (!empty($conf->global->MAIN_FEATURES_LEVEL))
1497
-            $appli .= "<br>" . $langs->trans("LevelOfFeature") . ': ' . $conf->global->MAIN_FEATURES_LEVEL;
1497
+            $appli .= "<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
1498 1498
 
1499 1499
         $logouttext = '';
1500 1500
         if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1501 1501
             //$logouthtmltext=$appli.'<br>';
1502 1502
             if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') {
1503
-                $logouthtmltext .= $langs->trans("Logout") . '<br>';
1503
+                $logouthtmltext .= $langs->trans("Logout").'<br>';
1504 1504
 
1505 1505
                 //$logouttext .='<a accesskey="l" href="'.DOL_BASE_URI.'/user/logout.php">';
1506
-                $logouttext .= '<a accesskey="l" href="' . BASE_URI . '?controller=user&method=logout">';
1506
+                $logouttext .= '<a accesskey="l" href="'.BASE_URI.'?controller=user&method=logout">';
1507 1507
                 //$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
1508 1508
                 $logouttext .= '<span class="fa fa-sign-out atoplogin"></span>';
1509 1509
                 $logouttext .= '</a>';
1510 1510
             } else {
1511 1511
                 $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]);
1512
-                $logouttext .= img_picto($langs->trans('Logout') . ":" . $langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
1512
+                $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
1513 1513
             }
1514 1514
         }
1515 1515
 
1516
-        print '<div class="login_block">' . "\n";
1516
+        print '<div class="login_block">'."\n";
1517 1517
 
1518 1518
         // Add login user link
1519 1519
         $toprightmenu .= '<div class="login_block_user">';
@@ -1524,18 +1524,18 @@  discard block
 block discarded – undo
1524 1524
         $toprightmenu .= $user->getNomUrl($mode, '', 1, 0, 11, 0, ($user->firstname ? 'firstname' : -1), 'atoplogin');
1525 1525
         $toprightmenu .= '</div></div>';
1526 1526
 
1527
-        $toprightmenu .= '</div>' . "\n";
1527
+        $toprightmenu .= '</div>'."\n";
1528 1528
 
1529 1529
         $toprightmenu .= '<div class="login_block_other">';
1530 1530
 
1531 1531
         // Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>')
1532 1532
         $parameters = array();
1533
-        $result = $hookmanager->executeHooks('printTopRightMenu', $parameters);    // Note that $action and $object may have been modified by some hooks
1533
+        $result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks
1534 1534
         if (is_numeric($result)) {
1535 1535
             if ($result == 0)
1536
-                $toprightmenu .= $hookmanager->resPrint;  // add
1536
+                $toprightmenu .= $hookmanager->resPrint; // add
1537 1537
             else
1538
-                $toprightmenu = $hookmanager->resPrint;      // replace
1538
+                $toprightmenu = $hookmanager->resPrint; // replace
1539 1539
         }
1540 1540
         else {
1541 1541
             $toprightmenu .= $result; // For backward compatibility
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
         // Link to module builder
1545 1545
         if (!empty($conf->modulebuilder->enabled)) {
1546 1546
             //$text = '<a href="' . DOL_BASE_URI . '/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
1547
-            $text = '<a href="' . BASE_URI . '?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
1547
+            $text = '<a href="'.BASE_URI.'?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
1548 1548
             //$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
1549 1549
             $text .= '<span class="fa fa-bug atoplogin"></span>';
1550 1550
             $text .= '</a>';
@@ -1558,11 +1558,11 @@  discard block
 block discarded – undo
1558 1558
             if (is_array($_POST)) {
1559 1559
                 foreach ($_POST as $key => $value) {
1560 1560
                     if ($key !== 'action' && $key !== 'password' && !is_array($value))
1561
-                        $qs .= '&' . $key . '=' . urlencode($value);
1561
+                        $qs .= '&'.$key.'='.urlencode($value);
1562 1562
                 }
1563 1563
             }
1564
-            $qs .= (($qs && $morequerystring) ? '&' : '') . $morequerystring;
1565
-            $text = '<a href="' . dol_escape_htmltag($_SERVER["PHP_SELF"]) . '?' . $qs . ($qs ? '&' : '') . 'optioncss=print" target="_blank">';
1564
+            $qs .= (($qs && $morequerystring) ? '&' : '').$morequerystring;
1565
+            $text = '<a href="'.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.$qs.($qs ? '&' : '').'optioncss=print" target="_blank">';
1566 1566
             //$text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"');
1567 1567
             $text .= '<span class="fa fa-print atoplogin"></span>';
1568 1568
             $text .= '</a>';
@@ -1591,12 +1591,12 @@  discard block
 block discarded – undo
1591 1591
                 $text = '';
1592 1592
                 if (!empty($conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) {
1593 1593
                     $langs->load('admin');
1594
-                    $appli .= '<br>' . $langs->trans("Database") . ': ' . $db->database_name;
1594
+                    $appli .= '<br>'.$langs->trans("Database").': '.$db->database_name;
1595 1595
                 }
1596
-                $title = $appli . '<br>';
1596
+                $title = $appli.'<br>';
1597 1597
                 $title .= $langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage');
1598 1598
                 if ($mode == 'wiki')
1599
-                    $title .= ' - ' . $langs->trans("PageWiki") . ' &quot;' . dol_escape_htmltag(strtr($helppage, '_', ' ')) . '&quot;';
1599
+                    $title .= ' - '.$langs->trans("PageWiki").' &quot;'.dol_escape_htmltag(strtr($helppage, '_', ' ')).'&quot;';
1600 1600
                 $text .= '<a class="help" target="_blank" rel="noopener" href="';
1601 1601
                 if ($mode == 'wiki')
1602 1602
                     $text .= sprintf($helpbaseurl, urlencode(html_entity_decode($helppage)));
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
 
1621 1621
         print $toprightmenu;
1622 1622
 
1623
-        print "</div>\n";  // end div class="login_block"
1623
+        print "</div>\n"; // end div class="login_block"
1624 1624
 
1625 1625
         print '</div></div>';
1626 1626
 
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
     }
1630 1630
 
1631 1631
     if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile))
1632
-        print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">';
1632
+        print '<!-- Begin div id-container --><div id="id-container" class="id-container'.($morecss ? ' '.$morecss : '').'">';
1633 1633
 }
1634 1634
 
1635 1635
 /**
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
         // Instantiate hooks of thirdparty module
1662 1662
         $hookmanager->initHooks(array('searchform', 'leftblock'));
1663 1663
 
1664
-        print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n";
1664
+        print "\n".'<!-- Begin side-nav id-left -->'."\n".'<div class="side-nav"><div id="id-left">'."\n";
1665 1665
 
1666 1666
         if ($conf->browser->layout == 'phone')
1667 1667
             $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
@@ -1673,7 +1673,7 @@  discard block
 block discarded – undo
1673 1673
         }
1674 1674
         $selected = -1;
1675 1675
         $usedbyinclude = 1;
1676
-        include_once DOL_BASE_PATH . '/core/ajax/selectsearchbox.php'; // This set $arrayresult
1676
+        include_once DOL_BASE_PATH.'/core/ajax/selectsearchbox.php'; // This set $arrayresult
1677 1677
 
1678 1678
         if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
1679 1679
             //$searchform.=$form->selectArrayAjax('searchselectcombo', DOL_BASE_URI.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'vmenusearchselectcombo', 1, $langs->trans("Search"), 1);
@@ -1688,7 +1688,7 @@  discard block
 block discarded – undo
1688 1688
         // Execute hook printSearchForm
1689 1689
         $parameters = array('searchform' => $searchform);
1690 1690
 
1691
-        $reshook = $hookmanager->executeHooks('printSearchForm', $parameters);    // Note that $action and $object may have been modified by some hooks
1691
+        $reshook = $hookmanager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks
1692 1692
         if (empty($reshook)) {
1693 1693
             $searchform .= $hookmanager->resPrint;
1694 1694
         } else
@@ -1696,10 +1696,10 @@  discard block
 block discarded – undo
1696 1696
 
1697 1697
         // Force special value for $searchform
1698 1698
         if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax)) {
1699
-            $urltosearch = DOL_BASE_URI . '/core/search_page.php?showtitlebefore=1';
1700
-            $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="' . $urltosearch . '" alt="' . dol_escape_htmltag($langs->trans("ShowSearchFields")) . '">' . $langs->trans("Search") . '...</a></div></div>';
1699
+            $urltosearch = DOL_BASE_URI.'/core/search_page.php?showtitlebefore=1';
1700
+            $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="'.$urltosearch.'" alt="'.dol_escape_htmltag($langs->trans("ShowSearchFields")).'">'.$langs->trans("Search").'...</a></div></div>';
1701 1701
         } elseif ($conf->use_javascript_ajax && !empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
1702
-            $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="' . dol_escape_htmltag($langs->trans("ShowSearchFields")) . '">' . $langs->trans("Search") . '...</a></div><div id="divsearchforms2" style="display: none">' . $searchform . '</div>';
1702
+            $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="#" alt="'.dol_escape_htmltag($langs->trans("ShowSearchFields")).'">'.$langs->trans("Search").'...</a></div><div id="divsearchforms2" style="display: none">'.$searchform.'</div>';
1703 1703
             $searchform .= '<script type="text/javascript">
1704 1704
             	jQuery(document).ready(function () {
1705 1705
             		jQuery("#divsearchforms1").click(function(){
@@ -1712,16 +1712,16 @@  discard block
 block discarded – undo
1712 1712
 
1713 1713
         // Define $bookmarks
1714 1714
         if (!empty($conf->bookmark->enabled) && $user->rights->bookmark->lire) {
1715
-            include_once DOL_BASE_PATH . '/bookmarks/bookmarks.lib.php';
1715
+            include_once DOL_BASE_PATH.'/bookmarks/bookmarks.lib.php';
1716 1716
             $langs->load("bookmarks");
1717 1717
 
1718 1718
             $bookmarks = printBookmarksList($db, $langs);
1719 1719
         }
1720 1720
 
1721 1721
         // Left column
1722
-        print '<!-- Begin left menu -->' . "\n";
1722
+        print '<!-- Begin left menu -->'."\n";
1723 1723
 
1724
-        print '<div class="vmenu"' . (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"') . '>' . "\n\n";
1724
+        print '<div class="vmenu"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"').'>'."\n\n";
1725 1725
 
1726 1726
         // Show left menu with other forms
1727 1727
         $menumanager->menu_array = $menu_array_before;
@@ -1730,7 +1730,7 @@  discard block
 block discarded – undo
1730 1730
         // Dolibarr version + help + bug report link
1731 1731
         print "\n";
1732 1732
         print "<!-- Begin Help Block-->\n";
1733
-        print '<div id="blockvmenuhelp" class="blockvmenuhelp">' . "\n";
1733
+        print '<div id="blockvmenuhelp" class="blockvmenuhelp">'."\n";
1734 1734
 
1735 1735
         // Version
1736 1736
         if (empty($conf->global->MAIN_HIDE_VERSION)) {    // Version is already on help picto and on login page.
@@ -1752,15 +1752,15 @@  discard block
 block discarded – undo
1752 1752
                 $appli = $conf->global->MAIN_APPLICATION_TITLE;
1753 1753
                 $doliurl = '';
1754 1754
                 if (preg_match('/\d\.\d/', $appli)) {
1755
-                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
1756
-                        $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
1755
+                    if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli))
1756
+                        $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
1757 1757
                 } else
1758
-                    $appli .= " " . DOL_VERSION;
1758
+                    $appli .= " ".DOL_VERSION;
1759 1759
             } else
1760
-                $appli .= " " . DOL_VERSION;
1760
+                $appli .= " ".DOL_VERSION;
1761 1761
             print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
1762 1762
             if ($doliurl)
1763
-                print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">';
1763
+                print '<a class="help" target="_blank" rel="noopener" href="'.$doliurl.'">';
1764 1764
             else
1765 1765
                 print '<span class="help">';
1766 1766
             print $appli;
@@ -1768,12 +1768,12 @@  discard block
 block discarded – undo
1768 1768
                 print '</a>';
1769 1769
             else
1770 1770
                 print '</span>';
1771
-            print '</div>' . "\n";
1771
+            print '</div>'."\n";
1772 1772
         }
1773 1773
 
1774 1774
         // Link to bugtrack
1775 1775
         if (!empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) {
1776
-            require_once DOL_BASE_PATH . '/core/lib/functions2.lib.php';
1776
+            require_once DOL_BASE_PATH.'/core/lib/functions2.lib.php';
1777 1777
 
1778 1778
             $bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new';
1779 1779
             $bugbaseurl .= '?title=';
@@ -1782,16 +1782,16 @@  discard block
 block discarded – undo
1782 1782
             $bugbaseurl .= urlencode("# Bug\n");
1783 1783
             $bugbaseurl .= urlencode("\n");
1784 1784
             $bugbaseurl .= urlencode("## Environment\n");
1785
-            $bugbaseurl .= urlencode("- **Version**: " . DOL_VERSION . "\n");
1786
-            $bugbaseurl .= urlencode("- **OS**: " . php_uname('s') . "\n");
1787
-            $bugbaseurl .= urlencode("- **Web server**: " . $_SERVER["SERVER_SOFTWARE"] . "\n");
1788
-            $bugbaseurl .= urlencode("- **PHP**: " . php_sapi_name() . ' ' . phpversion() . "\n");
1789
-            $bugbaseurl .= urlencode("- **Database**: " . $db::LABEL . ' ' . $db->getVersion() . "\n");
1790
-            $bugbaseurl .= urlencode("- **URL**: " . $_SERVER["REQUEST_URI"] . "\n");
1785
+            $bugbaseurl .= urlencode("- **Version**: ".DOL_VERSION."\n");
1786
+            $bugbaseurl .= urlencode("- **OS**: ".php_uname('s')."\n");
1787
+            $bugbaseurl .= urlencode("- **Web server**: ".$_SERVER["SERVER_SOFTWARE"]."\n");
1788
+            $bugbaseurl .= urlencode("- **PHP**: ".php_sapi_name().' '.phpversion()."\n");
1789
+            $bugbaseurl .= urlencode("- **Database**: ".$db::LABEL.' '.$db->getVersion()."\n");
1790
+            $bugbaseurl .= urlencode("- **URL**: ".$_SERVER["REQUEST_URI"]."\n");
1791 1791
             $bugbaseurl .= urlencode("\n");
1792 1792
             $bugbaseurl .= urlencode("## Report\n");
1793 1793
             print '<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">';
1794
-            print '<a class="help" target="_blank" rel="noopener" href="' . $bugbaseurl . '">' . $langs->trans("FindBug") . '</a>';
1794
+            print '<a class="help" target="_blank" rel="noopener" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a>';
1795 1795
             print '</div>';
1796 1796
         }
1797 1797
 
@@ -1805,14 +1805,14 @@  discard block
 block discarded – undo
1805 1805
 
1806 1806
         // Execute hook printLeftBlock
1807 1807
         $parameters = array();
1808
-        $reshook = $hookmanager->executeHooks('printLeftBlock', $parameters);    // Note that $action and $object may have been modified by some hooks
1808
+        $reshook = $hookmanager->executeHooks('printLeftBlock', $parameters); // Note that $action and $object may have been modified by some hooks
1809 1809
         print $hookmanager->resPrint;
1810 1810
 
1811 1811
         print '</div></div> <!-- End side-nav id-left -->'; // End div id="side-nav" div id="id-left"
1812 1812
     }
1813 1813
 
1814 1814
     print "\n";
1815
-    print '<!-- Begin right area -->' . "\n";
1815
+    print '<!-- Begin right area -->'."\n";
1816 1816
 
1817 1817
     if (empty($leftmenuwithoutmainarea))
1818 1818
         main_area($title);
@@ -1833,7 +1833,7 @@  discard block
 block discarded – undo
1833 1833
 
1834 1834
     print "\n";
1835 1835
 
1836
-    print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n";
1836
+    print '<!-- Begin div class="fiche" -->'."\n".'<div class="fiche">'."\n";
1837 1837
 
1838 1838
     if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
1839 1839
         print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED));
@@ -1899,17 +1899,17 @@  discard block
 block discarded – undo
1899 1899
     global $conf, $langs, $user;
1900 1900
 
1901 1901
     $ret = '';
1902
-    $ret .= '<form action="' . $urlaction . '" method="post" class="searchform">';
1903
-    $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
1902
+    $ret .= '<form action="'.$urlaction.'" method="post" class="searchform">';
1903
+    $ret .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
1904 1904
     $ret .= '<input type="hidden" name="mode" value="search">';
1905
-    $ret .= '<input type="hidden" name="savelogin" value="' . dol_escape_htmltag($user->login) . '">';
1905
+    $ret .= '<input type="hidden" name="savelogin" value="'.dol_escape_htmltag($user->login).'">';
1906 1906
     if ($showtitlebefore)
1907
-        $ret .= $title . ' ';
1908
-    $ret .= '<input type="text" class="flat ' . $htmlmorecss . '"';
1909
-    $ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"';
1910
-    $ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : '');
1911
-    $ret .= ' placeholder="' . strip_tags($title) . '"';
1912
-    $ret .= ' name="' . $htmlinputname . '" id="' . $prefhtmlinputname . $htmlinputname . '" />';
1907
+        $ret .= $title.' ';
1908
+    $ret .= '<input type="text" class="flat '.$htmlmorecss.'"';
1909
+    $ret .= ' style="text-indent: 22px; background-image: url(\''.$img.'\'); background-repeat: no-repeat; background-position: 3px;"';
1910
+    $ret .= ($accesskey ? ' accesskey="'.$accesskey.'"' : '');
1911
+    $ret .= ' placeholder="'.strip_tags($title).'"';
1912
+    $ret .= ' name="'.$htmlinputname.'" id="'.$prefhtmlinputname.$htmlinputname.'" />';
1913 1913
     //$ret.='<input type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px" value="'.$langs->trans("Go").'">';
1914 1914
     $ret .= '<button type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">';
1915 1915
     $ret .= '<span class="fa fa-search"></span>';
@@ -1935,7 +1935,7 @@  discard block
 block discarded – undo
1935 1935
         global $delayedhtmlcontent;
1936 1936
         global $contextpage, $page, $limit;
1937 1937
 
1938
-        $ext = 'layout=' . $conf->browser->layout . '&version=' . urlencode(DOL_VERSION);
1938
+        $ext = 'layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION);
1939 1939
 
1940 1940
         // Global html output events ($mesgs, $errors, $warnings)
1941 1941
         dol_htmloutput_events($disabledoutputofmessages);
@@ -1945,15 +1945,15 @@  discard block
 block discarded – undo
1945 1945
         if (is_object($user) && !empty($user->lastsearch_values_tmp) && is_array($user->lastsearch_values_tmp)) {
1946 1946
             // Clean and save data
1947 1947
             foreach ($user->lastsearch_values_tmp as $key => $val) {
1948
-                unset($_SESSION['lastsearch_values_tmp_' . $key]);   // Clean array to rebuild it just after
1948
+                unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean array to rebuild it just after
1949 1949
                 if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button
1950 1950
                     if (empty($val['sortfield']))
1951 1951
                         unset($val['sortfield']);
1952 1952
                     if (empty($val['sortorder']))
1953 1953
                         unset($val['sortorder']);
1954
-                    dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)");
1955
-                    $_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val);
1956
-                    unset($_SESSION['lastsearch_values_' . $key]);
1954
+                    dol_syslog('Save lastsearch_values_tmp_'.$key.'='.json_encode($val, 0)." (systematic recording of last search criterias)");
1955
+                    $_SESSION['lastsearch_values_tmp_'.$key] = json_encode($val);
1956
+                    unset($_SESSION['lastsearch_values_'.$key]);
1957 1957
                 }
1958 1958
             }
1959 1959
         }
@@ -1962,37 +1962,37 @@  discard block
 block discarded – undo
1962 1962
         $relativepathstring = $_SERVER["PHP_SELF"];
1963 1963
         // Clean $relativepathstring
1964 1964
         if (constant('DOL_BASE_URI'))
1965
-            $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
1965
+            $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring);
1966 1966
         $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
1967 1967
         $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
1968 1968
         if (preg_match('/list\.php$/', $relativepathstring)) {
1969
-            unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]);
1970
-            unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]);
1971
-            unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]);
1969
+            unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]);
1970
+            unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]);
1971
+            unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]);
1972 1972
 
1973 1973
             if (!empty($contextpage))
1974
-                $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
1974
+                $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring] = $contextpage;
1975 1975
             if (!empty($page) && $page > 1)
1976
-                $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
1976
+                $_SESSION['lastsearch_page_tmp_'.$relativepathstring] = $page;
1977 1977
             if (!empty($limit) && $limit != $conf->limit)
1978
-                $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
1978
+                $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] = $limit;
1979 1979
 
1980
-            unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]);
1981
-            unset($_SESSION['lastsearch_page_' . $relativepathstring]);
1982
-            unset($_SESSION['lastsearch_limit_' . $relativepathstring]);
1980
+            unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]);
1981
+            unset($_SESSION['lastsearch_page_'.$relativepathstring]);
1982
+            unset($_SESSION['lastsearch_limit_'.$relativepathstring]);
1983 1983
         }
1984 1984
 
1985 1985
         // Core error message
1986 1986
         if (!empty($conf->global->MAIN_CORE_ERROR)) {
1987 1987
             // Ajax version
1988 1988
             if ($conf->use_javascript_ajax) {
1989
-                $title = img_warning() . ' ' . $langs->trans('CoreErrorTitle');
1989
+                $title = img_warning().' '.$langs->trans('CoreErrorTitle');
1990 1990
                 print ajax_dialog($title, $langs->trans('CoreErrorMessage'));
1991 1991
             }
1992 1992
             // html version
1993 1993
             else {
1994
-                $msg = img_warning() . ' ' . $langs->trans('CoreErrorMessage');
1995
-                print '<div class="error">' . $msg . '</div>';
1994
+                $msg = img_warning().' '.$langs->trans('CoreErrorMessage');
1995
+                print '<div class="error">'.$msg.'</div>';
1996 1996
             }
1997 1997
 
1998 1998
             //define("MAIN_CORE_ERROR",0);      // Constant was defined and we can't change value of a constant
@@ -2000,17 +2000,17 @@  discard block
 block discarded – undo
2000 2000
 
2001 2001
         print "\n\n";
2002 2002
 
2003
-        print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche
2003
+        print '</div> <!-- End div class="fiche" -->'."\n"; // End div fiche
2004 2004
 
2005 2005
         if (empty($conf->dol_hide_leftmenu))
2006
-            print '</div> <!-- End div id-right -->' . "\n"; // End div id-right
2006
+            print '</div> <!-- End div id-right -->'."\n"; // End div id-right
2007 2007
 
2008 2008
         if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile))
2009
-            print '</div> <!-- End div id-container -->' . "\n"; // End div container
2009
+            print '</div> <!-- End div id-container -->'."\n"; // End div container
2010 2010
 
2011 2011
         print "\n";
2012 2012
         if ($comment)
2013
-            print '<!-- ' . $comment . ' -->' . "\n";
2013
+            print '<!-- '.$comment.' -->'."\n";
2014 2014
 
2015 2015
         printCommonFooter($zone);
2016 2016
 
@@ -2018,8 +2018,8 @@  discard block
 block discarded – undo
2018 2018
             print $delayedhtmlcontent;
2019 2019
 
2020 2020
         if (!empty($conf->use_javascript_ajax)) {
2021
-            print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n";
2022
-            print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_foot.js&lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n";
2021
+            print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
2022
+            print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_foot.js&lang='.$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n";
2023 2023
         }
2024 2024
 
2025 2025
         // Wrapper to add log when clicking on download or preview
@@ -2031,7 +2031,7 @@  discard block
 block discarded – undo
2031 2031
                 <script type="text/javascript">
2032 2032
                     jQuery(document).ready(function () {
2033 2033
                         $('a.documentpreview').click(function () {
2034
-                            $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>'
2034
+                            $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>'
2035 2035
                                     , {
2036 2036
                                         id:<?php echo $object->id; ?>
2037 2037
                                         , element: '<?php echo $object->element ?>'
@@ -2040,7 +2040,7 @@  discard block
 block discarded – undo
2040 2040
                             );
2041 2041
                         });
2042 2042
                         $('a.documentdownload').click(function () {
2043
-                            $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>'
2043
+                            $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>'
2044 2044
                                     , {
2045 2045
                                         id:<?php echo $object->id; ?>
2046 2046
                                         , element: '<?php echo $object->element ?>'
@@ -2056,7 +2056,7 @@  discard block
 block discarded – undo
2056 2056
 
2057 2057
         // A div for the address popup
2058 2058
         print "\n<!-- A div to allow dialog popup -->\n";
2059
-        print '<div id="dialogforpopup" style="display: none;"></div>' . "\n";
2059
+        print '<div id="dialogforpopup" style="display: none;"></div>'."\n";
2060 2060
 
2061 2061
         print "</body>\n";
2062 2062
 
Please login to merge, or discard this patch.
Braces   +415 added lines, -273 removed lines patch added patch discarded remove patch
@@ -213,16 +213,18 @@  discard block
 block discarded – undo
213 213
     foreach ($tmplist as $tmpkey) {
214 214
         $postkey = $tmpautoset[0] . '_' . $tmpkey;
215 215
         //var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]);
216
-        if (!empty($_POST[$postkey]))
217
-            $cookiearrayvalue[$tmpkey] = $_POST[$postkey];
216
+        if (!empty($_POST[$postkey])) {
217
+                    $cookiearrayvalue[$tmpkey] = $_POST[$postkey];
218
+        }
218 219
     }
219 220
     $cookiename = $tmpautoset[0];
220 221
     $cookievalue = json_encode($cookiearrayvalue);
221 222
     //var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
222 223
     setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, false, true); // keep cookie 1 year and add tag httponly
223
-    if (empty($cookievalue))
224
-        unset($_COOKIE[$cookiename]);
225
-}
224
+    if (empty($cookievalue)) {
225
+            unset($_COOKIE[$cookiename]);
226
+    }
227
+    }
226 228
 
227 229
 
228 230
 // Init session. Name of session is specific to Dolibarr instance.
@@ -231,8 +233,9 @@  discard block
 block discarded – undo
231 233
 
232 234
 $sessionname = 'DOLSESSID_' . $prefix;
233 235
 $sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix;
234
-if (!empty($_COOKIE[$sessiontimeout]))
236
+if (!empty($_COOKIE[$sessiontimeout])) {
235 237
     ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
238
+}
236 239
 session_name($sessionname);
237 240
 session_set_cookie_params(0, '/', null, false, true);   // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
238 241
 // This create lock, released when session_write_close() or end of page.
@@ -263,11 +266,13 @@  discard block
 block discarded – undo
263 266
     $conf->browser->layout = $tmp['layout'];     // 'classic', 'phone', 'tablet'
264 267
     //var_dump($conf->browser);
265 268
 
266
-    if ($conf->browser->layout == 'phone')
267
-        $conf->dol_no_mouse_hover = 1;
268
-    if ($conf->browser->layout == 'phone')
269
-        $conf->global->MAIN_TESTMENUHIDER = 1;
270
-}
269
+    if ($conf->browser->layout == 'phone') {
270
+            $conf->dol_no_mouse_hover = 1;
271
+    }
272
+    if ($conf->browser->layout == 'phone') {
273
+            $conf->global->MAIN_TESTMENUHIDER = 1;
274
+    }
275
+    }
271 276
 
272 277
 // Force HTTPS if required ($conf->file->main_force_https is 0/1 or https dolibarr root url)
273 278
 // $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
@@ -312,10 +317,14 @@  discard block
 block discarded – undo
312 317
 }
313 318
 
314 319
 // Loading of additional presentation includes
315
-if (!defined('NOREQUIREHTML'))
316
-    require_once DOL_BASE_PATH . '/core/class/html.form.class.php';     // Need 660ko memory (800ko in 2.2)
317
-if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax)
318
-    require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php'; // Need 22ko memory
320
+if (!defined('NOREQUIREHTML')) {
321
+    require_once DOL_BASE_PATH . '/core/class/html.form.class.php';
322
+}
323
+// Need 660ko memory (800ko in 2.2)
324
+if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) {
325
+    require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php';
326
+}
327
+// Need 22ko memory
319 328
 
320 329
 
321 330
 
@@ -344,8 +353,9 @@  discard block
 block discarded – undo
344 353
 // Creation of a token against CSRF vulnerabilities
345 354
 if (!defined('NOTOKENRENEWAL')) {
346 355
     // roulement des jetons car cree a chaque appel
347
-    if (isset($_SESSION['newtoken']))
348
-        $_SESSION['token'] = $_SESSION['newtoken'];
356
+    if (isset($_SESSION['newtoken'])) {
357
+            $_SESSION['token'] = $_SESSION['newtoken'];
358
+    }
349 359
 
350 360
     // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken']
351 361
     $token = dol_hash(uniqid(mt_rand(), true)); // Generates a hash of a random number
@@ -367,14 +377,16 @@  discard block
 block discarded – undo
367 377
 }
368 378
 
369 379
 // Disable modules (this must be after session_start and after conf has been loaded)
370
-if (GETPOST('disablemodules', 'alpha'))
380
+if (GETPOST('disablemodules', 'alpha')) {
371 381
     $_SESSION["disablemodules"] = GETPOST('disablemodules', 'alpha');
382
+}
372 383
 if (!empty($_SESSION["disablemodules"])) {
373 384
     $disabled_modules = explode(',', $_SESSION["disablemodules"]);
374 385
     foreach ($disabled_modules as $module) {
375 386
         if ($module) {
376
-            if (empty($conf->$module))
377
-                $conf->$module = new stdClass();
387
+            if (empty($conf->$module)) {
388
+                            $conf->$module = new stdClass();
389
+            }
378 390
             $conf->$module->enabled = false;
379 391
             if ($module == 'fournisseur') {  // Special case
380 392
                 $conf->supplier_order->enabled = 0;
@@ -396,11 +408,13 @@  discard block
 block discarded – undo
396 408
         $dolibarr_main_authentication = constant('MAIN_AUTHENTICATION_MODE');
397 409
     } else {
398 410
         // Authentication mode
399
-        if (empty($dolibarr_main_authentication))
400
-            $dolibarr_main_authentication = 'http,dolibarr';
411
+        if (empty($dolibarr_main_authentication)) {
412
+                    $dolibarr_main_authentication = 'http,dolibarr';
413
+        }
401 414
         // Authentication mode: forceuser
402
-        if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user))
403
-            $dolibarr_auto_user = 'auto';
415
+        if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) {
416
+                    $dolibarr_auto_user = 'auto';
417
+        }
404 418
     }
405 419
     // Set authmode
406 420
     $authmode = explode(',', $dolibarr_main_authentication);
@@ -477,35 +491,41 @@  discard block
 block discarded – undo
477 491
                 $hookmanager->initHooks(array('login'));
478 492
                 $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
479 493
                 $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
480
-                if ($reshook < 0)
481
-                    $error++;
494
+                if ($reshook < 0) {
495
+                                    $error++;
496
+                }
482 497
 
483 498
                 // Note: exit is done later
484 499
             }
485 500
         }
486 501
 
487 502
         $allowedmethodtopostusername = 2;
488
-        if (defined('MAIN_AUTHENTICATION_POST_METHOD'))
489
-            $allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD');
503
+        if (defined('MAIN_AUTHENTICATION_POST_METHOD')) {
504
+                    $allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD');
505
+        }
490 506
         $usertotest = (!empty($_COOKIE['login_dolibarr']) ? $_COOKIE['login_dolibarr'] : GETPOST("username", "alpha", $allowedmethodtopostusername));
491 507
         $passwordtotest = GETPOST('password', 'none', $allowedmethodtopostusername);
492 508
         $entitytotest = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : (!empty($conf->entity) ? $conf->entity : 1));
493 509
 
494 510
         // Define if we received data to test the login.
495 511
         $goontestloop = false;
496
-        if (isset($_SERVER["REMOTE_USER"]) && in_array('http', $authmode))
497
-            $goontestloop = true;
498
-        if ($dolibarr_main_authentication == 'forceuser' && !empty($dolibarr_auto_user))
499
-            $goontestloop = true;
500
-        if (GETPOST("username", "alpha", $allowedmethodtopostusername) || !empty($_COOKIE['login_dolibarr']) || GETPOST('openid_mode', 'alpha', 1))
501
-            $goontestloop = true;
512
+        if (isset($_SERVER["REMOTE_USER"]) && in_array('http', $authmode)) {
513
+                    $goontestloop = true;
514
+        }
515
+        if ($dolibarr_main_authentication == 'forceuser' && !empty($dolibarr_auto_user)) {
516
+                    $goontestloop = true;
517
+        }
518
+        if (GETPOST("username", "alpha", $allowedmethodtopostusername) || !empty($_COOKIE['login_dolibarr']) || GETPOST('openid_mode', 'alpha', 1)) {
519
+                    $goontestloop = true;
520
+        }
502 521
 
503 522
         if (!is_object($langs)) { // This can occurs when calling page with NOREQUIRETRAN defined, however we need langs for error messages.
504 523
             include_once DOL_BASE_PATH . '/core/class/translate.class.php';
505 524
             $langs = new Translate("", $conf);
506 525
             $langcode = (GETPOST('lang', 'aZ09', 1) ? GETPOST('lang', 'aZ09', 1) : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT));
507
-            if (defined('MAIN_LANG_DEFAULT'))
508
-                $langcode = constant('MAIN_LANG_DEFAULT');
526
+            if (defined('MAIN_LANG_DEFAULT')) {
527
+                            $langcode = constant('MAIN_LANG_DEFAULT');
528
+            }
509 529
             $langs->setDefaultLang($langcode);
510 530
         }
511 531
 
@@ -527,8 +547,9 @@  discard block
 block discarded – undo
527 547
                     $datenow = dol_now();
528 548
                     $datefirst = dol_stringtotime($_POST["dst_first"]);
529 549
                     $datesecond = dol_stringtotime($_POST["dst_second"]);
530
-                    if ($datenow >= $datefirst && $datenow < $datesecond)
531
-                        $dol_dst = 1;
550
+                    if ($datenow >= $datefirst && $datenow < $datesecond) {
551
+                                            $dol_dst = 1;
552
+                    }
532 553
                 }
533 554
                 //print $datefirst.'-'.$datesecond.'-'.$datenow.'-'.$dol_tz.'-'.$dol_tzstring.'-'.$dol_dst; exit;
534 555
             }
@@ -540,8 +561,9 @@  discard block
 block discarded – undo
540 561
 
541 562
                 // Bad password. No authmode has found a good password.
542 563
                 // We set a generic message if not defined inside function checkLoginPassEntity or subfunctions
543
-                if (empty($_SESSION["dol_loginmesg"]))
544
-                    $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword");
564
+                if (empty($_SESSION["dol_loginmesg"])) {
565
+                                    $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword");
566
+                }
545 567
 
546 568
                 // Call trigger for the "security events" log
547 569
                 $user->trigger_mesg = $langs->trans("ErrorBadLoginPassword") . ' - login=' . GETPOST("username", "alpha", 2);
@@ -558,8 +580,9 @@  discard block
 block discarded – undo
558 580
                 $hookmanager->initHooks(array('login'));
559 581
                 $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
560 582
                 $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
561
-                if ($reshook < 0)
562
-                    $error++;
583
+                if ($reshook < 0) {
584
+                                    $error++;
585
+                }
563 586
 
564 587
                 // Note: exit is done in next chapter
565 588
             }
@@ -569,10 +592,11 @@  discard block
 block discarded – undo
569 592
         if (!$login || (in_array('ldap', $authmode) && empty($passwordtotest))) { // With LDAP we refused empty password because some LDAP are "opened" for anonymous access so connexion is a success.
570 593
             // No data to test login, so we show the login page
571 594
             dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . " showing the login form and exit");
572
-            if (defined('NOREDIRECTBYMAINTOLOGIN'))
573
-                return 'ERROR_NOT_LOGGED';
574
-            else
575
-                dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : ''));
595
+            if (defined('NOREDIRECTBYMAINTOLOGIN')) {
596
+                            return 'ERROR_NOT_LOGGED';
597
+            } else {
598
+                            dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : ''));
599
+            }
576 600
             exit;
577 601
         }
578 602
 
@@ -611,21 +635,24 @@  discard block
 block discarded – undo
611 635
             $hookmanager->initHooks(array('login'));
612 636
             $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
613 637
             $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
614
-            if ($reshook < 0)
615
-                $error++;
638
+            if ($reshook < 0) {
639
+                            $error++;
640
+            }
616 641
 
617 642
             $paramsurl = array();
618
-            if (GETPOST('textbrowser', 'int'))
619
-                $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
620
-            if (GETPOST('nojs', 'int'))
621
-                $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
622
-            if (GETPOST('lang', 'aZ09'))
623
-                $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
643
+            if (GETPOST('textbrowser', 'int')) {
644
+                            $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
645
+            }
646
+            if (GETPOST('nojs', 'int')) {
647
+                            $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
648
+            }
649
+            if (GETPOST('lang', 'aZ09')) {
650
+                            $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
651
+            }
624 652
             header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''));
625 653
             exit;
626 654
         }
627
-    }
628
-    else {
655
+    } else {
629 656
         // We are already into an authenticated session
630 657
         $login = $_SESSION["dol_login"];
631 658
         $entity = $_SESSION["dol_entity"];
@@ -667,20 +694,23 @@  discard block
 block discarded – undo
667 694
             $hookmanager->initHooks(array('login'));
668 695
             $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
669 696
             $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
670
-            if ($reshook < 0)
671
-                $error++;
697
+            if ($reshook < 0) {
698
+                            $error++;
699
+            }
672 700
 
673 701
             $paramsurl = array();
674
-            if (GETPOST('textbrowser', 'int'))
675
-                $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
676
-            if (GETPOST('nojs', 'int'))
677
-                $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
678
-            if (GETPOST('lang', 'aZ09'))
679
-                $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
702
+            if (GETPOST('textbrowser', 'int')) {
703
+                            $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
704
+            }
705
+            if (GETPOST('nojs', 'int')) {
706
+                            $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
707
+            }
708
+            if (GETPOST('lang', 'aZ09')) {
709
+                            $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
710
+            }
680 711
             header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''));
681 712
             exit;
682
-        }
683
-        else {
713
+        } else {
684 714
             // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
685 715
             $hookmanager->initHooks(array('main'));
686 716
 
@@ -689,8 +719,9 @@  discard block
 block discarded – undo
689 719
                 $relativepathstring = preg_replace('/\?.*$/', '', $_SERVER["HTTP_REFERER"]);
690 720
                 $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring);     // Get full path except host server
691 721
                 // Clean $relativepathstring
692
-                if (constant('DOL_BASE_URI'))
693
-                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
722
+                if (constant('DOL_BASE_URI')) {
723
+                                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
724
+                }
694 725
                 $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
695 726
                 $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
696 727
                 //var_dump($relativepathstring);
@@ -741,16 +772,21 @@  discard block
 block discarded – undo
741 772
         $_SESSION["dol_company"] = $conf->global->MAIN_INFO_SOCIETE_NOM;
742 773
         $_SESSION["dol_entity"] = $conf->entity;
743 774
         // Store value into session (values stored only if defined)
744
-        if (!empty($dol_hide_topmenu))
745
-            $_SESSION['dol_hide_topmenu'] = $dol_hide_topmenu;
746
-        if (!empty($dol_hide_leftmenu))
747
-            $_SESSION['dol_hide_leftmenu'] = $dol_hide_leftmenu;
748
-        if (!empty($dol_optimize_smallscreen))
749
-            $_SESSION['dol_optimize_smallscreen'] = $dol_optimize_smallscreen;
750
-        if (!empty($dol_no_mouse_hover))
751
-            $_SESSION['dol_no_mouse_hover'] = $dol_no_mouse_hover;
752
-        if (!empty($dol_use_jmobile))
753
-            $_SESSION['dol_use_jmobile'] = $dol_use_jmobile;
775
+        if (!empty($dol_hide_topmenu)) {
776
+                    $_SESSION['dol_hide_topmenu'] = $dol_hide_topmenu;
777
+        }
778
+        if (!empty($dol_hide_leftmenu)) {
779
+                    $_SESSION['dol_hide_leftmenu'] = $dol_hide_leftmenu;
780
+        }
781
+        if (!empty($dol_optimize_smallscreen)) {
782
+                    $_SESSION['dol_optimize_smallscreen'] = $dol_optimize_smallscreen;
783
+        }
784
+        if (!empty($dol_no_mouse_hover)) {
785
+                    $_SESSION['dol_no_mouse_hover'] = $dol_no_mouse_hover;
786
+        }
787
+        if (!empty($dol_use_jmobile)) {
788
+                    $_SESSION['dol_use_jmobile'] = $dol_use_jmobile;
789
+        }
754 790
 
755 791
         dol_syslog("This is a new started user session. _SESSION['dol_login']=" . $_SESSION["dol_login"] . " Session id=" . session_id());
756 792
 
@@ -775,8 +811,9 @@  discard block
 block discarded – undo
775 811
         $hookmanager->initHooks(array('login'));
776 812
         $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginfo' => $loginfo);
777 813
         $reshook = $hookmanager->executeHooks('afterLogin', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
778
-        if ($reshook < 0)
779
-            $error++;
814
+        if ($reshook < 0) {
815
+                    $error++;
816
+        }
780 817
 
781 818
         if ($error) {
782 819
             $db->rollback();
@@ -814,10 +851,14 @@  discard block
 block discarded – undo
814 851
      */
815 852
 
816 853
     // Set liste_limit
817
-    if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT))
818
-        $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT; // Can be 0
819
-    if (isset($user->conf->PRODUIT_LIMIT_SIZE))
820
-        $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE; // Can be 0
854
+    if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) {
855
+            $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT;
856
+    }
857
+    // Can be 0
858
+    if (isset($user->conf->PRODUIT_LIMIT_SIZE)) {
859
+            $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE;
860
+    }
861
+    // Can be 0
821 862
 
822 863
 
823 864
 
@@ -844,8 +885,9 @@  discard block
 block discarded – undo
844 885
     if (!empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) {
845 886
         $conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT;
846 887
     }
847
-} else
888
+} else {
848 889
     $conf->use_javascript_ajax = 0;
890
+}
849 891
 // Set MAIN_OPTIMIZEFORTEXTBROWSER
850 892
 if (GETPOST('textbrowser', 'int') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks') || !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {   // If we must enable text browser
851 893
     $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1;
@@ -854,25 +896,32 @@  discard block
 block discarded – undo
854 896
 }
855 897
 
856 898
 // Set terminal output option according to conf->browser.
857
-if (GETPOST('dol_hide_leftmenu', 'int') || !empty($_SESSION['dol_hide_leftmenu']))
899
+if (GETPOST('dol_hide_leftmenu', 'int') || !empty($_SESSION['dol_hide_leftmenu'])) {
858 900
     $conf->dol_hide_leftmenu = 1;
859
-if (GETPOST('dol_hide_topmenu', 'int') || !empty($_SESSION['dol_hide_topmenu']))
901
+}
902
+if (GETPOST('dol_hide_topmenu', 'int') || !empty($_SESSION['dol_hide_topmenu'])) {
860 903
     $conf->dol_hide_topmenu = 1;
861
-if (GETPOST('dol_optimize_smallscreen', 'int') || !empty($_SESSION['dol_optimize_smallscreen']))
904
+}
905
+if (GETPOST('dol_optimize_smallscreen', 'int') || !empty($_SESSION['dol_optimize_smallscreen'])) {
862 906
     $conf->dol_optimize_smallscreen = 1;
863
-if (GETPOST('dol_no_mouse_hover', 'int') || !empty($_SESSION['dol_no_mouse_hover']))
907
+}
908
+if (GETPOST('dol_no_mouse_hover', 'int') || !empty($_SESSION['dol_no_mouse_hover'])) {
864 909
     $conf->dol_no_mouse_hover = 1;
865
-if (GETPOST('dol_use_jmobile', 'int') || !empty($_SESSION['dol_use_jmobile']))
910
+}
911
+if (GETPOST('dol_use_jmobile', 'int') || !empty($_SESSION['dol_use_jmobile'])) {
866 912
     $conf->dol_use_jmobile = 1;
867
-if (!empty($conf->browser->layout) && $conf->browser->layout != 'classic')
913
+}
914
+if (!empty($conf->browser->layout) && $conf->browser->layout != 'classic') {
868 915
     $conf->dol_no_mouse_hover = 1;
916
+}
869 917
 if ((!empty($conf->browser->layout) && $conf->browser->layout == 'phone') || (!empty($_SESSION['dol_screenwidth']) && $_SESSION['dol_screenwidth'] < 400) || (!empty($_SESSION['dol_screenheight']) && $_SESSION['dol_screenheight'] < 400)
870 918
 ) {
871 919
     $conf->dol_optimize_smallscreen = 1;
872 920
 }
873 921
 // If we force to use jmobile, then we reenable javascript
874
-if (!empty($conf->dol_use_jmobile))
922
+if (!empty($conf->dol_use_jmobile)) {
875 923
     $conf->use_javascript_ajax = 1;
924
+}
876 925
 // Replace themes bugged with jmobile with eldy
877 926
 if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array('bureau2crea', 'cameleo', 'amarok'))) {
878 927
     $conf->theme = 'eldy';
@@ -896,8 +945,9 @@  discard block
 block discarded – undo
896 945
 if (!defined('NOLOGIN')) {
897 946
     // If the login is not recovered, it is identified with an account that does not exist.
898 947
     // Hacking attempt?
899
-    if (!$user->login)
900
-        accessforbidden();
948
+    if (!$user->login) {
949
+            accessforbidden();
950
+    }
901 951
 
902 952
     // Check if user is active
903 953
     if ($user->statut < 1) {
@@ -972,15 +1022,18 @@  discard block
 block discarded – undo
972 1022
 
973 1023
     // Load the menu manager (only if not already done)
974 1024
     $file_menu = $conf->standard_menu;
975
-    if (GETPOST('menu', 'alpha'))
976
-        $file_menu = GETPOST('menu', 'alpha');     // example: menu=eldy_menu.php
1025
+    if (GETPOST('menu', 'alpha')) {
1026
+            $file_menu = GETPOST('menu', 'alpha');
1027
+    }
1028
+    // example: menu=eldy_menu.php
977 1029
     if (!class_exists('MenuManager')) {
978 1030
         $menufound = 0;
979 1031
         $dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
980 1032
         foreach ($dirmenus as $dirmenu) {
981 1033
             $menufound = dol_include_once($dirmenu . "standard/" . $file_menu);
982
-            if (class_exists('MenuManager'))
983
-                break;
1034
+            if (class_exists('MenuManager')) {
1035
+                            break;
1036
+            }
984 1037
         }
985 1038
         if (!class_exists('MenuManager')) { // If failed to include, we try with standard eldy_menu.php
986 1039
             dol_syslog("You define a menu manager '" . $file_menu . "' that can not be loaded.", LOG_WARNING);
@@ -1054,10 +1107,11 @@  discard block
 block discarded – undo
1054 1107
 {
1055 1108
     global $db, $conf, $hookmanager;
1056 1109
 
1057
-    if ($contenttype == 'text/html')
1058
-        header("Content-Type: text/html; charset=" . $conf->file->character_set_client);
1059
-    else
1060
-        header("Content-Type: " . $contenttype);
1110
+    if ($contenttype == 'text/html') {
1111
+            header("Content-Type: text/html; charset=" . $conf->file->character_set_client);
1112
+    } else {
1113
+            header("Content-Type: " . $contenttype);
1114
+    }
1061 1115
     // Security options
1062 1116
     header("X-Content-Type-Options: nosniff");  // With the nosniff option, if the server says the content is text/html, the browser will render it as text/html (note that most browsers now force this option to on)
1063 1117
     header("X-Frame-Options: SAMEORIGIN");      // Frames allowed only if on same domain (stop some XSS attacks)
@@ -1071,16 +1125,21 @@  discard block
 block discarded – undo
1071 1125
         //else $contentsecuritypolicy = $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY;
1072 1126
         $contentsecuritypolicy = $conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY;
1073 1127
 
1074
-        if (!is_object($hookmanager))
1075
-            $hookmanager = new HookManager($db);
1128
+        if (!is_object($hookmanager)) {
1129
+                    $hookmanager = new HookManager($db);
1130
+        }
1076 1131
         $hookmanager->initHooks("main");
1077 1132
 
1078 1133
         $parameters = array('contentsecuritypolicy' => $contentsecuritypolicy);
1079 1134
         $result = $hookmanager->executeHooks('setContentSecurityPolicy', $parameters);    // Note that $action and $object may have been modified by some hooks
1080
-        if ($result > 0)
1081
-            $contentsecuritypolicy = $hookmanager->resPrint; // Replace CSP
1082
-        else
1083
-            $contentsecuritypolicy .= $hookmanager->resPrint;    // Concat CSP
1135
+        if ($result > 0) {
1136
+                    $contentsecuritypolicy = $hookmanager->resPrint;
1137
+        }
1138
+        // Replace CSP
1139
+        else {
1140
+                    $contentsecuritypolicy .= $hookmanager->resPrint;
1141
+        }
1142
+        // Concat CSP
1084 1143
 
1085 1144
         if (!empty($contentsecuritypolicy)) {
1086 1145
             // For example, to restrict 'script', 'object', 'frames' or 'img' to some domains:
@@ -1127,18 +1186,20 @@  discard block
 block discarded – undo
1127 1186
     }
1128 1187
     print '<!doctype html>' . "\n";
1129 1188
 
1130
-    if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST))
1131
-        print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_BASE_URI . '/cache.manifest">' . "\n";
1132
-    else
1133
-        print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n";
1189
+    if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST)) {
1190
+            print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_BASE_URI . '/cache.manifest">' . "\n";
1191
+    } else {
1192
+            print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n";
1193
+    }
1134 1194
     //print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'."\n";
1135 1195
     if (empty($disablehead)) {
1136 1196
         $ext = 'layout=' . $conf->browser->layout . '&version=' . urlencode(DOL_VERSION);
1137 1197
 
1138 1198
         print "<head>\n";
1139 1199
 
1140
-        if (GETPOST('dol_basehref', 'alpha'))
1141
-            print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')) . '">' . "\n";
1200
+        if (GETPOST('dol_basehref', 'alpha')) {
1201
+                    print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')) . '">' . "\n";
1202
+        }
1142 1203
 
1143 1204
         // Displays meta
1144 1205
         print '<meta charset="UTF-8">' . "\n";
@@ -1148,10 +1209,13 @@  discard block
 block discarded – undo
1148 1209
 
1149 1210
         // Favicon
1150 1211
         $favicon = dol_buildpath('/theme/' . $conf->theme . '/img/favicon.ico', 1);
1151
-        if (!empty($conf->global->MAIN_FAVICON_URL))
1152
-            $favicon = $conf->global->MAIN_FAVICON_URL;
1153
-        if (empty($conf->dol_use_jmobile))
1154
-            print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n"; // Not required into an Android webview
1212
+        if (!empty($conf->global->MAIN_FAVICON_URL)) {
1213
+                    $favicon = $conf->global->MAIN_FAVICON_URL;
1214
+        }
1215
+        if (empty($conf->dol_use_jmobile)) {
1216
+                    print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n";
1217
+        }
1218
+        // Not required into an Android webview
1155 1219
 
1156 1220
 
1157 1221
 
@@ -1161,47 +1225,59 @@  discard block
 block discarded – undo
1161 1225
         //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="copyright" title="GNU General Public License" href="http://www.gnu.org/copyleft/gpl.html#SEC1">'."\n";
1162 1226
         //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="author" title="Dolibarr Development Team" href="https://www.dolibarr.org">'."\n";
1163 1227
         // Auto refresh page
1164
-        if (GETPOST('autorefresh', 'int') > 0)
1165
-            print '<meta http-equiv="refresh" content="' . GETPOST('autorefresh', 'int') . '">';
1228
+        if (GETPOST('autorefresh', 'int') > 0) {
1229
+                    print '<meta http-equiv="refresh" content="' . GETPOST('autorefresh', 'int') . '">';
1230
+        }
1166 1231
 
1167 1232
         // Displays title
1168 1233
         $appli = constant('DOL_APPLICATION_TITLE');
1169
-        if (!empty($conf->global->MAIN_APPLICATION_TITLE))
1170
-            $appli = $conf->global->MAIN_APPLICATION_TITLE;
1234
+        if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1235
+                    $appli = $conf->global->MAIN_APPLICATION_TITLE;
1236
+        }
1171 1237
 
1172 1238
         print '<title>';
1173 1239
         $titletoshow = '';
1174
-        if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE))
1175
-            $titletoshow = dol_htmlentities($title);
1176
-        else if ($title)
1177
-            $titletoshow = dol_htmlentities($appli . ' - ' . $title);
1178
-        else
1179
-            $titletoshow = dol_htmlentities($appli);
1180
-
1181
-        if (!is_object($hookmanager))
1182
-            $hookmanager = new HookManager($db);
1240
+        if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE)) {
1241
+                    $titletoshow = dol_htmlentities($title);
1242
+        } else if ($title) {
1243
+                    $titletoshow = dol_htmlentities($appli . ' - ' . $title);
1244
+        } else {
1245
+                    $titletoshow = dol_htmlentities($appli);
1246
+        }
1247
+
1248
+        if (!is_object($hookmanager)) {
1249
+                    $hookmanager = new HookManager($db);
1250
+        }
1183 1251
         $hookmanager->initHooks("main");
1184 1252
         $parameters = array('title' => $titletoshow);
1185 1253
         $result = $hookmanager->executeHooks('setHtmlTitle', $parameters);  // Note that $action and $object may have been modified by some hooks
1186
-        if ($result > 0)
1187
-            $titletoshow = $hookmanager->resPrint;    // Replace Title to show
1188
-        else
1189
-            $titletoshow .= $hookmanager->resPrint;      // Concat to Title to show
1254
+        if ($result > 0) {
1255
+                    $titletoshow = $hookmanager->resPrint;
1256
+        }
1257
+        // Replace Title to show
1258
+        else {
1259
+                    $titletoshow .= $hookmanager->resPrint;
1260
+        }
1261
+        // Concat to Title to show
1190 1262
 
1191 1263
         print $titletoshow;
1192 1264
         print '</title>';
1193 1265
 
1194 1266
         print "\n";
1195 1267
 
1196
-        if (GETPOST('version', 'int'))
1197
-            $ext = 'version=' . GETPOST('version', 'int'); // usefull to force no cache on css/js
1198
-        if (GETPOST('testmenuhider', 'int') || !empty($conf->global->MAIN_TESTMENUHIDER))
1199
-            $ext .= '&testmenuhider=' . (GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER);
1268
+        if (GETPOST('version', 'int')) {
1269
+                    $ext = 'version=' . GETPOST('version', 'int');
1270
+        }
1271
+        // usefull to force no cache on css/js
1272
+        if (GETPOST('testmenuhider', 'int') || !empty($conf->global->MAIN_TESTMENUHIDER)) {
1273
+                    $ext .= '&testmenuhider=' . (GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER);
1274
+        }
1200 1275
 
1201 1276
         $themeparam = '&lang=' . $langs->defaultlang . '&amp;theme=' . $conf->theme . (GETPOST('optioncss', 'aZ09') ? '&amp;optioncss=' . GETPOST('optioncss', 'aZ09', 1) : '') . '&amp;userid=' . $user->id . '&amp;entity=' . $conf->entity;
1202 1277
         $themeparam .= ($ext ? '&amp;' . $ext : '');
1203
-        if (!empty($_SESSION['dol_resetcache']))
1204
-            $themeparam .= '&amp;dol_resetcache=' . $_SESSION['dol_resetcache'];
1278
+        if (!empty($_SESSION['dol_resetcache'])) {
1279
+                    $themeparam .= '&amp;dol_resetcache=' . $_SESSION['dol_resetcache'];
1280
+        }
1205 1281
         if (GETPOST('dol_hide_topmenu', 'int')) {
1206 1282
             $themeparam .= '&amp;dol_hide_topmenu=' . GETPOST('dol_hide_topmenu', 'int');
1207 1283
         }
@@ -1222,14 +1298,21 @@  discard block
 block discarded – undo
1222 1298
         if (!defined('DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax) {
1223 1299
             print '<!-- Includes CSS for JQuery (Ajax library) -->' . "\n";
1224 1300
             $jquerytheme = 'base';
1225
-            if (!empty($conf->global->MAIN_USE_JQUERY_THEME))
1226
-                $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
1227
-            if (constant('JS_JQUERY_UI'))
1228
-                print '<link rel="stylesheet" type="text/css" href="' . JS_JQUERY_UI . 'css/' . $jquerytheme . '/jquery-ui.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";  // JQuery
1229
-            else
1230
-                print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.css' . ($ext ? '?' . $ext : '') . '">' . "\n";    // JQuery
1231
-            if (!defined('DISABLE_JQUERY_JNOTIFY'))
1232
-                print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";          // JNotify
1301
+            if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) {
1302
+                            $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
1303
+            }
1304
+            if (constant('JS_JQUERY_UI')) {
1305
+                            print '<link rel="stylesheet" type="text/css" href="' . JS_JQUERY_UI . 'css/' . $jquerytheme . '/jquery-ui.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1306
+            }
1307
+            // JQuery
1308
+            else {
1309
+                            print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1310
+            }
1311
+            // JQuery
1312
+            if (!defined('DISABLE_JQUERY_JNOTIFY')) {
1313
+                            print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1314
+            }
1315
+            // JNotify
1233 1316
             if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) {     // jQuery plugin "mutiselect", "multiple-select", "select2"...
1234 1317
                 $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1235 1318
                 print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/' . $tmpplugin . '/dist/css/' . $tmpplugin . '.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
@@ -1257,8 +1340,9 @@  discard block
 block discarded – undo
1257 1340
 
1258 1341
         //print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
1259 1342
         print '<link rel="stylesheet" type="text/css" href="' . $themepath . $themeparam . '">' . "\n";
1260
-        if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME))
1261
-            print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->' . "\n" . '<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">' . "\n";
1343
+        if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME)) {
1344
+                    print '<!-- Includes CSS that does not exists as a workaround of flash bug of chrome -->' . "\n" . '<link rel="stylesheet" type="text/css" href="filethatdoesnotexiststosolvechromeflashbug">' . "\n";
1345
+        }
1262 1346
 
1263 1347
         // CSS forced by modules (relative url starting with /)
1264 1348
         if (!empty($conf->modules_parts['css'])) {
@@ -1266,13 +1350,15 @@  discard block
 block discarded – undo
1266 1350
             foreach ($arraycss as $modcss => $filescss) {
1267 1351
                 $filescss = (array) $filescss; // To be sure filecss is an array
1268 1352
                 foreach ($filescss as $cssfile) {
1269
-                    if (empty($cssfile))
1270
-                        dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING);
1353
+                    if (empty($cssfile)) {
1354
+                                            dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING);
1355
+                    }
1271 1356
                     // cssfile is a relative path
1272 1357
                     print '<!-- Includes CSS added by module ' . $modcss . ' -->' . "\n" . '<link rel="stylesheet" type="text/css" href="' . dol_buildpath($cssfile, 1);
1273 1358
                     // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters, so browser cache is not used.
1274
-                    if (!preg_match('/\.css$/i', $cssfile))
1275
-                        print $themeparam;
1359
+                    if (!preg_match('/\.css$/i', $cssfile)) {
1360
+                                            print $themeparam;
1361
+                    }
1276 1362
                     print '">' . "\n";
1277 1363
                 }
1278 1364
             }
@@ -1282,8 +1368,9 @@  discard block
 block discarded – undo
1282 1368
             foreach ($arrayofcss as $cssfile) {
1283 1369
                 print '<!-- Includes CSS added by page -->' . "\n" . '<link rel="stylesheet" type="text/css" title="default" href="' . dol_buildpath($cssfile, 1);
1284 1370
                 // We add params only if page is not static, because some web server setup does not return content type text/css if url has parameters and browser cache is not used.
1285
-                if (!preg_match('/\.css$/i', $cssfile))
1286
-                    print $themeparam;
1371
+                if (!preg_match('/\.css$/i', $cssfile)) {
1372
+                                    print $themeparam;
1373
+                }
1287 1374
                 print '">' . "\n";
1288 1375
             }
1289 1376
         }
@@ -1292,22 +1379,26 @@  discard block
 block discarded – undo
1292 1379
         if (!defined('DISABLE_JQUERY') && !$disablejs && !empty($conf->use_javascript_ajax)) {
1293 1380
             // JQuery. Must be before other includes
1294 1381
             print '<!-- Includes JS for JQuery -->' . "\n";
1295
-            if (defined('JS_JQUERY') && constant('JS_JQUERY'))
1296
-                print '<script type="text/javascript" src="' . JS_JQUERY . 'jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1297
-            else
1298
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1382
+            if (defined('JS_JQUERY') && constant('JS_JQUERY')) {
1383
+                            print '<script type="text/javascript" src="' . JS_JQUERY . 'jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1384
+            } else {
1385
+                            print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1386
+            }
1299 1387
             if (!empty($conf->global->MAIN_FEATURES_LEVEL) && !defined('JS_JQUERY_MIGRATE_DISABLED')) {
1300
-                if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE'))
1301
-                    print '<script type="text/javascript" src="' . JS_JQUERY_MIGRATE . 'jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1302
-                else
1303
-                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1304
-            }
1305
-            if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI'))
1306
-                print '<script type="text/javascript" src="' . JS_JQUERY_UI . 'jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1307
-            else
1308
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1309
-            if (!defined('DISABLE_JQUERY_TABLEDND'))
1310
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/tablednd/jquery.tablednd.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1388
+                if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE')) {
1389
+                                    print '<script type="text/javascript" src="' . JS_JQUERY_MIGRATE . 'jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1390
+                } else {
1391
+                                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1392
+                }
1393
+            }
1394
+            if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) {
1395
+                            print '<script type="text/javascript" src="' . JS_JQUERY_UI . 'jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1396
+            } else {
1397
+                            print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1398
+            }
1399
+            if (!defined('DISABLE_JQUERY_TABLEDND')) {
1400
+                            print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/tablednd/jquery.tablednd.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1401
+            }
1311 1402
             // jQuery jnotify
1312 1403
             if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) {
1313 1404
                 print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
@@ -1378,10 +1469,12 @@  discard block
 block discarded – undo
1378 1469
             // Browser notifications
1379 1470
             if (!defined('DISABLE_BROWSER_NOTIF')) {
1380 1471
                 $enablebrowsernotif = false;
1381
-                if (!empty($conf->agenda->enabled) && !empty($conf->global->AGENDA_REMINDER_BROWSER))
1382
-                    $enablebrowsernotif = true;
1383
-                if ($conf->browser->layout == 'phone')
1384
-                    $enablebrowsernotif = false;
1472
+                if (!empty($conf->agenda->enabled) && !empty($conf->global->AGENDA_REMINDER_BROWSER)) {
1473
+                                    $enablebrowsernotif = true;
1474
+                }
1475
+                if ($conf->browser->layout == 'phone') {
1476
+                                    $enablebrowsernotif = false;
1477
+                }
1385 1478
                 if ($enablebrowsernotif) {
1386 1479
                     print '<!-- Includes JS of Dolibarr (brwoser layout = ' . $conf->browser->layout . ')-->' . "\n";
1387 1480
                     //print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/lib_notification.js.php' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
@@ -1418,10 +1511,12 @@  discard block
 block discarded – undo
1418 1511
             }
1419 1512
         }
1420 1513
 
1421
-        if (!empty($head))
1422
-            print $head . "\n";
1423
-        if (!empty($conf->global->MAIN_HTML_HEADER))
1424
-            print $conf->global->MAIN_HTML_HEADER . "\n";
1514
+        if (!empty($head)) {
1515
+                    print $head . "\n";
1516
+        }
1517
+        if (!empty($conf->global->MAIN_HTML_HEADER)) {
1518
+                    print $conf->global->MAIN_HTML_HEADER . "\n";
1519
+        }
1425 1520
 
1426 1521
         print "<!-- Alixar debugBar header -->";
1427 1522
         print Debug::getRenderHeader(); // Includes Alixar debugBar header
@@ -1486,15 +1581,20 @@  discard block
 block discarded – undo
1486 1581
         if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1487 1582
             $appli = $conf->global->MAIN_APPLICATION_TITLE;
1488 1583
             if (preg_match('/\d\.\d/', $appli)) {
1489
-                if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
1490
-                    $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
1491
-            } else
1492
-                $appli .= " " . DOL_VERSION;
1493
-        } else
1494
-            $appli .= " " . DOL_VERSION;
1584
+                if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) {
1585
+                                    $appli .= " (" . DOL_VERSION . ")";
1586
+                }
1587
+                // If new title contains a version that is different than core
1588
+            } else {
1589
+                            $appli .= " " . DOL_VERSION;
1590
+            }
1591
+        } else {
1592
+                    $appli .= " " . DOL_VERSION;
1593
+        }
1495 1594
 
1496
-        if (!empty($conf->global->MAIN_FEATURES_LEVEL))
1497
-            $appli .= "<br>" . $langs->trans("LevelOfFeature") . ': ' . $conf->global->MAIN_FEATURES_LEVEL;
1595
+        if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
1596
+                    $appli .= "<br>" . $langs->trans("LevelOfFeature") . ': ' . $conf->global->MAIN_FEATURES_LEVEL;
1597
+        }
1498 1598
 
1499 1599
         $logouttext = '';
1500 1600
         if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
@@ -1532,12 +1632,15 @@  discard block
 block discarded – undo
1532 1632
         $parameters = array();
1533 1633
         $result = $hookmanager->executeHooks('printTopRightMenu', $parameters);    // Note that $action and $object may have been modified by some hooks
1534 1634
         if (is_numeric($result)) {
1535
-            if ($result == 0)
1536
-                $toprightmenu .= $hookmanager->resPrint;  // add
1537
-            else
1538
-                $toprightmenu = $hookmanager->resPrint;      // replace
1539
-        }
1540
-        else {
1635
+            if ($result == 0) {
1636
+                            $toprightmenu .= $hookmanager->resPrint;
1637
+            }
1638
+            // add
1639
+            else {
1640
+                            $toprightmenu = $hookmanager->resPrint;
1641
+            }
1642
+            // replace
1643
+        } else {
1541 1644
             $toprightmenu .= $result; // For backward compatibility
1542 1645
         }
1543 1646
 
@@ -1557,8 +1660,9 @@  discard block
 block discarded – undo
1557 1660
 
1558 1661
             if (is_array($_POST)) {
1559 1662
                 foreach ($_POST as $key => $value) {
1560
-                    if ($key !== 'action' && $key !== 'password' && !is_array($value))
1561
-                        $qs .= '&' . $key . '=' . urlencode($value);
1663
+                    if ($key !== 'action' && $key !== 'password' && !is_array($value)) {
1664
+                                            $qs .= '&' . $key . '=' . urlencode($value);
1665
+                    }
1562 1666
                 }
1563 1667
             }
1564 1668
             $qs .= (($qs && $morequerystring) ? '&' : '') . $morequerystring;
@@ -1577,8 +1681,9 @@  discard block
 block discarded – undo
1577 1681
             $helppage = '';
1578 1682
             $mode = '';
1579 1683
 
1580
-            if (empty($helppagename))
1581
-                $helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios';
1684
+            if (empty($helppagename)) {
1685
+                            $helppagename = 'EN:User_documentation|FR:Documentation_utilisateur|ES:Documentación_usuarios';
1686
+            }
1582 1687
 
1583 1688
             // Get helpbaseurl, helppage and mode from helppagename and langs
1584 1689
             $arrayres = getHelpParamFor($helppagename, $langs);
@@ -1595,13 +1700,15 @@  discard block
 block discarded – undo
1595 1700
                 }
1596 1701
                 $title = $appli . '<br>';
1597 1702
                 $title .= $langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage');
1598
-                if ($mode == 'wiki')
1599
-                    $title .= ' - ' . $langs->trans("PageWiki") . ' &quot;' . dol_escape_htmltag(strtr($helppage, '_', ' ')) . '&quot;';
1703
+                if ($mode == 'wiki') {
1704
+                                    $title .= ' - ' . $langs->trans("PageWiki") . ' &quot;' . dol_escape_htmltag(strtr($helppage, '_', ' ')) . '&quot;';
1705
+                }
1600 1706
                 $text .= '<a class="help" target="_blank" rel="noopener" href="';
1601
-                if ($mode == 'wiki')
1602
-                    $text .= sprintf($helpbaseurl, urlencode(html_entity_decode($helppage)));
1603
-                else
1604
-                    $text .= sprintf($helpbaseurl, $helppage);
1707
+                if ($mode == 'wiki') {
1708
+                                    $text .= sprintf($helpbaseurl, urlencode(html_entity_decode($helppage)));
1709
+                } else {
1710
+                                    $text .= sprintf($helpbaseurl, $helppage);
1711
+                }
1605 1712
                 $text .= '">';
1606 1713
                 //$text.=img_picto('', 'helpdoc_top').' ';
1607 1714
                 $text .= '<span class="fa fa-question-circle atoplogin"></span>';
@@ -1628,9 +1735,10 @@  discard block
 block discarded – undo
1628 1735
         print "<!-- End top horizontal menu -->\n\n";
1629 1736
     }
1630 1737
 
1631
-    if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile))
1632
-        print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">';
1633
-}
1738
+    if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) {
1739
+            print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">';
1740
+    }
1741
+    }
1634 1742
 
1635 1743
 /**
1636 1744
  *  Show left menu bar
@@ -1654,8 +1762,9 @@  discard block
 block discarded – undo
1654 1762
     $searchform = '';
1655 1763
     $bookmarks = '';
1656 1764
 
1657
-    if (!empty($menu_array_before))
1658
-        dol_syslog("Deprecated parameter menu_array_before was used when calling main::left_menu function. Menu entries of module should now be defined into module descriptor and not provided when calling left_menu.", LOG_WARNING);
1765
+    if (!empty($menu_array_before)) {
1766
+            dol_syslog("Deprecated parameter menu_array_before was used when calling main::left_menu function. Menu entries of module should now be defined into module descriptor and not provided when calling left_menu.", LOG_WARNING);
1767
+    }
1659 1768
 
1660 1769
     if (empty($conf->dol_hide_leftmenu) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) {
1661 1770
         // Instantiate hooks of thirdparty module
@@ -1663,8 +1772,10 @@  discard block
 block discarded – undo
1663 1772
 
1664 1773
         print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n";
1665 1774
 
1666
-        if ($conf->browser->layout == 'phone')
1667
-            $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
1775
+        if ($conf->browser->layout == 'phone') {
1776
+                    $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1;
1777
+        }
1778
+        // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
1668 1779
 
1669 1780
         print "\n";
1670 1781
 
@@ -1691,8 +1802,9 @@  discard block
 block discarded – undo
1691 1802
         $reshook = $hookmanager->executeHooks('printSearchForm', $parameters);    // Note that $action and $object may have been modified by some hooks
1692 1803
         if (empty($reshook)) {
1693 1804
             $searchform .= $hookmanager->resPrint;
1694
-        } else
1695
-            $searchform = $hookmanager->resPrint;
1805
+        } else {
1806
+                    $searchform = $hookmanager->resPrint;
1807
+        }
1696 1808
 
1697 1809
         // Force special value for $searchform
1698 1810
         if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax)) {
@@ -1736,38 +1848,49 @@  discard block
 block discarded – undo
1736 1848
         if (empty($conf->global->MAIN_HIDE_VERSION)) {    // Version is already on help picto and on login page.
1737 1849
             $doliurl = 'https://www.dolibarr.org';
1738 1850
             //local communities
1739
-            if (preg_match('/fr/i', $langs->defaultlang))
1740
-                $doliurl = 'https://www.dolibarr.fr';
1741
-            if (preg_match('/es/i', $langs->defaultlang))
1742
-                $doliurl = 'https://www.dolibarr.es';
1743
-            if (preg_match('/de/i', $langs->defaultlang))
1744
-                $doliurl = 'https://www.dolibarr.de';
1745
-            if (preg_match('/it/i', $langs->defaultlang))
1746
-                $doliurl = 'https://www.dolibarr.it';
1747
-            if (preg_match('/gr/i', $langs->defaultlang))
1748
-                $doliurl = 'https://www.dolibarr.gr';
1851
+            if (preg_match('/fr/i', $langs->defaultlang)) {
1852
+                            $doliurl = 'https://www.dolibarr.fr';
1853
+            }
1854
+            if (preg_match('/es/i', $langs->defaultlang)) {
1855
+                            $doliurl = 'https://www.dolibarr.es';
1856
+            }
1857
+            if (preg_match('/de/i', $langs->defaultlang)) {
1858
+                            $doliurl = 'https://www.dolibarr.de';
1859
+            }
1860
+            if (preg_match('/it/i', $langs->defaultlang)) {
1861
+                            $doliurl = 'https://www.dolibarr.it';
1862
+            }
1863
+            if (preg_match('/gr/i', $langs->defaultlang)) {
1864
+                            $doliurl = 'https://www.dolibarr.gr';
1865
+            }
1749 1866
 
1750 1867
             $appli = constant('DOL_APPLICATION_TITLE');
1751 1868
             if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1752 1869
                 $appli = $conf->global->MAIN_APPLICATION_TITLE;
1753 1870
                 $doliurl = '';
1754 1871
                 if (preg_match('/\d\.\d/', $appli)) {
1755
-                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
1756
-                        $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
1757
-                } else
1758
-                    $appli .= " " . DOL_VERSION;
1759
-            } else
1760
-                $appli .= " " . DOL_VERSION;
1872
+                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) {
1873
+                                            $appli .= " (" . DOL_VERSION . ")";
1874
+                    }
1875
+                    // If new title contains a version that is different than core
1876
+                } else {
1877
+                                    $appli .= " " . DOL_VERSION;
1878
+                }
1879
+            } else {
1880
+                            $appli .= " " . DOL_VERSION;
1881
+            }
1761 1882
             print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
1762
-            if ($doliurl)
1763
-                print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">';
1764
-            else
1765
-                print '<span class="help">';
1883
+            if ($doliurl) {
1884
+                            print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">';
1885
+            } else {
1886
+                            print '<span class="help">';
1887
+            }
1766 1888
             print $appli;
1767
-            if ($doliurl)
1768
-                print '</a>';
1769
-            else
1770
-                print '</span>';
1889
+            if ($doliurl) {
1890
+                            print '</a>';
1891
+            } else {
1892
+                            print '</span>';
1893
+            }
1771 1894
             print '</div>' . "\n";
1772 1895
         }
1773 1896
 
@@ -1814,9 +1937,10 @@  discard block
 block discarded – undo
1814 1937
     print "\n";
1815 1938
     print '<!-- Begin right area -->' . "\n";
1816 1939
 
1817
-    if (empty($leftmenuwithoutmainarea))
1818
-        main_area($title);
1819
-}
1940
+    if (empty($leftmenuwithoutmainarea)) {
1941
+            main_area($title);
1942
+    }
1943
+    }
1820 1944
 
1821 1945
 /**
1822 1946
  *  Begin main area
@@ -1828,16 +1952,18 @@  discard block
 block discarded – undo
1828 1952
 {
1829 1953
     global $conf, $langs;
1830 1954
 
1831
-    if (empty($conf->dol_hide_leftmenu))
1832
-        print '<div id="id-right">';
1955
+    if (empty($conf->dol_hide_leftmenu)) {
1956
+            print '<div id="id-right">';
1957
+    }
1833 1958
 
1834 1959
     print "\n";
1835 1960
 
1836 1961
     print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n";
1837 1962
 
1838
-    if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
1839
-        print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED));
1840
-}
1963
+    if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
1964
+            print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED));
1965
+    }
1966
+    }
1841 1967
 
1842 1968
 /**
1843 1969
  *  Return helpbaseurl, helppage and mode
@@ -1861,18 +1987,21 @@  discard block
 block discarded – undo
1861 1987
         // If WIKI URL
1862 1988
         if (preg_match('/^es/i', $langs->defaultlang)) {
1863 1989
             $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
1864
-            if (preg_match('/ES:([^|]+)/i', $helppagename, $reg))
1865
-                $helppage = $reg[1];
1990
+            if (preg_match('/ES:([^|]+)/i', $helppagename, $reg)) {
1991
+                            $helppage = $reg[1];
1992
+            }
1866 1993
         }
1867 1994
         if (preg_match('/^fr/i', $langs->defaultlang)) {
1868 1995
             $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
1869
-            if (preg_match('/FR:([^|]+)/i', $helppagename, $reg))
1870
-                $helppage = $reg[1];
1996
+            if (preg_match('/FR:([^|]+)/i', $helppagename, $reg)) {
1997
+                            $helppage = $reg[1];
1998
+            }
1871 1999
         }
1872 2000
         if (empty($helppage)) { // If help page not already found
1873 2001
             $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
1874
-            if (preg_match('/EN:([^|]+)/i', $helppagename, $reg))
1875
-                $helppage = $reg[1];
2002
+            if (preg_match('/EN:([^|]+)/i', $helppagename, $reg)) {
2003
+                            $helppage = $reg[1];
2004
+            }
1876 2005
         }
1877 2006
         $mode = 'wiki';
1878 2007
     }
@@ -1903,8 +2032,9 @@  discard block
 block discarded – undo
1903 2032
     $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
1904 2033
     $ret .= '<input type="hidden" name="mode" value="search">';
1905 2034
     $ret .= '<input type="hidden" name="savelogin" value="' . dol_escape_htmltag($user->login) . '">';
1906
-    if ($showtitlebefore)
1907
-        $ret .= $title . ' ';
2035
+    if ($showtitlebefore) {
2036
+            $ret .= $title . ' ';
2037
+    }
1908 2038
     $ret .= '<input type="text" class="flat ' . $htmlmorecss . '"';
1909 2039
     $ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"';
1910 2040
     $ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : '');
@@ -1947,10 +2077,12 @@  discard block
 block discarded – undo
1947 2077
             foreach ($user->lastsearch_values_tmp as $key => $val) {
1948 2078
                 unset($_SESSION['lastsearch_values_tmp_' . $key]);   // Clean array to rebuild it just after
1949 2079
                 if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button
1950
-                    if (empty($val['sortfield']))
1951
-                        unset($val['sortfield']);
1952
-                    if (empty($val['sortorder']))
1953
-                        unset($val['sortorder']);
2080
+                    if (empty($val['sortfield'])) {
2081
+                                            unset($val['sortfield']);
2082
+                    }
2083
+                    if (empty($val['sortorder'])) {
2084
+                                            unset($val['sortorder']);
2085
+                    }
1954 2086
                     dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)");
1955 2087
                     $_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val);
1956 2088
                     unset($_SESSION['lastsearch_values_' . $key]);
@@ -1961,8 +2093,9 @@  discard block
 block discarded – undo
1961 2093
 
1962 2094
         $relativepathstring = $_SERVER["PHP_SELF"];
1963 2095
         // Clean $relativepathstring
1964
-        if (constant('DOL_BASE_URI'))
1965
-            $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
2096
+        if (constant('DOL_BASE_URI')) {
2097
+                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
2098
+        }
1966 2099
         $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
1967 2100
         $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
1968 2101
         if (preg_match('/list\.php$/', $relativepathstring)) {
@@ -1970,12 +2103,15 @@  discard block
 block discarded – undo
1970 2103
             unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]);
1971 2104
             unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]);
1972 2105
 
1973
-            if (!empty($contextpage))
1974
-                $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
1975
-            if (!empty($page) && $page > 1)
1976
-                $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
1977
-            if (!empty($limit) && $limit != $conf->limit)
1978
-                $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
2106
+            if (!empty($contextpage)) {
2107
+                            $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
2108
+            }
2109
+            if (!empty($page) && $page > 1) {
2110
+                            $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
2111
+            }
2112
+            if (!empty($limit) && $limit != $conf->limit) {
2113
+                            $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
2114
+            }
1979 2115
 
1980 2116
             unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]);
1981 2117
             unset($_SESSION['lastsearch_page_' . $relativepathstring]);
@@ -2002,20 +2138,26 @@  discard block
 block discarded – undo
2002 2138
 
2003 2139
         print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche
2004 2140
 
2005
-        if (empty($conf->dol_hide_leftmenu))
2006
-            print '</div> <!-- End div id-right -->' . "\n"; // End div id-right
2141
+        if (empty($conf->dol_hide_leftmenu)) {
2142
+                    print '</div> <!-- End div id-right -->' . "\n";
2143
+        }
2144
+        // End div id-right
2007 2145
 
2008
-        if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile))
2009
-            print '</div> <!-- End div id-container -->' . "\n"; // End div container
2146
+        if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) {
2147
+                    print '</div> <!-- End div id-container -->' . "\n";
2148
+        }
2149
+        // End div container
2010 2150
 
2011 2151
         print "\n";
2012
-        if ($comment)
2013
-            print '<!-- ' . $comment . ' -->' . "\n";
2152
+        if ($comment) {
2153
+                    print '<!-- ' . $comment . ' -->' . "\n";
2154
+        }
2014 2155
 
2015 2156
         printCommonFooter($zone);
2016 2157
 
2017
-        if (!empty($delayedhtmlcontent))
2018
-            print $delayedhtmlcontent;
2158
+        if (!empty($delayedhtmlcontent)) {
2159
+                    print $delayedhtmlcontent;
2160
+        }
2019 2161
 
2020 2162
         if (!empty($conf->use_javascript_ajax)) {
2021 2163
             print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n";
Please login to merge, or discard this patch.
Helpers/AlixarDispatcher.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
     {
15 15
         parent::__construct();
16 16
 
17
-        $this->searchDir[] = BASE_PATH . '/plugins';
17
+        $this->searchDir[] = BASE_PATH.'/plugins';
18 18
         $path = null;
19 19
     }
20 20
 
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
           define('SITE_URL', APP_PROTOCOL . '://' . SERVER_NAME);
40 40
           define('BASE_URI', SITE_URL . APP_URI);
41 41
          */
42
-        define('DOL_BASE_PATH', BASE_PATH . '/dolibarr/htdocs');
43
-        define('DOL_BASE_URI', BASE_URI . '/dolibarr/htdocs');
42
+        define('DOL_BASE_PATH', BASE_PATH.'/dolibarr/htdocs');
43
+        define('DOL_BASE_URI', BASE_URI.'/dolibarr/htdocs');
44 44
 //define('DOL_DOCUMENT_ROOT', DOL_BASE_PATH);
45 45
 
46 46
         define('CORE_FOLDER', '/core');
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
         define('CACHE_FOLDER', '/../cache');
55 55
         //define('VENDOR_FOLDER', BASE_URI . '/vendor');
56 56
 
57
-        define('CORE_PATH', BASE_PATH . CORE_FOLDER);
58
-        define('CONFIG_PATH', BASE_PATH . CONFIG_FOLDER);
59
-        define('CONTROLLERS_PATH', BASE_PATH . CONTROLLERS_FOLDER);
60
-        define('HELPERS_PATH', BASE_PATH . HELPERS_FOLDER);
61
-        define('MODELS_PATH', BASE_PATH . MODELS_FOLDER);
62
-        define('SKINS_PATH', BASE_PATH . SKINS_FOLDER);
63
-        define('TEMPLATES_PATH', BASE_PATH . TEMPLATES_FOLDER);
64
-        define('PLUGINS_PATH', BASE_PATH . PLUGINS_FOLDER);
65
-        define('CACHE_PATH', BASE_PATH . CACHE_FOLDER);
57
+        define('CORE_PATH', BASE_PATH.CORE_FOLDER);
58
+        define('CONFIG_PATH', BASE_PATH.CONFIG_FOLDER);
59
+        define('CONTROLLERS_PATH', BASE_PATH.CONTROLLERS_FOLDER);
60
+        define('HELPERS_PATH', BASE_PATH.HELPERS_FOLDER);
61
+        define('MODELS_PATH', BASE_PATH.MODELS_FOLDER);
62
+        define('SKINS_PATH', BASE_PATH.SKINS_FOLDER);
63
+        define('TEMPLATES_PATH', BASE_PATH.TEMPLATES_FOLDER);
64
+        define('PLUGINS_PATH', BASE_PATH.PLUGINS_FOLDER);
65
+        define('CACHE_PATH', BASE_PATH.CACHE_FOLDER);
66 66
         //define('VENDOR_PATH', BASE_PATH . VENDOR_FOLDER);
67 67
     }
68 68
 
Please login to merge, or discard this patch.