Passed
Push — master ( 043752...2a5ce0 )
by Alxarafe
27:58
created
dolibarr/htdocs/admin/menus/index.php 2 patches
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
  *  \ingroup    core
25 25
  *  \brief      Index page for menu editor
26 26
  */
27
-require DOL_BASE_PATH . '/main.inc.php';
28
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formadmin.class.php';
29
-require_once DOL_DOCUMENT_ROOT . '/core/lib/treeview.lib.php';
27
+require DOL_BASE_PATH.'/main.inc.php';
28
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
29
+require_once DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php';
30 30
 
31 31
 // Load translation files required by the page
32 32
 $langs->loadLangs(array("other", "admin"));
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 $dirsmartphone = array();
40 40
 $dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
41 41
 foreach ($dirmenus as $dirmenu) {
42
-    $dirstandard[] = $dirmenu . 'standard';
43
-    $dirsmartphone[] = $dirmenu . 'smartphone';
42
+    $dirstandard[] = $dirmenu.'standard';
43
+    $dirsmartphone[] = $dirmenu.'smartphone';
44 44
 }
45 45
 
46 46
 $action = GETPOST('action', 'alpha');
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 
75 75
     // Get current position
76 76
     $sql = "SELECT m.rowid, m.position, m.type, m.fk_menu";
77
-    $sql .= " FROM " . MAIN_DB_PREFIX . "menu as m";
78
-    $sql .= " WHERE m.rowid = " . GETPOST("menuId", "int");
79
-    dol_syslog("admin/menus/index.php " . $sql);
77
+    $sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
78
+    $sql .= " WHERE m.rowid = ".GETPOST("menuId", "int");
79
+    dol_syslog("admin/menus/index.php ".$sql);
80 80
     $result = $db->query($sql);
81 81
     $num = $db->num_rows($result);
82 82
     $i = 0;
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 
92 92
     // Menu before
93 93
     $sql = "SELECT m.rowid, m.position";
94
-    $sql .= " FROM " . MAIN_DB_PREFIX . "menu as m";
95
-    $sql .= " WHERE (m.position < " . ($current['order']) . " OR (m.position = " . ($current['order']) . " AND rowid < " . GETPOST("menuId", "int") . "))";
96
-    $sql .= " AND m.menu_handler='" . $db->escape($menu_handler_to_search) . "'";
97
-    $sql .= " AND m.entity = " . $conf->entity;
98
-    $sql .= " AND m.type = '" . $db->escape($current['type']) . "'";
99
-    $sql .= " AND m.fk_menu = '" . $db->escape($current['fk_menu']) . "'";
94
+    $sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
95
+    $sql .= " WHERE (m.position < ".($current['order'])." OR (m.position = ".($current['order'])." AND rowid < ".GETPOST("menuId", "int")."))";
96
+    $sql .= " AND m.menu_handler='".$db->escape($menu_handler_to_search)."'";
97
+    $sql .= " AND m.entity = ".$conf->entity;
98
+    $sql .= " AND m.type = '".$db->escape($current['type'])."'";
99
+    $sql .= " AND m.fk_menu = '".$db->escape($current['fk_menu'])."'";
100 100
     $sql .= " ORDER BY m.position, m.rowid";
101
-    dol_syslog("admin/menus/index.php " . $sql);
101
+    dol_syslog("admin/menus/index.php ".$sql);
102 102
     $result = $db->query($sql);
103 103
     $num = $db->num_rows($result);
104 104
     $i = 0;
@@ -109,15 +109,15 @@  discard block
 block discarded – undo
109 109
         $i++;
110 110
     }
111 111
 
112
-    $sql = "UPDATE " . MAIN_DB_PREFIX . "menu as m";
113
-    $sql .= " SET m.position = " . $previous['order'];
114
-    $sql .= " WHERE m.rowid = " . $current['rowid']; // Up the selected entry
115
-    dol_syslog("admin/menus/index.php " . $sql);
112
+    $sql = "UPDATE ".MAIN_DB_PREFIX."menu as m";
113
+    $sql .= " SET m.position = ".$previous['order'];
114
+    $sql .= " WHERE m.rowid = ".$current['rowid']; // Up the selected entry
115
+    dol_syslog("admin/menus/index.php ".$sql);
116 116
     $db->query($sql);
117
-    $sql = "UPDATE " . MAIN_DB_PREFIX . "menu as m";
118
-    $sql .= " SET m.position = " . ($current['order'] != $previous['order'] ? $current['order'] : $current['order'] + 1);
119
-    $sql .= " WHERE m.rowid = " . $previous['rowid']; // Descend celui du dessus
120
-    dol_syslog("admin/menus/index.php " . $sql);
117
+    $sql = "UPDATE ".MAIN_DB_PREFIX."menu as m";
118
+    $sql .= " SET m.position = ".($current['order'] != $previous['order'] ? $current['order'] : $current['order'] + 1);
119
+    $sql .= " WHERE m.rowid = ".$previous['rowid']; // Descend celui du dessus
120
+    dol_syslog("admin/menus/index.php ".$sql);
121 121
     $db->query($sql);
122 122
 } elseif ($action == 'down') {
123 123
     $current = array();
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 
126 126
     // Get current position
127 127
     $sql = "SELECT m.rowid, m.position, m.type, m.fk_menu";
128
-    $sql .= " FROM " . MAIN_DB_PREFIX . "menu as m";
129
-    $sql .= " WHERE m.rowid = " . GETPOST("menuId", "int");
130
-    dol_syslog("admin/menus/index.php " . $sql);
128
+    $sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
129
+    $sql .= " WHERE m.rowid = ".GETPOST("menuId", "int");
130
+    dol_syslog("admin/menus/index.php ".$sql);
131 131
     $result = $db->query($sql);
132 132
     $num = $db->num_rows($result);
133 133
     $i = 0;
@@ -142,14 +142,14 @@  discard block
 block discarded – undo
142 142
 
143 143
     // Menu after
144 144
     $sql = "SELECT m.rowid, m.position";
145
-    $sql .= " FROM " . MAIN_DB_PREFIX . "menu as m";
146
-    $sql .= " WHERE (m.position > " . ($current['order']) . " OR (m.position = " . ($current['order']) . " AND rowid > " . GETPOST("menuId", "int") . "))";
147
-    $sql .= " AND m.menu_handler='" . $db->escape($menu_handler_to_search) . "'";
148
-    $sql .= " AND m.entity = " . $conf->entity;
149
-    $sql .= " AND m.type = '" . $db->escape($current['type']) . "'";
150
-    $sql .= " AND m.fk_menu = '" . $db->escape($current['fk_menu']) . "'";
145
+    $sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
146
+    $sql .= " WHERE (m.position > ".($current['order'])." OR (m.position = ".($current['order'])." AND rowid > ".GETPOST("menuId", "int")."))";
147
+    $sql .= " AND m.menu_handler='".$db->escape($menu_handler_to_search)."'";
148
+    $sql .= " AND m.entity = ".$conf->entity;
149
+    $sql .= " AND m.type = '".$db->escape($current['type'])."'";
150
+    $sql .= " AND m.fk_menu = '".$db->escape($current['fk_menu'])."'";
151 151
     $sql .= " ORDER BY m.position, m.rowid";
152
-    dol_syslog("admin/menus/index.php " . $sql);
152
+    dol_syslog("admin/menus/index.php ".$sql);
153 153
     $result = $db->query($sql);
154 154
     $num = $db->num_rows($result);
155 155
     $i = 0;
@@ -160,28 +160,28 @@  discard block
 block discarded – undo
160 160
         $i++;
161 161
     }
162 162
 
163
-    $sql = "UPDATE " . MAIN_DB_PREFIX . "menu as m";
164
-    $sql .= " SET m.position = " . ($current['order'] != $next['order'] ? $next['order'] : $current['order'] + 1); // Down the selected entry
165
-    $sql .= " WHERE m.rowid = " . $current['rowid'];
166
-    dol_syslog("admin/menus/index.php " . $sql);
163
+    $sql = "UPDATE ".MAIN_DB_PREFIX."menu as m";
164
+    $sql .= " SET m.position = ".($current['order'] != $next['order'] ? $next['order'] : $current['order'] + 1); // Down the selected entry
165
+    $sql .= " WHERE m.rowid = ".$current['rowid'];
166
+    dol_syslog("admin/menus/index.php ".$sql);
167 167
     $db->query($sql);
168
-    $sql = "UPDATE " . MAIN_DB_PREFIX . "menu as m"; // Up the next entry
169
-    $sql .= " SET m.position = " . $current['order'];
170
-    $sql .= " WHERE m.rowid = " . $next['rowid'];
171
-    dol_syslog("admin/menus/index.php " . $sql);
168
+    $sql = "UPDATE ".MAIN_DB_PREFIX."menu as m"; // Up the next entry
169
+    $sql .= " SET m.position = ".$current['order'];
170
+    $sql .= " WHERE m.rowid = ".$next['rowid'];
171
+    dol_syslog("admin/menus/index.php ".$sql);
172 172
     $db->query($sql);
173 173
 } elseif ($action == 'confirm_delete' && $confirm == 'yes') {
174 174
     $db->begin();
175 175
 
176
-    $sql = "DELETE FROM " . MAIN_DB_PREFIX . "menu";
177
-    $sql .= " WHERE rowid = " . GETPOST('menuId', 'int');
176
+    $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";
177
+    $sql .= " WHERE rowid = ".GETPOST('menuId', 'int');
178 178
     $resql = $db->query($sql);
179 179
     if ($resql) {
180 180
         $db->commit();
181 181
 
182 182
         setEventMessages($langs->trans("MenuDeleted"), null, 'mesgs');
183 183
 
184
-        header("Location: " . DOL_URL_ROOT . '/admin/menus/index.php?menu_handler=' . $menu_handler);
184
+        header("Location: ".DOL_URL_ROOT.'/admin/menus/index.php?menu_handler='.$menu_handler);
185 185
         exit;
186 186
     } else {
187 187
         $db->rollback();
@@ -210,44 +210,44 @@  discard block
 block discarded – undo
210 210
 
211 211
 $h = 0;
212 212
 
213
-$head[$h][0] = DOL_URL_ROOT . "/admin/menus.php";
213
+$head[$h][0] = DOL_URL_ROOT."/admin/menus.php";
214 214
 $head[$h][1] = $langs->trans("MenuHandlers");
215 215
 $head[$h][2] = 'handler';
216 216
 $h++;
217 217
 
218
-$head[$h][0] = DOL_URL_ROOT . "/admin/menus/index.php";
218
+$head[$h][0] = DOL_URL_ROOT."/admin/menus/index.php";
219 219
 $head[$h][1] = $langs->trans("MenuAdmin");
220 220
 $head[$h][2] = 'editor';
221 221
 $h++;
222 222
 
223
-$head[$h][0] = DOL_URL_ROOT . "/admin/menus/other.php";
223
+$head[$h][0] = DOL_URL_ROOT."/admin/menus/other.php";
224 224
 $head[$h][1] = $langs->trans("Miscellaneous");
225 225
 $head[$h][2] = 'misc';
226 226
 $h++;
227 227
 
228 228
 dol_fiche_head($head, 'editor', $langs->trans("Menus"), -1);
229 229
 
230
-print $langs->trans("MenusEditorDesc") . "<br>\n";
230
+print $langs->trans("MenusEditorDesc")."<br>\n";
231 231
 print "<br>\n";
232 232
 
233 233
 
234 234
 // Confirmation for remove menu entry
235 235
 if ($action == 'delete') {
236 236
     $sql = "SELECT m.titre";
237
-    $sql .= " FROM " . MAIN_DB_PREFIX . "menu as m";
238
-    $sql .= " WHERE m.rowid = " . GETPOST('menuId', 'int');
237
+    $sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
238
+    $sql .= " WHERE m.rowid = ".GETPOST('menuId', 'int');
239 239
     $result = $db->query($sql);
240 240
     $obj = $db->fetch_object($result);
241 241
 
242
-    print $form->formconfirm("index.php?menu_handler=" . $menu_handler . "&menuId=" . GETPOST('menuId', 'int'), $langs->trans("DeleteMenu"), $langs->trans("ConfirmDeleteMenu", $obj->titre), "confirm_delete");
242
+    print $form->formconfirm("index.php?menu_handler=".$menu_handler."&menuId=".GETPOST('menuId', 'int'), $langs->trans("DeleteMenu"), $langs->trans("ConfirmDeleteMenu", $obj->titre), "confirm_delete");
243 243
 }
244 244
 
245 245
 
246
-print '<form name="newmenu" class="nocellnopadd" action="' . $_SERVER["PHP_SELF"] . '">';
246
+print '<form name="newmenu" class="nocellnopadd" action="'.$_SERVER["PHP_SELF"].'">';
247 247
 print '<input type="hidden" action="change_menu_handler">';
248
-print $langs->trans("MenuHandler") . ': ';
249
-print $formadmin->select_menu_families($menu_handler . (preg_match('/_menu/', $menu_handler) ? '' : '_menu'), 'menu_handler', array_merge($dirstandard, $dirsmartphone));
250
-print ' &nbsp; <input type="submit" class="button" value="' . $langs->trans("Refresh") . '">';
248
+print $langs->trans("MenuHandler").': ';
249
+print $formadmin->select_menu_families($menu_handler.(preg_match('/_menu/', $menu_handler) ? '' : '_menu'), 'menu_handler', array_merge($dirstandard, $dirsmartphone));
250
+print ' &nbsp; <input type="submit" class="button" value="'.$langs->trans("Refresh").'">';
251 251
 print '</form>';
252 252
 
253 253
 print '<br>';
@@ -255,9 +255,9 @@  discard block
 block discarded – undo
255 255
 print '<table class="noborder centpercent">';
256 256
 
257 257
 print '<tr class="liste_titre">';
258
-print '<td>' . $langs->trans("TreeMenuPersonalized") . '</td>';
259
-print '<td align="right"><div id="iddivjstreecontrol"><a href="#">' . img_picto('', 'object_category') . ' ' . $langs->trans("UndoExpandAll") . '</a>';
260
-print ' | <a href="#">' . img_picto('', 'object_category-expanded') . ' ' . $langs->trans("ExpandAll") . '</a></div></td>';
258
+print '<td>'.$langs->trans("TreeMenuPersonalized").'</td>';
259
+print '<td align="right"><div id="iddivjstreecontrol"><a href="#">'.img_picto('', 'object_category').' '.$langs->trans("UndoExpandAll").'</a>';
260
+print ' | <a href="#">'.img_picto('', 'object_category-expanded').' '.$langs->trans("ExpandAll").'</a></div></td>';
261 261
 print '</tr>';
262 262
 
263 263
 print '<tr>';
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
     //puis tous les elements enfants
287 287
 
288 288
     $sql = "SELECT m.rowid, m.titre, m.langs, m.mainmenu, m.leftmenu, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.position, m.module";
289
-    $sql .= " FROM " . MAIN_DB_PREFIX . "menu as m";
290
-    $sql .= " WHERE menu_handler = '" . $db->escape($menu_handler_to_search) . "'";
291
-    $sql .= " AND entity = " . $conf->entity;
289
+    $sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
290
+    $sql .= " WHERE menu_handler = '".$db->escape($menu_handler_to_search)."'";
291
+    $sql .= " AND entity = ".$conf->entity;
292 292
     //$sql.= " AND fk_menu >= 0";
293
-    $sql .= " ORDER BY m.position, m.rowid";  // Order is position then rowid (because we need a sort criteria when position is same)
293
+    $sql .= " ORDER BY m.position, m.rowid"; // Order is position then rowid (because we need a sort criteria when position is same)
294 294
 
295 295
     $res = $db->query($sql);
296 296
     if ($res) {
@@ -312,30 +312,30 @@  discard block
 block discarded – undo
312 312
                 'fk_mainmenu' => $menu['fk_mainmenu'],
313 313
                 'fk_leftmenu' => $menu['fk_leftmenu'],
314 314
                 'position' => $menu['position'],
315
-                'entry' => '<table class="nobordernopadding centpercent"><tr><td>' .
316
-                '<strong> &nbsp; <a href="edit.php?menu_handler=' . $menu_handler_to_search . '&action=edit&menuId=' . $menu['rowid'] . '">' . $titre . '</a></strong>' .
317
-                '</td><td align="right">' .
318
-                '<a href="edit.php?menu_handler=' . $menu_handler_to_search . '&action=edit&menuId=' . $menu['rowid'] . '">' . img_edit('default', 0, 'class="menuEdit" id="edit' . $menu['rowid'] . '"') . '</a> ' .
319
-                '<a href="edit.php?menu_handler=' . $menu_handler_to_search . '&action=create&menuId=' . $menu['rowid'] . '">' . img_edit_add('default') . '</a> ' .
320
-                '<a href="index.php?menu_handler=' . $menu_handler_to_search . '&action=delete&menuId=' . $menu['rowid'] . '">' . img_delete('default') . '</a> ' .
321
-                '&nbsp; &nbsp; &nbsp;' .
322
-                '<a href="index.php?menu_handler=' . $menu_handler_to_search . '&action=up&menuId=' . $menu['rowid'] . '">' . img_picto("Up", "1uparrow") . '</a><a href="index.php?menu_handler=' . $menu_handler_to_search . '&action=down&menuId=' . $menu['rowid'] . '">' . img_picto("Down", "1downarrow") . '</a>' .
315
+                'entry' => '<table class="nobordernopadding centpercent"><tr><td>'.
316
+                '<strong> &nbsp; <a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.$titre.'</a></strong>'.
317
+                '</td><td align="right">'.
318
+                '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> '.
319
+                '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> '.
320
+                '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> '.
321
+                '&nbsp; &nbsp; &nbsp;'.
322
+                '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>'.
323 323
                 '</td></tr></table>',
324
-                'buttons' => '<a href="edit.php?menu_handler=' . $menu_handler_to_search . '&action=edit&menuId=' . $menu['rowid'] . '">' . img_edit('default', 0, 'class="menuEdit" id="edit' . $menu['rowid'] . '"') . '</a> ' .
325
-                '<a href="edit.php?menu_handler=' . $menu_handler_to_search . '&action=create&menuId=' . $menu['rowid'] . '">' . img_edit_add('default') . '</a> ' .
326
-                '<a href="index.php?menu_handler=' . $menu_handler_to_search . '&action=delete&menuId=' . $menu['rowid'] . '">' . img_delete('default') . '</a> ' .
327
-                '&nbsp; &nbsp; &nbsp;' .
328
-                '<a href="index.php?menu_handler=' . $menu_handler_to_search . '&action=up&menuId=' . $menu['rowid'] . '">' . img_picto("Up", "1uparrow") . '</a><a href="index.php?menu_handler=' . $menu_handler_to_search . '&action=down&menuId=' . $menu['rowid'] . '">' . img_picto("Down", "1downarrow") . '</a>'
324
+                'buttons' => '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=edit&menuId='.$menu['rowid'].'">'.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').'</a> '.
325
+                '<a href="edit.php?menu_handler='.$menu_handler_to_search.'&action=create&menuId='.$menu['rowid'].'">'.img_edit_add('default').'</a> '.
326
+                '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=delete&menuId='.$menu['rowid'].'">'.img_delete('default').'</a> '.
327
+                '&nbsp; &nbsp; &nbsp;'.
328
+                '<a href="index.php?menu_handler='.$menu_handler_to_search.'&action=up&menuId='.$menu['rowid'].'">'.img_picto("Up", "1uparrow").'</a><a href="index.php?menu_handler='.$menu_handler_to_search.'&action=down&menuId='.$menu['rowid'].'">'.img_picto("Down", "1downarrow").'</a>'
329 329
             );
330 330
             $i++;
331 331
         }
332 332
     }
333 333
 
334
-    global $tree_recur_alreadyadded;       // This var was def into tree_recur
334
+    global $tree_recur_alreadyadded; // This var was def into tree_recur
335 335
     //var_dump($data);
336 336
     // Appelle de la fonction recursive (ammorce) avec recherche depuis la racine.
337 337
     //tree_recur($data, $data[0], 0, 'iddivjstree', 0, 1);  // use this to get info on name and foreign keys of menu entry
338
-    tree_recur($data, $data[0], 0, 'iddivjstree', 0, 0);  // $data[0] is virtual record 'racine'
338
+    tree_recur($data, $data[0], 0, 'iddivjstree', 0, 0); // $data[0] is virtual record 'racine'
339 339
 
340 340
 
341 341
     print '</td>';
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
         print '<table class="noborder centpercent">';
358 358
 
359 359
         print '<tr class="liste_titre">';
360
-        print '<td>' . $langs->trans("NotTopTreeMenuPersonalized") . '</td>';
360
+        print '<td>'.$langs->trans("NotTopTreeMenuPersonalized").'</td>';
361 361
         print '<td align="right"></td>';
362 362
         print '</tr>';
363 363
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
         foreach ($remainingdata as $datar) {
367 367
             $father = array('rowid' => $datar['rowid'], 'title' => "???", 'mainmenu' => $datar['fk_mainmenu'], 'leftmenu' => $datar['fk_leftmenu'], 'fk_mainmenu' => '', 'fk_leftmenu' => '');
368 368
             //print 'Start with rowid='.$datar['rowid'].' mainmenu='.$father ['mainmenu'].' leftmenu='.$father ['leftmenu'].'<br>'."\n";
369
-            tree_recur($data, $father, 0, 'iddivjstree' . $datar['rowid'], 1, 1);
369
+            tree_recur($data, $father, 0, 'iddivjstree'.$datar['rowid'], 1, 1);
370 370
         }
371 371
 
372 372
         print '</td>';
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      * Boutons actions
384 384
      */
385 385
     print '<div class="tabsAction">';
386
-    print '<a class="butAction" href="' . DOL_URL_ROOT . '/admin/menus/edit.php?menuId=0&amp;action=create&amp;menu_handler=' . urlencode($menu_handler) . '">' . $langs->trans("NewMenu") . '</a>';
386
+    print '<a class="butAction" href="'.DOL_URL_ROOT.'/admin/menus/edit.php?menuId=0&amp;action=create&amp;menu_handler='.urlencode($menu_handler).'">'.$langs->trans("NewMenu").'</a>';
387 387
     print '</div>';
388 388
 } else {
389 389
     $langs->load("errors");
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -298,8 +298,9 @@  discard block
 block discarded – undo
298 298
 
299 299
         $i = 1;
300 300
         while ($menu = $db->fetch_array($res)) {
301
-            if (!empty($menu['langs']))
302
-                $langs->load($menu['langs']);
301
+            if (!empty($menu['langs'])) {
302
+                            $langs->load($menu['langs']);
303
+            }
303 304
             $titre = $langs->trans($menu['titre']);
304 305
 
305 306
             $data[] = array(
@@ -348,8 +349,9 @@  discard block
 block discarded – undo
348 349
     // Process remaining records (records that are not linked to root by any path)
349 350
     $remainingdata = array();
350 351
     foreach ($data as $datar) {
351
-        if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']])
352
-            continue;
352
+        if (empty($datar['rowid']) || $tree_recur_alreadyadded[$datar['rowid']]) {
353
+                    continue;
354
+        }
353 355
         $remainingdata[] = $datar;
354 356
     }
355 357
 
Please login to merge, or discard this patch.
dolibarr/htdocs/core/menus/standard/eldy_menu.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
      * @var DoliDB Database handler.
34 34
      */
35 35
     public $db;
36
-    var $type_user;         // Put 0 for internal users, 1 for external users
37
-    var $atarget = "";                                // To store default target to use onto links
36
+    var $type_user; // Put 0 for internal users, 1 for external users
37
+    var $atarget = ""; // To store default target to use onto links
38 38
     var $name = "eldy";
39 39
     var $menu_array;
40 40
     var $menu_array_after;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
             $leftmenu = $forceleftmenu;
103 103
         }
104 104
 
105
-        require_once DOL_DOCUMENT_ROOT . '/core/class/menubase.class.php';
105
+        require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
106 106
         $tabMenu = array();
107 107
         $menuArbo = new Menubase($this->db, 'eldy');
108 108
         $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'eldy', $tabMenu);
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
 
126 126
         //var_dump($this->tabMenu);
127 127
 
128
-        require_once DOL_DOCUMENT_ROOT . '/core/menus/standard/eldy.lib.php';
128
+        require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
129 129
 
130 130
         if ($this->type_user == 1) {
131 131
             $conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED = 1;
132 132
             $conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED = 1;
133 133
         }
134 134
 
135
-        require_once DOL_DOCUMENT_ROOT . '/core/class/menu.class.php';
135
+        require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
136 136
         $this->menu = new Menu();
137 137
 
138 138
         if (empty($conf->global->MAIN_MENU_INVERT)) {
@@ -153,16 +153,16 @@  discard block
 block discarded – undo
153 153
         }
154 154
 
155 155
         if ($mode == 'topnb') {
156
-            print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);  // no output
156
+            print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); // no output
157 157
             return $this->menu->getNbOfVisibleMenuEntries();
158 158
         }
159 159
 
160 160
         if ($mode == 'jmobile') {     // Used to get menu in xml ul/li
161
-            print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);      // Fill this->menu that is empty with top menu
161
+            print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); // Fill this->menu that is empty with top menu
162 162
             // $this->menu->liste is top menu
163 163
             //var_dump($this->menu->liste);exit;
164 164
             $lastlevel = array();
165
-            print '<!-- Generate menu list from menu handler ' . $this->name . ' -->' . "\n";
165
+            print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
166 166
             foreach ($this->menu->liste as $key => $val) {  // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
167 167
                 print '<ul class="ulmenu" data-inset="true">';
168 168
                 print '<li class="lilevel0">';
@@ -183,13 +183,13 @@  discard block
 block discarded – undo
183 183
                     }
184 184
 
185 185
                     print $val['titre'];
186
-                    print '</a>' . "\n";
186
+                    print '</a>'."\n";
187 187
 
188 188
                     // Search submenu fot this mainmenu entry
189 189
                     $tmpmainmenu = $val['mainmenu'];
190 190
                     $tmpleftmenu = 'all';
191 191
                     $submenu = new Menu();
192
-                    print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $submenu, 1, $tmpmainmenu, $tmpleftmenu);       // Fill $submenu (example with tmpmainmenu='home' tmpleftmenu='all', return left menu tree of Home)
192
+                    print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $submenu, 1, $tmpmainmenu, $tmpleftmenu); // Fill $submenu (example with tmpmainmenu='home' tmpleftmenu='all', return left menu tree of Home)
193 193
                     // Note: $submenu contains menu entry with substitution not yet done
194 194
                     //if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu); exit; }
195 195
                     //if ($tmpmainmenu=='accountancy') { var_dump($submenu->liste); exit; }
@@ -199,21 +199,21 @@  discard block
 block discarded – undo
199 199
                     $canonnexturl = preg_replace('/\?.*$/', '', $nexturl);
200 200
                     //var_dump($canonrelurl);
201 201
                     //var_dump($canonnexturl);
202
-                    print '<ul>' . "\n";
202
+                    print '<ul>'."\n";
203 203
                     if (($canonrelurl != $canonnexturl && !in_array($val['mainmenu'], array('tools'))) || (strpos($canonrelurl, '/product/index.php') !== false || strpos($canonrelurl, '/compta/bank/list.php') !== false)) {
204 204
                         // We add sub entry
205
-                        print str_pad('', 1) . '<li class="lilevel1 ui-btn-icon-right ui-btn">';  // ui-btn to highlight on clic
206
-                        print '<a href="' . $relurl . '">';
207
-                        if ($langs->trans(ucfirst($val['mainmenu']) . "Dashboard") == ucfirst($val['mainmenu']) . "Dashboard") {  // No translation
205
+                        print str_pad('', 1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
206
+                        print '<a href="'.$relurl.'">';
207
+                        if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") {  // No translation
208 208
                             if (in_array($val['mainmenu'], array('cashdesk', 'externalsite', 'website', 'collab'))) {
209 209
                                 print $langs->trans("Access");
210 210
                             } else {
211 211
                                 print $langs->trans("Dashboard");
212 212
                             }
213 213
                         } else
214
-                            print $langs->trans(ucfirst($val['mainmenu']) . "Dashboard");
214
+                            print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
215 215
                         print '</a>';
216
-                        print '</li>' . "\n";
216
+                        print '</li>'."\n";
217 217
                     }
218 218
 
219 219
                     if ($val['level'] == 0) {
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
                         if ($showmenu) {  // Visible (option to hide when not allowed is off or allowed)
248 248
                             $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
249 249
                             $substitarray['__USERID__'] = $user->id; // For backward compatibility
250
-                            $val2['url'] = make_substitutions($val2['url'], $substitarray);  // Make also substitution of __(XXX)__ and __[XXX]__
250
+                            $val2['url'] = make_substitutions($val2['url'], $substitarray); // Make also substitution of __(XXX)__ and __[XXX]__
251 251
 
252 252
                             if (!preg_match("/^(http:\/\/|https:\/\/)/i", $val2['url'])) {
253 253
                                 $relurl2 = dol_buildpath($val2['url'], 1);
@@ -266,14 +266,14 @@  discard block
 block discarded – undo
266 266
                             }
267 267
 
268 268
                             print str_pad('', $val2['level'] + 1);
269
-                            print '<li class="lilevel' . ($val2['level'] + 1);
269
+                            print '<li class="lilevel'.($val2['level'] + 1);
270 270
                             if ($val2['level'] == 0) {
271
-                                print ' ui-btn-icon-right ui-btn';  // ui-btn to highlight on clic
271
+                                print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
272 272
                             }
273
-                            print $disabled . '">';  // ui-btn to highlight on clic
273
+                            print $disabled.'">'; // ui-btn to highlight on clic
274 274
                             if ($relurl2) {
275 275
                                 if ($val2['enabled']) { // Allowed
276
-                                    print '<a href="' . $relurl2 . '"';
276
+                                    print '<a href="'.$relurl2.'"';
277 277
                                     //print ' data-ajax="false"';
278 278
                                     print '>';
279 279
                                     $lastlevel2[$val2['level']] = 'enabled';
@@ -297,17 +297,17 @@  discard block
 block discarded – undo
297 297
                                 else
298 298
                                     print '</a>';
299 299
                             }
300
-                            print '</li>' . "\n";
300
+                            print '</li>'."\n";
301 301
                         }
302 302
                     }
303 303
                     //var_dump($submenu);
304 304
                     print '</ul>';
305 305
                 }
306 306
                 if ($val['enabled'] == 2) {
307
-                    print '<font class="vsmenudisabled">' . $val['titre'] . '</font>';
307
+                    print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
308 308
                 }
309 309
                 print '</li>';
310
-                print '</ul>' . "\n";
310
+                print '</ul>'."\n";
311 311
             }
312 312
         }
313 313
 
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -210,8 +210,9 @@  discard block
 block discarded – undo
210 210
                             } else {
211 211
                                 print $langs->trans("Dashboard");
212 212
                             }
213
-                        } else
214
-                            print $langs->trans(ucfirst($val['mainmenu']) . "Dashboard");
213
+                        } else {
214
+                                                    print $langs->trans(ucfirst($val['mainmenu']) . "Dashboard");
215
+                        }
215 216
                         print '</a>';
216 217
                         print '</li>' . "\n";
217 218
                     }
@@ -292,10 +293,12 @@  discard block
 block discarded – undo
292 293
                             //var_dump($lastlevel2);
293 294
                             print $val2['titre'];
294 295
                             if ($relurl2) {
295
-                                if ($val2['enabled']) // Allowed
296
-                                    print '</a>';
297
-                                else
298
-                                    print '</a>';
296
+                                if ($val2['enabled']) {
297
+                                    // Allowed
298
+                                    print '</a>';
299
+                                } else {
300
+                                                                    print '</a>';
301
+                                }
299 302
                             }
300 303
                             print '</li>' . "\n";
301 304
                         }
Please login to merge, or discard this patch.
dolibarr/htdocs/core/class/menubase.class.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     public $titre;
80 80
     public $langs;
81 81
     public $level;
82
-    public $leftmenu;  //<! Not used
82
+    public $leftmenu; //<! Not used
83 83
     public $perms;
84 84
     public $enabled;
85 85
     public $user;
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
         $this->type = trim($this->type);
115 115
         $this->mainmenu = trim($this->mainmenu);
116 116
         $this->leftmenu = trim($this->leftmenu);
117
-        $this->fk_menu = (int) $this->fk_menu;          // If -1, fk_mainmenu and fk_leftmenu must be defined
117
+        $this->fk_menu = (int) $this->fk_menu; // If -1, fk_mainmenu and fk_leftmenu must be defined
118 118
         $this->fk_mainmenu = trim($this->fk_mainmenu);
119 119
         $this->fk_leftmenu = trim($this->fk_leftmenu);
120 120
         $this->position = (int) $this->position;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         // may use an already used value because its internal cursor does not increase when we do
142 142
         // an insert with a forced id.
143 143
         if (in_array($this->db->type, array('pgsql'))) {
144
-            $sql = "SELECT MAX(rowid) as maxrowid FROM " . MAIN_DB_PREFIX . "menu";
144
+            $sql = "SELECT MAX(rowid) as maxrowid FROM ".MAIN_DB_PREFIX."menu";
145 145
             $resqlrowid = $this->db->query($sql);
146 146
             if ($resqlrowid) {
147 147
                 $obj = $this->db->fetch_object($resqlrowid);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                     $maxrowid = 1;
153 153
                 }
154 154
 
155
-                $sql = "SELECT setval('" . MAIN_DB_PREFIX . "menu_rowid_seq', " . ($maxrowid) . ")";
155
+                $sql = "SELECT setval('".MAIN_DB_PREFIX."menu_rowid_seq', ".($maxrowid).")";
156 156
                 //print $sql; exit;
157 157
                 $resqlrowidset = $this->db->query($sql);
158 158
                 if (!$resqlrowidset) {
@@ -165,12 +165,12 @@  discard block
 block discarded – undo
165 165
 
166 166
         // Check that entry does not exists yet on key menu_handler-fk_menu-position-url-entity, to avoid errors with postgresql
167 167
         $sql = "SELECT count(*)";
168
-        $sql .= " FROM " . MAIN_DB_PREFIX . "menu";
169
-        $sql .= " WHERE menu_handler = '" . $this->db->escape($this->menu_handler) . "'";
170
-        $sql .= " AND fk_menu = " . ((int) $this->fk_menu);
171
-        $sql .= " AND position = " . ((int) $this->position);
172
-        $sql .= " AND url = '" . $this->db->escape($this->url) . "'";
173
-        $sql .= " AND entity = " . $conf->entity;
168
+        $sql .= " FROM ".MAIN_DB_PREFIX."menu";
169
+        $sql .= " WHERE menu_handler = '".$this->db->escape($this->menu_handler)."'";
170
+        $sql .= " AND fk_menu = ".((int) $this->fk_menu);
171
+        $sql .= " AND position = ".((int) $this->position);
172
+        $sql .= " AND url = '".$this->db->escape($this->url)."'";
173
+        $sql .= " AND entity = ".$conf->entity;
174 174
 
175 175
         $result = $this->db->query($sql);
176 176
         if ($result) {
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 
179 179
             if ($row[0] == 0) {   // If not found
180 180
                 // Insert request
181
-                $sql = "INSERT INTO " . MAIN_DB_PREFIX . "menu(";
181
+                $sql = "INSERT INTO ".MAIN_DB_PREFIX."menu(";
182 182
                 $sql .= "menu_handler,";
183 183
                 $sql .= "entity,";
184 184
                 $sql .= "module,";
@@ -197,38 +197,38 @@  discard block
 block discarded – undo
197 197
                 $sql .= "enabled,";
198 198
                 $sql .= "usertype";
199 199
                 $sql .= ") VALUES (";
200
-                $sql .= " '" . $this->db->escape($this->menu_handler) . "',";
201
-                $sql .= " '" . $this->db->escape($conf->entity) . "',";
202
-                $sql .= " '" . $this->db->escape($this->module) . "',";
203
-                $sql .= " '" . $this->db->escape($this->type) . "',";
204
-                $sql .= " " . ($this->mainmenu ? "'" . $this->db->escape($this->mainmenu) . "'" : "''") . ",";    // Can't be null
205
-                $sql .= " " . ($this->leftmenu ? "'" . $this->db->escape($this->leftmenu) . "'" : "null") . ",";
206
-                $sql .= " " . ((int) $this->fk_menu) . ",";
207
-                $sql .= " " . ($this->fk_mainmenu ? "'" . $this->db->escape($this->fk_mainmenu) . "'" : "null") . ",";
208
-                $sql .= " " . ($this->fk_leftmenu ? "'" . $this->db->escape($this->fk_leftmenu) . "'" : "null") . ",";
209
-                $sql .= " " . ((int) $this->position) . ",";
210
-                $sql .= " '" . $this->db->escape($this->url) . "',";
211
-                $sql .= " '" . $this->db->escape($this->target) . "',";
212
-                $sql .= " '" . $this->db->escape($this->titre) . "',";
213
-                $sql .= " '" . $this->db->escape($this->langs) . "',";
214
-                $sql .= " '" . $this->db->escape($this->perms) . "',";
215
-                $sql .= " '" . $this->db->escape($this->enabled) . "',";
216
-                $sql .= " '" . $this->db->escape($this->user) . "'";
200
+                $sql .= " '".$this->db->escape($this->menu_handler)."',";
201
+                $sql .= " '".$this->db->escape($conf->entity)."',";
202
+                $sql .= " '".$this->db->escape($this->module)."',";
203
+                $sql .= " '".$this->db->escape($this->type)."',";
204
+                $sql .= " ".($this->mainmenu ? "'".$this->db->escape($this->mainmenu)."'" : "''").","; // Can't be null
205
+                $sql .= " ".($this->leftmenu ? "'".$this->db->escape($this->leftmenu)."'" : "null").",";
206
+                $sql .= " ".((int) $this->fk_menu).",";
207
+                $sql .= " ".($this->fk_mainmenu ? "'".$this->db->escape($this->fk_mainmenu)."'" : "null").",";
208
+                $sql .= " ".($this->fk_leftmenu ? "'".$this->db->escape($this->fk_leftmenu)."'" : "null").",";
209
+                $sql .= " ".((int) $this->position).",";
210
+                $sql .= " '".$this->db->escape($this->url)."',";
211
+                $sql .= " '".$this->db->escape($this->target)."',";
212
+                $sql .= " '".$this->db->escape($this->titre)."',";
213
+                $sql .= " '".$this->db->escape($this->langs)."',";
214
+                $sql .= " '".$this->db->escape($this->perms)."',";
215
+                $sql .= " '".$this->db->escape($this->enabled)."',";
216
+                $sql .= " '".$this->db->escape($this->user)."'";
217 217
                 $sql .= ")";
218 218
 
219
-                dol_syslog(get_class($this) . "::create", LOG_DEBUG);
219
+                dol_syslog(get_class($this)."::create", LOG_DEBUG);
220 220
                 $resql = $this->db->query($sql);
221 221
                 if ($resql) {
222
-                    $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "menu");
223
-                    dol_syslog(get_class($this) . "::create record added has rowid=" . $this->id, LOG_DEBUG);
222
+                    $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."menu");
223
+                    dol_syslog(get_class($this)."::create record added has rowid=".$this->id, LOG_DEBUG);
224 224
 
225 225
                     return $this->id;
226 226
                 } else {
227
-                    $this->error = "Error " . $this->db->lasterror();
227
+                    $this->error = "Error ".$this->db->lasterror();
228 228
                     return -1;
229 229
                 }
230 230
             } else {
231
-                dol_syslog(get_class($this) . "::create menu entry already exists", LOG_WARNING);
231
+                dol_syslog(get_class($this)."::create menu entry already exists", LOG_WARNING);
232 232
                 $this->error = 'Error Menu entry already exists';
233 233
                 return 0;
234 234
             }
@@ -270,29 +270,29 @@  discard block
 block discarded – undo
270 270
         // Check parameters
271 271
         // Put here code to add control on parameters values
272 272
         // Update request
273
-        $sql = "UPDATE " . MAIN_DB_PREFIX . "menu SET";
274
-        $sql .= " menu_handler='" . $this->db->escape($this->menu_handler) . "',";
275
-        $sql .= " module='" . $this->db->escape($this->module) . "',";
276
-        $sql .= " type='" . $this->db->escape($this->type) . "',";
277
-        $sql .= " mainmenu='" . $this->db->escape($this->mainmenu) . "',";
278
-        $sql .= " leftmenu='" . $this->db->escape($this->leftmenu) . "',";
279
-        $sql .= " fk_menu=" . $this->fk_menu . ",";
280
-        $sql .= " fk_mainmenu=" . ($this->fk_mainmenu ? "'" . $this->db->escape($this->fk_mainmenu) . "'" : "null") . ",";
281
-        $sql .= " fk_leftmenu=" . ($this->fk_leftmenu ? "'" . $this->db->escape($this->fk_leftmenu) . "'" : "null") . ",";
282
-        $sql .= " position=" . ($this->position > 0 ? $this->position : 0) . ",";
283
-        $sql .= " url='" . $this->db->escape($this->url) . "',";
284
-        $sql .= " target='" . $this->db->escape($this->target) . "',";
285
-        $sql .= " titre='" . $this->db->escape($this->titre) . "',";
286
-        $sql .= " langs='" . $this->db->escape($this->langs) . "',";
287
-        $sql .= " perms='" . $this->db->escape($this->perms) . "',";
288
-        $sql .= " enabled='" . $this->db->escape($this->enabled) . "',";
289
-        $sql .= " usertype='" . $this->db->escape($this->user) . "'";
290
-        $sql .= " WHERE rowid=" . $this->id;
291
-
292
-        dol_syslog(get_class($this) . "::update", LOG_DEBUG);
273
+        $sql = "UPDATE ".MAIN_DB_PREFIX."menu SET";
274
+        $sql .= " menu_handler='".$this->db->escape($this->menu_handler)."',";
275
+        $sql .= " module='".$this->db->escape($this->module)."',";
276
+        $sql .= " type='".$this->db->escape($this->type)."',";
277
+        $sql .= " mainmenu='".$this->db->escape($this->mainmenu)."',";
278
+        $sql .= " leftmenu='".$this->db->escape($this->leftmenu)."',";
279
+        $sql .= " fk_menu=".$this->fk_menu.",";
280
+        $sql .= " fk_mainmenu=".($this->fk_mainmenu ? "'".$this->db->escape($this->fk_mainmenu)."'" : "null").",";
281
+        $sql .= " fk_leftmenu=".($this->fk_leftmenu ? "'".$this->db->escape($this->fk_leftmenu)."'" : "null").",";
282
+        $sql .= " position=".($this->position > 0 ? $this->position : 0).",";
283
+        $sql .= " url='".$this->db->escape($this->url)."',";
284
+        $sql .= " target='".$this->db->escape($this->target)."',";
285
+        $sql .= " titre='".$this->db->escape($this->titre)."',";
286
+        $sql .= " langs='".$this->db->escape($this->langs)."',";
287
+        $sql .= " perms='".$this->db->escape($this->perms)."',";
288
+        $sql .= " enabled='".$this->db->escape($this->enabled)."',";
289
+        $sql .= " usertype='".$this->db->escape($this->user)."'";
290
+        $sql .= " WHERE rowid=".$this->id;
291
+
292
+        dol_syslog(get_class($this)."::update", LOG_DEBUG);
293 293
         $resql = $this->db->query($sql);
294 294
         if (!$resql) {
295
-            $this->error = "Error " . $this->db->lasterror();
295
+            $this->error = "Error ".$this->db->lasterror();
296 296
             return -1;
297 297
         }
298 298
 
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
         $sql .= " t.enabled,";
331 331
         $sql .= " t.usertype as user,";
332 332
         $sql .= " t.tms";
333
-        $sql .= " FROM " . MAIN_DB_PREFIX . "menu as t";
334
-        $sql .= " WHERE t.rowid = " . $id;
333
+        $sql .= " FROM ".MAIN_DB_PREFIX."menu as t";
334
+        $sql .= " WHERE t.rowid = ".$id;
335 335
 
336
-        dol_syslog(get_class($this) . "::fetch", LOG_DEBUG);
336
+        dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
337 337
         $resql = $this->db->query($sql);
338 338
         if ($resql) {
339 339
             if ($this->db->num_rows($resql)) {
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 
365 365
             return 1;
366 366
         } else {
367
-            $this->error = "Error " . $this->db->lasterror();
367
+            $this->error = "Error ".$this->db->lasterror();
368 368
             return -1;
369 369
         }
370 370
     }
@@ -379,13 +379,13 @@  discard block
 block discarded – undo
379 379
     {
380 380
         global $conf, $langs;
381 381
 
382
-        $sql = "DELETE FROM " . MAIN_DB_PREFIX . "menu";
383
-        $sql .= " WHERE rowid=" . $this->id;
382
+        $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";
383
+        $sql .= " WHERE rowid=".$this->id;
384 384
 
385
-        dol_syslog(get_class($this) . "::delete", LOG_DEBUG);
385
+        dol_syslog(get_class($this)."::delete", LOG_DEBUG);
386 386
         $resql = $this->db->query($sql);
387 387
         if (!$resql) {
388
-            $this->error = "Error " . $this->db->lasterror();
388
+            $this->error = "Error ".$this->db->lasterror();
389 389
             return -1;
390 390
         }
391 391
 
@@ -434,10 +434,10 @@  discard block
 block discarded – undo
434 434
     function menuTopCharger($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
435 435
     {
436 436
         global $langs, $user, $conf; // To export to dol_eval function
437
-        global $mainmenu, $leftmenu;  // To export to dol_eval function
437
+        global $mainmenu, $leftmenu; // To export to dol_eval function
438 438
 
439
-        $mainmenu = $mymainmenu;  // To export to dol_eval function
440
-        $leftmenu = $myleftmenu;  // To export to dol_eval function
439
+        $mainmenu = $mymainmenu; // To export to dol_eval function
440
+        $leftmenu = $myleftmenu; // To export to dol_eval function
441 441
 
442 442
         $newTabMenu = array();
443 443
         foreach ($tabMenu as $val) {
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
      */
464 464
     function menuLeftCharger($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
465 465
     {
466
-        global $langs, $user, $conf;  // To export to dol_eval function
467
-        global $mainmenu, $leftmenu;  // To export to dol_eval function
466
+        global $langs, $user, $conf; // To export to dol_eval function
467
+        global $mainmenu, $leftmenu; // To export to dol_eval function
468 468
 
469
-        $mainmenu = $mymainmenu;  // To export to dol_eval function
470
-        $leftmenu = $myleftmenu;  // To export to dol_eval function
469
+        $mainmenu = $mymainmenu; // To export to dol_eval function
470
+        $leftmenu = $myleftmenu; // To export to dol_eval function
471 471
         // Detect what is top mainmenu id
472 472
         $menutopid = '';
473 473
         foreach ($tabMenu as $key => $val) {
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
                     if ($found) {
523 523
                         $this->newmenu->insert($lastid, $val['url'], $val['titre'], $searchlastsub, $val['perms'], $val['target'], $val['mainmenu'], $val['leftmenu'], $val['position']);
524 524
                     } else {
525
-                        dol_syslog("Error. Modules " . $val['module'] . " has defined a menu entry with a parent='fk_mainmenu=" . $val['fk_leftmenu'] . ",fk_leftmenu=" . $val['fk_leftmenu'] . "' and position=" . $val['position'] . '. The parent was not found. May be you forget it into your definition of menu, or may be the parent has a "position" that is after the child (fix field "position" of parent or child in this case).', LOG_WARNING);
525
+                        dol_syslog("Error. Modules ".$val['module']." has defined a menu entry with a parent='fk_mainmenu=".$val['fk_leftmenu'].",fk_leftmenu=".$val['fk_leftmenu']."' and position=".$val['position'].'. The parent was not found. May be you forget it into your definition of menu, or may be the parent has a "position" that is after the child (fix field "position" of parent or child in this case).', LOG_WARNING);
526 526
                         //print "Parent menu not found !!<br>";
527 527
                     }
528 528
                 }
@@ -548,13 +548,13 @@  discard block
 block discarded – undo
548 548
         global $mainmenu, $leftmenu; // To export to dol_eval function
549 549
 
550 550
         $menutopid = 0;
551
-        $mainmenu = $mymainmenu;  // To export to dol_eval function
552
-        $leftmenu = $myleftmenu;  // To export to dol_eval function
551
+        $mainmenu = $mymainmenu; // To export to dol_eval function
552
+        $leftmenu = $myleftmenu; // To export to dol_eval function
553 553
 
554 554
         $sql = "SELECT m.rowid, m.type, m.module, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.url, m.titre, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu, m.position";
555
-        $sql .= " FROM " . MAIN_DB_PREFIX . "menu as m";
556
-        $sql .= " WHERE m.entity IN (0," . $conf->entity . ")";
557
-        $sql .= " AND m.menu_handler IN ('" . $menu_handler . "','all')";
555
+        $sql .= " FROM ".MAIN_DB_PREFIX."menu as m";
556
+        $sql .= " WHERE m.entity IN (0,".$conf->entity.")";
557
+        $sql .= " AND m.menu_handler IN ('".$menu_handler."','all')";
558 558
         if ($type_user == 0) {
559 559
             $sql .= " AND m.usertype IN (0,2)";
560 560
         }
@@ -565,7 +565,7 @@  discard block
 block discarded – undo
565 565
         //print $sql;
566 566
         //$tmp1=microtime(true);
567 567
         //print '>>> 1 0<br>';
568
-        dol_syslog(get_class($this) . "::menuLoad mymainmenu=" . $mymainmenu . " myleftmenu=" . $myleftmenu . " type_user=" . $type_user . " menu_handler=" . $menu_handler . " tabMenu size=" . count($tabMenu) . "", LOG_DEBUG);
568
+        dol_syslog(get_class($this)."::menuLoad mymainmenu=".$mymainmenu." myleftmenu=".$myleftmenu." type_user=".$type_user." menu_handler=".$menu_handler." tabMenu size=".count($tabMenu)."", LOG_DEBUG);
569 569
         $resql = $this->db->query($sql);
570 570
         if ($resql) {
571 571
             $numa = $this->db->num_rows($resql);
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 
600 600
                 // Define $title
601 601
                 if ($enabled) {
602
-                    $title = $langs->trans($menu['titre']);  // If $menu['titre'] start with $, a dol_eval is done.
602
+                    $title = $langs->trans($menu['titre']); // If $menu['titre'] start with $, a dol_eval is done.
603 603
                     //var_dump($title.'-'.$menu['titre']);
604 604
                     if ($title == $menu['titre']) {   // Translation not found
605 605
                         if (!empty($menu['langs'])) {    // If there is a dedicated translation file
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 
613 613
                         if (preg_match("/\//", $menu['titre'])) { // To manage translation when title is string1/string2
614 614
                             $tab_titre = explode("/", $menu['titre']);
615
-                            $title = $langs->trans($tab_titre[0]) . "/" . $langs->trans($tab_titre[1]);
615
+                            $title = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]);
616 616
                         } else if (preg_match('/\|\|/', $menu['titre'])) { // To manage different translation (Title||AltTitle@ConditionForAltTitle)
617 617
                             $tab_title = explode("||", $menu['titre']);
618 618
                             $alt_title = explode("@", $tab_title[1]);
@@ -631,9 +631,9 @@  discard block
 block discarded – undo
631 631
                     $tabMenu[$b]['url'] = $menu['url'];
632 632
                     if (!preg_match("/^(http:\/\/|https:\/\/)/i", $tabMenu[$b]['url'])) {
633 633
                         if (preg_match('/\?/', $tabMenu[$b]['url'])) {
634
-                            $tabMenu[$b]['url'] .= '&amp;idmenu=' . $menu['rowid'];
634
+                            $tabMenu[$b]['url'] .= '&amp;idmenu='.$menu['rowid'];
635 635
                         } else {
636
-                            $tabMenu[$b]['url'] .= '?idmenu=' . $menu['rowid'];
636
+                            $tabMenu[$b]['url'] .= '?idmenu='.$menu['rowid'];
637 637
                         }
638 638
                     }
639 639
                     $tabMenu[$b]['titre'] = $title;
Please login to merge, or discard this patch.
dolibarr/htdocs/core/modules/DolibarrModules.class.php 1 patch
Spacing   +220 added lines, -220 removed lines patch added patch discarded remove patch
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     public $export_fields_array;
225 225
     public $export_TypeFields_array;
226 226
     public $export_entities_array;
227
-    public $export_special_array;           // special or computed field
227
+    public $export_special_array; // special or computed field
228 228
     public $export_dependencies_array;
229 229
     public $export_sql_start;
230 230
     public $export_sql_end;
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 
399 399
         // Insert constant defined by modules (into llx_const)
400 400
         if (!$err && !preg_match('/newboxdefonly/', $options)) {
401
-            $err += $this->insert_const();    // Test on newboxdefonly to avoid to erase value during upgrade
401
+            $err += $this->insert_const(); // Test on newboxdefonly to avoid to erase value during upgrade
402 402
         }
403 403
 
404 404
         // Insert boxes def into llx_boxes_def and boxes setup (into llx_boxes)
@@ -440,14 +440,14 @@  discard block
 block discarded – undo
440 440
                 // Add current entity id
441 441
                 $sql = str_replace('__ENTITY__', $conf->entity, $sql);
442 442
 
443
-                dol_syslog(get_class($this) . "::_init ignoreerror=" . $ignoreerror . "", LOG_DEBUG);
443
+                dol_syslog(get_class($this)."::_init ignoreerror=".$ignoreerror."", LOG_DEBUG);
444 444
                 $result = $this->db->query($sql, $ignoreerror);
445 445
                 if (!$result) {
446 446
                     if (!$ignoreerror) {
447 447
                         $this->error = $this->db->lasterror();
448 448
                         $err++;
449 449
                     } else {
450
-                        dol_syslog(get_class($this) . "::_init Warning " . $this->db->lasterror(), LOG_WARNING);
450
+                        dol_syslog(get_class($this)."::_init Warning ".$this->db->lasterror(), LOG_WARNING);
451 451
                     }
452 452
                 }
453 453
             }
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 
500 500
         // Remove list of module's available boxes (entry in llx_boxes)
501 501
         if (!$err && !preg_match('/(newboxdefonly|noboxes)/', $options)) {
502
-            $err += $this->delete_boxes();    // We don't have to delete if option ask to keep boxes safe or ask to add new box def only
502
+            $err += $this->delete_boxes(); // We don't have to delete if option ask to keep boxes safe or ask to add new box def only
503 503
         }
504 504
 
505 505
         // Remove list of module's cron job entries (entry in llx_cronjobs)
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
         $num = count($array_sql);
527 527
         for ($i = 0; $i < $num; $i++) {
528 528
             if (!$err) {
529
-                dol_syslog(get_class($this) . "::_remove", LOG_DEBUG);
529
+                dol_syslog(get_class($this)."::_remove", LOG_DEBUG);
530 530
                 $result = $this->db->query($array_sql[$i]);
531 531
                 if (!$result) {
532 532
                     $this->error = $this->db->error();
@@ -556,9 +556,9 @@  discard block
 block discarded – undo
556 556
         global $langs;
557 557
         $langs->load("admin");
558 558
 
559
-        if ($langs->transnoentitiesnoconv("Module" . $this->numero . "Name") != ("Module" . $this->numero . "Name")) {
559
+        if ($langs->transnoentitiesnoconv("Module".$this->numero."Name") != ("Module".$this->numero."Name")) {
560 560
             // If module name translation exists
561
-            return $langs->transnoentitiesnoconv("Module" . $this->numero . "Name");
561
+            return $langs->transnoentitiesnoconv("Module".$this->numero."Name");
562 562
         } else {
563 563
             // If module name translation using it's unique id does not exist, we try to use its name to find translation
564 564
             if (is_array($this->langfiles)) {
@@ -569,9 +569,9 @@  discard block
 block discarded – undo
569 569
                 }
570 570
             }
571 571
 
572
-            if ($langs->trans("Module" . $this->name . "Name") != ("Module" . $this->name . "Name")) {
572
+            if ($langs->trans("Module".$this->name."Name") != ("Module".$this->name."Name")) {
573 573
                 // If module name translation exists
574
-                return $langs->transnoentitiesnoconv("Module" . $this->name . "Name");
574
+                return $langs->transnoentitiesnoconv("Module".$this->name."Name");
575 575
             }
576 576
 
577 577
             // Last chance with simple label
@@ -589,9 +589,9 @@  discard block
 block discarded – undo
589 589
         global $langs;
590 590
         $langs->load("admin");
591 591
 
592
-        if ($langs->transnoentitiesnoconv("Module" . $this->numero . "Desc") != ("Module" . $this->numero . "Desc")) {
592
+        if ($langs->transnoentitiesnoconv("Module".$this->numero."Desc") != ("Module".$this->numero."Desc")) {
593 593
             // If module description translation exists
594
-            return $langs->transnoentitiesnoconv("Module" . $this->numero . "Desc");
594
+            return $langs->transnoentitiesnoconv("Module".$this->numero."Desc");
595 595
         } else {
596 596
             // If module description translation does not exist using its unique id, we can use its name to find translation
597 597
             if (is_array($this->langfiles)) {
@@ -602,9 +602,9 @@  discard block
 block discarded – undo
602 602
                 }
603 603
             }
604 604
 
605
-            if ($langs->transnoentitiesnoconv("Module" . $this->name . "Desc") != ("Module" . $this->name . "Desc")) {
605
+            if ($langs->transnoentitiesnoconv("Module".$this->name."Desc") != ("Module".$this->name."Desc")) {
606 606
                 // If module name translation exists
607
-                return $langs->trans("Module" . $this->name . "Desc");
607
+                return $langs->trans("Module".$this->name."Desc");
608 608
             }
609 609
 
610 610
             // Last chance with simple label
@@ -623,8 +623,8 @@  discard block
 block discarded – undo
623 623
         global $langs;
624 624
         $langs->load("admin");
625 625
 
626
-        include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
627
-        include_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php';
626
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
627
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
628 628
 
629 629
         $pathoffile = $this->getDescLongReadmeFound();
630 630
 
@@ -632,13 +632,13 @@  discard block
 block discarded – undo
632 632
             $content = file_get_contents($pathoffile);
633 633
 
634 634
             if ((float) DOL_VERSION >= 6.0) {
635
-                @include_once DOL_DOCUMENT_ROOT . '/core/lib/parsemd.lib.php';
635
+                @include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';
636 636
 
637 637
                 $content = dolMd2Html(
638 638
                     $content, 'parsedown', array(
639
-                    'doc/' => dol_buildpath(strtolower($this->name) . '/doc/', 1),
640
-                    'img/' => dol_buildpath(strtolower($this->name) . '/img/', 1),
641
-                    'images/' => dol_buildpath(strtolower($this->name) . '/imgages/', 1),
639
+                    'doc/' => dol_buildpath(strtolower($this->name).'/doc/', 1),
640
+                    'img/' => dol_buildpath(strtolower($this->name).'/img/', 1),
641
+                    'images/' => dol_buildpath(strtolower($this->name).'/imgages/', 1),
642 642
                     )
643 643
                 );
644 644
             } else {
@@ -674,19 +674,19 @@  discard block
 block discarded – undo
674 674
 
675 675
         // Define path to file README.md.
676 676
         // First check README-la_LA.md then README-la.md then README.md
677
-        $pathoffile = dol_buildpath(strtolower($this->name) . '/README-' . $langs->defaultlang . '.md', 0);
677
+        $pathoffile = dol_buildpath(strtolower($this->name).'/README-'.$langs->defaultlang.'.md', 0);
678 678
         if (dol_is_file($pathoffile)) {
679 679
             $filefound = true;
680 680
         }
681 681
         if (!$filefound) {
682 682
             $tmp = explode('_', $langs->defaultlang);
683
-            $pathoffile = dol_buildpath(strtolower($this->name) . '/README-' . $tmp[0] . '.md', 0);
683
+            $pathoffile = dol_buildpath(strtolower($this->name).'/README-'.$tmp[0].'.md', 0);
684 684
             if (dol_is_file($pathoffile)) {
685 685
                 $filefound = true;
686 686
             }
687 687
         }
688 688
         if (!$filefound) {
689
-            $pathoffile = dol_buildpath(strtolower($this->name) . '/README.md', 0);
689
+            $pathoffile = dol_buildpath(strtolower($this->name).'/README.md', 0);
690 690
             if (dol_is_file($pathoffile)) {
691 691
                 $filefound = true;
692 692
             }
@@ -705,19 +705,19 @@  discard block
 block discarded – undo
705 705
         global $langs;
706 706
         $langs->load("admin");
707 707
 
708
-        include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
709
-        include_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php';
708
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
709
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
710 710
 
711 711
         $filefound = false;
712 712
 
713 713
         // Define path to file README.md.
714 714
         // First check README-la_LA.md then README.md
715
-        $pathoffile = dol_buildpath(strtolower($this->name) . '/ChangeLog-' . $langs->defaultlang . '.md', 0);
715
+        $pathoffile = dol_buildpath(strtolower($this->name).'/ChangeLog-'.$langs->defaultlang.'.md', 0);
716 716
         if (dol_is_file($pathoffile)) {
717 717
             $filefound = true;
718 718
         }
719 719
         if (!$filefound) {
720
-            $pathoffile = dol_buildpath(strtolower($this->name) . '/ChangeLog.md', 0);
720
+            $pathoffile = dol_buildpath(strtolower($this->name).'/ChangeLog.md', 0);
721 721
             if (dol_is_file($pathoffile)) {
722 722
                 $filefound = true;
723 723
             }
@@ -727,8 +727,8 @@  discard block
 block discarded – undo
727 727
             $content = file_get_contents($pathoffile);
728 728
 
729 729
             if ((float) DOL_VERSION >= 6.0) {
730
-                @include_once DOL_DOCUMENT_ROOT . '/core/lib/parsemd.lib.php';
731
-                $content = dolMd2Html($content, 'parsedown', array('doc/' => dol_buildpath(strtolower($this->name) . '/doc/', 1)));
730
+                @include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php';
731
+                $content = dolMd2Html($content, 'parsedown', array('doc/' => dol_buildpath(strtolower($this->name).'/doc/', 1)));
732 732
             } else {
733 733
                 $content = nl2br($content);
734 734
             }
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
         }
787 787
 
788 788
         if (preg_match('/_deprecated/', $this->version)) {
789
-            $ret .= ($translated ? ' (' . $langs->transnoentitiesnoconv("Deprecated") . ')' : $this->version);
789
+            $ret .= ($translated ? ' ('.$langs->transnoentitiesnoconv("Deprecated").')' : $this->version);
790 790
         }
791 791
         return $ret;
792 792
     }
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
     {
835 835
         global $langs;
836 836
 
837
-        $langstring = "ExportDataset_" . $this->export_code[$r];
837
+        $langstring = "ExportDataset_".$this->export_code[$r];
838 838
         if ($langs->trans($langstring) == $langstring) {
839 839
             // Translation not found
840 840
             return $langs->trans($this->export_label[$r]);
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
     {
856 856
         global $langs;
857 857
 
858
-        $langstring = "ImportDataset_" . $this->import_code[$r];
858
+        $langstring = "ImportDataset_".$this->import_code[$r];
859 859
         //print "x".$langstring;
860 860
         if ($langs->trans($langstring) == $langstring) {
861 861
             // Translation not found
@@ -875,11 +875,11 @@  discard block
 block discarded – undo
875 875
     {
876 876
         global $conf;
877 877
 
878
-        $sql = "SELECT tms FROM " . MAIN_DB_PREFIX . "const";
879
-        $sql .= " WHERE " . $this->db->decrypt('name') . " = '" . $this->db->escape($this->const_name) . "'";
880
-        $sql .= " AND entity IN (0, " . $conf->entity . ")";
878
+        $sql = "SELECT tms FROM ".MAIN_DB_PREFIX."const";
879
+        $sql .= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
880
+        $sql .= " AND entity IN (0, ".$conf->entity.")";
881 881
 
882
-        dol_syslog(get_class($this) . "::getLastActiveDate", LOG_DEBUG);
882
+        dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
883 883
         $resql = $this->db->query($sql);
884 884
         if (!$resql) {
885 885
             $err++;
@@ -902,11 +902,11 @@  discard block
 block discarded – undo
902 902
     {
903 903
         global $conf;
904 904
 
905
-        $sql = "SELECT tms, note FROM " . MAIN_DB_PREFIX . "const";
906
-        $sql .= " WHERE " . $this->db->decrypt('name') . " = '" . $this->db->escape($this->const_name) . "'";
907
-        $sql .= " AND entity IN (0, " . $conf->entity . ")";
905
+        $sql = "SELECT tms, note FROM ".MAIN_DB_PREFIX."const";
906
+        $sql .= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
907
+        $sql .= " AND entity IN (0, ".$conf->entity.")";
908 908
 
909
-        dol_syslog(get_class($this) . "::getLastActiveDate", LOG_DEBUG);
909
+        dol_syslog(get_class($this)."::getLastActiveDate", LOG_DEBUG);
910 910
         $resql = $this->db->query($sql);
911 911
         if (!$resql) {
912 912
             $err++;
@@ -938,11 +938,11 @@  discard block
 block discarded – undo
938 938
         // Common module
939 939
         $entity = ((!empty($this->always_enabled) || !empty($this->core_enabled)) ? 0 : $conf->entity);
940 940
 
941
-        $sql = "DELETE FROM " . MAIN_DB_PREFIX . "const";
942
-        $sql .= " WHERE " . $this->db->decrypt('name') . " = '" . $this->db->escape($this->const_name) . "'";
943
-        $sql .= " AND entity IN (0, " . $entity . ")";
941
+        $sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
942
+        $sql .= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
943
+        $sql .= " AND entity IN (0, ".$entity.")";
944 944
 
945
-        dol_syslog(get_class($this) . "::_active delete activation constant", LOG_DEBUG);
945
+        dol_syslog(get_class($this)."::_active delete activation constant", LOG_DEBUG);
946 946
         $resql = $this->db->query($sql);
947 947
         if (!$resql) {
948 948
             $err++;
@@ -950,13 +950,13 @@  discard block
 block discarded – undo
950 950
 
951 951
         $note = json_encode(array('authorid' => (is_object($user) ? $user->id : 0), 'ip' => (empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'])));
952 952
 
953
-        $sql = "INSERT INTO " . MAIN_DB_PREFIX . "const (name, value, visible, entity, note) VALUES";
954
-        $sql .= " (" . $this->db->encrypt($this->const_name, 1);
955
-        $sql .= ", " . $this->db->encrypt('1', 1);
956
-        $sql .= ", 0, " . $entity;
957
-        $sql .= ", '" . $this->db->escape($note) . "')";
953
+        $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name, value, visible, entity, note) VALUES";
954
+        $sql .= " (".$this->db->encrypt($this->const_name, 1);
955
+        $sql .= ", ".$this->db->encrypt('1', 1);
956
+        $sql .= ", 0, ".$entity;
957
+        $sql .= ", '".$this->db->escape($note)."')";
958 958
 
959
-        dol_syslog(get_class($this) . "::_active insert activation constant", LOG_DEBUG);
959
+        dol_syslog(get_class($this)."::_active insert activation constant", LOG_DEBUG);
960 960
         $resql = $this->db->query($sql);
961 961
         if (!$resql) {
962 962
             $err++;
@@ -979,11 +979,11 @@  discard block
 block discarded – undo
979 979
         // Common module
980 980
         $entity = ((!empty($this->always_enabled) || !empty($this->core_enabled)) ? 0 : $conf->entity);
981 981
 
982
-        $sql = "DELETE FROM " . MAIN_DB_PREFIX . "const";
983
-        $sql .= " WHERE " . $this->db->decrypt('name') . " = '" . $this->db->escape($this->const_name) . "'";
984
-        $sql .= " AND entity IN (0, " . $entity . ")";
982
+        $sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
983
+        $sql .= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
984
+        $sql .= " AND entity IN (0, ".$entity.")";
985 985
 
986
-        dol_syslog(get_class($this) . "::_unactive", LOG_DEBUG);
986
+        dol_syslog(get_class($this)."::_unactive", LOG_DEBUG);
987 987
         $this->db->query($sql);
988 988
 
989 989
         return $err;
@@ -1011,15 +1011,15 @@  discard block
 block discarded – undo
1011 1011
             return 1;
1012 1012
         }
1013 1013
 
1014
-        include_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
1014
+        include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
1015 1015
 
1016 1016
         $ok = 1;
1017 1017
         foreach ($conf->file->dol_document_root as $dirroot) {
1018 1018
             if ($ok) {
1019
-                $dir = $dirroot . $reldir;
1019
+                $dir = $dirroot.$reldir;
1020 1020
                 $ok = 0;
1021 1021
 
1022
-                $handle = @opendir($dir);         // Dir may not exists
1022
+                $handle = @opendir($dir); // Dir may not exists
1023 1023
                 if (is_resource($handle)) {
1024 1024
                     $dirfound++;
1025 1025
 
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
                     sort($files);
1032 1032
                     foreach ($files as $file) {
1033 1033
                         if (preg_match('/\.sql$/i', $file) && !preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 4) == 'llx_' && substr($file, 0, 4) != 'data') {
1034
-                            $result = run_sql($dir . $file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
1034
+                            $result = run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
1035 1035
                             if ($result <= 0) {
1036 1036
                                 $error++;
1037 1037
                             }
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
                     sort($files);
1049 1049
                     foreach ($files as $file) {
1050 1050
                         if (preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 4) == 'llx_' && substr($file, 0, 4) != 'data') {
1051
-                            $result = run_sql($dir . $file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
1051
+                            $result = run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
1052 1052
                             if ($result <= 0) {
1053 1053
                                 $error++;
1054 1054
                             }
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
                     sort($files);
1066 1066
                     foreach ($files as $file) {
1067 1067
                         if (preg_match('/\.sql$/i', $file) && !preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 4) == 'data') {
1068
-                            $result = run_sql($dir . $file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
1068
+                            $result = run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
1069 1069
                             if ($result <= 0) {
1070 1070
                                 $error++;
1071 1071
                             }
@@ -1082,7 +1082,7 @@  discard block
 block discarded – undo
1082 1082
                     sort($files);
1083 1083
                     foreach ($files as $file) {
1084 1084
                         if (preg_match('/\.sql$/i', $file) && !preg_match('/\.key\.sql$/i', $file) && substr($file, 0, 6) == 'update') {
1085
-                            $result = run_sql($dir . $file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
1085
+                            $result = run_sql($dir.$file, empty($conf->global->MAIN_DISPLAY_SQL_INSTALL_LOG) ? 1 : 0, '', 1);
1086 1086
                             if ($result <= 0) {
1087 1087
                                 $error++;
1088 1088
                             }
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
         }
1100 1100
 
1101 1101
         if (!$dirfound) {
1102
-            dol_syslog("A module ask to load sql files into " . $reldir . " but this directory was not found.", LOG_WARNING);
1102
+            dol_syslog("A module ask to load sql files into ".$reldir." but this directory was not found.", LOG_WARNING);
1103 1103
         }
1104 1104
         return $ok;
1105 1105
     }
@@ -1115,14 +1115,14 @@  discard block
 block discarded – undo
1115 1115
     function insert_boxes($option = '')
1116 1116
     {
1117 1117
         // phpcs:enable
1118
-        include_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';
1118
+        include_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
1119 1119
 
1120 1120
         global $conf;
1121 1121
 
1122 1122
         $err = 0;
1123 1123
 
1124 1124
         if (is_array($this->boxes)) {
1125
-            dol_syslog(get_class($this) . "::insert_boxes", LOG_DEBUG);
1125
+            dol_syslog(get_class($this)."::insert_boxes", LOG_DEBUG);
1126 1126
 
1127 1127
             $pos_name = InfoBox::getListOfPagesForBoxes();
1128 1128
 
@@ -1132,18 +1132,18 @@  discard block
 block discarded – undo
1132 1132
                 $enabledbydefaulton = isset($this->boxes[$key]['enabledbydefaulton']) ? $this->boxes[$key]['enabledbydefaulton'] : 'Home';
1133 1133
 
1134 1134
                 if (empty($file)) {
1135
-                    $file = isset($this->boxes[$key][1]) ? $this->boxes[$key][1] : '';    // For backward compatibility
1135
+                    $file = isset($this->boxes[$key][1]) ? $this->boxes[$key][1] : ''; // For backward compatibility
1136 1136
                 }
1137 1137
                 if (empty($note)) {
1138
-                    $note = isset($this->boxes[$key][2]) ? $this->boxes[$key][2] : '';    // For backward compatibility
1138
+                    $note = isset($this->boxes[$key][2]) ? $this->boxes[$key][2] : ''; // For backward compatibility
1139 1139
                 }
1140 1140
 
1141 1141
                 // Search if boxes def already present
1142
-                $sql = "SELECT count(*) as nb FROM " . MAIN_DB_PREFIX . "boxes_def";
1143
-                $sql .= " WHERE file = '" . $this->db->escape($file) . "'";
1144
-                $sql .= " AND entity = " . $conf->entity;
1142
+                $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."boxes_def";
1143
+                $sql .= " WHERE file = '".$this->db->escape($file)."'";
1144
+                $sql .= " AND entity = ".$conf->entity;
1145 1145
                 if ($note) {
1146
-                    $sql .= " AND note ='" . $this->db->escape($note) . "'";
1146
+                    $sql .= " AND note ='".$this->db->escape($note)."'";
1147 1147
                 }
1148 1148
 
1149 1149
                 $result = $this->db->query($sql);
@@ -1153,31 +1153,31 @@  discard block
 block discarded – undo
1153 1153
                         $this->db->begin();
1154 1154
 
1155 1155
                         if (!$err) {
1156
-                            $sql = "INSERT INTO " . MAIN_DB_PREFIX . "boxes_def (file, entity, note)";
1157
-                            $sql .= " VALUES ('" . $this->db->escape($file) . "', ";
1158
-                            $sql .= $conf->entity . ", ";
1159
-                            $sql .= $note ? "'" . $this->db->escape($note) . "'" : "null";
1156
+                            $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (file, entity, note)";
1157
+                            $sql .= " VALUES ('".$this->db->escape($file)."', ";
1158
+                            $sql .= $conf->entity.", ";
1159
+                            $sql .= $note ? "'".$this->db->escape($note)."'" : "null";
1160 1160
                             $sql .= ")";
1161 1161
 
1162
-                            dol_syslog(get_class($this) . "::insert_boxes", LOG_DEBUG);
1162
+                            dol_syslog(get_class($this)."::insert_boxes", LOG_DEBUG);
1163 1163
                             $resql = $this->db->query($sql);
1164 1164
                             if (!$resql) {
1165 1165
                                 $err++;
1166 1166
                             }
1167 1167
                         }
1168 1168
                         if (!$err && !preg_match('/newboxdefonly/', $option)) {
1169
-                            $lastid = $this->db->last_insert_id(MAIN_DB_PREFIX . "boxes_def", "rowid");
1169
+                            $lastid = $this->db->last_insert_id(MAIN_DB_PREFIX."boxes_def", "rowid");
1170 1170
 
1171 1171
                             foreach ($pos_name as $key2 => $val2) {
1172 1172
                                 //print 'key2='.$key2.'-val2='.$val2."<br>\n";
1173 1173
                                 if ($enabledbydefaulton && $val2 != $enabledbydefaulton) {
1174
-                                    continue;        // Not enabled by default onto this page.
1174
+                                    continue; // Not enabled by default onto this page.
1175 1175
                                 }
1176 1176
 
1177
-                                $sql = "INSERT INTO " . MAIN_DB_PREFIX . "boxes (box_id,position,box_order,fk_user,entity)";
1178
-                                $sql .= " VALUES (" . $lastid . ", " . $key2 . ", '0', 0, " . $conf->entity . ")";
1177
+                                $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes (box_id,position,box_order,fk_user,entity)";
1178
+                                $sql .= " VALUES (".$lastid.", ".$key2.", '0', 0, ".$conf->entity.")";
1179 1179
 
1180
-                                dol_syslog(get_class($this) . "::insert_boxes onto page " . $key2 . "=" . $val2 . "", LOG_DEBUG);
1180
+                                dol_syslog(get_class($this)."::insert_boxes onto page ".$key2."=".$val2."", LOG_DEBUG);
1181 1181
                                 $resql = $this->db->query($sql);
1182 1182
                                 if (!$resql) {
1183 1183
                                     $err++;
@@ -1226,44 +1226,44 @@  discard block
 block discarded – undo
1226 1226
                 //print "Remove box ".$file.'<br>';
1227 1227
                 if ($file == 'box_graph_product_distribution.php') {
1228 1228
                     if (!empty($conf->produit->enabled) || !empty($conf->service->enabled)) {
1229
-                        dol_syslog("We discard disabling of module " . $file . " because another module still active require it.");
1229
+                        dol_syslog("We discard disabling of module ".$file." because another module still active require it.");
1230 1230
                         continue;
1231 1231
                     }
1232 1232
                 }
1233 1233
 
1234 1234
                 if (empty($file)) {
1235
-                    $file = isset($this->boxes[$key][1]) ? $this->boxes[$key][1] : '';    // For backward compatibility
1235
+                    $file = isset($this->boxes[$key][1]) ? $this->boxes[$key][1] : ''; // For backward compatibility
1236 1236
                 }
1237 1237
 
1238 1238
                 if ($this->db->type == 'sqlite3') {
1239 1239
                     // sqlite doesn't support "USING" syntax.
1240 1240
                     // TODO: remove this dependency.
1241
-                    $sql = "DELETE FROM " . MAIN_DB_PREFIX . "boxes ";
1242
-                    $sql .= "WHERE " . MAIN_DB_PREFIX . "boxes.box_id IN (";
1243
-                    $sql .= "SELECT " . MAIN_DB_PREFIX . "boxes_def.rowid ";
1244
-                    $sql .= "FROM " . MAIN_DB_PREFIX . "boxes_def ";
1245
-                    $sql .= "WHERE " . MAIN_DB_PREFIX . "boxes_def.file = '" . $this->db->escape($file) . "') ";
1246
-                    $sql .= "AND " . MAIN_DB_PREFIX . "boxes.entity = " . $conf->entity;
1241
+                    $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes ";
1242
+                    $sql .= "WHERE ".MAIN_DB_PREFIX."boxes.box_id IN (";
1243
+                    $sql .= "SELECT ".MAIN_DB_PREFIX."boxes_def.rowid ";
1244
+                    $sql .= "FROM ".MAIN_DB_PREFIX."boxes_def ";
1245
+                    $sql .= "WHERE ".MAIN_DB_PREFIX."boxes_def.file = '".$this->db->escape($file)."') ";
1246
+                    $sql .= "AND ".MAIN_DB_PREFIX."boxes.entity = ".$conf->entity;
1247 1247
                 } else {
1248
-                    $sql = "DELETE FROM " . MAIN_DB_PREFIX . "boxes";
1249
-                    $sql .= " USING " . MAIN_DB_PREFIX . "boxes, " . MAIN_DB_PREFIX . "boxes_def";
1250
-                    $sql .= " WHERE " . MAIN_DB_PREFIX . "boxes.box_id = " . MAIN_DB_PREFIX . "boxes_def.rowid";
1251
-                    $sql .= " AND " . MAIN_DB_PREFIX . "boxes_def.file = '" . $this->db->escape($file) . "'";
1252
-                    $sql .= " AND " . MAIN_DB_PREFIX . "boxes.entity = " . $conf->entity;
1248
+                    $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes";
1249
+                    $sql .= " USING ".MAIN_DB_PREFIX."boxes, ".MAIN_DB_PREFIX."boxes_def";
1250
+                    $sql .= " WHERE ".MAIN_DB_PREFIX."boxes.box_id = ".MAIN_DB_PREFIX."boxes_def.rowid";
1251
+                    $sql .= " AND ".MAIN_DB_PREFIX."boxes_def.file = '".$this->db->escape($file)."'";
1252
+                    $sql .= " AND ".MAIN_DB_PREFIX."boxes.entity = ".$conf->entity;
1253 1253
                 }
1254 1254
 
1255
-                dol_syslog(get_class($this) . "::delete_boxes", LOG_DEBUG);
1255
+                dol_syslog(get_class($this)."::delete_boxes", LOG_DEBUG);
1256 1256
                 $resql = $this->db->query($sql);
1257 1257
                 if (!$resql) {
1258 1258
                     $this->error = $this->db->lasterror();
1259 1259
                     $err++;
1260 1260
                 }
1261 1261
 
1262
-                $sql = "DELETE FROM " . MAIN_DB_PREFIX . "boxes_def";
1263
-                $sql .= " WHERE file = '" . $this->db->escape($file) . "'";
1264
-                $sql .= " AND entity = " . $conf->entity;
1262
+                $sql = "DELETE FROM ".MAIN_DB_PREFIX."boxes_def";
1263
+                $sql .= " WHERE file = '".$this->db->escape($file)."'";
1264
+                $sql .= " AND entity = ".$conf->entity;
1265 1265
 
1266
-                dol_syslog(get_class($this) . "::delete_boxes", LOG_DEBUG);
1266
+                dol_syslog(get_class($this)."::delete_boxes", LOG_DEBUG);
1267 1267
                 $resql = $this->db->query($sql);
1268 1268
                 if (!$resql) {
1269 1269
                     $this->error = $this->db->lasterror();
@@ -1284,14 +1284,14 @@  discard block
 block discarded – undo
1284 1284
     function insert_cronjobs()
1285 1285
     {
1286 1286
         // phpcs:enable
1287
-        include_once DOL_DOCUMENT_ROOT . '/core/class/infobox.class.php';
1287
+        include_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php';
1288 1288
 
1289 1289
         global $conf;
1290 1290
 
1291 1291
         $err = 0;
1292 1292
 
1293 1293
         if (is_array($this->cronjobs)) {
1294
-            dol_syslog(get_class($this) . "::insert_cronjobs", LOG_DEBUG);
1294
+            dol_syslog(get_class($this)."::insert_cronjobs", LOG_DEBUG);
1295 1295
 
1296 1296
             foreach ($this->cronjobs as $key => $value) {
1297 1297
                 $entity = isset($this->cronjobs[$key]['entity']) ? $this->cronjobs[$key]['entity'] : $conf->entity;
@@ -1309,23 +1309,23 @@  discard block
 block discarded – undo
1309 1309
                 $datestart = isset($this->cronjobs[$key]['datestart']) ? $this->cronjobs[$key]['datestart'] : '';
1310 1310
                 $dateend = isset($this->cronjobs[$key]['dateend']) ? $this->cronjobs[$key]['dateend'] : '';
1311 1311
                 $status = isset($this->cronjobs[$key]['status']) ? $this->cronjobs[$key]['status'] : '';
1312
-                $test = isset($this->cronjobs[$key]['test']) ? $this->cronjobs[$key]['test'] : '';                    // Line must be enabled or not (so visible or not)
1312
+                $test = isset($this->cronjobs[$key]['test']) ? $this->cronjobs[$key]['test'] : ''; // Line must be enabled or not (so visible or not)
1313 1313
                 // Search if cron entry already present
1314
-                $sql = "SELECT count(*) as nb FROM " . MAIN_DB_PREFIX . "cronjob";
1315
-                $sql .= " WHERE module_name = '" . $this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class) . "'";
1314
+                $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."cronjob";
1315
+                $sql .= " WHERE module_name = '".$this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class)."'";
1316 1316
                 if ($class) {
1317
-                    $sql .= " AND classesname = '" . $this->db->escape($class) . "'";
1317
+                    $sql .= " AND classesname = '".$this->db->escape($class)."'";
1318 1318
                 }
1319 1319
                 if ($objectname) {
1320
-                    $sql .= " AND objectname = '" . $this->db->escape($objectname) . "'";
1320
+                    $sql .= " AND objectname = '".$this->db->escape($objectname)."'";
1321 1321
                 }
1322 1322
                 if ($method) {
1323
-                    $sql .= " AND methodename = '" . $this->db->escape($method) . "'";
1323
+                    $sql .= " AND methodename = '".$this->db->escape($method)."'";
1324 1324
                 }
1325 1325
                 if ($command) {
1326
-                    $sql .= " AND command = '" . $this->db->escape($command) . "'";
1326
+                    $sql .= " AND command = '".$this->db->escape($command)."'";
1327 1327
                 }
1328
-                $sql .= " AND entity = " . $entity;    // Must be exact entity
1328
+                $sql .= " AND entity = ".$entity; // Must be exact entity
1329 1329
 
1330 1330
                 $now = dol_now();
1331 1331
 
@@ -1336,7 +1336,7 @@  discard block
 block discarded – undo
1336 1336
                         $this->db->begin();
1337 1337
 
1338 1338
                         if (!$err) {
1339
-                            $sql = "INSERT INTO " . MAIN_DB_PREFIX . "cronjob (module_name, datec, datestart, dateend, label, jobtype, classesname, objectname, methodename, command, params, note,";
1339
+                            $sql = "INSERT INTO ".MAIN_DB_PREFIX."cronjob (module_name, datec, datestart, dateend, label, jobtype, classesname, objectname, methodename, command, params, note,";
1340 1340
                             if (is_int($frequency)) {
1341 1341
                                 $sql .= ' frequency,';
1342 1342
                             }
@@ -1351,32 +1351,32 @@  discard block
 block discarded – undo
1351 1351
                             }
1352 1352
                             $sql .= " entity, test)";
1353 1353
                             $sql .= " VALUES (";
1354
-                            $sql .= "'" . $this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class) . "', ";
1355
-                            $sql .= "'" . $this->db->idate($now) . "', ";
1356
-                            $sql .= ($datestart ? "'" . $this->db->idate($datestart) . "'" : "'" . $this->db->idate($now) . "'") . ", ";
1357
-                            $sql .= ($dateend ? "'" . $this->db->idate($dateend) . "'" : "NULL") . ", ";
1358
-                            $sql .= "'" . $this->db->escape($label) . "', ";
1359
-                            $sql .= "'" . $this->db->escape($jobtype) . "', ";
1360
-                            $sql .= ($class ? "'" . $this->db->escape($class) . "'" : "null") . ",";
1361
-                            $sql .= ($objectname ? "'" . $this->db->escape($objectname) . "'" : "null") . ",";
1362
-                            $sql .= ($method ? "'" . $this->db->escape($method) . "'" : "null") . ",";
1363
-                            $sql .= ($command ? "'" . $this->db->escape($command) . "'" : "null") . ",";
1364
-                            $sql .= ($parameters ? "'" . $this->db->escape($parameters) . "'" : "null") . ",";
1365
-                            $sql .= ($comment ? "'" . $this->db->escape($comment) . "'" : "null") . ",";
1354
+                            $sql .= "'".$this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class)."', ";
1355
+                            $sql .= "'".$this->db->idate($now)."', ";
1356
+                            $sql .= ($datestart ? "'".$this->db->idate($datestart)."'" : "'".$this->db->idate($now)."'").", ";
1357
+                            $sql .= ($dateend ? "'".$this->db->idate($dateend)."'" : "NULL").", ";
1358
+                            $sql .= "'".$this->db->escape($label)."', ";
1359
+                            $sql .= "'".$this->db->escape($jobtype)."', ";
1360
+                            $sql .= ($class ? "'".$this->db->escape($class)."'" : "null").",";
1361
+                            $sql .= ($objectname ? "'".$this->db->escape($objectname)."'" : "null").",";
1362
+                            $sql .= ($method ? "'".$this->db->escape($method)."'" : "null").",";
1363
+                            $sql .= ($command ? "'".$this->db->escape($command)."'" : "null").",";
1364
+                            $sql .= ($parameters ? "'".$this->db->escape($parameters)."'" : "null").",";
1365
+                            $sql .= ($comment ? "'".$this->db->escape($comment)."'" : "null").",";
1366 1366
                             if (is_int($frequency)) {
1367
-                                $sql .= "'" . $this->db->escape($frequency) . "', ";
1367
+                                $sql .= "'".$this->db->escape($frequency)."', ";
1368 1368
                             }
1369 1369
                             if (is_int($unitfrequency)) {
1370
-                                $sql .= "'" . $this->db->escape($unitfrequency) . "', ";
1370
+                                $sql .= "'".$this->db->escape($unitfrequency)."', ";
1371 1371
                             }
1372 1372
                             if (is_int($priority)) {
1373
-                                $sql .= "'" . $this->db->escape($priority) . "', ";
1373
+                                $sql .= "'".$this->db->escape($priority)."', ";
1374 1374
                             }
1375 1375
                             if (is_int($status)) {
1376
-                                $sql .= "'" . $this->db->escape($status) . "', ";
1376
+                                $sql .= "'".$this->db->escape($status)."', ";
1377 1377
                             }
1378
-                            $sql .= $entity . ",";
1379
-                            $sql .= "'" . $this->db->escape($test) . "'";
1378
+                            $sql .= $entity.",";
1379
+                            $sql .= "'".$this->db->escape($test)."'";
1380 1380
                             $sql .= ")";
1381 1381
 
1382 1382
                             $resql = $this->db->query($sql);
@@ -1417,13 +1417,13 @@  discard block
 block discarded – undo
1417 1417
         $err = 0;
1418 1418
 
1419 1419
         if (is_array($this->cronjobs)) {
1420
-            $sql = "DELETE FROM " . MAIN_DB_PREFIX . "cronjob";
1421
-            $sql .= " WHERE module_name = '" . $this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class) . "'";
1422
-            $sql .= " AND entity = " . $conf->entity;
1423
-            $sql .= " AND test = '1'";        // We delete on lines that are not set with a complete test that is '$conf->module->enabled' so when module is disabled, the cron is also removed.
1420
+            $sql = "DELETE FROM ".MAIN_DB_PREFIX."cronjob";
1421
+            $sql .= " WHERE module_name = '".$this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class)."'";
1422
+            $sql .= " AND entity = ".$conf->entity;
1423
+            $sql .= " AND test = '1'"; // We delete on lines that are not set with a complete test that is '$conf->module->enabled' so when module is disabled, the cron is also removed.
1424 1424
             // For crons declared with a '$conf->module->enabled', there is no need to delete the line, so we don't loose setup if we reenable module.
1425 1425
 
1426
-            dol_syslog(get_class($this) . "::delete_cronjobs", LOG_DEBUG);
1426
+            dol_syslog(get_class($this)."::delete_cronjobs", LOG_DEBUG);
1427 1427
             $resql = $this->db->query($sql);
1428 1428
             if (!$resql) {
1429 1429
                 $this->error = $this->db->lasterror();
@@ -1447,11 +1447,11 @@  discard block
 block discarded – undo
1447 1447
 
1448 1448
         $err = 0;
1449 1449
 
1450
-        $sql = "DELETE FROM " . MAIN_DB_PREFIX . "const";
1451
-        $sql .= " WHERE " . $this->db->decrypt('name') . " like '" . $this->db->escape($this->const_name) . "_TABS_%'";
1452
-        $sql .= " AND entity = " . $conf->entity;
1450
+        $sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
1451
+        $sql .= " WHERE ".$this->db->decrypt('name')." like '".$this->db->escape($this->const_name)."_TABS_%'";
1452
+        $sql .= " AND entity = ".$conf->entity;
1453 1453
 
1454
-        dol_syslog(get_class($this) . "::delete_tabs", LOG_DEBUG);
1454
+        dol_syslog(get_class($this)."::delete_tabs", LOG_DEBUG);
1455 1455
         if (!$this->db->query($sql)) {
1456 1456
             $this->error = $this->db->lasterror();
1457 1457
             $err++;
@@ -1474,12 +1474,12 @@  discard block
 block discarded – undo
1474 1474
         $err = 0;
1475 1475
 
1476 1476
         if (!empty($this->tabs)) {
1477
-            dol_syslog(get_class($this) . "::insert_tabs", LOG_DEBUG);
1477
+            dol_syslog(get_class($this)."::insert_tabs", LOG_DEBUG);
1478 1478
 
1479 1479
             $i = 0;
1480 1480
             foreach ($this->tabs as $key => $value) {
1481 1481
                 if (is_array($value) && count($value) == 0) {
1482
-                    continue;    // Discard empty arrays
1482
+                    continue; // Discard empty arrays
1483 1483
                 }
1484 1484
 
1485 1485
                 $entity = $conf->entity;
@@ -1493,7 +1493,7 @@  discard block
 block discarded – undo
1493 1493
                 }
1494 1494
 
1495 1495
                 if ($newvalue) {
1496
-                    $sql = "INSERT INTO " . MAIN_DB_PREFIX . "const (";
1496
+                    $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
1497 1497
                     $sql .= "name";
1498 1498
                     $sql .= ", type";
1499 1499
                     $sql .= ", value";
@@ -1502,12 +1502,12 @@  discard block
 block discarded – undo
1502 1502
                     $sql .= ", entity";
1503 1503
                     $sql .= ")";
1504 1504
                     $sql .= " VALUES (";
1505
-                    $sql .= $this->db->encrypt($this->const_name . "_TABS_" . $i, 1);
1505
+                    $sql .= $this->db->encrypt($this->const_name."_TABS_".$i, 1);
1506 1506
                     $sql .= ", 'chaine'";
1507
-                    $sql .= ", " . $this->db->encrypt($newvalue, 1);
1507
+                    $sql .= ", ".$this->db->encrypt($newvalue, 1);
1508 1508
                     $sql .= ", null";
1509 1509
                     $sql .= ", '0'";
1510
-                    $sql .= ", " . $entity;
1510
+                    $sql .= ", ".$entity;
1511 1511
                     $sql .= ")";
1512 1512
 
1513 1513
                     $resql = $this->db->query($sql);
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
             return 0;
1545 1545
         }
1546 1546
 
1547
-        dol_syslog(get_class($this) . "::insert_const", LOG_DEBUG);
1547
+        dol_syslog(get_class($this)."::insert_const", LOG_DEBUG);
1548 1548
 
1549 1549
         foreach ($this->const as $key => $value) {
1550 1550
             $name = $this->const[$key][0];
@@ -1563,30 +1563,30 @@  discard block
 block discarded – undo
1563 1563
             }
1564 1564
 
1565 1565
             $sql = "SELECT count(*)";
1566
-            $sql .= " FROM " . MAIN_DB_PREFIX . "const";
1567
-            $sql .= " WHERE " . $this->db->decrypt('name') . " = '" . $this->db->escape($name) . "'";
1568
-            $sql .= " AND entity = " . $entity;
1566
+            $sql .= " FROM ".MAIN_DB_PREFIX."const";
1567
+            $sql .= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($name)."'";
1568
+            $sql .= " AND entity = ".$entity;
1569 1569
 
1570 1570
             $result = $this->db->query($sql);
1571 1571
             if ($result) {
1572 1572
                 $row = $this->db->fetch_row($result);
1573 1573
 
1574 1574
                 if ($row[0] == 0) {   // If not found
1575
-                    $sql = "INSERT INTO " . MAIN_DB_PREFIX . "const (name,type,value,note,visible,entity)";
1575
+                    $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,type,value,note,visible,entity)";
1576 1576
                     $sql .= " VALUES (";
1577 1577
                     $sql .= $this->db->encrypt($name, 1);
1578
-                    $sql .= ",'" . $type . "'";
1579
-                    $sql .= "," . (($val != '') ? $this->db->encrypt($val, 1) : "''");
1580
-                    $sql .= "," . ($note ? "'" . $this->db->escape($note) . "'" : "null");
1581
-                    $sql .= ",'" . $visible . "'";
1582
-                    $sql .= "," . $entity;
1578
+                    $sql .= ",'".$type."'";
1579
+                    $sql .= ",".(($val != '') ? $this->db->encrypt($val, 1) : "''");
1580
+                    $sql .= ",".($note ? "'".$this->db->escape($note)."'" : "null");
1581
+                    $sql .= ",'".$visible."'";
1582
+                    $sql .= ",".$entity;
1583 1583
                     $sql .= ")";
1584 1584
 
1585 1585
                     if (!$this->db->query($sql)) {
1586 1586
                         $err++;
1587 1587
                     }
1588 1588
                 } else {
1589
-                    dol_syslog(get_class($this) . "::insert_const constant '" . $name . "' already exists", LOG_WARNING);
1589
+                    dol_syslog(get_class($this)."::insert_const constant '".$name."' already exists", LOG_WARNING);
1590 1590
                 }
1591 1591
             } else {
1592 1592
                 $err++;
@@ -1618,10 +1618,10 @@  discard block
 block discarded – undo
1618 1618
             $deleteonunactive = (!empty($this->const[$key][6])) ? 1 : 0;
1619 1619
 
1620 1620
             if ($deleteonunactive) {
1621
-                $sql = "DELETE FROM " . MAIN_DB_PREFIX . "const";
1622
-                $sql .= " WHERE " . $this->db->decrypt('name') . " = '" . $name . "'";
1623
-                $sql .= " AND entity in (0, " . $conf->entity . ")";
1624
-                dol_syslog(get_class($this) . "::delete_const", LOG_DEBUG);
1621
+                $sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
1622
+                $sql .= " WHERE ".$this->db->decrypt('name')." = '".$name."'";
1623
+                $sql .= " AND entity in (0, ".$conf->entity.")";
1624
+                dol_syslog(get_class($this)."::delete_const", LOG_DEBUG);
1625 1625
                 if (!$this->db->query($sql)) {
1626 1626
                     $this->error = $this->db->lasterror();
1627 1627
                     $err++;
@@ -1649,13 +1649,13 @@  discard block
 block discarded – undo
1649 1649
         $err = 0;
1650 1650
         $entity = (!empty($force_entity) ? $force_entity : $conf->entity);
1651 1651
 
1652
-        dol_syslog(get_class($this) . "::insert_permissions", LOG_DEBUG);
1652
+        dol_syslog(get_class($this)."::insert_permissions", LOG_DEBUG);
1653 1653
 
1654 1654
         // Test if module is activated
1655
-        $sql_del = "SELECT " . $this->db->decrypt('value') . " as value";
1656
-        $sql_del .= " FROM " . MAIN_DB_PREFIX . "const";
1657
-        $sql_del .= " WHERE " . $this->db->decrypt('name') . " = '" . $this->db->escape($this->const_name) . "'";
1658
-        $sql_del .= " AND entity IN (0," . $entity . ")";
1655
+        $sql_del = "SELECT ".$this->db->decrypt('value')." as value";
1656
+        $sql_del .= " FROM ".MAIN_DB_PREFIX."const";
1657
+        $sql_del .= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
1658
+        $sql_del .= " AND entity IN (0,".$entity.")";
1659 1659
 
1660 1660
         $resql = $this->db->query($sql_del);
1661 1661
 
@@ -1677,8 +1677,8 @@  discard block
 block discarded – undo
1677 1677
                     }
1678 1678
 
1679 1679
                     // Search if perm already present
1680
-                    $sql = "SELECT count(*) as nb FROM " . MAIN_DB_PREFIX . "rights_def";
1681
-                    $sql .= " WHERE id = " . $r_id . " AND entity = " . $entity;
1680
+                    $sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."rights_def";
1681
+                    $sql .= " WHERE id = ".$r_id." AND entity = ".$entity;
1682 1682
 
1683 1683
                     $resqlselect = $this->db->query($sql);
1684 1684
                     if ($resqlselect) {
@@ -1686,21 +1686,21 @@  discard block
 block discarded – undo
1686 1686
                         if ($objcount && $objcount->nb == 0) {
1687 1687
                             if (dol_strlen($r_perms)) {
1688 1688
                                 if (dol_strlen($r_subperms)) {
1689
-                                    $sql = "INSERT INTO " . MAIN_DB_PREFIX . "rights_def";
1689
+                                    $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def";
1690 1690
                                     $sql .= " (id, entity, libelle, module, type, bydefault, perms, subperms)";
1691 1691
                                     $sql .= " VALUES ";
1692
-                                    $sql .= "(" . $r_id . "," . $entity . ",'" . $this->db->escape($r_desc) . "','" . $r_modul . "','" . $r_type . "'," . $r_def . ",'" . $r_perms . "','" . $r_subperms . "')";
1692
+                                    $sql .= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."','".$r_subperms."')";
1693 1693
                                 } else {
1694
-                                    $sql = "INSERT INTO " . MAIN_DB_PREFIX . "rights_def";
1694
+                                    $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def";
1695 1695
                                     $sql .= " (id, entity, libelle, module, type, bydefault, perms)";
1696 1696
                                     $sql .= " VALUES ";
1697
-                                    $sql .= "(" . $r_id . "," . $entity . ",'" . $this->db->escape($r_desc) . "','" . $r_modul . "','" . $r_type . "'," . $r_def . ",'" . $r_perms . "')";
1697
+                                    $sql .= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."')";
1698 1698
                                 }
1699 1699
                             } else {
1700
-                                $sql = "INSERT INTO " . MAIN_DB_PREFIX . "rights_def ";
1700
+                                $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def ";
1701 1701
                                 $sql .= " (id, entity, libelle, module, type, bydefault)";
1702 1702
                                 $sql .= " VALUES ";
1703
-                                $sql .= "(" . $r_id . "," . $entity . ",'" . $this->db->escape($r_desc) . "','" . $r_modul . "','" . $r_type . "'," . $r_def . ")";
1703
+                                $sql .= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.")";
1704 1704
                             }
1705 1705
 
1706 1706
                             $resqlinsert = $this->db->query($sql, 1);
@@ -1711,7 +1711,7 @@  discard block
 block discarded – undo
1711 1711
                                     $err++;
1712 1712
                                     break;
1713 1713
                                 } else {
1714
-                                    dol_syslog(get_class($this) . "::insert_permissions record already exists", LOG_INFO);
1714
+                                    dol_syslog(get_class($this)."::insert_permissions record already exists", LOG_INFO);
1715 1715
                                 }
1716 1716
                             }
1717 1717
 
@@ -1724,24 +1724,24 @@  discard block
 block discarded – undo
1724 1724
                     // If we want to init permissions on admin users
1725 1725
                     if ($reinitadminperms) {
1726 1726
                         if (!class_exists('User')) {
1727
-                            include_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php';
1727
+                            include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
1728 1728
                         }
1729
-                        $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "user WHERE admin = 1";
1730
-                        dol_syslog(get_class($this) . "::insert_permissions Search all admin users", LOG_DEBUG);
1729
+                        $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."user WHERE admin = 1";
1730
+                        dol_syslog(get_class($this)."::insert_permissions Search all admin users", LOG_DEBUG);
1731 1731
                         $resqlseladmin = $this->db->query($sql, 1);
1732 1732
                         if ($resqlseladmin) {
1733 1733
                             $num = $this->db->num_rows($resqlseladmin);
1734 1734
                             $i = 0;
1735 1735
                             while ($i < $num) {
1736 1736
                                 $obj2 = $this->db->fetch_object($resqlseladmin);
1737
-                                dol_syslog(get_class($this) . "::insert_permissions Add permission to user id=" . $obj2->rowid);
1737
+                                dol_syslog(get_class($this)."::insert_permissions Add permission to user id=".$obj2->rowid);
1738 1738
 
1739 1739
                                 $tmpuser = new User($this->db);
1740 1740
                                 $result = $tmpuser->fetch($obj2->rowid);
1741 1741
                                 if ($result > 0) {
1742 1742
                                     $tmpuser->addrights($r_id, '', '', 0, 1);
1743 1743
                                 } else {
1744
-                                    dol_syslog(get_class($this) . "::insert_permissions Failed to add the permission to user because fetch return an error", LOG_ERR);
1744
+                                    dol_syslog(get_class($this)."::insert_permissions Failed to add the permission to user because fetch return an error", LOG_ERR);
1745 1745
                                 }
1746 1746
                                 $i++;
1747 1747
                             }
@@ -1779,10 +1779,10 @@  discard block
 block discarded – undo
1779 1779
 
1780 1780
         $err = 0;
1781 1781
 
1782
-        $sql = "DELETE FROM " . MAIN_DB_PREFIX . "rights_def";
1783
-        $sql .= " WHERE module = '" . $this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class) . "'";
1784
-        $sql .= " AND entity = " . $conf->entity;
1785
-        dol_syslog(get_class($this) . "::delete_permissions", LOG_DEBUG);
1782
+        $sql = "DELETE FROM ".MAIN_DB_PREFIX."rights_def";
1783
+        $sql .= " WHERE module = '".$this->db->escape(empty($this->rights_class) ? strtolower($this->name) : $this->rights_class)."'";
1784
+        $sql .= " AND entity = ".$conf->entity;
1785
+        dol_syslog(get_class($this)."::delete_permissions", LOG_DEBUG);
1786 1786
         if (!$this->db->query($sql)) {
1787 1787
             $this->error = $this->db->lasterror();
1788 1788
             $err++;
@@ -1806,9 +1806,9 @@  discard block
 block discarded – undo
1806 1806
             return 0;
1807 1807
         }
1808 1808
 
1809
-        include_once DOL_DOCUMENT_ROOT . '/core/class/menubase.class.php';
1809
+        include_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
1810 1810
 
1811
-        dol_syslog(get_class($this) . "::insert_menus", LOG_DEBUG);
1811
+        dol_syslog(get_class($this)."::insert_menus", LOG_DEBUG);
1812 1812
 
1813 1813
         $err = 0;
1814 1814
 
@@ -1845,7 +1845,7 @@  discard block
 block discarded – undo
1845 1845
                 }
1846 1846
                 if (!$foundparent) {
1847 1847
                     $this->error = "ErrorBadDefinitionOfMenuArrayInModuleDescriptor";
1848
-                    dol_syslog(get_class($this) . "::insert_menus " . $this->error . " " . $this->menu[$key]['fk_menu'], LOG_ERR);
1848
+                    dol_syslog(get_class($this)."::insert_menus ".$this->error." ".$this->menu[$key]['fk_menu'], LOG_ERR);
1849 1849
                     $err++;
1850 1850
                 }
1851 1851
             }
@@ -1863,12 +1863,12 @@  discard block
 block discarded – undo
1863 1863
             $menu->position = $this->menu[$key]['position'];
1864 1864
 
1865 1865
             if (!$err) {
1866
-                $result = $menu->create($user);    // Save menu entry into table llx_menu
1866
+                $result = $menu->create($user); // Save menu entry into table llx_menu
1867 1867
                 if ($result > 0) {
1868 1868
                     $this->menu[$key]['rowid'] = $result;
1869 1869
                 } else {
1870 1870
                     $this->error = $menu->error;
1871
-                    dol_syslog(get_class($this) . '::insert_menus result=' . $result . " " . $this->error, LOG_ERR);
1871
+                    dol_syslog(get_class($this).'::insert_menus result='.$result." ".$this->error, LOG_ERR);
1872 1872
                     $err++;
1873 1873
                     break;
1874 1874
                 }
@@ -1878,7 +1878,7 @@  discard block
 block discarded – undo
1878 1878
         if (!$err) {
1879 1879
             $this->db->commit();
1880 1880
         } else {
1881
-            dol_syslog(get_class($this) . "::insert_menus " . $this->error, LOG_ERR);
1881
+            dol_syslog(get_class($this)."::insert_menus ".$this->error, LOG_ERR);
1882 1882
             $this->db->rollback();
1883 1883
         }
1884 1884
 
@@ -1901,11 +1901,11 @@  discard block
 block discarded – undo
1901 1901
         //$module=strtolower($this->name);        TODO When right_class will be same than module name
1902 1902
         $module = empty($this->rights_class) ? strtolower($this->name) : $this->rights_class;
1903 1903
 
1904
-        $sql = "DELETE FROM " . MAIN_DB_PREFIX . "menu";
1905
-        $sql .= " WHERE module = '" . $this->db->escape($module) . "'";
1906
-        $sql .= " AND entity = " . $conf->entity;
1904
+        $sql = "DELETE FROM ".MAIN_DB_PREFIX."menu";
1905
+        $sql .= " WHERE module = '".$this->db->escape($module)."'";
1906
+        $sql .= " AND entity = ".$conf->entity;
1907 1907
 
1908
-        dol_syslog(get_class($this) . "::delete_menus", LOG_DEBUG);
1908
+        dol_syslog(get_class($this)."::delete_menus", LOG_DEBUG);
1909 1909
         $resql = $this->db->query($sql);
1910 1910
         if (!$resql) {
1911 1911
             $this->error = $this->db->lasterror();
@@ -1933,35 +1933,35 @@  discard block
 block discarded – undo
1933 1933
                 $addtodatabase = 0;
1934 1934
 
1935 1935
                 if (!is_array($value)) {
1936
-                    $dir = $value;    // Default simple mode
1936
+                    $dir = $value; // Default simple mode
1937 1937
                 } else {
1938
-                    $constname = $this->const_name . "_DIR_";
1938
+                    $constname = $this->const_name."_DIR_";
1939 1939
                     $dir = $this->dirs[$key][1];
1940 1940
                     $addtodatabase = empty($this->dirs[$key][2]) ? '' : $this->dirs[$key][2]; // Create constante in llx_const
1941 1941
                     $subname = empty($this->dirs[$key][3]) ? '' : strtoupper($this->dirs[$key][3]); // Add submodule name (ex: $conf->module->submodule->dir_output)
1942 1942
                     $forcename = empty($this->dirs[$key][4]) ? '' : strtoupper($this->dirs[$key][4]); // Change the module name if different
1943 1943
 
1944 1944
                     if (!empty($forcename)) {
1945
-                        $constname = 'MAIN_MODULE_' . $forcename . "_DIR_";
1945
+                        $constname = 'MAIN_MODULE_'.$forcename."_DIR_";
1946 1946
                     }
1947 1947
                     if (!empty($subname)) {
1948
-                        $constname = $constname . $subname . "_";
1948
+                        $constname = $constname.$subname."_";
1949 1949
                     }
1950 1950
 
1951
-                    $name = $constname . strtoupper($this->dirs[$key][0]);
1951
+                    $name = $constname.strtoupper($this->dirs[$key][0]);
1952 1952
                 }
1953 1953
 
1954 1954
                 // Define directory full path ($dir must start with "/")
1955 1955
                 if (empty($conf->global->MAIN_MODULE_MULTICOMPANY) || $conf->entity == 1) {
1956
-                    $fulldir = DOL_DATA_ROOT . $dir;
1956
+                    $fulldir = DOL_DATA_ROOT.$dir;
1957 1957
                 } else {
1958
-                    $fulldir = DOL_DATA_ROOT . "/" . $conf->entity . $dir;
1958
+                    $fulldir = DOL_DATA_ROOT."/".$conf->entity.$dir;
1959 1959
                 }
1960 1960
                 // Create dir if it does not exists
1961 1961
                 if (!empty($fulldir) && !file_exists($fulldir)) {
1962 1962
                     if (dol_mkdir($fulldir, DOL_DATA_ROOT) < 0) {
1963 1963
                         $this->error = $langs->trans("ErrorCanNotCreateDir", $fulldir);
1964
-                        dol_syslog(get_class($this) . "::_init " . $this->error, LOG_ERR);
1964
+                        dol_syslog(get_class($this)."::_init ".$this->error, LOG_ERR);
1965 1965
                         $err++;
1966 1966
                     }
1967 1967
                 }
@@ -1996,20 +1996,20 @@  discard block
 block discarded – undo
1996 1996
         $err = 0;
1997 1997
 
1998 1998
         $sql = "SELECT count(*)";
1999
-        $sql .= " FROM " . MAIN_DB_PREFIX . "const";
2000
-        $sql .= " WHERE " . $this->db->decrypt('name') . " = '" . $name . "'";
2001
-        $sql .= " AND entity = " . $conf->entity;
1999
+        $sql .= " FROM ".MAIN_DB_PREFIX."const";
2000
+        $sql .= " WHERE ".$this->db->decrypt('name')." = '".$name."'";
2001
+        $sql .= " AND entity = ".$conf->entity;
2002 2002
 
2003
-        dol_syslog(get_class($this) . "::insert_dirs", LOG_DEBUG);
2003
+        dol_syslog(get_class($this)."::insert_dirs", LOG_DEBUG);
2004 2004
         $result = $this->db->query($sql);
2005 2005
         if ($result) {
2006 2006
             $row = $this->db->fetch_row($result);
2007 2007
 
2008 2008
             if ($row[0] == 0) {
2009
-                $sql = "INSERT INTO " . MAIN_DB_PREFIX . "const (name,type,value,note,visible,entity)";
2010
-                $sql .= " VALUES (" . $this->db->encrypt($name, 1) . ",'chaine'," . $this->db->encrypt($dir, 1) . ",'Directory for module " . $this->name . "','0'," . $conf->entity . ")";
2009
+                $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (name,type,value,note,visible,entity)";
2010
+                $sql .= " VALUES (".$this->db->encrypt($name, 1).",'chaine',".$this->db->encrypt($dir, 1).",'Directory for module ".$this->name."','0',".$conf->entity.")";
2011 2011
 
2012
-                dol_syslog(get_class($this) . "::insert_dirs", LOG_DEBUG);
2012
+                dol_syslog(get_class($this)."::insert_dirs", LOG_DEBUG);
2013 2013
                 $this->db->query($sql);
2014 2014
             }
2015 2015
         } else {
@@ -2033,11 +2033,11 @@  discard block
 block discarded – undo
2033 2033
 
2034 2034
         $err = 0;
2035 2035
 
2036
-        $sql = "DELETE FROM " . MAIN_DB_PREFIX . "const";
2037
-        $sql .= " WHERE " . $this->db->decrypt('name') . " LIKE '" . $this->db->escape($this->const_name) . "_DIR_%'";
2038
-        $sql .= " AND entity = " . $conf->entity;
2036
+        $sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
2037
+        $sql .= " WHERE ".$this->db->decrypt('name')." LIKE '".$this->db->escape($this->const_name)."_DIR_%'";
2038
+        $sql .= " AND entity = ".$conf->entity;
2039 2039
 
2040
-        dol_syslog(get_class($this) . "::delete_dirs", LOG_DEBUG);
2040
+        dol_syslog(get_class($this)."::delete_dirs", LOG_DEBUG);
2041 2041
         if (!$this->db->query($sql)) {
2042 2042
             $this->error = $this->db->lasterror();
2043 2043
             $err++;
@@ -2062,7 +2062,7 @@  discard block
 block discarded – undo
2062 2062
         if (is_array($this->module_parts) && !empty($this->module_parts)) {
2063 2063
             foreach ($this->module_parts as $key => $value) {
2064 2064
                 if (is_array($value) && count($value) == 0) {
2065
-                    continue;    // Discard empty arrays
2065
+                    continue; // Discard empty arrays
2066 2066
                 }
2067 2067
 
2068 2068
                 $entity = $conf->entity; // Reset the current entity
@@ -2087,7 +2087,7 @@  discard block
 block discarded – undo
2087 2087
                     }
2088 2088
                 }
2089 2089
 
2090
-                $sql = "INSERT INTO " . MAIN_DB_PREFIX . "const (";
2090
+                $sql = "INSERT INTO ".MAIN_DB_PREFIX."const (";
2091 2091
                 $sql .= "name";
2092 2092
                 $sql .= ", type";
2093 2093
                 $sql .= ", value";
@@ -2096,15 +2096,15 @@  discard block
 block discarded – undo
2096 2096
                 $sql .= ", entity";
2097 2097
                 $sql .= ")";
2098 2098
                 $sql .= " VALUES (";
2099
-                $sql .= $this->db->encrypt($this->const_name . "_" . strtoupper($key), 1);
2099
+                $sql .= $this->db->encrypt($this->const_name."_".strtoupper($key), 1);
2100 2100
                 $sql .= ", 'chaine'";
2101
-                $sql .= ", " . $this->db->encrypt($newvalue, 1);
2101
+                $sql .= ", ".$this->db->encrypt($newvalue, 1);
2102 2102
                 $sql .= ", null";
2103 2103
                 $sql .= ", '0'";
2104
-                $sql .= ", " . $entity;
2104
+                $sql .= ", ".$entity;
2105 2105
                 $sql .= ")";
2106 2106
 
2107
-                dol_syslog(get_class($this) . "::insert_module_parts for key=" . $this->const_name . "_" . strtoupper($key), LOG_DEBUG);
2107
+                dol_syslog(get_class($this)."::insert_module_parts for key=".$this->const_name."_".strtoupper($key), LOG_DEBUG);
2108 2108
 
2109 2109
                 $resql = $this->db->query($sql, 1);
2110 2110
                 if (!$resql) {
@@ -2112,7 +2112,7 @@  discard block
 block discarded – undo
2112 2112
                         $error++;
2113 2113
                         $this->error = $this->db->lasterror();
2114 2114
                     } else {
2115
-                        dol_syslog(get_class($this) . "::insert_module_parts for " . $this->const_name . "_" . strtoupper($key) . " Record already exists.", LOG_WARNING);
2115
+                        dol_syslog(get_class($this)."::insert_module_parts for ".$this->const_name."_".strtoupper($key)." Record already exists.", LOG_WARNING);
2116 2116
                     }
2117 2117
                 }
2118 2118
             }
@@ -2141,11 +2141,11 @@  discard block
 block discarded – undo
2141 2141
                     $entity = $value['entity'];
2142 2142
                 }
2143 2143
 
2144
-                $sql = "DELETE FROM " . MAIN_DB_PREFIX . "const";
2145
-                $sql .= " WHERE " . $this->db->decrypt('name') . " LIKE '" . $this->db->escape($this->const_name) . "_" . strtoupper($key) . "'";
2146
-                $sql .= " AND entity = " . $entity;
2144
+                $sql = "DELETE FROM ".MAIN_DB_PREFIX."const";
2145
+                $sql .= " WHERE ".$this->db->decrypt('name')." LIKE '".$this->db->escape($this->const_name)."_".strtoupper($key)."'";
2146
+                $sql .= " AND entity = ".$entity;
2147 2147
 
2148
-                dol_syslog(get_class($this) . "::delete_const_" . $key . "", LOG_DEBUG);
2148
+                dol_syslog(get_class($this)."::delete_const_".$key."", LOG_DEBUG);
2149 2149
                 if (!$this->db->query($sql)) {
2150 2150
                     $this->error = $this->db->lasterror();
2151 2151
                     $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
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
         $inj += preg_match('/insert\s+into/i', $val);
102 102
         $inj += preg_match('/select\s+from/i', $val);
103 103
         $inj += preg_match('/into\s+(outfile|dumpfile)/i', $val);
104
-        $inj += preg_match('/user\s*\(/i', $val);      // avoid to use function user() that return current database login
105
-        $inj += preg_match('/information_schema/i', $val);    // avoid to use request that read information_schema database
104
+        $inj += preg_match('/user\s*\(/i', $val); // avoid to use function user() that return current database login
105
+        $inj += preg_match('/information_schema/i', $val); // avoid to use request that read information_schema database
106 106
     }
107 107
     if ($type == 3) {
108 108
         $inj += preg_match('/select|update|delete|replace|group\s+by|concat|count|from/i', $val);
@@ -126,15 +126,15 @@  discard block
 block discarded – undo
126 126
         $inj += preg_match('/<style/i', $val);
127 127
     }
128 128
     $inj += preg_match('/base[\s]+href/si', $val);
129
-    $inj += preg_match('/<.*onmouse/si', $val);       // onmousexxx can be set on img or any html tag like <img title='...' onmouseover=alert(1)>
130
-    $inj += preg_match('/onerror\s*=/i', $val);       // onerror can be set on img or any html tag like <img title='...' onerror = alert(1)>
131
-    $inj += preg_match('/onfocus\s*=/i', $val);       // onfocus can be set on input text html tag like <input type='text' value='...' onfocus = alert(1)>
132
-    $inj += preg_match('/onload\s*=/i', $val);        // onload can be set on svg tag <svg/onload=alert(1)> or other tag like body <body onload=alert(1)>
133
-    $inj += preg_match('/onloadstart\s*=/i', $val);   // onload can be set on audio tag <audio onloadstart=alert(1)>
134
-    $inj += preg_match('/onclick\s*=/i', $val);       // onclick can be set on img text html tag like <img onclick = alert(1)>
135
-    $inj += preg_match('/onscroll\s*=/i', $val);      // onscroll can be on textarea
129
+    $inj += preg_match('/<.*onmouse/si', $val); // onmousexxx can be set on img or any html tag like <img title='...' onmouseover=alert(1)>
130
+    $inj += preg_match('/onerror\s*=/i', $val); // onerror can be set on img or any html tag like <img title='...' onerror = alert(1)>
131
+    $inj += preg_match('/onfocus\s*=/i', $val); // onfocus can be set on input text html tag like <input type='text' value='...' onfocus = alert(1)>
132
+    $inj += preg_match('/onload\s*=/i', $val); // onload can be set on svg tag <svg/onload=alert(1)> or other tag like body <body onload=alert(1)>
133
+    $inj += preg_match('/onloadstart\s*=/i', $val); // onload can be set on audio tag <audio onloadstart=alert(1)>
134
+    $inj += preg_match('/onclick\s*=/i', $val); // onclick can be set on img text html tag like <img onclick = alert(1)>
135
+    $inj += preg_match('/onscroll\s*=/i', $val); // onscroll can be on textarea
136 136
     //$inj += preg_match('/on[A-Z][a-z]+\*=/', $val);   // To lock event handlers onAbort(), ...
137
-    $inj += preg_match('/&#58;|&#0000058|&#x3A/i', $val);  // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...'
137
+    $inj += preg_match('/&#58;|&#0000058|&#x3A/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...'
138 138
     //if ($type == 1)
139 139
     //{
140 140
     $inj += preg_match('/javascript:/i', $val);
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
     //}
143 143
     // For XSS Injection done by adding javascript closing html tags like with onmousemove, etc... (closing a src or href tag with not cleaned param)
144 144
     if ($type == 1) {
145
-        $inj += preg_match('/"/i', $val);  // We refused " in GET parameters value
145
+        $inj += preg_match('/"/i', $val); // We refused " in GET parameters value
146 146
     }
147 147
     if ($type == 2) {
148
-        $inj += preg_match('/[;"]/', $val);  // PHP_SELF is a file system path. It can contains spaces.
148
+        $inj += preg_match('/[;"]/', $val); // PHP_SELF is a file system path. It can contains spaces.
149 149
     }
150 150
     return $inj;
151 151
 }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             if (analyseVarsForSqlAndScriptsInjection($key, $type) && analyseVarsForSqlAndScriptsInjection($value, $type)) {
165 165
                 //$var[$key] = $value;	// This is useless
166 166
             } else {
167
-                print 'Access refused by SQL/Script injection protection in main.inc.php (type=' . htmlentities($type) . ' key=' . htmlentities($key) . ' value=' . htmlentities($value) . ' page=' . htmlentities($_SERVER["REQUEST_URI"]) . ')';
167
+                print 'Access refused by SQL/Script injection protection in main.inc.php (type='.htmlentities($type).' key='.htmlentities($key).' value='.htmlentities($value).' page='.htmlentities($_SERVER["REQUEST_URI"]).')';
168 168
                 exit;
169 169
             }
170 170
         }
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
 
199 199
 // This is to make Dolibarr working with Plesk
200 200
 if (!empty($_SERVER['DOCUMENT_ROOT']) && substr($_SERVER['DOCUMENT_ROOT'], -6) !== 'htdocs') {
201
-    set_include_path($_SERVER['DOCUMENT_ROOT'] . '/htdocs');
201
+    set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
202 202
 }
203 203
 
204 204
 // Include the conf.php and functions.lib.php
205
-require_once DOL_BASE_PATH . '/filefunc.inc.php';
205
+require_once DOL_BASE_PATH.'/filefunc.inc.php';
206 206
 
207 207
 // If there is a POST parameter to tell to save automatically some POST parameters into cookies, we do it.
208 208
 // This is used for example by form of boxes to save personalization of some options.
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
     $tmplist = explode(',', $tmpautoset[1]);
213 213
     $cookiearrayvalue = array();
214 214
     foreach ($tmplist as $tmpkey) {
215
-        $postkey = $tmpautoset[0] . '_' . $tmpkey;
215
+        $postkey = $tmpautoset[0].'_'.$tmpkey;
216 216
         //var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]);
217 217
         if (!empty($_POST[$postkey]))
218 218
             $cookiearrayvalue[$tmpkey] = $_POST[$postkey];
@@ -230,12 +230,12 @@  discard block
 block discarded – undo
230 230
 // Note: the function dol_getprefix may have been redefined to return a different key to manage another area to protect.
231 231
 $prefix = dol_getprefix('');
232 232
 
233
-$sessionname = 'DOLSESSID_' . $prefix;
234
-$sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix;
233
+$sessionname = 'DOLSESSID_'.$prefix;
234
+$sessiontimeout = 'DOLSESSTIMEOUT_'.$prefix;
235 235
 if (!empty($_COOKIE[$sessiontimeout]))
236 236
     ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
237 237
 session_name($sessionname);
238
-session_set_cookie_params(0, '/', null, false, true);   // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
238
+session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
239 239
 // This create lock, released when session_write_close() or end of page.
240 240
 // We need this lock as long as we read/write $_SESSION ['vars']. We can remove lock when finished.
241 241
 if (!defined('NOSESSION')) {
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
     $conf->browser->name = $tmp['browsername'];
262 262
     $conf->browser->os = $tmp['browseros'];
263 263
     $conf->browser->version = $tmp['browserversion'];
264
-    $conf->browser->layout = $tmp['layout'];     // 'classic', 'phone', 'tablet'
264
+    $conf->browser->layout = $tmp['layout']; // 'classic', 'phone', 'tablet'
265 265
     //var_dump($conf->browser);
266 266
 
267 267
     if ($conf->browser->layout == 'phone')
@@ -280,16 +280,16 @@  discard block
 block discarded – undo
280 280
                 $newurl = preg_replace('/^http:/i', 'https:', $_SERVER["SCRIPT_URI"]);
281 281
             }
282 282
         } else { // Check HTTPS environment variable (Apache/mod_ssl only)
283
-            $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT) . $_SERVER["REQUEST_URI"];
283
+            $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT).$_SERVER["REQUEST_URI"];
284 284
         }
285 285
     } else {
286 286
         // Check HTTPS environment variable (Apache/mod_ssl only)
287
-        $newurl = $conf->file->main_force_https . $_SERVER["REQUEST_URI"];
287
+        $newurl = $conf->file->main_force_https.$_SERVER["REQUEST_URI"];
288 288
     }
289 289
     // Start redirect
290 290
     if ($newurl) {
291
-        dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to " . $newurl);
292
-        header("Location: " . $newurl);
291
+        dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl);
292
+        header("Location: ".$newurl);
293 293
         exit;
294 294
     } else {
295 295
         dol_syslog("main.inc: dolibarr_main_force_https is on but we failed to forge new https url so no redirect is done", LOG_WARNING);
@@ -314,9 +314,9 @@  discard block
 block discarded – undo
314 314
 
315 315
 // Loading of additional presentation includes
316 316
 if (!defined('NOREQUIREHTML'))
317
-    require_once DOL_BASE_PATH . '/core/class/html.form.class.php';     // Need 660ko memory (800ko in 2.2)
317
+    require_once DOL_BASE_PATH.'/core/class/html.form.class.php'; // Need 660ko memory (800ko in 2.2)
318 318
 if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax)
319
-    require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php'; // Need 22ko memory
319
+    require_once DOL_BASE_PATH.'/core/lib/ajax.lib.php'; // Need 22ko memory
320 320
 
321 321
 
322 322
 
@@ -337,19 +337,19 @@  discard block
 block discarded – undo
337 337
 // If install or upgrade process not done or not completely finished, we call the install page.
338 338
 if (!empty($conf->global->MAIN_NOT_INSTALLED) || !empty($conf->global->MAIN_NOT_UPGRADED)) {
339 339
     dol_syslog("main.inc: A previous install or upgrade was not complete. Redirect to install page.", LOG_WARNING);
340
-    header("Location: " . DOL_BASE_URI . "/install/index.php");
340
+    header("Location: ".DOL_BASE_URI."/install/index.php");
341 341
     exit;
342 342
 }
343 343
 // If an upgrade process is required, we call the install page.
344 344
 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))) {
345 345
     $versiontocompare = empty($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE;
346
-    require_once DOL_BASE_PATH . '/core/lib/admin.lib.php';
346
+    require_once DOL_BASE_PATH.'/core/lib/admin.lib.php';
347 347
     $dolibarrversionlastupgrade = preg_split('/[.-]/', $versiontocompare);
348 348
     $dolibarrversionprogram = preg_split('/[.-]/', DOL_VERSION);
349 349
     $rescomp = versioncompare($dolibarrversionprogram, $dolibarrversionlastupgrade);
350 350
     if ($rescomp > 0) {   // Programs have a version higher than database. We did not add "&& $rescomp < 3" because we want upgrade process for build upgrades
351
-        dol_syslog("main.inc: database version " . $versiontocompare . " is lower than programs version " . DOL_VERSION . ". Redirect to install page.", LOG_WARNING);
352
-        header("Location: " . DOL_BASE_URI . "/install/index.php");
351
+        dol_syslog("main.inc: database version ".$versiontocompare." is lower than programs version ".DOL_VERSION.". Redirect to install page.", LOG_WARNING);
352
+        header("Location: ".DOL_BASE_URI."/install/index.php");
353 353
         exit;
354 354
     }
355 355
 }
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
     }
373 373
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {  // This test must be after loading $_SESSION['token'].
374 374
         if (GETPOST('token', 'alpha') != $_SESSION['token']) {
375
-            dol_syslog("Invalid token in " . $_SERVER['HTTP_REFERER'] . ", action=" . GETPOST('action', 'aZ09') . ", _POST['token']=" . GETPOST('token', 'alpha') . ", _SESSION['token']=" . $_SESSION['token'], LOG_WARNING);
375
+            dol_syslog("Invalid token in ".$_SERVER['HTTP_REFERER'].", action=".GETPOST('action', 'aZ09').", _POST['token']=".GETPOST('token', 'alpha').", _SESSION['token']=".$_SESSION['token'], LOG_WARNING);
376 376
             //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.
377 377
             unset($_POST);
378 378
         }
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
     $test = true;
433 433
     if (!isset($_SESSION["dol_login"])) {
434 434
         // It is not already authenticated and it requests the login / password
435
-        include_once DOL_BASE_PATH . '/core/lib/security2.lib.php';
435
+        include_once DOL_BASE_PATH.'/core/lib/security2.lib.php';
436 436
 
437 437
         $dol_dst_observed = GETPOST("dst_observed", 'int', 3);
438 438
         $dol_dst_first = GETPOST("dst_first", 'int', 3);
@@ -446,17 +446,17 @@  discard block
 block discarded – undo
446 446
         $dol_use_jmobile = GETPOST('dol_use_jmobile', 'int', 3);
447 447
         //dol_syslog("POST key=".join(array_keys($_POST),',').' value='.join($_POST,','));
448 448
         // If in demo mode, we check we go to home page through the public/demo/index.php page
449
-        if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_BASE_URI . '/index.php') {  // We ask index page
449
+        if (!empty($dolibarr_main_demo) && $_SERVER['PHP_SELF'] == DOL_BASE_URI.'/index.php') {  // We ask index page
450 450
             if (empty($_SERVER['HTTP_REFERER']) || !preg_match('/public/', $_SERVER['HTTP_REFERER'])) {
451
-                dol_syslog("Call index page from another url than demo page (call is done from page " . $_SERVER['HTTP_REFERER'] . ")");
451
+                dol_syslog("Call index page from another url than demo page (call is done from page ".$_SERVER['HTTP_REFERER'].")");
452 452
                 $url = '';
453
-                $url .= ($url ? '&' : '') . ($dol_hide_topmenu ? 'dol_hide_topmenu=' . $dol_hide_topmenu : '');
454
-                $url .= ($url ? '&' : '') . ($dol_hide_leftmenu ? 'dol_hide_leftmenu=' . $dol_hide_leftmenu : '');
455
-                $url .= ($url ? '&' : '') . ($dol_optimize_smallscreen ? 'dol_optimize_smallscreen=' . $dol_optimize_smallscreen : '');
456
-                $url .= ($url ? '&' : '') . ($dol_no_mouse_hover ? 'dol_no_mouse_hover=' . $dol_no_mouse_hover : '');
457
-                $url .= ($url ? '&' : '') . ($dol_use_jmobile ? 'dol_use_jmobile=' . $dol_use_jmobile : '');
458
-                $url = DOL_BASE_URI . '/public/demo/index.php' . ($url ? '?' . $url : '');
459
-                header("Location: " . $url);
453
+                $url .= ($url ? '&' : '').($dol_hide_topmenu ? 'dol_hide_topmenu='.$dol_hide_topmenu : '');
454
+                $url .= ($url ? '&' : '').($dol_hide_leftmenu ? 'dol_hide_leftmenu='.$dol_hide_leftmenu : '');
455
+                $url .= ($url ? '&' : '').($dol_optimize_smallscreen ? 'dol_optimize_smallscreen='.$dol_optimize_smallscreen : '');
456
+                $url .= ($url ? '&' : '').($dol_no_mouse_hover ? 'dol_no_mouse_hover='.$dol_no_mouse_hover : '');
457
+                $url .= ($url ? '&' : '').($dol_use_jmobile ? 'dol_use_jmobile='.$dol_use_jmobile : '');
458
+                $url = DOL_BASE_URI.'/public/demo/index.php'.($url ? '?'.$url : '');
459
+                header("Location: ".$url);
460 460
                 exit;
461 461
             }
462 462
         }
@@ -476,9 +476,9 @@  discard block
 block discarded – undo
476 476
                 $test = false;
477 477
 
478 478
                 // Call trigger for the "security events" log
479
-                $user->trigger_mesg = 'ErrorBadValueForCode - login=' . GETPOST("username", "alpha", 2);
479
+                $user->trigger_mesg = 'ErrorBadValueForCode - login='.GETPOST("username", "alpha", 2);
480 480
                 // Call of triggers
481
-                include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
481
+                include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
482 482
                 $interface = new Interfaces($db);
483 483
                 $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf);
484 484
                 if ($result < 0) {
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
                 $action = '';
490 490
                 $hookmanager->initHooks(array('login'));
491 491
                 $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
492
-                $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
492
+                $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
493 493
                 if ($reshook < 0)
494 494
                     $error++;
495 495
 
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
             $goontestloop = true;
515 515
 
516 516
         if (!is_object($langs)) { // This can occurs when calling page with NOREQUIRETRAN defined, however we need langs for error messages.
517
-            include_once DOL_BASE_PATH . '/core/class/translate.class.php';
517
+            include_once DOL_BASE_PATH.'/core/class/translate.class.php';
518 518
             $langs = new Translate("", $conf);
519 519
             $langcode = (GETPOST('lang', 'aZ09', 1) ? GETPOST('lang', 'aZ09', 1) : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT));
520 520
             if (defined('MAIN_LANG_DEFAULT'))
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
                 $dol_tz_string = preg_replace('/\s/', '_', $dol_tz_string);
537 537
                 $dol_dst = 0;
538 538
                 if (isset($_POST["dst_first"]) && isset($_POST["dst_second"])) {
539
-                    include_once DOL_BASE_PATH . '/core/lib/date.lib.php';
539
+                    include_once DOL_BASE_PATH.'/core/lib/date.lib.php';
540 540
                     $datenow = dol_now();
541 541
                     $datefirst = dol_stringtotime($_POST["dst_first"]);
542 542
                     $datesecond = dol_stringtotime($_POST["dst_second"]);
@@ -557,9 +557,9 @@  discard block
 block discarded – undo
557 557
                     $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword");
558 558
 
559 559
                 // Call trigger for the "security events" log
560
-                $user->trigger_mesg = $langs->trans("ErrorBadLoginPassword") . ' - login=' . GETPOST("username", "alpha", 2);
560
+                $user->trigger_mesg = $langs->trans("ErrorBadLoginPassword").' - login='.GETPOST("username", "alpha", 2);
561 561
                 // Call of triggers
562
-                include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
562
+                include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
563 563
                 $interface = new Interfaces($db);
564 564
                 $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf, GETPOST("username", "alpha", 2));
565 565
                 if ($result < 0) {
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
                 $action = '';
571 571
                 $hookmanager->initHooks(array('login'));
572 572
                 $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
573
-                $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
573
+                $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
574 574
                 if ($reshook < 0)
575 575
                     $error++;
576 576
 
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
         // End test login / passwords
582 582
         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.
583 583
             // No data to test login, so we show the login page
584
-            dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . " showing the login form and exit");
584
+            dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." showing the login form and exit");
585 585
             if (defined('NOREDIRECTBYMAINTOLOGIN'))
586 586
                 return 'ERROR_NOT_LOGGED';
587 587
             else
@@ -594,8 +594,8 @@  discard block
 block discarded – undo
594 594
             dol_syslog('User not found, connexion refused');
595 595
             session_destroy();
596 596
             session_name($sessionname);
597
-            session_set_cookie_params(0, '/', null, false, true);   // Add tag httponly on session cookie
598
-            session_start();    // Fixing the bug of register_globals here is useless since session is empty
597
+            session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie
598
+            session_start(); // Fixing the bug of register_globals here is useless since session is empty
599 599
 
600 600
             if ($resultFetchUser == 0) {
601 601
                 // Load translation files required by page
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 
604 604
                 $_SESSION["dol_loginmesg"] = $langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login);
605 605
 
606
-                $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login=' . $login;
606
+                $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
607 607
             }
608 608
             if ($resultFetchUser < 0) {
609 609
                 $_SESSION["dol_loginmesg"] = $user->error;
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
             }
613 613
 
614 614
             // Call triggers for the "security events" log
615
-            include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
615
+            include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
616 616
             $interface = new Interfaces($db);
617 617
             $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf);
618 618
             if ($result < 0) {
@@ -623,18 +623,18 @@  discard block
 block discarded – undo
623 623
             $action = '';
624 624
             $hookmanager->initHooks(array('login'));
625 625
             $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
626
-            $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
626
+            $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
627 627
             if ($reshook < 0)
628 628
                 $error++;
629 629
 
630 630
             $paramsurl = array();
631 631
             if (GETPOST('textbrowser', 'int'))
632
-                $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
632
+                $paramsurl[] = 'textbrowser='.GETPOST('textbrowser', 'int');
633 633
             if (GETPOST('nojs', 'int'))
634
-                $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
634
+                $paramsurl[] = 'nojs='.GETPOST('nojs', 'int');
635 635
             if (GETPOST('lang', 'aZ09'))
636
-                $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
637
-            header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''));
636
+                $paramsurl[] = 'lang='.GETPOST('lang', 'aZ09');
637
+            header('Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : ''));
638 638
             exit;
639 639
         }
640 640
     }
@@ -642,16 +642,16 @@  discard block
 block discarded – undo
642 642
         // We are already into an authenticated session
643 643
         $login = $_SESSION["dol_login"];
644 644
         $entity = $_SESSION["dol_entity"];
645
-        dol_syslog("- This is an already logged session. _SESSION['dol_login']=" . $login . " _SESSION['dol_entity']=" . $entity, LOG_DEBUG);
645
+        dol_syslog("- This is an already logged session. _SESSION['dol_login']=".$login." _SESSION['dol_entity']=".$entity, LOG_DEBUG);
646 646
 
647 647
         $resultFetchUser = $user->fetch('', $login, '', 1, ($entity > 0 ? $entity : -1));
648 648
         if ($resultFetchUser <= 0) {
649 649
             // Account has been removed after login
650
-            dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=" . $login, LOG_WARNING);
650
+            dol_syslog("Can't load user even if session logged. _SESSION['dol_login']=".$login, LOG_WARNING);
651 651
             session_destroy();
652 652
             session_name($sessionname);
653
-            session_set_cookie_params(0, '/', null, false, true);   // Add tag httponly on session cookie
654
-            session_start();    // Fixing the bug of register_globals here is useless since session is empty
653
+            session_set_cookie_params(0, '/', null, false, true); // Add tag httponly on session cookie
654
+            session_start(); // Fixing the bug of register_globals here is useless since session is empty
655 655
 
656 656
             if ($resultFetchUser == 0) {
657 657
                 // Load translation files required by page
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 
660 660
                 $_SESSION["dol_loginmesg"] = $langs->trans("ErrorCantLoadUserFromDolibarrDatabase", $login);
661 661
 
662
-                $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login=' . $login;
662
+                $user->trigger_mesg = 'ErrorCantLoadUserFromDolibarrDatabase - login='.$login;
663 663
             }
664 664
             if ($resultFetchUser < 0) {
665 665
                 $_SESSION["dol_loginmesg"] = $user->error;
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
             }
669 669
 
670 670
             // Call triggers for the "security events" log
671
-            include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
671
+            include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
672 672
             $interface = new Interfaces($db);
673 673
             $result = $interface->run_triggers('USER_LOGIN_FAILED', $user, $user, $langs, $conf);
674 674
             if ($result < 0) {
@@ -679,18 +679,18 @@  discard block
 block discarded – undo
679 679
             $action = '';
680 680
             $hookmanager->initHooks(array('login'));
681 681
             $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
682
-            $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
682
+            $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
683 683
             if ($reshook < 0)
684 684
                 $error++;
685 685
 
686 686
             $paramsurl = array();
687 687
             if (GETPOST('textbrowser', 'int'))
688
-                $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
688
+                $paramsurl[] = 'textbrowser='.GETPOST('textbrowser', 'int');
689 689
             if (GETPOST('nojs', 'int'))
690
-                $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
690
+                $paramsurl[] = 'nojs='.GETPOST('nojs', 'int');
691 691
             if (GETPOST('lang', 'aZ09'))
692
-                $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
693
-            header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''));
692
+                $paramsurl[] = 'lang='.GETPOST('lang', 'aZ09');
693
+            header('Location: '.DOL_BASE_URI.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : ''));
694 694
             exit;
695 695
         }
696 696
         else {
@@ -700,29 +700,29 @@  discard block
 block discarded – undo
700 700
             // Code for search criteria persistence.
701 701
             if (!empty($_GET['save_lastsearch_values'])) {    // We must use $_GET here
702 702
                 $relativepathstring = preg_replace('/\?.*$/', '', $_SERVER["HTTP_REFERER"]);
703
-                $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring);     // Get full path except host server
703
+                $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring); // Get full path except host server
704 704
                 // Clean $relativepathstring
705 705
                 if (constant('DOL_BASE_URI'))
706
-                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
706
+                    $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring);
707 707
                 $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
708 708
                 $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
709 709
                 //var_dump($relativepathstring);
710 710
                 // 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
711
-                if (!empty($_SESSION['lastsearch_values_tmp_' . $relativepathstring])) {
712
-                    $_SESSION['lastsearch_values_' . $relativepathstring] = $_SESSION['lastsearch_values_tmp_' . $relativepathstring];
713
-                    unset($_SESSION['lastsearch_values_tmp_' . $relativepathstring]);
711
+                if (!empty($_SESSION['lastsearch_values_tmp_'.$relativepathstring])) {
712
+                    $_SESSION['lastsearch_values_'.$relativepathstring] = $_SESSION['lastsearch_values_tmp_'.$relativepathstring];
713
+                    unset($_SESSION['lastsearch_values_tmp_'.$relativepathstring]);
714 714
                 }
715
-                if (!empty($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring])) {
716
-                    $_SESSION['lastsearch_contextpage_' . $relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring];
717
-                    unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]);
715
+                if (!empty($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring])) {
716
+                    $_SESSION['lastsearch_contextpage_'.$relativepathstring] = $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring];
717
+                    unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]);
718 718
                 }
719
-                if (!empty($_SESSION['lastsearch_page_tmp_' . $relativepathstring]) && $_SESSION['lastsearch_page_tmp_' . $relativepathstring] > 1) {
720
-                    $_SESSION['lastsearch_page_' . $relativepathstring] = $_SESSION['lastsearch_page_tmp_' . $relativepathstring];
721
-                    unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]);
719
+                if (!empty($_SESSION['lastsearch_page_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_page_tmp_'.$relativepathstring] > 1) {
720
+                    $_SESSION['lastsearch_page_'.$relativepathstring] = $_SESSION['lastsearch_page_tmp_'.$relativepathstring];
721
+                    unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]);
722 722
                 }
723
-                if (!empty($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]) && $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] != $conf->liste_limit) {
724
-                    $_SESSION['lastsearch_limit_' . $relativepathstring] = $_SESSION['lastsearch_limit_tmp_' . $relativepathstring];
725
-                    unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]);
723
+                if (!empty($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]) && $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] != $conf->liste_limit) {
724
+                    $_SESSION['lastsearch_limit_'.$relativepathstring] = $_SESSION['lastsearch_limit_tmp_'.$relativepathstring];
725
+                    unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]);
726 726
                 }
727 727
             }
728 728
 
@@ -765,18 +765,18 @@  discard block
 block discarded – undo
765 765
         if (!empty($dol_use_jmobile))
766 766
             $_SESSION['dol_use_jmobile'] = $dol_use_jmobile;
767 767
 
768
-        dol_syslog("This is a new started user session. _SESSION['dol_login']=" . $_SESSION["dol_login"] . " Session id=" . session_id());
768
+        dol_syslog("This is a new started user session. _SESSION['dol_login']=".$_SESSION["dol_login"]." Session id=".session_id());
769 769
 
770 770
         $db->begin();
771 771
 
772 772
         $user->update_last_login_date();
773 773
 
774
-        $loginfo = 'TZ=' . $_SESSION["dol_tz"] . ';TZString=' . $_SESSION["dol_tz_string"] . ';Screen=' . $_SESSION["dol_screenwidth"] . 'x' . $_SESSION["dol_screenheight"];
774
+        $loginfo = 'TZ='.$_SESSION["dol_tz"].';TZString='.$_SESSION["dol_tz_string"].';Screen='.$_SESSION["dol_screenwidth"].'x'.$_SESSION["dol_screenheight"];
775 775
 
776 776
         // Call triggers for the "security events" log
777 777
         $user->trigger_mesg = $loginfo;
778 778
         // Call triggers
779
-        include_once DOL_BASE_PATH . '/core/class/interfaces.class.php';
779
+        include_once DOL_BASE_PATH.'/core/class/interfaces.class.php';
780 780
         $interface = new Interfaces($db);
781 781
         $result = $interface->run_triggers('USER_LOGIN', $user, $user, $langs, $conf);
782 782
         if ($result < 0) {
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
         $action = '';
788 788
         $hookmanager->initHooks(array('login'));
789 789
         $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginfo' => $loginfo);
790
-        $reshook = $hookmanager->executeHooks('afterLogin', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
790
+        $reshook = $hookmanager->executeHooks('afterLogin', $parameters, $user, $action); // Note that $action and $object may have been modified by some hooks
791 791
         if ($reshook < 0)
792 792
             $error++;
793 793
 
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
         if (!empty($landingpage)) {    // Example: /index.php
806 806
             $newpath = dol_buildpath($landingpage, 1);
807 807
             if ($_SERVER["PHP_SELF"] != $newpath) {   // not already on landing page (avoid infinite loop)
808
-                header('Location: ' . $newpath);
808
+                header('Location: '.$newpath);
809 809
                 exit;
810 810
             }
811 811
         }
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
     if (empty($conf->global->MAIN_FORCETHEME) && !empty($user->conf->MAIN_THEME)) {
853 853
         $conf->theme = $user->conf->MAIN_THEME;
854 854
         // $conf->css = "/theme/" . $conf->theme . "/style.css.php";
855
-        $conf->css = '?controller=theme/' . $conf->theme . '&method=style.css';
855
+        $conf->css = '?controller=theme/'.$conf->theme.'&method=style.css';
856 856
     }
857 857
 }
858 858
 
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 if (GETPOST('theme', 'alpha')) {
861 861
     $conf->theme = GETPOST('theme', 'alpha', 1);
862 862
     // $conf->css = "/theme/" . $conf->theme . "/style.css.php";
863
-    $conf->css = '?controller=theme/' . $conf->theme . '&method=style.css';
863
+    $conf->css = '?controller=theme/'.$conf->theme.'&method=style.css';
864 864
 }
865 865
 
866 866
 
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array('bureau2crea', 'cameleo', 'amarok'))) {
903 903
     $conf->theme = 'eldy';
904 904
     // $conf->css = "/theme/" . $conf->theme . "/style.css.php";
905
-    $conf->css = '?controller=theme/' . $conf->theme . '&method=style.css';
905
+    $conf->css = '?controller=theme/'.$conf->theme.'&method=style.css';
906 906
 }
907 907
 
908 908
 if (!defined('NOREQUIRETRAN')) {
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 }
939 939
 
940 940
 
941
-dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . ' - action=' . GETPOST('action', 'az09') . ', massaction=' . GETPOST('massaction', 'az09'));
941
+dol_syslog("--- Access to ".$_SERVER["PHP_SELF"].' - action='.GETPOST('action', 'az09').', massaction='.GETPOST('massaction', 'az09'));
942 942
 //Another call for easy debugg
943 943
 //dol_syslog("Access to ".$_SERVER["PHP_SELF"].' GET='.join(',',array_keys($_GET)).'->'.join(',',$_GET).' POST:'.join(',',array_keys($_POST)).'->'.join(',',$_POST));
944 944
 // Load main languages files
@@ -950,7 +950,7 @@  discard block
 block discarded – undo
950 950
 // Define some constants used for style of arrays
951 951
 $bc = array(0 => 'class="impair"', 1 => 'class="pair"');
952 952
 $bcdd = array(0 => 'class="drag drop oddeven"', 1 => 'class="drag drop oddeven"');
953
-$bcnd = array(0 => 'class="nodrag nodrop nohover"', 1 => 'class="nodrag nodrop nohoverpair"');  // Used for tr to add new lines
953
+$bcnd = array(0 => 'class="nodrag nodrop nohover"', 1 => 'class="nodrag nodrop nohoverpair"'); // Used for tr to add new lines
954 954
 $bctag = array(0 => 'class="impair tagtr"', 1 => 'class="pair tagtr"');
955 955
 
956 956
 // Define messages variables
@@ -998,19 +998,19 @@  discard block
 block discarded – undo
998 998
     // Load the menu manager (only if not already done)
999 999
     $file_menu = $conf->standard_menu;
1000 1000
     if (GETPOST('menu', 'alpha'))
1001
-        $file_menu = GETPOST('menu', 'alpha');     // example: menu=eldy_menu.php
1001
+        $file_menu = GETPOST('menu', 'alpha'); // example: menu=eldy_menu.php
1002 1002
     if (!class_exists('MenuManager')) {
1003 1003
         $menufound = 0;
1004 1004
         $dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
1005 1005
         foreach ($dirmenus as $dirmenu) {
1006
-            $menufound = dol_include_once($dirmenu . "standard/" . $file_menu);
1006
+            $menufound = dol_include_once($dirmenu."standard/".$file_menu);
1007 1007
             if (class_exists('MenuManager'))
1008 1008
                 break;
1009 1009
         }
1010 1010
         if (!class_exists('MenuManager')) { // If failed to include, we try with standard eldy_menu.php
1011
-            dol_syslog("You define a menu manager '" . $file_menu . "' that can not be loaded.", LOG_WARNING);
1011
+            dol_syslog("You define a menu manager '".$file_menu."' that can not be loaded.", LOG_WARNING);
1012 1012
             $file_menu = 'eldy_menu.php';
1013
-            include_once DOL_DOCUMENT_ROOT . "/core/menus/standard/" . $file_menu;
1013
+            include_once DOL_DOCUMENT_ROOT."/core/menus/standard/".$file_menu;
1014 1014
         }
1015 1015
     }
1016 1016
     $menumanager = new MenuManager($db, empty($user->societe_id) ? 0 : 1);
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
         // html header
1049 1049
         top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss);
1050 1050
 
1051
-        print '<body id="mainbody"' . ($morecssonbody ? ' class="' . $morecssonbody . '"' : '') . '>' . "\n";
1051
+        print '<body id="mainbody"'.($morecssonbody ? ' class="'.$morecssonbody.'"' : '').'>'."\n";
1052 1052
 
1053 1053
         // top menu and left menu area
1054 1054
         if (empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) {
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
         }
1057 1057
 
1058 1058
         if (empty($conf->dol_hide_leftmenu)) {
1059
-            left_menu('', $help_url, '', '', 1, $title, 1);  // $menumanager is retreived with a global $menumanager inside this function
1059
+            left_menu('', $help_url, '', '', 1, $title, 1); // $menumanager is retreived with a global $menumanager inside this function
1060 1060
         }
1061 1061
 
1062 1062
         // main area
@@ -1080,13 +1080,13 @@  discard block
 block discarded – undo
1080 1080
     global $db, $conf, $hookmanager;
1081 1081
 
1082 1082
     if ($contenttype == 'text/html') {
1083
-        header("Content-Type: text/html; charset=" . $conf->file->character_set_client);
1083
+        header("Content-Type: text/html; charset=".$conf->file->character_set_client);
1084 1084
     } else {
1085
-        header("Content-Type: " . $contenttype);
1085
+        header("Content-Type: ".$contenttype);
1086 1086
     }
1087 1087
     // Security options
1088
-    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)
1089
-    header("X-Frame-Options: SAMEORIGIN");      // Frames allowed only if on same domain (stop some XSS attacks)
1088
+    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)
1089
+    header("X-Frame-Options: SAMEORIGIN"); // Frames allowed only if on same domain (stop some XSS attacks)
1090 1090
     //header("X-XSS-Protection: 1");      		// XSS protection of some browsers (note: use of Content-Security-Policy is more efficient). Disabled as deprecated.
1091 1091
     if (!defined('FORCECSP')) {
1092 1092
         //if (! isset($conf->global->MAIN_HTTP_CONTENT_SECURITY_POLICY))
@@ -1103,11 +1103,11 @@  discard block
 block discarded – undo
1103 1103
         $hookmanager->initHooks("main");
1104 1104
 
1105 1105
         $parameters = array('contentsecuritypolicy' => $contentsecuritypolicy);
1106
-        $result = $hookmanager->executeHooks('setContentSecurityPolicy', $parameters);    // Note that $action and $object may have been modified by some hooks
1106
+        $result = $hookmanager->executeHooks('setContentSecurityPolicy', $parameters); // Note that $action and $object may have been modified by some hooks
1107 1107
         if ($result > 0) {
1108 1108
             $contentsecuritypolicy = $hookmanager->resPrint; // Replace CSP
1109 1109
         } else {
1110
-            $contentsecuritypolicy .= $hookmanager->resPrint;    // Concat CSP
1110
+            $contentsecuritypolicy .= $hookmanager->resPrint; // Concat CSP
1111 1111
         }
1112 1112
 
1113 1113
         if (!empty($contentsecuritypolicy)) {
@@ -1119,10 +1119,10 @@  discard block
 block discarded – undo
1119 1119
             // default-src 'self'; img-src *;
1120 1120
             // Pre-existing site that uses too much inline code to fix but wants to ensure resources are loaded only over https and disable plugins:
1121 1121
             // default-src http: https: 'unsafe-eval' 'unsafe-inline'; object-src 'none'
1122
-            header("Content-Security-Policy: " . $contentsecuritypolicy);
1122
+            header("Content-Security-Policy: ".$contentsecuritypolicy);
1123 1123
         }
1124 1124
     } elseif (constant('FORCECSP')) {
1125
-        header("Content-Security-Policy: " . constant('FORCECSP'));
1125
+        header("Content-Security-Policy: ".constant('FORCECSP'));
1126 1126
     }
1127 1127
     if ($forcenocache) {
1128 1128
         header("Cache-Control: no-cache, no-store, must-revalidate, max-age=0");
@@ -1153,33 +1153,33 @@  discard block
 block discarded – undo
1153 1153
         // $conf->css = '/theme/eldy/style.css.php'; // If not defined, eldy by default
1154 1154
         $conf->css = '?controller=theme/eldy&method=style.css';
1155 1155
     }
1156
-    print '<!doctype html>' . "\n";
1156
+    print '<!doctype html>'."\n";
1157 1157
 
1158 1158
     if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST))
1159
-        print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_BASE_URI . '/cache.manifest">' . "\n";
1159
+        print '<html lang="'.substr($langs->defaultlang, 0, 2).'" manifest="'.DOL_BASE_URI.'/cache.manifest">'."\n";
1160 1160
     else
1161
-        print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n";
1161
+        print '<html lang="'.substr($langs->defaultlang, 0, 2).'">'."\n";
1162 1162
     //print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'."\n";
1163 1163
     if (empty($disablehead)) {
1164
-        $ext = 'layout=' . $conf->browser->layout . '&version=' . urlencode(DOL_VERSION);
1164
+        $ext = 'layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION);
1165 1165
 
1166 1166
         print "<head>\n";
1167 1167
 
1168 1168
         if (GETPOST('dol_basehref', 'alpha'))
1169
-            print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')) . '">' . "\n";
1169
+            print '<base href="'.dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')).'">'."\n";
1170 1170
 
1171 1171
         // Displays meta
1172
-        print '<meta charset="UTF-8">' . "\n";
1173
-        print '<meta name="robots" content="noindex' . ($disablenofollow ? '' : ',nofollow') . '">' . "\n"; // Do not index
1174
-        print '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\n";  // Scale for mobile device
1175
-        print '<meta name="author" content="Dolibarr Development Team">' . "\n";
1172
+        print '<meta charset="UTF-8">'."\n";
1173
+        print '<meta name="robots" content="noindex'.($disablenofollow ? '' : ',nofollow').'">'."\n"; // Do not index
1174
+        print '<meta name="viewport" content="width=device-width, initial-scale=1.0">'."\n"; // Scale for mobile device
1175
+        print '<meta name="author" content="Dolibarr Development Team">'."\n";
1176 1176
 
1177 1177
         // Favicon
1178
-        $favicon = dol_buildpath('/theme/' . $conf->theme . '/img/favicon.ico', 1);
1178
+        $favicon = dol_buildpath('/theme/'.$conf->theme.'/img/favicon.ico', 1);
1179 1179
         if (!empty($conf->global->MAIN_FAVICON_URL))
1180 1180
             $favicon = $conf->global->MAIN_FAVICON_URL;
1181 1181
         if (empty($conf->dol_use_jmobile))
1182
-            print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n"; // Not required into an Android webview
1182
+            print '<link rel="shortcut icon" type="image/x-icon" href="'.$favicon.'"/>'."\n"; // Not required into an Android webview
1183 1183
 
1184 1184
 
1185 1185
 
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
         //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="author" title="Dolibarr Development Team" href="https://www.dolibarr.org">'."\n";
1203 1203
         // Auto refresh page
1204 1204
         if (GETPOST('autorefresh', 'int') > 0)
1205
-            print '<meta http-equiv="refresh" content="' . GETPOST('autorefresh', 'int') . '">';
1205
+            print '<meta http-equiv="refresh" content="'.GETPOST('autorefresh', 'int').'">';
1206 1206
 
1207 1207
         // Displays title
1208 1208
         $appli = constant('DOL_APPLICATION_TITLE');
@@ -1214,7 +1214,7 @@  discard block
 block discarded – undo
1214 1214
         if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE))
1215 1215
             $titletoshow = dol_htmlentities($title);
1216 1216
         else if ($title)
1217
-            $titletoshow = dol_htmlentities($appli . ' - ' . $title);
1217
+            $titletoshow = dol_htmlentities($appli.' - '.$title);
1218 1218
         else
1219 1219
             $titletoshow = dol_htmlentities($appli);
1220 1220
 
@@ -1222,11 +1222,11 @@  discard block
 block discarded – undo
1222 1222
             $hookmanager = new HookManager($db);
1223 1223
         $hookmanager->initHooks("main");
1224 1224
         $parameters = array('title' => $titletoshow);
1225
-        $result = $hookmanager->executeHooks('setHtmlTitle', $parameters);  // Note that $action and $object may have been modified by some hooks
1225
+        $result = $hookmanager->executeHooks('setHtmlTitle', $parameters); // Note that $action and $object may have been modified by some hooks
1226 1226
         if ($result > 0)
1227
-            $titletoshow = $hookmanager->resPrint;    // Replace Title to show
1227
+            $titletoshow = $hookmanager->resPrint; // Replace Title to show
1228 1228
         else
1229
-            $titletoshow .= $hookmanager->resPrint;      // Concat to Title to show
1229
+            $titletoshow .= $hookmanager->resPrint; // Concat to Title to show
1230 1230
 
1231 1231
         print $titletoshow;
1232 1232
         print '</title>';
@@ -1234,70 +1234,70 @@  discard block
 block discarded – undo
1234 1234
         print "\n";
1235 1235
 
1236 1236
         if (GETPOST('version', 'int')) {
1237
-            $ext = 'version=' . GETPOST('version', 'int'); // usefull to force no cache on css/js
1237
+            $ext = 'version='.GETPOST('version', 'int'); // usefull to force no cache on css/js
1238 1238
         }
1239 1239
         if (GETPOST('testmenuhider', 'int') || !empty($conf->global->MAIN_TESTMENUHIDER)) {
1240
-            $ext .= '&testmenuhider=' . (GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER);
1240
+            $ext .= '&testmenuhider='.(GETPOST('testmenuhider', 'int') ? GETPOST('testmenuhider', 'int') : $conf->global->MAIN_TESTMENUHIDER);
1241 1241
         }
1242
-        $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;
1243
-        $themeparam .= ($ext ? '&amp;' . $ext : '');
1242
+        $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;
1243
+        $themeparam .= ($ext ? '&amp;'.$ext : '');
1244 1244
         if (!empty($_SESSION['dol_resetcache']))
1245 1245
         {
1246
-            $themeparam .= '&amp;dol_resetcache=' . $_SESSION['dol_resetcache'];
1246
+            $themeparam .= '&amp;dol_resetcache='.$_SESSION['dol_resetcache'];
1247 1247
         }
1248 1248
         if (GETPOST('dol_hide_topmenu', 'int')) {
1249
-            $themeparam .= '&amp;dol_hide_topmenu=' . GETPOST('dol_hide_topmenu', 'int');
1249
+            $themeparam .= '&amp;dol_hide_topmenu='.GETPOST('dol_hide_topmenu', 'int');
1250 1250
         }
1251 1251
         if (GETPOST('dol_hide_leftmenu', 'int')) {
1252
-            $themeparam .= '&amp;dol_hide_leftmenu=' . GETPOST('dol_hide_leftmenu', 'int');
1252
+            $themeparam .= '&amp;dol_hide_leftmenu='.GETPOST('dol_hide_leftmenu', 'int');
1253 1253
         }
1254 1254
         if (GETPOST('dol_optimize_smallscreen', 'int')) {
1255
-            $themeparam .= '&amp;dol_optimize_smallscreen=' . GETPOST('dol_optimize_smallscreen', 'int');
1255
+            $themeparam .= '&amp;dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen', 'int');
1256 1256
         }
1257 1257
         if (GETPOST('dol_no_mouse_hover', 'int')) {
1258
-            $themeparam .= '&amp;dol_no_mouse_hover=' . GETPOST('dol_no_mouse_hover', 'int');
1258
+            $themeparam .= '&amp;dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover', 'int');
1259 1259
         }
1260 1260
         if (GETPOST('dol_use_jmobile', 'int')) {
1261
-            $themeparam .= '&amp;dol_use_jmobile=' . GETPOST('dol_use_jmobile', 'int');
1261
+            $themeparam .= '&amp;dol_use_jmobile='.GETPOST('dol_use_jmobile', 'int');
1262 1262
             $conf->dol_use_jmobile = GETPOST('dol_use_jmobile', 'int');
1263 1263
         }
1264 1264
 
1265 1265
         if (!defined('DISABLE_JQUERY') && !$disablejs && $conf->use_javascript_ajax) {
1266
-            print '<!-- Includes CSS for JQuery (Ajax library) -->' . "\n";
1266
+            print '<!-- Includes CSS for JQuery (Ajax library) -->'."\n";
1267 1267
             $jquerytheme = 'base';
1268 1268
             if (!empty($conf->global->MAIN_USE_JQUERY_THEME)) {
1269 1269
                 $jquerytheme = $conf->global->MAIN_USE_JQUERY_THEME;
1270 1270
             }
1271 1271
             if (constant('JS_JQUERY_UI')) {
1272
-                print '<link rel="stylesheet" type="text/css" href="' . JS_JQUERY_UI . 'css/' . $jquerytheme . '/jquery-ui.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";  // JQuery
1272
+                print '<link rel="stylesheet" type="text/css" href="'.JS_JQUERY_UI.'css/'.$jquerytheme.'/jquery-ui.min.css'.($ext ? '?'.$ext : '').'">'."\n"; // JQuery
1273 1273
             } else {
1274
-                print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/css/' . $jquerytheme . '/jquery-ui.css' . ($ext ? '?' . $ext : '') . '">' . "\n";    // JQuery
1274
+                print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/includes/jquery/css/'.$jquerytheme.'/jquery-ui.css'.($ext ? '?'.$ext : '').'">'."\n"; // JQuery
1275 1275
             }
1276 1276
             if (!defined('DISABLE_JQUERY_JNOTIFY')) {
1277
-                print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";          // JNotify
1277
+                print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/includes/jquery/plugins/jnotify/jquery.jnotify-alt.min.css'.($ext ? '?'.$ext : '').'">'."\n"; // JNotify
1278 1278
             }
1279 1279
             if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) {     // jQuery plugin "mutiselect", "multiple-select", "select2"...
1280 1280
                 $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1281
-                print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/includes/jquery/plugins/' . $tmpplugin . '/dist/css/' . $tmpplugin . '.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1281
+                print '<link rel="stylesheet" type="text/css" href="'.DOL_BASE_URI.'/includes/jquery/plugins/'.$tmpplugin.'/dist/css/'.$tmpplugin.'.css'.($ext ? '?'.$ext : '').'">'."\n";
1282 1282
             }
1283 1283
         }
1284 1284
 
1285 1285
         if (!defined('DISABLE_FONT_AWSOME')) {
1286
-            print '<!-- Includes CSS for font awesome -->' . "\n";
1286
+            print '<!-- Includes CSS for font awesome -->'."\n";
1287 1287
             // print '<link rel="stylesheet" type="text/css" href="' . DOL_BASE_URI . '/theme/common/fontawesome/css/font-awesome.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1288 1288
             // TODO: Check the fontawesome version we are going to use
1289 1289
             //print '<link rel="stylesheet" type="text/css" href="' . BASE_URI . '/vendor/components/font-awesome/css/fontawesome.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1290
-            print '<link rel="stylesheet" type="text/css" href="' . BASE_URI . '/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/css/font-awesome.min.css' . ($ext ? '?' . $ext : '') . '">' . "\n";
1290
+            print '<link rel="stylesheet" type="text/css" href="'.BASE_URI.'/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/css/font-awesome.min.css'.($ext ? '?'.$ext : '').'">'."\n";
1291 1291
         }
1292 1292
 
1293
-        print '<!-- Includes CSS for Dolibarr theme -->' . "\n";
1293
+        print '<!-- Includes CSS for Dolibarr theme -->'."\n";
1294 1294
         // Output style sheets (optioncss='print' or ''). Note: $conf->css looks like '/theme/eldy/style.css.php'
1295 1295
         $themepath = dol_buildpath($conf->css, 3);
1296 1296
         $themesubdir = '';
1297 1297
         if (!empty($conf->modules_parts['theme'])) { // This slow down
1298 1298
             foreach ($conf->modules_parts['theme'] as $reldir) {
1299
-                if (file_exists(dol_buildpath($reldir . $conf->css, 0))) {
1300
-                    $themepath = dol_buildpath($reldir . $conf->css, 1);
1299
+                if (file_exists(dol_buildpath($reldir.$conf->css, 0))) {
1300
+                    $themepath = dol_buildpath($reldir.$conf->css, 1);
1301 1301
                     $themesubdir = $reldir;
1302 1302
                     break;
1303 1303
                 }
@@ -1305,9 +1305,9 @@  discard block
 block discarded – undo
1305 1305
         }
1306 1306
 
1307 1307
         //print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
1308
-        print '<link rel="stylesheet" type="text/css" href="' . $themepath . $themeparam . '">' . "\n";
1308
+        print '<link rel="stylesheet" type="text/css" href="'.$themepath.$themeparam.'">'."\n";
1309 1309
         if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME))
1310
-            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";
1310
+            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";
1311 1311
 
1312 1312
         // CSS forced by modules (relative url starting with /)
1313 1313
         if (!empty($conf->modules_parts['css'])) {
@@ -1316,122 +1316,122 @@  discard block
 block discarded – undo
1316 1316
                 $filescss = (array) $filescss; // To be sure filecss is an array
1317 1317
                 foreach ($filescss as $cssfile) {
1318 1318
                     if (empty($cssfile))
1319
-                        dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING);
1319
+                        dol_syslog("Warning: module ".$modcss." declared a css path file into its descriptor that is empty.", LOG_WARNING);
1320 1320
                     // cssfile is a relative path
1321
-                    print '<!-- Includes CSS added by module ' . $modcss . ' -->' . "\n" . '<link rel="stylesheet" type="text/css" href="' . dol_buildpath($cssfile, 1);
1321
+                    print '<!-- Includes CSS added by module '.$modcss.' -->'."\n".'<link rel="stylesheet" type="text/css" href="'.dol_buildpath($cssfile, 1);
1322 1322
                     // 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.
1323 1323
                     if (!preg_match('/\.css$/i', $cssfile))
1324 1324
                         print $themeparam;
1325
-                    print '">' . "\n";
1325
+                    print '">'."\n";
1326 1326
                 }
1327 1327
             }
1328 1328
         }
1329 1329
         // CSS forced by page in top_htmlhead call (relative url starting with /)
1330 1330
         if (is_array($arrayofcss)) {
1331 1331
             foreach ($arrayofcss as $cssfile) {
1332
-                print '<!-- Includes CSS added by page -->' . "\n" . '<link rel="stylesheet" type="text/css" title="default" href="' . dol_buildpath($cssfile, 1);
1332
+                print '<!-- Includes CSS added by page -->'."\n".'<link rel="stylesheet" type="text/css" title="default" href="'.dol_buildpath($cssfile, 1);
1333 1333
                 // 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.
1334 1334
                 if (!preg_match('/\.css$/i', $cssfile))
1335 1335
                     print $themeparam;
1336
-                print '">' . "\n";
1336
+                print '">'."\n";
1337 1337
             }
1338 1338
         }
1339 1339
 
1340 1340
         // Output standard javascript links
1341 1341
         if (!defined('DISABLE_JQUERY') && !$disablejs && !empty($conf->use_javascript_ajax)) {
1342 1342
             // JQuery. Must be before other includes
1343
-            print '<!-- Includes JS for JQuery -->' . "\n";
1343
+            print '<!-- Includes JS for JQuery -->'."\n";
1344 1344
             if (defined('JS_JQUERY') && constant('JS_JQUERY')) {
1345
-                print '<script type="text/javascript" src="' . JS_JQUERY . 'jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1345
+                print '<script type="text/javascript" src="'.JS_JQUERY.'jquery.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1346 1346
             } else {
1347 1347
                 // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1348
-                print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jquery/jquery.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1348
+                print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jquery/jquery.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1349 1349
             }
1350 1350
             if (!empty($conf->global->MAIN_FEATURES_LEVEL) && !defined('JS_JQUERY_MIGRATE_DISABLED')) {
1351 1351
                 if (defined('JS_JQUERY_MIGRATE') && constant('JS_JQUERY_MIGRATE')) {
1352
-                    print '<script type="text/javascript" src="' . JS_JQUERY_MIGRATE . 'jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1352
+                    print '<script type="text/javascript" src="'.JS_JQUERY_MIGRATE.'jquery-migrate.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1353 1353
                 } else {
1354 1354
                     // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1355
-                    print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jquery/jquery-migrate.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1355
+                    print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jquery/jquery-migrate.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1356 1356
                 }
1357 1357
             }
1358 1358
             if (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) {
1359
-                print '<script type="text/javascript" src="' . JS_JQUERY_UI . 'jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1359
+                print '<script type="text/javascript" src="'.JS_JQUERY_UI.'jquery-ui.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1360 1360
             } else {
1361 1361
                 // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/js/jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1362
-                print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jqueryui/jquery-ui.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1362
+                print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jqueryui/jquery-ui.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1363 1363
             }
1364 1364
             if (!defined('DISABLE_JQUERY_TABLEDND')) {
1365
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/tablednd/jquery.tablednd.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1365
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/tablednd/jquery.tablednd.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1366 1366
             }
1367 1367
             // jQuery jnotify
1368 1368
             if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) {
1369
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jnotify/jquery.jnotify.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1369
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jnotify/jquery.jnotify.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1370 1370
             }
1371 1371
             // Flot
1372 1372
             if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT) && !defined('DISABLE_JQUERY_FLOT')) {
1373 1373
                 if (constant('JS_JQUERY_FLOT')) {
1374
-                    print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1375
-                    print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.pie.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1376
-                    print '<script type="text/javascript" src="' . JS_JQUERY_FLOT . 'jquery.flot.stack.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1374
+                    print '<script type="text/javascript" src="'.JS_JQUERY_FLOT.'jquery.flot.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1375
+                    print '<script type="text/javascript" src="'.JS_JQUERY_FLOT.'jquery.flot.pie.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1376
+                    print '<script type="text/javascript" src="'.JS_JQUERY_FLOT.'jquery.flot.stack.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1377 1377
                 } else {
1378
-                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/flot/jquery.flot.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1379
-                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/flot/jquery.flot.pie.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1380
-                    print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/flot/jquery.flot.stack.min.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1378
+                    print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/flot/jquery.flot.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1379
+                    print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/flot/jquery.flot.pie.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1380
+                    print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/flot/jquery.flot.stack.min.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1381 1381
                 }
1382 1382
             }
1383 1383
             // jQuery jeditable
1384 1384
             if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !defined('DISABLE_JQUERY_JEDITABLE')) {
1385
-                print '<!-- JS to manage editInPlace feature -->' . "\n";
1386
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1387
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1388
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1389
-                print '<script type="text/javascript">' . "\n";
1390
-                print 'var urlSaveInPlace = \'' . DOL_BASE_URI . '/core/ajax/saveinplace.php\';' . "\n";
1391
-                print 'var urlLoadInPlace = \'' . DOL_BASE_URI . '/core/ajax/loadinplace.php\';' . "\n";
1392
-                print 'var tooltipInPlace = \'' . $langs->transnoentities('ClickToEdit') . '\';' . "\n"; // Added in title attribute of span
1393
-                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 ?
1394
-                print 'var cancelInPlace = \'' . $langs->trans('Cancel') . '\';' . "\n";
1395
-                print 'var submitInPlace = \'' . $langs->trans('Ok') . '\';' . "\n";
1396
-                print 'var indicatorInPlace = \'<img src="' . DOL_BASE_URI . "/theme/" . $conf->theme . "/img/working.gif" . '">\';' . "\n";
1397
-                print 'var withInPlace = 300;';  // width in pixel for default string edit
1398
-                print '</script>' . "\n";
1399
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/editinplace.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1385
+                print '<!-- JS to manage editInPlace feature -->'."\n";
1386
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1387
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-datepicker.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1388
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.ui-autocomplete.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1389
+                print '<script type="text/javascript">'."\n";
1390
+                print 'var urlSaveInPlace = \''.DOL_BASE_URI.'/core/ajax/saveinplace.php\';'."\n";
1391
+                print 'var urlLoadInPlace = \''.DOL_BASE_URI.'/core/ajax/loadinplace.php\';'."\n";
1392
+                print 'var tooltipInPlace = \''.$langs->transnoentities('ClickToEdit').'\';'."\n"; // Added in title attribute of span
1393
+                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 ?
1394
+                print 'var cancelInPlace = \''.$langs->trans('Cancel').'\';'."\n";
1395
+                print 'var submitInPlace = \''.$langs->trans('Ok').'\';'."\n";
1396
+                print 'var indicatorInPlace = \'<img src="'.DOL_BASE_URI."/theme/".$conf->theme."/img/working.gif".'">\';'."\n";
1397
+                print 'var withInPlace = 300;'; // width in pixel for default string edit
1398
+                print '</script>'."\n";
1399
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/core/js/editinplace.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1400 1400
                 // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1401
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1401
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/jeditable/jquery.jeditable.ckeditor.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1402 1402
             }
1403 1403
             // jQuery Timepicker
1404 1404
             if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) {
1405 1405
                 // print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/timepicker/jquery-ui-timepicker-addon.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1406
-                print '<script type="text/javascript" src="' . BASE_URI . '/vendor/components/jqueryui/ui/widgets/timepicker.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1407
-                print '<script type="text/javascript" src="' . BASE_PATH . '?controller=core/js/&method=timepicker.js&lang=' . $langs->defaultlang . ($ext ? '&amp;' . $ext : '') . '"></script>' . "\n";
1406
+                print '<script type="text/javascript" src="'.BASE_URI.'/vendor/components/jqueryui/ui/widgets/timepicker.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1407
+                print '<script type="text/javascript" src="'.BASE_PATH.'?controller=core/js/&method=timepicker.js&lang='.$langs->defaultlang.($ext ? '&amp;'.$ext : '').'"></script>'."\n";
1408 1408
             }
1409 1409
             if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) {     // jQuery plugin "mutiselect", "multiple-select", "select2", ...
1410 1410
                 $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ? constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT;
1411
-                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
1411
+                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
1412 1412
             }
1413 1413
             if (!defined('DISABLE_MULTISELECT')) {     // jQuery plugin "mutiselect" to select with checkboxes
1414
-                print '<script type="text/javascript" src="' . DOL_BASE_URI . '/includes/jquery/plugins/multiselect/jquery.multi-select.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1414
+                print '<script type="text/javascript" src="'.DOL_BASE_URI.'/includes/jquery/plugins/multiselect/jquery.multi-select.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1415 1415
             }
1416 1416
         }
1417 1417
 
1418 1418
         if (!$disablejs && !empty($conf->use_javascript_ajax)) {
1419 1419
             // CKEditor
1420 1420
             if (!empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') && !defined('DISABLE_CKEDITOR')) {
1421
-                print '<!-- Includes JS for CKEditor -->' . "\n";
1421
+                print '<!-- Includes JS for CKEditor -->'."\n";
1422 1422
                 // $pathckeditor = DOL_BASE_URI . '/includes/ckeditor/ckeditor/';
1423
-                $pathckeditor = BASE_URI . '/vendor/ckeditor/ckeditor/';
1423
+                $pathckeditor = BASE_URI.'/vendor/ckeditor/ckeditor/';
1424 1424
                 $jsckeditor = 'ckeditor.js';
1425 1425
                 if (constant('JS_CKEDITOR')) { // To use external ckeditor 4 js lib
1426 1426
                     $pathckeditor = constant('JS_CKEDITOR');
1427 1427
                 }
1428 1428
                 print '<script type="text/javascript">';
1429
-                print 'var CKEDITOR_BASEPATH = \'' . $pathckeditor . '\';' . "\n";
1430
-                print 'var ckeditorConfig = \'' . dol_buildpath($themesubdir . '/theme/' . $conf->theme . '/ckeditor/config.js' . ($ext ? '?' . $ext : ''), 1) . '\';' . "\n";  // $themesubdir='' in standard usage
1431
-                print 'var ckeditorFilebrowserBrowseUrl = \'' . DOL_BASE_URI . '/core/filemanagerdol/browser/default/browser.php?Connector=' . DOL_BASE_URI . '/core/filemanagerdol/connectors/php/connector.php\';' . "\n";
1432
-                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";
1433
-                print '</script>' . "\n";
1434
-                print '<script type="text/javascript" src="' . $pathckeditor . $jsckeditor . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1429
+                print 'var CKEDITOR_BASEPATH = \''.$pathckeditor.'\';'."\n";
1430
+                print 'var ckeditorConfig = \''.dol_buildpath($themesubdir.'/theme/'.$conf->theme.'/ckeditor/config.js'.($ext ? '?'.$ext : ''), 1).'\';'."\n"; // $themesubdir='' in standard usage
1431
+                print 'var ckeditorFilebrowserBrowseUrl = \''.DOL_BASE_URI.'/core/filemanagerdol/browser/default/browser.php?Connector='.DOL_BASE_URI.'/core/filemanagerdol/connectors/php/connector.php\';'."\n";
1432
+                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";
1433
+                print '</script>'."\n";
1434
+                print '<script type="text/javascript" src="'.$pathckeditor.$jsckeditor.($ext ? '?'.$ext : '').'"></script>'."\n";
1435 1435
             }
1436 1436
 
1437 1437
             // Browser notifications
@@ -1442,16 +1442,16 @@  discard block
 block discarded – undo
1442 1442
                 if ($conf->browser->layout == 'phone')
1443 1443
                     $enablebrowsernotif = false;
1444 1444
                 if ($enablebrowsernotif) {
1445
-                    print '<!-- Includes JS of Dolibarr (brwoser layout = ' . $conf->browser->layout . ')-->' . "\n";
1445
+                    print '<!-- Includes JS of Dolibarr (brwoser layout = '.$conf->browser->layout.')-->'."\n";
1446 1446
                     //print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/lib_notification.js.php' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1447
-                    print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_notification.js' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
1447
+                    print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_notification.js'.($ext ? '?'.$ext : '').'"></script>'."\n";
1448 1448
                 }
1449 1449
             }
1450 1450
 
1451 1451
             // Global js function
1452
-            print '<!-- Includes JS of Dolibarr -->' . "\n";
1452
+            print '<!-- Includes JS of Dolibarr -->'."\n";
1453 1453
             //print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/lib_head.js.php?lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n";
1454
-            print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_head.js&lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n";
1454
+            print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_head.js&lang='.$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n";
1455 1455
 
1456 1456
             // JS forced by modules (relative url starting with /)
1457 1457
             if (!empty($conf->modules_parts['js'])) {  // $conf->modules_parts['js'] is array('module'=>array('file1','file2'))
@@ -1460,27 +1460,27 @@  discard block
 block discarded – undo
1460 1460
                     $filesjs = (array) $filesjs; // To be sure filejs is an array
1461 1461
                     foreach ($filesjs as $jsfile) {
1462 1462
                         // jsfile is a relative path
1463
-                        print '<!-- Include JS added by module ' . $modjs . '-->' . "\n" . '<script type="text/javascript" src="' . dol_buildpath($jsfile, 1) . '"></script>' . "\n";
1463
+                        print '<!-- Include JS added by module '.$modjs.'-->'."\n".'<script type="text/javascript" src="'.dol_buildpath($jsfile, 1).'"></script>'."\n";
1464 1464
                     }
1465 1465
                 }
1466 1466
             }
1467 1467
             // JS forced by page in top_htmlhead (relative url starting with /)
1468 1468
             if (is_array($arrayofjs)) {
1469
-                print '<!-- Includes JS added by page -->' . "\n";
1469
+                print '<!-- Includes JS added by page -->'."\n";
1470 1470
                 foreach ($arrayofjs as $jsfile) {
1471 1471
                     if (preg_match('/^http/i', $jsfile)) {
1472
-                        print '<script type="text/javascript" src="' . $jsfile . '"></script>' . "\n";
1472
+                        print '<script type="text/javascript" src="'.$jsfile.'"></script>'."\n";
1473 1473
                     } else {
1474
-                        print '<script type="text/javascript" src="' . dol_buildpath($jsfile, 1) . '"></script>' . "\n";
1474
+                        print '<script type="text/javascript" src="'.dol_buildpath($jsfile, 1).'"></script>'."\n";
1475 1475
                     }
1476 1476
                 }
1477 1477
             }
1478 1478
         }
1479 1479
 
1480 1480
         if (!empty($head))
1481
-            print $head . "\n";
1481
+            print $head."\n";
1482 1482
         if (!empty($conf->global->MAIN_HTML_HEADER))
1483
-            print $conf->global->MAIN_HTML_HEADER . "\n";
1483
+            print $conf->global->MAIN_HTML_HEADER."\n";
1484 1484
 
1485 1485
         print "<!-- Alixar debugBar header -->";
1486 1486
         print Debug::getRenderHeader(); // Includes Alixar debugBar header
@@ -1531,13 +1531,13 @@  discard block
 block discarded – undo
1531 1531
      * Top menu
1532 1532
      */
1533 1533
     if ((empty($conf->dol_hide_topmenu) || GETPOST('dol_invisible_topmenu', 'int')) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) {
1534
-        print "\n" . '<!-- Start top horizontal -->' . "\n";
1534
+        print "\n".'<!-- Start top horizontal -->'."\n";
1535 1535
 
1536
-        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.
1536
+        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.
1537 1537
         // Show menu entries
1538
-        print '<div id="tmenu_tooltip' . (empty($conf->global->MAIN_MENU_INVERT) ? '' : 'invert') . '" class="tmenu">' . "\n";
1538
+        print '<div id="tmenu_tooltip'.(empty($conf->global->MAIN_MENU_INVERT) ? '' : 'invert').'" class="tmenu">'."\n";
1539 1539
         $menumanager->atarget = $target;
1540
-        $menumanager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks));      // This contains a \n
1540
+        $menumanager->showmenu('top', array('searchform' => $searchform, 'bookmarks' => $bookmarks)); // This contains a \n
1541 1541
         print "</div>\n";
1542 1542
 
1543 1543
         // Define link to login card
@@ -1545,34 +1545,34 @@  discard block
 block discarded – undo
1545 1545
         if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1546 1546
             $appli = $conf->global->MAIN_APPLICATION_TITLE;
1547 1547
             if (preg_match('/\d\.\d/', $appli)) {
1548
-                if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
1549
-                    $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
1548
+                if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli))
1549
+                    $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
1550 1550
             } else
1551
-                $appli .= " " . DOL_VERSION;
1551
+                $appli .= " ".DOL_VERSION;
1552 1552
         } else
1553
-            $appli .= " " . DOL_VERSION;
1553
+            $appli .= " ".DOL_VERSION;
1554 1554
 
1555 1555
         if (!empty($conf->global->MAIN_FEATURES_LEVEL))
1556
-            $appli .= "<br>" . $langs->trans("LevelOfFeature") . ': ' . $conf->global->MAIN_FEATURES_LEVEL;
1556
+            $appli .= "<br>".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL;
1557 1557
 
1558 1558
         $logouttext = '';
1559 1559
         if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
1560 1560
             //$logouthtmltext=$appli.'<br>';
1561 1561
             if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') {
1562
-                $logouthtmltext .= $langs->trans("Logout") . '<br>';
1562
+                $logouthtmltext .= $langs->trans("Logout").'<br>';
1563 1563
 
1564 1564
                 //$logouttext .='<a accesskey="l" href="'.DOL_BASE_URI.'/user/logout.php">';
1565
-                $logouttext .= '<a accesskey="l" href="' . BASE_URI . '?controller=user&method=logout">';
1565
+                $logouttext .= '<a accesskey="l" href="'.BASE_URI.'?controller=user&method=logout">';
1566 1566
                 //$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
1567 1567
                 $logouttext .= '<span class="fa fa-sign-out atoplogin"></span>';
1568 1568
                 $logouttext .= '</a>';
1569 1569
             } else {
1570 1570
                 $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]);
1571
-                $logouttext .= img_picto($langs->trans('Logout') . ":" . $langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
1571
+                $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1);
1572 1572
             }
1573 1573
         }
1574 1574
 
1575
-        print '<div class="login_block">' . "\n";
1575
+        print '<div class="login_block">'."\n";
1576 1576
 
1577 1577
         // Add login user link
1578 1578
         $toprightmenu .= '<div class="login_block_user">';
@@ -1583,18 +1583,18 @@  discard block
 block discarded – undo
1583 1583
         $toprightmenu .= $user->getNomUrl($mode, '', 1, 0, 11, 0, ($user->firstname ? 'firstname' : -1), 'atoplogin');
1584 1584
         $toprightmenu .= '</div></div>';
1585 1585
 
1586
-        $toprightmenu .= '</div>' . "\n";
1586
+        $toprightmenu .= '</div>'."\n";
1587 1587
 
1588 1588
         $toprightmenu .= '<div class="login_block_other">';
1589 1589
 
1590 1590
         // Execute hook printTopRightMenu (hooks should output string like '<div class="login"><a href="">mylink</a></div>')
1591 1591
         $parameters = array();
1592
-        $result = $hookmanager->executeHooks('printTopRightMenu', $parameters);    // Note that $action and $object may have been modified by some hooks
1592
+        $result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note that $action and $object may have been modified by some hooks
1593 1593
         if (is_numeric($result)) {
1594 1594
             if ($result == 0)
1595
-                $toprightmenu .= $hookmanager->resPrint;  // add
1595
+                $toprightmenu .= $hookmanager->resPrint; // add
1596 1596
             else
1597
-                $toprightmenu = $hookmanager->resPrint;      // replace
1597
+                $toprightmenu = $hookmanager->resPrint; // replace
1598 1598
         }
1599 1599
         else {
1600 1600
             $toprightmenu .= $result; // For backward compatibility
@@ -1603,7 +1603,7 @@  discard block
 block discarded – undo
1603 1603
         // Link to module builder
1604 1604
         if (!empty($conf->modulebuilder->enabled)) {
1605 1605
             //$text = '<a href="' . DOL_BASE_URI . '/modulebuilder/index.php?mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
1606
-            $text = '<a href="' . BASE_URI . '?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
1606
+            $text = '<a href="'.BASE_URI.'?controller=modulebuilder&method=index&mainmenu=home&leftmenu=admintools" target="_modulebuilder">';
1607 1607
             //$text.= img_picto(":".$langs->trans("ModuleBuilder"), 'printer_top.png', 'class="printer"');
1608 1608
             $text .= '<span class="fa fa-bug atoplogin"></span>';
1609 1609
             $text .= '</a>';
@@ -1617,12 +1617,12 @@  discard block
 block discarded – undo
1617 1617
             if (is_array($_POST)) {
1618 1618
                 foreach ($_POST as $key => $value) {
1619 1619
                     if ($key !== 'action' && $key !== 'password' && !is_array($value)) {
1620
-                        $qs .= '&' . $key . '=' . urlencode($value);
1620
+                        $qs .= '&'.$key.'='.urlencode($value);
1621 1621
                     }
1622 1622
                 }
1623 1623
             }
1624
-            $qs .= (($qs && $morequerystring) ? '&' : '') . $morequerystring;
1625
-            $text = '<a href="' . dol_escape_htmltag($_SERVER["PHP_SELF"]) . '?' . $qs . ($qs ? '&' : '') . 'optioncss=print" target="_blank">';
1624
+            $qs .= (($qs && $morequerystring) ? '&' : '').$morequerystring;
1625
+            $text = '<a href="'.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.$qs.($qs ? '&' : '').'optioncss=print" target="_blank">';
1626 1626
             //$text.= img_picto(":".$langs->trans("PrintContentArea"), 'printer_top.png', 'class="printer"');
1627 1627
             $text .= '<span class="fa fa-print atoplogin"></span>';
1628 1628
             $text .= '</a>';
@@ -1651,12 +1651,12 @@  discard block
 block discarded – undo
1651 1651
                 $text = '';
1652 1652
                 if (!empty($conf->global->MAIN_SHOWDATABASENAMEINHELPPAGESLINK)) {
1653 1653
                     $langs->load('admin');
1654
-                    $appli .= '<br>' . $langs->trans("Database") . ': ' . $db->database_name;
1654
+                    $appli .= '<br>'.$langs->trans("Database").': '.$db->database_name;
1655 1655
                 }
1656
-                $title = $appli . '<br>';
1656
+                $title = $appli.'<br>';
1657 1657
                 $title .= $langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage' : 'GoToHelpPage');
1658 1658
                 if ($mode == 'wiki') {
1659
-                    $title .= ' - ' . $langs->trans("PageWiki") . ' &quot;' . dol_escape_htmltag(strtr($helppage, '_', ' ')) . '&quot;';
1659
+                    $title .= ' - '.$langs->trans("PageWiki").' &quot;'.dol_escape_htmltag(strtr($helppage, '_', ' ')).'&quot;';
1660 1660
                 }
1661 1661
                 $text .= '<a class="help" target="_blank" rel="noopener" href="';
1662 1662
                 if ($mode == 'wiki') {
@@ -1682,7 +1682,7 @@  discard block
 block discarded – undo
1682 1682
 
1683 1683
         print $toprightmenu;
1684 1684
 
1685
-        print "</div>\n";  // end div class="login_block"
1685
+        print "</div>\n"; // end div class="login_block"
1686 1686
 
1687 1687
         print '</div></div>';
1688 1688
 
@@ -1691,7 +1691,7 @@  discard block
 block discarded – undo
1691 1691
     }
1692 1692
 
1693 1693
     if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile))
1694
-        print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">';
1694
+        print '<!-- Begin div id-container --><div id="id-container" class="id-container'.($morecss ? ' '.$morecss : '').'">';
1695 1695
 }
1696 1696
 
1697 1697
 /**
@@ -1723,7 +1723,7 @@  discard block
 block discarded – undo
1723 1723
         // Instantiate hooks of thirdparty module
1724 1724
         $hookmanager->initHooks(array('searchform', 'leftblock'));
1725 1725
 
1726
-        print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n";
1726
+        print "\n".'<!-- Begin side-nav id-left -->'."\n".'<div class="side-nav"><div id="id-left">'."\n";
1727 1727
 
1728 1728
         if ($conf->browser->layout == 'phone')
1729 1729
             $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
@@ -1735,7 +1735,7 @@  discard block
 block discarded – undo
1735 1735
         }
1736 1736
         $selected = -1;
1737 1737
         $usedbyinclude = 1;
1738
-        include_once DOL_BASE_PATH . '/core/ajax/selectsearchbox.php'; // This set $arrayresult
1738
+        include_once DOL_BASE_PATH.'/core/ajax/selectsearchbox.php'; // This set $arrayresult
1739 1739
 
1740 1740
         if ($conf->use_javascript_ajax && empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
1741 1741
             //$searchform.=$form->selectArrayAjax('searchselectcombo', DOL_BASE_URI.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'vmenusearchselectcombo', 1, $langs->trans("Search"), 1);
@@ -1750,7 +1750,7 @@  discard block
 block discarded – undo
1750 1750
         // Execute hook printSearchForm
1751 1751
         $parameters = array('searchform' => $searchform);
1752 1752
 
1753
-        $reshook = $hookmanager->executeHooks('printSearchForm', $parameters);    // Note that $action and $object may have been modified by some hooks
1753
+        $reshook = $hookmanager->executeHooks('printSearchForm', $parameters); // Note that $action and $object may have been modified by some hooks
1754 1754
         if (empty($reshook)) {
1755 1755
             $searchform .= $hookmanager->resPrint;
1756 1756
         } else
@@ -1758,10 +1758,10 @@  discard block
 block discarded – undo
1758 1758
 
1759 1759
         // Force special value for $searchform
1760 1760
         if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax)) {
1761
-            $urltosearch = DOL_BASE_URI . '/core/search_page.php?showtitlebefore=1';
1762
-            $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="' . $urltosearch . '" alt="' . dol_escape_htmltag($langs->trans("ShowSearchFields")) . '">' . $langs->trans("Search") . '...</a></div></div>';
1761
+            $urltosearch = DOL_BASE_URI.'/core/search_page.php?showtitlebefore=1';
1762
+            $searchform = '<div class="blockvmenuimpair blockvmenusearchphone"><div id="divsearchforms1"><a href="'.$urltosearch.'" alt="'.dol_escape_htmltag($langs->trans("ShowSearchFields")).'">'.$langs->trans("Search").'...</a></div></div>';
1763 1763
         } elseif ($conf->use_javascript_ajax && !empty($conf->global->MAIN_USE_OLD_SEARCH_FORM)) {
1764
-            $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>';
1764
+            $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>';
1765 1765
             $searchform .= '<script type="text/javascript">
1766 1766
             	jQuery(document).ready(function () {
1767 1767
             		jQuery("#divsearchforms1").click(function(){
@@ -1774,16 +1774,16 @@  discard block
 block discarded – undo
1774 1774
 
1775 1775
         // Define $bookmarks
1776 1776
         if (!empty($conf->bookmark->enabled) && $user->rights->bookmark->lire) {
1777
-            include_once DOL_BASE_PATH . '/bookmarks/bookmarks.lib.php';
1777
+            include_once DOL_BASE_PATH.'/bookmarks/bookmarks.lib.php';
1778 1778
             $langs->load("bookmarks");
1779 1779
 
1780 1780
             $bookmarks = printBookmarksList($db, $langs);
1781 1781
         }
1782 1782
 
1783 1783
         // Left column
1784
-        print '<!-- Begin left menu -->' . "\n";
1784
+        print '<!-- Begin left menu -->'."\n";
1785 1785
 
1786
-        print '<div class="vmenu"' . (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"') . '>' . "\n\n";
1786
+        print '<div class="vmenu"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' title="Left menu"').'>'."\n\n";
1787 1787
 
1788 1788
         // Show left menu with other forms
1789 1789
         $menumanager->menu_array = $menu_array_before;
@@ -1792,7 +1792,7 @@  discard block
 block discarded – undo
1792 1792
         // Dolibarr version + help + bug report link
1793 1793
         print "\n";
1794 1794
         print "<!-- Begin Help Block-->\n";
1795
-        print '<div id="blockvmenuhelp" class="blockvmenuhelp">' . "\n";
1795
+        print '<div id="blockvmenuhelp" class="blockvmenuhelp">'."\n";
1796 1796
 
1797 1797
         // Version
1798 1798
         if (empty($conf->global->MAIN_HIDE_VERSION)) {    // Version is already on help picto and on login page.
@@ -1814,15 +1814,15 @@  discard block
 block discarded – undo
1814 1814
                 $appli = $conf->global->MAIN_APPLICATION_TITLE;
1815 1815
                 $doliurl = '';
1816 1816
                 if (preg_match('/\d\.\d/', $appli)) {
1817
-                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
1818
-                        $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
1817
+                    if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli))
1818
+                        $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core
1819 1819
                 } else
1820
-                    $appli .= " " . DOL_VERSION;
1820
+                    $appli .= " ".DOL_VERSION;
1821 1821
             } else
1822
-                $appli .= " " . DOL_VERSION;
1822
+                $appli .= " ".DOL_VERSION;
1823 1823
             print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
1824 1824
             if ($doliurl)
1825
-                print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">';
1825
+                print '<a class="help" target="_blank" rel="noopener" href="'.$doliurl.'">';
1826 1826
             else
1827 1827
                 print '<span class="help">';
1828 1828
             print $appli;
@@ -1830,12 +1830,12 @@  discard block
 block discarded – undo
1830 1830
                 print '</a>';
1831 1831
             else
1832 1832
                 print '</span>';
1833
-            print '</div>' . "\n";
1833
+            print '</div>'."\n";
1834 1834
         }
1835 1835
 
1836 1836
         // Link to bugtrack
1837 1837
         if (!empty($conf->global->MAIN_BUGTRACK_ENABLELINK)) {
1838
-            require_once DOL_BASE_PATH . '/core/lib/functions2.lib.php';
1838
+            require_once DOL_BASE_PATH.'/core/lib/functions2.lib.php';
1839 1839
 
1840 1840
             $bugbaseurl = 'https://github.com/Dolibarr/dolibarr/issues/new';
1841 1841
             $bugbaseurl .= '?title=';
@@ -1844,16 +1844,16 @@  discard block
 block discarded – undo
1844 1844
             $bugbaseurl .= urlencode("# Bug\n");
1845 1845
             $bugbaseurl .= urlencode("\n");
1846 1846
             $bugbaseurl .= urlencode("## Environment\n");
1847
-            $bugbaseurl .= urlencode("- **Version**: " . DOL_VERSION . "\n");
1848
-            $bugbaseurl .= urlencode("- **OS**: " . php_uname('s') . "\n");
1849
-            $bugbaseurl .= urlencode("- **Web server**: " . $_SERVER["SERVER_SOFTWARE"] . "\n");
1850
-            $bugbaseurl .= urlencode("- **PHP**: " . php_sapi_name() . ' ' . phpversion() . "\n");
1851
-            $bugbaseurl .= urlencode("- **Database**: " . $db::LABEL . ' ' . $db->getVersion() . "\n");
1852
-            $bugbaseurl .= urlencode("- **URL**: " . $_SERVER["REQUEST_URI"] . "\n");
1847
+            $bugbaseurl .= urlencode("- **Version**: ".DOL_VERSION."\n");
1848
+            $bugbaseurl .= urlencode("- **OS**: ".php_uname('s')."\n");
1849
+            $bugbaseurl .= urlencode("- **Web server**: ".$_SERVER["SERVER_SOFTWARE"]."\n");
1850
+            $bugbaseurl .= urlencode("- **PHP**: ".php_sapi_name().' '.phpversion()."\n");
1851
+            $bugbaseurl .= urlencode("- **Database**: ".$db::LABEL.' '.$db->getVersion()."\n");
1852
+            $bugbaseurl .= urlencode("- **URL**: ".$_SERVER["REQUEST_URI"]."\n");
1853 1853
             $bugbaseurl .= urlencode("\n");
1854 1854
             $bugbaseurl .= urlencode("## Report\n");
1855 1855
             print '<div id="blockvmenuhelpbugreport" class="blockvmenuhelp">';
1856
-            print '<a class="help" target="_blank" rel="noopener" href="' . $bugbaseurl . '">' . $langs->trans("FindBug") . '</a>';
1856
+            print '<a class="help" target="_blank" rel="noopener" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a>';
1857 1857
             print '</div>';
1858 1858
         }
1859 1859
 
@@ -1867,14 +1867,14 @@  discard block
 block discarded – undo
1867 1867
 
1868 1868
         // Execute hook printLeftBlock
1869 1869
         $parameters = array();
1870
-        $reshook = $hookmanager->executeHooks('printLeftBlock', $parameters);    // Note that $action and $object may have been modified by some hooks
1870
+        $reshook = $hookmanager->executeHooks('printLeftBlock', $parameters); // Note that $action and $object may have been modified by some hooks
1871 1871
         print $hookmanager->resPrint;
1872 1872
 
1873 1873
         print '</div></div> <!-- End side-nav id-left -->'; // End div id="side-nav" div id="id-left"
1874 1874
     }
1875 1875
 
1876 1876
     print "\n";
1877
-    print '<!-- Begin right area -->' . "\n";
1877
+    print '<!-- Begin right area -->'."\n";
1878 1878
 
1879 1879
     if (empty($leftmenuwithoutmainarea))
1880 1880
         main_area($title);
@@ -1895,7 +1895,7 @@  discard block
 block discarded – undo
1895 1895
 
1896 1896
     print "\n";
1897 1897
 
1898
-    print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n";
1898
+    print '<!-- Begin div class="fiche" -->'."\n".'<div class="fiche">'."\n";
1899 1899
 
1900 1900
     if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
1901 1901
         print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED));
@@ -1961,17 +1961,17 @@  discard block
 block discarded – undo
1961 1961
     global $conf, $langs, $user;
1962 1962
 
1963 1963
     $ret = '';
1964
-    $ret .= '<form action="' . $urlaction . '" method="post" class="searchform">';
1965
-    $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
1964
+    $ret .= '<form action="'.$urlaction.'" method="post" class="searchform">';
1965
+    $ret .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
1966 1966
     $ret .= '<input type="hidden" name="mode" value="search">';
1967
-    $ret .= '<input type="hidden" name="savelogin" value="' . dol_escape_htmltag($user->login) . '">';
1967
+    $ret .= '<input type="hidden" name="savelogin" value="'.dol_escape_htmltag($user->login).'">';
1968 1968
     if ($showtitlebefore)
1969
-        $ret .= $title . ' ';
1970
-    $ret .= '<input type="text" class="flat ' . $htmlmorecss . '"';
1971
-    $ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"';
1972
-    $ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : '');
1973
-    $ret .= ' placeholder="' . strip_tags($title) . '"';
1974
-    $ret .= ' name="' . $htmlinputname . '" id="' . $prefhtmlinputname . $htmlinputname . '" />';
1969
+        $ret .= $title.' ';
1970
+    $ret .= '<input type="text" class="flat '.$htmlmorecss.'"';
1971
+    $ret .= ' style="text-indent: 22px; background-image: url(\''.$img.'\'); background-repeat: no-repeat; background-position: 3px;"';
1972
+    $ret .= ($accesskey ? ' accesskey="'.$accesskey.'"' : '');
1973
+    $ret .= ' placeholder="'.strip_tags($title).'"';
1974
+    $ret .= ' name="'.$htmlinputname.'" id="'.$prefhtmlinputname.$htmlinputname.'" />';
1975 1975
     //$ret.='<input type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px" value="'.$langs->trans("Go").'">';
1976 1976
     $ret .= '<button type="submit" class="button" style="padding-top: 4px; padding-bottom: 4px; padding-left: 6px; padding-right: 6px">';
1977 1977
     $ret .= '<span class="fa fa-search"></span>';
@@ -1997,7 +1997,7 @@  discard block
 block discarded – undo
1997 1997
         global $delayedhtmlcontent;
1998 1998
         global $contextpage, $page, $limit;
1999 1999
 
2000
-        $ext = 'layout=' . $conf->browser->layout . '&version=' . urlencode(DOL_VERSION);
2000
+        $ext = 'layout='.$conf->browser->layout.'&version='.urlencode(DOL_VERSION);
2001 2001
 
2002 2002
         // Global html output events ($mesgs, $errors, $warnings)
2003 2003
         dol_htmloutput_events($disabledoutputofmessages);
@@ -2007,15 +2007,15 @@  discard block
 block discarded – undo
2007 2007
         if (is_object($user) && !empty($user->lastsearch_values_tmp) && is_array($user->lastsearch_values_tmp)) {
2008 2008
             // Clean and save data
2009 2009
             foreach ($user->lastsearch_values_tmp as $key => $val) {
2010
-                unset($_SESSION['lastsearch_values_tmp_' . $key]);   // Clean array to rebuild it just after
2010
+                unset($_SESSION['lastsearch_values_tmp_'.$key]); // Clean array to rebuild it just after
2011 2011
                 if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button
2012 2012
                     if (empty($val['sortfield']))
2013 2013
                         unset($val['sortfield']);
2014 2014
                     if (empty($val['sortorder']))
2015 2015
                         unset($val['sortorder']);
2016
-                    dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)");
2017
-                    $_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val);
2018
-                    unset($_SESSION['lastsearch_values_' . $key]);
2016
+                    dol_syslog('Save lastsearch_values_tmp_'.$key.'='.json_encode($val, 0)." (systematic recording of last search criterias)");
2017
+                    $_SESSION['lastsearch_values_tmp_'.$key] = json_encode($val);
2018
+                    unset($_SESSION['lastsearch_values_'.$key]);
2019 2019
                 }
2020 2020
             }
2021 2021
         }
@@ -2024,37 +2024,37 @@  discard block
 block discarded – undo
2024 2024
         $relativepathstring = $_SERVER["PHP_SELF"];
2025 2025
         // Clean $relativepathstring
2026 2026
         if (constant('DOL_BASE_URI'))
2027
-            $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
2027
+            $relativepathstring = preg_replace('/^'.preg_quote(constant('DOL_BASE_URI'), '/').'/', '', $relativepathstring);
2028 2028
         $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
2029 2029
         $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
2030 2030
         if (preg_match('/list\.php$/', $relativepathstring)) {
2031
-            unset($_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring]);
2032
-            unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]);
2033
-            unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]);
2031
+            unset($_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring]);
2032
+            unset($_SESSION['lastsearch_page_tmp_'.$relativepathstring]);
2033
+            unset($_SESSION['lastsearch_limit_tmp_'.$relativepathstring]);
2034 2034
 
2035 2035
             if (!empty($contextpage))
2036
-                $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
2036
+                $_SESSION['lastsearch_contextpage_tmp_'.$relativepathstring] = $contextpage;
2037 2037
             if (!empty($page) && $page > 1)
2038
-                $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
2038
+                $_SESSION['lastsearch_page_tmp_'.$relativepathstring] = $page;
2039 2039
             if (!empty($limit) && $limit != $conf->limit)
2040
-                $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
2040
+                $_SESSION['lastsearch_limit_tmp_'.$relativepathstring] = $limit;
2041 2041
 
2042
-            unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]);
2043
-            unset($_SESSION['lastsearch_page_' . $relativepathstring]);
2044
-            unset($_SESSION['lastsearch_limit_' . $relativepathstring]);
2042
+            unset($_SESSION['lastsearch_contextpage_'.$relativepathstring]);
2043
+            unset($_SESSION['lastsearch_page_'.$relativepathstring]);
2044
+            unset($_SESSION['lastsearch_limit_'.$relativepathstring]);
2045 2045
         }
2046 2046
 
2047 2047
         // Core error message
2048 2048
         if (!empty($conf->global->MAIN_CORE_ERROR)) {
2049 2049
             // Ajax version
2050 2050
             if ($conf->use_javascript_ajax) {
2051
-                $title = img_warning() . ' ' . $langs->trans('CoreErrorTitle');
2051
+                $title = img_warning().' '.$langs->trans('CoreErrorTitle');
2052 2052
                 print ajax_dialog($title, $langs->trans('CoreErrorMessage'));
2053 2053
             }
2054 2054
             // html version
2055 2055
             else {
2056
-                $msg = img_warning() . ' ' . $langs->trans('CoreErrorMessage');
2057
-                print '<div class="error">' . $msg . '</div>';
2056
+                $msg = img_warning().' '.$langs->trans('CoreErrorMessage');
2057
+                print '<div class="error">'.$msg.'</div>';
2058 2058
             }
2059 2059
 
2060 2060
             //define("MAIN_CORE_ERROR",0);      // Constant was defined and we can't change value of a constant
@@ -2062,17 +2062,17 @@  discard block
 block discarded – undo
2062 2062
 
2063 2063
         print "\n\n";
2064 2064
 
2065
-        print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche
2065
+        print '</div> <!-- End div class="fiche" -->'."\n"; // End div fiche
2066 2066
 
2067 2067
         if (empty($conf->dol_hide_leftmenu))
2068
-            print '</div> <!-- End div id-right -->' . "\n"; // End div id-right
2068
+            print '</div> <!-- End div id-right -->'."\n"; // End div id-right
2069 2069
 
2070 2070
         if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile))
2071
-            print '</div> <!-- End div id-container -->' . "\n"; // End div container
2071
+            print '</div> <!-- End div id-container -->'."\n"; // End div container
2072 2072
 
2073 2073
         print "\n";
2074 2074
         if ($comment)
2075
-            print '<!-- ' . $comment . ' -->' . "\n";
2075
+            print '<!-- '.$comment.' -->'."\n";
2076 2076
 
2077 2077
         printCommonFooter($zone);
2078 2078
 
@@ -2080,8 +2080,8 @@  discard block
 block discarded – undo
2080 2080
             print $delayedhtmlcontent;
2081 2081
 
2082 2082
         if (!empty($conf->use_javascript_ajax)) {
2083
-            print "\n" . '<!-- Includes JS Footer of Dolibarr -->' . "\n";
2084
-            print '<script type="text/javascript" src="' . BASE_URI . '?controller=core/js/&method=lib_foot.js&lang=' . $langs->defaultlang . ($ext ? '&' . $ext : '') . '"></script>' . "\n";
2083
+            print "\n".'<!-- Includes JS Footer of Dolibarr -->'."\n";
2084
+            print '<script type="text/javascript" src="'.BASE_URI.'?controller=core/js/&method=lib_foot.js&lang='.$langs->defaultlang.($ext ? '&'.$ext : '').'"></script>'."\n";
2085 2085
         }
2086 2086
 
2087 2087
         // Wrapper to add log when clicking on download or preview
@@ -2093,7 +2093,7 @@  discard block
 block discarded – undo
2093 2093
                 <script type="text/javascript">
2094 2094
                     jQuery(document).ready(function () {
2095 2095
                         $('a.documentpreview').click(function () {
2096
-                            $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>'
2096
+                            $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>'
2097 2097
                                     , {
2098 2098
                                         id:<?php echo $object->id; ?>
2099 2099
                                         , element: '<?php echo $object->element ?>'
@@ -2102,7 +2102,7 @@  discard block
 block discarded – undo
2102 2102
                             );
2103 2103
                         });
2104 2104
                         $('a.documentdownload').click(function () {
2105
-                            $.post('<?php echo DOL_BASE_URI . "/blockedlog/ajax/block-add.php" ?>'
2105
+                            $.post('<?php echo DOL_BASE_URI."/blockedlog/ajax/block-add.php" ?>'
2106 2106
                                     , {
2107 2107
                                         id:<?php echo $object->id; ?>
2108 2108
                                         , element: '<?php echo $object->element ?>'
@@ -2118,7 +2118,7 @@  discard block
 block discarded – undo
2118 2118
 
2119 2119
         // A div for the address popup
2120 2120
         print "\n<!-- A div to allow dialog popup -->\n";
2121
-        print '<div id="dialogforpopup" style="display: none;"></div>' . "\n";
2121
+        print '<div id="dialogforpopup" style="display: none;"></div>'."\n";
2122 2122
 
2123 2123
         print "</body>\n";
2124 2124
 
Please login to merge, or discard this patch.
Braces   +341 added lines, -224 removed lines patch added patch discarded remove patch
@@ -214,16 +214,18 @@  discard block
 block discarded – undo
214 214
     foreach ($tmplist as $tmpkey) {
215 215
         $postkey = $tmpautoset[0] . '_' . $tmpkey;
216 216
         //var_dump('tmpkey='.$tmpkey.' postkey='.$postkey.' value='.$_POST[$postkey]);
217
-        if (!empty($_POST[$postkey]))
218
-            $cookiearrayvalue[$tmpkey] = $_POST[$postkey];
217
+        if (!empty($_POST[$postkey])) {
218
+                    $cookiearrayvalue[$tmpkey] = $_POST[$postkey];
219
+        }
219 220
     }
220 221
     $cookiename = $tmpautoset[0];
221 222
     $cookievalue = json_encode($cookiearrayvalue);
222 223
     //var_dump('setcookie cookiename='.$cookiename.' cookievalue='.$cookievalue);
223 224
     setcookie($cookiename, empty($cookievalue) ? '' : $cookievalue, empty($cookievalue) ? 0 : (time() + (86400 * 354)), '/', null, false, true); // keep cookie 1 year and add tag httponly
224
-    if (empty($cookievalue))
225
-        unset($_COOKIE[$cookiename]);
226
-}
225
+    if (empty($cookievalue)) {
226
+            unset($_COOKIE[$cookiename]);
227
+    }
228
+    }
227 229
 
228 230
 
229 231
 // Init session. Name of session is specific to Dolibarr instance.
@@ -232,8 +234,9 @@  discard block
 block discarded – undo
232 234
 
233 235
 $sessionname = 'DOLSESSID_' . $prefix;
234 236
 $sessiontimeout = 'DOLSESSTIMEOUT_' . $prefix;
235
-if (!empty($_COOKIE[$sessiontimeout]))
237
+if (!empty($_COOKIE[$sessiontimeout])) {
236 238
     ini_set('session.gc_maxlifetime', $_COOKIE[$sessiontimeout]);
239
+}
237 240
 session_name($sessionname);
238 241
 session_set_cookie_params(0, '/', null, false, true);   // Add tag httponly on session cookie (same as setting session.cookie_httponly into php.ini). Must be called before the session_start.
239 242
 // This create lock, released when session_write_close() or end of page.
@@ -264,11 +267,13 @@  discard block
 block discarded – undo
264 267
     $conf->browser->layout = $tmp['layout'];     // 'classic', 'phone', 'tablet'
265 268
     //var_dump($conf->browser);
266 269
 
267
-    if ($conf->browser->layout == 'phone')
268
-        $conf->dol_no_mouse_hover = 1;
269
-    if ($conf->browser->layout == 'phone')
270
-        $conf->global->MAIN_TESTMENUHIDER = 1;
271
-}
270
+    if ($conf->browser->layout == 'phone') {
271
+            $conf->dol_no_mouse_hover = 1;
272
+    }
273
+    if ($conf->browser->layout == 'phone') {
274
+            $conf->global->MAIN_TESTMENUHIDER = 1;
275
+    }
276
+    }
272 277
 
273 278
 // Force HTTPS if required ($conf->file->main_force_https is 0/1 or https dolibarr root url)
274 279
 // $_SERVER["HTTPS"] is 'on' when link is https, otherwise $_SERVER["HTTPS"] is empty or 'off'
@@ -313,10 +318,14 @@  discard block
 block discarded – undo
313 318
 }
314 319
 
315 320
 // Loading of additional presentation includes
316
-if (!defined('NOREQUIREHTML'))
317
-    require_once DOL_BASE_PATH . '/core/class/html.form.class.php';     // Need 660ko memory (800ko in 2.2)
318
-if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax)
319
-    require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php'; // Need 22ko memory
321
+if (!defined('NOREQUIREHTML')) {
322
+    require_once DOL_BASE_PATH . '/core/class/html.form.class.php';
323
+}
324
+// Need 660ko memory (800ko in 2.2)
325
+if (!defined('NOREQUIREAJAX') && $conf->use_javascript_ajax) {
326
+    require_once DOL_BASE_PATH . '/core/lib/ajax.lib.php';
327
+}
328
+// Need 22ko memory
320 329
 
321 330
 
322 331
 
@@ -357,8 +366,9 @@  discard block
 block discarded – undo
357 366
 // Creation of a token against CSRF vulnerabilities
358 367
 if (!defined('NOTOKENRENEWAL')) {
359 368
     // roulement des jetons car cree a chaque appel
360
-    if (isset($_SESSION['newtoken']))
361
-        $_SESSION['token'] = $_SESSION['newtoken'];
369
+    if (isset($_SESSION['newtoken'])) {
370
+            $_SESSION['token'] = $_SESSION['newtoken'];
371
+    }
362 372
 
363 373
     // Save in $_SESSION['newtoken'] what will be next token. Into forms, we will add param token = $_SESSION['newtoken']
364 374
     $token = dol_hash(uniqid(mt_rand(), true)); // Generates a hash of a random number
@@ -380,14 +390,16 @@  discard block
 block discarded – undo
380 390
 }
381 391
 
382 392
 // Disable modules (this must be after session_start and after conf has been loaded)
383
-if (GETPOST('disablemodules', 'alpha'))
393
+if (GETPOST('disablemodules', 'alpha')) {
384 394
     $_SESSION["disablemodules"] = GETPOST('disablemodules', 'alpha');
395
+}
385 396
 if (!empty($_SESSION["disablemodules"])) {
386 397
     $disabled_modules = explode(',', $_SESSION["disablemodules"]);
387 398
     foreach ($disabled_modules as $module) {
388 399
         if ($module) {
389
-            if (empty($conf->$module))
390
-                $conf->$module = new stdClass();
400
+            if (empty($conf->$module)) {
401
+                            $conf->$module = new stdClass();
402
+            }
391 403
             $conf->$module->enabled = false;
392 404
             if ($module == 'fournisseur') {  // Special case
393 405
                 $conf->supplier_order->enabled = 0;
@@ -409,11 +421,13 @@  discard block
 block discarded – undo
409 421
         $dolibarr_main_authentication = constant('MAIN_AUTHENTICATION_MODE');
410 422
     } else {
411 423
         // Authentication mode
412
-        if (empty($dolibarr_main_authentication))
413
-            $dolibarr_main_authentication = 'http,dolibarr';
424
+        if (empty($dolibarr_main_authentication)) {
425
+                    $dolibarr_main_authentication = 'http,dolibarr';
426
+        }
414 427
         // Authentication mode: forceuser
415
-        if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user))
416
-            $dolibarr_auto_user = 'auto';
428
+        if ($dolibarr_main_authentication == 'forceuser' && empty($dolibarr_auto_user)) {
429
+                    $dolibarr_auto_user = 'auto';
430
+        }
417 431
     }
418 432
     // Set authmode
419 433
     $authmode = explode(',', $dolibarr_main_authentication);
@@ -490,35 +504,41 @@  discard block
 block discarded – undo
490 504
                 $hookmanager->initHooks(array('login'));
491 505
                 $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
492 506
                 $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
493
-                if ($reshook < 0)
494
-                    $error++;
507
+                if ($reshook < 0) {
508
+                                    $error++;
509
+                }
495 510
 
496 511
                 // Note: exit is done later
497 512
             }
498 513
         }
499 514
 
500 515
         $allowedmethodtopostusername = 2;
501
-        if (defined('MAIN_AUTHENTICATION_POST_METHOD'))
502
-            $allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD');
516
+        if (defined('MAIN_AUTHENTICATION_POST_METHOD')) {
517
+                    $allowedmethodtopostusername = constant('MAIN_AUTHENTICATION_POST_METHOD');
518
+        }
503 519
         $usertotest = (!empty($_COOKIE['login_dolibarr']) ? $_COOKIE['login_dolibarr'] : GETPOST("username", "alpha", $allowedmethodtopostusername));
504 520
         $passwordtotest = GETPOST('password', 'none', $allowedmethodtopostusername);
505 521
         $entitytotest = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : (!empty($conf->entity) ? $conf->entity : 1));
506 522
 
507 523
         // Define if we received data to test the login.
508 524
         $goontestloop = false;
509
-        if (isset($_SERVER["REMOTE_USER"]) && in_array('http', $authmode))
510
-            $goontestloop = true;
511
-        if ($dolibarr_main_authentication == 'forceuser' && !empty($dolibarr_auto_user))
512
-            $goontestloop = true;
513
-        if (GETPOST("username", "alpha", $allowedmethodtopostusername) || !empty($_COOKIE['login_dolibarr']) || GETPOST('openid_mode', 'alpha', 1))
514
-            $goontestloop = true;
525
+        if (isset($_SERVER["REMOTE_USER"]) && in_array('http', $authmode)) {
526
+                    $goontestloop = true;
527
+        }
528
+        if ($dolibarr_main_authentication == 'forceuser' && !empty($dolibarr_auto_user)) {
529
+                    $goontestloop = true;
530
+        }
531
+        if (GETPOST("username", "alpha", $allowedmethodtopostusername) || !empty($_COOKIE['login_dolibarr']) || GETPOST('openid_mode', 'alpha', 1)) {
532
+                    $goontestloop = true;
533
+        }
515 534
 
516 535
         if (!is_object($langs)) { // This can occurs when calling page with NOREQUIRETRAN defined, however we need langs for error messages.
517 536
             include_once DOL_BASE_PATH . '/core/class/translate.class.php';
518 537
             $langs = new Translate("", $conf);
519 538
             $langcode = (GETPOST('lang', 'aZ09', 1) ? GETPOST('lang', 'aZ09', 1) : (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT));
520
-            if (defined('MAIN_LANG_DEFAULT'))
521
-                $langcode = constant('MAIN_LANG_DEFAULT');
539
+            if (defined('MAIN_LANG_DEFAULT')) {
540
+                            $langcode = constant('MAIN_LANG_DEFAULT');
541
+            }
522 542
             $langs->setDefaultLang($langcode);
523 543
         }
524 544
 
@@ -540,8 +560,9 @@  discard block
 block discarded – undo
540 560
                     $datenow = dol_now();
541 561
                     $datefirst = dol_stringtotime($_POST["dst_first"]);
542 562
                     $datesecond = dol_stringtotime($_POST["dst_second"]);
543
-                    if ($datenow >= $datefirst && $datenow < $datesecond)
544
-                        $dol_dst = 1;
563
+                    if ($datenow >= $datefirst && $datenow < $datesecond) {
564
+                                            $dol_dst = 1;
565
+                    }
545 566
                 }
546 567
                 //print $datefirst.'-'.$datesecond.'-'.$datenow.'-'.$dol_tz.'-'.$dol_tzstring.'-'.$dol_dst; exit;
547 568
             }
@@ -553,8 +574,9 @@  discard block
 block discarded – undo
553 574
 
554 575
                 // Bad password. No authmode has found a good password.
555 576
                 // We set a generic message if not defined inside function checkLoginPassEntity or subfunctions
556
-                if (empty($_SESSION["dol_loginmesg"]))
557
-                    $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword");
577
+                if (empty($_SESSION["dol_loginmesg"])) {
578
+                                    $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword");
579
+                }
558 580
 
559 581
                 // Call trigger for the "security events" log
560 582
                 $user->trigger_mesg = $langs->trans("ErrorBadLoginPassword") . ' - login=' . GETPOST("username", "alpha", 2);
@@ -571,8 +593,9 @@  discard block
 block discarded – undo
571 593
                 $hookmanager->initHooks(array('login'));
572 594
                 $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
573 595
                 $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
574
-                if ($reshook < 0)
575
-                    $error++;
596
+                if ($reshook < 0) {
597
+                                    $error++;
598
+                }
576 599
 
577 600
                 // Note: exit is done in next chapter
578 601
             }
@@ -582,10 +605,11 @@  discard block
 block discarded – undo
582 605
         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.
583 606
             // No data to test login, so we show the login page
584 607
             dol_syslog("--- Access to " . $_SERVER["PHP_SELF"] . " showing the login form and exit");
585
-            if (defined('NOREDIRECTBYMAINTOLOGIN'))
586
-                return 'ERROR_NOT_LOGGED';
587
-            else
588
-                dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : ''));
608
+            if (defined('NOREDIRECTBYMAINTOLOGIN')) {
609
+                            return 'ERROR_NOT_LOGGED';
610
+            } else {
611
+                            dol_loginfunction($langs, $conf, (!empty($mysoc) ? $mysoc : ''));
612
+            }
589 613
             exit;
590 614
         }
591 615
 
@@ -624,21 +648,24 @@  discard block
 block discarded – undo
624 648
             $hookmanager->initHooks(array('login'));
625 649
             $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
626 650
             $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
627
-            if ($reshook < 0)
628
-                $error++;
651
+            if ($reshook < 0) {
652
+                            $error++;
653
+            }
629 654
 
630 655
             $paramsurl = array();
631
-            if (GETPOST('textbrowser', 'int'))
632
-                $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
633
-            if (GETPOST('nojs', 'int'))
634
-                $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
635
-            if (GETPOST('lang', 'aZ09'))
636
-                $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
656
+            if (GETPOST('textbrowser', 'int')) {
657
+                            $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
658
+            }
659
+            if (GETPOST('nojs', 'int')) {
660
+                            $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
661
+            }
662
+            if (GETPOST('lang', 'aZ09')) {
663
+                            $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
664
+            }
637 665
             header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''));
638 666
             exit;
639 667
         }
640
-    }
641
-    else {
668
+    } else {
642 669
         // We are already into an authenticated session
643 670
         $login = $_SESSION["dol_login"];
644 671
         $entity = $_SESSION["dol_entity"];
@@ -680,20 +707,23 @@  discard block
 block discarded – undo
680 707
             $hookmanager->initHooks(array('login'));
681 708
             $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginmesg' => $_SESSION["dol_loginmesg"]);
682 709
             $reshook = $hookmanager->executeHooks('afterLoginFailed', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
683
-            if ($reshook < 0)
684
-                $error++;
710
+            if ($reshook < 0) {
711
+                            $error++;
712
+            }
685 713
 
686 714
             $paramsurl = array();
687
-            if (GETPOST('textbrowser', 'int'))
688
-                $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
689
-            if (GETPOST('nojs', 'int'))
690
-                $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
691
-            if (GETPOST('lang', 'aZ09'))
692
-                $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
715
+            if (GETPOST('textbrowser', 'int')) {
716
+                            $paramsurl[] = 'textbrowser=' . GETPOST('textbrowser', 'int');
717
+            }
718
+            if (GETPOST('nojs', 'int')) {
719
+                            $paramsurl[] = 'nojs=' . GETPOST('nojs', 'int');
720
+            }
721
+            if (GETPOST('lang', 'aZ09')) {
722
+                            $paramsurl[] = 'lang=' . GETPOST('lang', 'aZ09');
723
+            }
693 724
             header('Location: ' . DOL_BASE_URI . '/index.php' . (count($paramsurl) ? '?' . implode('&', $paramsurl) : ''));
694 725
             exit;
695
-        }
696
-        else {
726
+        } else {
697 727
             // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
698 728
             $hookmanager->initHooks(array('main'));
699 729
 
@@ -702,8 +732,9 @@  discard block
 block discarded – undo
702 732
                 $relativepathstring = preg_replace('/\?.*$/', '', $_SERVER["HTTP_REFERER"]);
703 733
                 $relativepathstring = preg_replace('/^https?:\/\/[^\/]*/', '', $relativepathstring);     // Get full path except host server
704 734
                 // Clean $relativepathstring
705
-                if (constant('DOL_BASE_URI'))
706
-                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
735
+                if (constant('DOL_BASE_URI')) {
736
+                                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
737
+                }
707 738
                 $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
708 739
                 $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
709 740
                 //var_dump($relativepathstring);
@@ -754,16 +785,21 @@  discard block
 block discarded – undo
754 785
         $_SESSION["dol_company"] = $conf->global->MAIN_INFO_SOCIETE_NOM;
755 786
         $_SESSION["dol_entity"] = $conf->entity;
756 787
         // Store value into session (values stored only if defined)
757
-        if (!empty($dol_hide_topmenu))
758
-            $_SESSION['dol_hide_topmenu'] = $dol_hide_topmenu;
759
-        if (!empty($dol_hide_leftmenu))
760
-            $_SESSION['dol_hide_leftmenu'] = $dol_hide_leftmenu;
761
-        if (!empty($dol_optimize_smallscreen))
762
-            $_SESSION['dol_optimize_smallscreen'] = $dol_optimize_smallscreen;
763
-        if (!empty($dol_no_mouse_hover))
764
-            $_SESSION['dol_no_mouse_hover'] = $dol_no_mouse_hover;
765
-        if (!empty($dol_use_jmobile))
766
-            $_SESSION['dol_use_jmobile'] = $dol_use_jmobile;
788
+        if (!empty($dol_hide_topmenu)) {
789
+                    $_SESSION['dol_hide_topmenu'] = $dol_hide_topmenu;
790
+        }
791
+        if (!empty($dol_hide_leftmenu)) {
792
+                    $_SESSION['dol_hide_leftmenu'] = $dol_hide_leftmenu;
793
+        }
794
+        if (!empty($dol_optimize_smallscreen)) {
795
+                    $_SESSION['dol_optimize_smallscreen'] = $dol_optimize_smallscreen;
796
+        }
797
+        if (!empty($dol_no_mouse_hover)) {
798
+                    $_SESSION['dol_no_mouse_hover'] = $dol_no_mouse_hover;
799
+        }
800
+        if (!empty($dol_use_jmobile)) {
801
+                    $_SESSION['dol_use_jmobile'] = $dol_use_jmobile;
802
+        }
767 803
 
768 804
         dol_syslog("This is a new started user session. _SESSION['dol_login']=" . $_SESSION["dol_login"] . " Session id=" . session_id());
769 805
 
@@ -788,8 +824,9 @@  discard block
 block discarded – undo
788 824
         $hookmanager->initHooks(array('login'));
789 825
         $parameters = array('dol_authmode' => $dol_authmode, 'dol_loginfo' => $loginfo);
790 826
         $reshook = $hookmanager->executeHooks('afterLogin', $parameters, $user, $action);    // Note that $action and $object may have been modified by some hooks
791
-        if ($reshook < 0)
792
-            $error++;
827
+        if ($reshook < 0) {
828
+                    $error++;
829
+        }
793 830
 
794 831
         if ($error) {
795 832
             $db->rollback();
@@ -827,10 +864,14 @@  discard block
 block discarded – undo
827 864
      */
828 865
 
829 866
     // Set liste_limit
830
-    if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT))
831
-        $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT; // Can be 0
832
-    if (isset($user->conf->PRODUIT_LIMIT_SIZE))
833
-        $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE; // Can be 0
867
+    if (isset($user->conf->MAIN_SIZE_LISTE_LIMIT)) {
868
+            $conf->liste_limit = $user->conf->MAIN_SIZE_LISTE_LIMIT;
869
+    }
870
+    // Can be 0
871
+    if (isset($user->conf->PRODUIT_LIMIT_SIZE)) {
872
+            $conf->product->limit_size = $user->conf->PRODUIT_LIMIT_SIZE;
873
+    }
874
+    // Can be 0
834 875
 
835 876
 
836 877
 
@@ -869,8 +910,9 @@  discard block
 block discarded – undo
869 910
     if (!empty($user->conf->MAIN_DISABLE_JAVASCRIPT)) {
870 911
         $conf->use_javascript_ajax = !$user->conf->MAIN_DISABLE_JAVASCRIPT;
871 912
     }
872
-} else
913
+} else {
873 914
     $conf->use_javascript_ajax = 0;
915
+}
874 916
 // Set MAIN_OPTIMIZEFORTEXTBROWSER
875 917
 if (GETPOST('textbrowser', 'int') || (!empty($conf->browser->name) && $conf->browser->name == 'lynxlinks') || !empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) {   // If we must enable text browser
876 918
     $conf->global->MAIN_OPTIMIZEFORTEXTBROWSER = 1;
@@ -879,25 +921,32 @@  discard block
 block discarded – undo
879 921
 }
880 922
 
881 923
 // Set terminal output option according to conf->browser.
882
-if (GETPOST('dol_hide_leftmenu', 'int') || !empty($_SESSION['dol_hide_leftmenu']))
924
+if (GETPOST('dol_hide_leftmenu', 'int') || !empty($_SESSION['dol_hide_leftmenu'])) {
883 925
     $conf->dol_hide_leftmenu = 1;
884
-if (GETPOST('dol_hide_topmenu', 'int') || !empty($_SESSION['dol_hide_topmenu']))
926
+}
927
+if (GETPOST('dol_hide_topmenu', 'int') || !empty($_SESSION['dol_hide_topmenu'])) {
885 928
     $conf->dol_hide_topmenu = 1;
886
-if (GETPOST('dol_optimize_smallscreen', 'int') || !empty($_SESSION['dol_optimize_smallscreen']))
929
+}
930
+if (GETPOST('dol_optimize_smallscreen', 'int') || !empty($_SESSION['dol_optimize_smallscreen'])) {
887 931
     $conf->dol_optimize_smallscreen = 1;
888
-if (GETPOST('dol_no_mouse_hover', 'int') || !empty($_SESSION['dol_no_mouse_hover']))
932
+}
933
+if (GETPOST('dol_no_mouse_hover', 'int') || !empty($_SESSION['dol_no_mouse_hover'])) {
889 934
     $conf->dol_no_mouse_hover = 1;
890
-if (GETPOST('dol_use_jmobile', 'int') || !empty($_SESSION['dol_use_jmobile']))
935
+}
936
+if (GETPOST('dol_use_jmobile', 'int') || !empty($_SESSION['dol_use_jmobile'])) {
891 937
     $conf->dol_use_jmobile = 1;
892
-if (!empty($conf->browser->layout) && $conf->browser->layout != 'classic')
938
+}
939
+if (!empty($conf->browser->layout) && $conf->browser->layout != 'classic') {
893 940
     $conf->dol_no_mouse_hover = 1;
941
+}
894 942
 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)
895 943
 ) {
896 944
     $conf->dol_optimize_smallscreen = 1;
897 945
 }
898 946
 // If we force to use jmobile, then we reenable javascript
899
-if (!empty($conf->dol_use_jmobile))
947
+if (!empty($conf->dol_use_jmobile)) {
900 948
     $conf->use_javascript_ajax = 1;
949
+}
901 950
 // Replace themes bugged with jmobile with eldy
902 951
 if (!empty($conf->dol_use_jmobile) && in_array($conf->theme, array('bureau2crea', 'cameleo', 'amarok'))) {
903 952
     $conf->theme = 'eldy';
@@ -921,8 +970,9 @@  discard block
 block discarded – undo
921 970
 if (!defined('NOLOGIN')) {
922 971
     // If the login is not recovered, it is identified with an account that does not exist.
923 972
     // Hacking attempt?
924
-    if (!$user->login)
925
-        accessforbidden();
973
+    if (!$user->login) {
974
+            accessforbidden();
975
+    }
926 976
 
927 977
     // Check if user is active
928 978
     if ($user->statut < 1) {
@@ -997,15 +1047,18 @@  discard block
 block discarded – undo
997 1047
 
998 1048
     // Load the menu manager (only if not already done)
999 1049
     $file_menu = $conf->standard_menu;
1000
-    if (GETPOST('menu', 'alpha'))
1001
-        $file_menu = GETPOST('menu', 'alpha');     // example: menu=eldy_menu.php
1050
+    if (GETPOST('menu', 'alpha')) {
1051
+            $file_menu = GETPOST('menu', 'alpha');
1052
+    }
1053
+    // example: menu=eldy_menu.php
1002 1054
     if (!class_exists('MenuManager')) {
1003 1055
         $menufound = 0;
1004 1056
         $dirmenus = array_merge(array("/core/menus/"), (array) $conf->modules_parts['menus']);
1005 1057
         foreach ($dirmenus as $dirmenu) {
1006 1058
             $menufound = dol_include_once($dirmenu . "standard/" . $file_menu);
1007
-            if (class_exists('MenuManager'))
1008
-                break;
1059
+            if (class_exists('MenuManager')) {
1060
+                            break;
1061
+            }
1009 1062
         }
1010 1063
         if (!class_exists('MenuManager')) { // If failed to include, we try with standard eldy_menu.php
1011 1064
             dol_syslog("You define a menu manager '" . $file_menu . "' that can not be loaded.", LOG_WARNING);
@@ -1155,18 +1208,20 @@  discard block
 block discarded – undo
1155 1208
     }
1156 1209
     print '<!doctype html>' . "\n";
1157 1210
 
1158
-    if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST))
1159
-        print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_BASE_URI . '/cache.manifest">' . "\n";
1160
-    else
1161
-        print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n";
1211
+    if (!empty($conf->global->MAIN_USE_CACHE_MANIFEST)) {
1212
+            print '<html lang="' . substr($langs->defaultlang, 0, 2) . '" manifest="' . DOL_BASE_URI . '/cache.manifest">' . "\n";
1213
+    } else {
1214
+            print '<html lang="' . substr($langs->defaultlang, 0, 2) . '">' . "\n";
1215
+    }
1162 1216
     //print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">'."\n";
1163 1217
     if (empty($disablehead)) {
1164 1218
         $ext = 'layout=' . $conf->browser->layout . '&version=' . urlencode(DOL_VERSION);
1165 1219
 
1166 1220
         print "<head>\n";
1167 1221
 
1168
-        if (GETPOST('dol_basehref', 'alpha'))
1169
-            print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')) . '">' . "\n";
1222
+        if (GETPOST('dol_basehref', 'alpha')) {
1223
+                    print '<base href="' . dol_escape_htmltag(GETPOST('dol_basehref', 'alpha')) . '">' . "\n";
1224
+        }
1170 1225
 
1171 1226
         // Displays meta
1172 1227
         print '<meta charset="UTF-8">' . "\n";
@@ -1176,10 +1231,13 @@  discard block
 block discarded – undo
1176 1231
 
1177 1232
         // Favicon
1178 1233
         $favicon = dol_buildpath('/theme/' . $conf->theme . '/img/favicon.ico', 1);
1179
-        if (!empty($conf->global->MAIN_FAVICON_URL))
1180
-            $favicon = $conf->global->MAIN_FAVICON_URL;
1181
-        if (empty($conf->dol_use_jmobile))
1182
-            print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n"; // Not required into an Android webview
1234
+        if (!empty($conf->global->MAIN_FAVICON_URL)) {
1235
+                    $favicon = $conf->global->MAIN_FAVICON_URL;
1236
+        }
1237
+        if (empty($conf->dol_use_jmobile)) {
1238
+                    print '<link rel="shortcut icon" type="image/x-icon" href="' . $favicon . '"/>' . "\n";
1239
+        }
1240
+        // Not required into an Android webview
1183 1241
 
1184 1242
 
1185 1243
 
@@ -1201,32 +1259,40 @@  discard block
 block discarded – undo
1201 1259
         //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";
1202 1260
         //if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) print '<link rel="author" title="Dolibarr Development Team" href="https://www.dolibarr.org">'."\n";
1203 1261
         // Auto refresh page
1204
-        if (GETPOST('autorefresh', 'int') > 0)
1205
-            print '<meta http-equiv="refresh" content="' . GETPOST('autorefresh', 'int') . '">';
1262
+        if (GETPOST('autorefresh', 'int') > 0) {
1263
+                    print '<meta http-equiv="refresh" content="' . GETPOST('autorefresh', 'int') . '">';
1264
+        }
1206 1265
 
1207 1266
         // Displays title
1208 1267
         $appli = constant('DOL_APPLICATION_TITLE');
1209
-        if (!empty($conf->global->MAIN_APPLICATION_TITLE))
1210
-            $appli = $conf->global->MAIN_APPLICATION_TITLE;
1268
+        if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1269
+                    $appli = $conf->global->MAIN_APPLICATION_TITLE;
1270
+        }
1211 1271
 
1212 1272
         print '<title>';
1213 1273
         $titletoshow = '';
1214
-        if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE))
1215
-            $titletoshow = dol_htmlentities($title);
1216
-        else if ($title)
1217
-            $titletoshow = dol_htmlentities($appli . ' - ' . $title);
1218
-        else
1219
-            $titletoshow = dol_htmlentities($appli);
1220
-
1221
-        if (!is_object($hookmanager))
1222
-            $hookmanager = new HookManager($db);
1274
+        if ($title && !empty($conf->global->MAIN_HTML_TITLE) && preg_match('/noapp/', $conf->global->MAIN_HTML_TITLE)) {
1275
+                    $titletoshow = dol_htmlentities($title);
1276
+        } else if ($title) {
1277
+                    $titletoshow = dol_htmlentities($appli . ' - ' . $title);
1278
+        } else {
1279
+                    $titletoshow = dol_htmlentities($appli);
1280
+        }
1281
+
1282
+        if (!is_object($hookmanager)) {
1283
+                    $hookmanager = new HookManager($db);
1284
+        }
1223 1285
         $hookmanager->initHooks("main");
1224 1286
         $parameters = array('title' => $titletoshow);
1225 1287
         $result = $hookmanager->executeHooks('setHtmlTitle', $parameters);  // Note that $action and $object may have been modified by some hooks
1226
-        if ($result > 0)
1227
-            $titletoshow = $hookmanager->resPrint;    // Replace Title to show
1228
-        else
1229
-            $titletoshow .= $hookmanager->resPrint;      // Concat to Title to show
1288
+        if ($result > 0) {
1289
+                    $titletoshow = $hookmanager->resPrint;
1290
+        }
1291
+        // Replace Title to show
1292
+        else {
1293
+                    $titletoshow .= $hookmanager->resPrint;
1294
+        }
1295
+        // Concat to Title to show
1230 1296
 
1231 1297
         print $titletoshow;
1232 1298
         print '</title>';
@@ -1306,8 +1372,9 @@  discard block
 block discarded – undo
1306 1372
 
1307 1373
         //print 'themepath='.$themepath.' themeparam='.$themeparam;exit;
1308 1374
         print '<link rel="stylesheet" type="text/css" href="' . $themepath . $themeparam . '">' . "\n";
1309
-        if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME))
1310
-            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";
1375
+        if (!empty($conf->global->MAIN_FIX_FLASH_ON_CHROME)) {
1376
+                    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";
1377
+        }
1311 1378
 
1312 1379
         // CSS forced by modules (relative url starting with /)
1313 1380
         if (!empty($conf->modules_parts['css'])) {
@@ -1315,13 +1382,15 @@  discard block
 block discarded – undo
1315 1382
             foreach ($arraycss as $modcss => $filescss) {
1316 1383
                 $filescss = (array) $filescss; // To be sure filecss is an array
1317 1384
                 foreach ($filescss as $cssfile) {
1318
-                    if (empty($cssfile))
1319
-                        dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING);
1385
+                    if (empty($cssfile)) {
1386
+                                            dol_syslog("Warning: module " . $modcss . " declared a css path file into its descriptor that is empty.", LOG_WARNING);
1387
+                    }
1320 1388
                     // cssfile is a relative path
1321 1389
                     print '<!-- Includes CSS added by module ' . $modcss . ' -->' . "\n" . '<link rel="stylesheet" type="text/css" href="' . dol_buildpath($cssfile, 1);
1322 1390
                     // 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.
1323
-                    if (!preg_match('/\.css$/i', $cssfile))
1324
-                        print $themeparam;
1391
+                    if (!preg_match('/\.css$/i', $cssfile)) {
1392
+                                            print $themeparam;
1393
+                    }
1325 1394
                     print '">' . "\n";
1326 1395
                 }
1327 1396
             }
@@ -1331,8 +1400,9 @@  discard block
 block discarded – undo
1331 1400
             foreach ($arrayofcss as $cssfile) {
1332 1401
                 print '<!-- Includes CSS added by page -->' . "\n" . '<link rel="stylesheet" type="text/css" title="default" href="' . dol_buildpath($cssfile, 1);
1333 1402
                 // 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.
1334
-                if (!preg_match('/\.css$/i', $cssfile))
1335
-                    print $themeparam;
1403
+                if (!preg_match('/\.css$/i', $cssfile)) {
1404
+                                    print $themeparam;
1405
+                }
1336 1406
                 print '">' . "\n";
1337 1407
             }
1338 1408
         }
@@ -1437,10 +1507,12 @@  discard block
 block discarded – undo
1437 1507
             // Browser notifications
1438 1508
             if (!defined('DISABLE_BROWSER_NOTIF')) {
1439 1509
                 $enablebrowsernotif = false;
1440
-                if (!empty($conf->agenda->enabled) && !empty($conf->global->AGENDA_REMINDER_BROWSER))
1441
-                    $enablebrowsernotif = true;
1442
-                if ($conf->browser->layout == 'phone')
1443
-                    $enablebrowsernotif = false;
1510
+                if (!empty($conf->agenda->enabled) && !empty($conf->global->AGENDA_REMINDER_BROWSER)) {
1511
+                                    $enablebrowsernotif = true;
1512
+                }
1513
+                if ($conf->browser->layout == 'phone') {
1514
+                                    $enablebrowsernotif = false;
1515
+                }
1444 1516
                 if ($enablebrowsernotif) {
1445 1517
                     print '<!-- Includes JS of Dolibarr (brwoser layout = ' . $conf->browser->layout . ')-->' . "\n";
1446 1518
                     //print '<script type="text/javascript" src="' . DOL_BASE_URI . '/core/js/lib_notification.js.php' . ($ext ? '?' . $ext : '') . '"></script>' . "\n";
@@ -1477,10 +1549,12 @@  discard block
 block discarded – undo
1477 1549
             }
1478 1550
         }
1479 1551
 
1480
-        if (!empty($head))
1481
-            print $head . "\n";
1482
-        if (!empty($conf->global->MAIN_HTML_HEADER))
1483
-            print $conf->global->MAIN_HTML_HEADER . "\n";
1552
+        if (!empty($head)) {
1553
+                    print $head . "\n";
1554
+        }
1555
+        if (!empty($conf->global->MAIN_HTML_HEADER)) {
1556
+                    print $conf->global->MAIN_HTML_HEADER . "\n";
1557
+        }
1484 1558
 
1485 1559
         print "<!-- Alixar debugBar header -->";
1486 1560
         print Debug::getRenderHeader(); // Includes Alixar debugBar header
@@ -1545,15 +1619,20 @@  discard block
 block discarded – undo
1545 1619
         if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1546 1620
             $appli = $conf->global->MAIN_APPLICATION_TITLE;
1547 1621
             if (preg_match('/\d\.\d/', $appli)) {
1548
-                if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
1549
-                    $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
1550
-            } else
1551
-                $appli .= " " . DOL_VERSION;
1552
-        } else
1553
-            $appli .= " " . DOL_VERSION;
1622
+                if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) {
1623
+                                    $appli .= " (" . DOL_VERSION . ")";
1624
+                }
1625
+                // If new title contains a version that is different than core
1626
+            } else {
1627
+                            $appli .= " " . DOL_VERSION;
1628
+            }
1629
+        } else {
1630
+                    $appli .= " " . DOL_VERSION;
1631
+        }
1554 1632
 
1555
-        if (!empty($conf->global->MAIN_FEATURES_LEVEL))
1556
-            $appli .= "<br>" . $langs->trans("LevelOfFeature") . ': ' . $conf->global->MAIN_FEATURES_LEVEL;
1633
+        if (!empty($conf->global->MAIN_FEATURES_LEVEL)) {
1634
+                    $appli .= "<br>" . $langs->trans("LevelOfFeature") . ': ' . $conf->global->MAIN_FEATURES_LEVEL;
1635
+        }
1557 1636
 
1558 1637
         $logouttext = '';
1559 1638
         if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
@@ -1591,12 +1670,15 @@  discard block
 block discarded – undo
1591 1670
         $parameters = array();
1592 1671
         $result = $hookmanager->executeHooks('printTopRightMenu', $parameters);    // Note that $action and $object may have been modified by some hooks
1593 1672
         if (is_numeric($result)) {
1594
-            if ($result == 0)
1595
-                $toprightmenu .= $hookmanager->resPrint;  // add
1596
-            else
1597
-                $toprightmenu = $hookmanager->resPrint;      // replace
1598
-        }
1599
-        else {
1673
+            if ($result == 0) {
1674
+                            $toprightmenu .= $hookmanager->resPrint;
1675
+            }
1676
+            // add
1677
+            else {
1678
+                            $toprightmenu = $hookmanager->resPrint;
1679
+            }
1680
+            // replace
1681
+        } else {
1600 1682
             $toprightmenu .= $result; // For backward compatibility
1601 1683
         }
1602 1684
 
@@ -1690,9 +1772,10 @@  discard block
 block discarded – undo
1690 1772
         print "<!-- End top horizontal menu -->\n\n";
1691 1773
     }
1692 1774
 
1693
-    if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile))
1694
-        print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">';
1695
-}
1775
+    if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) {
1776
+            print '<!-- Begin div id-container --><div id="id-container" class="id-container' . ($morecss ? ' ' . $morecss : '') . '">';
1777
+    }
1778
+    }
1696 1779
 
1697 1780
 /**
1698 1781
  *  Show left menu bar
@@ -1716,8 +1799,9 @@  discard block
 block discarded – undo
1716 1799
     $searchform = '';
1717 1800
     $bookmarks = '';
1718 1801
 
1719
-    if (!empty($menu_array_before))
1720
-        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);
1802
+    if (!empty($menu_array_before)) {
1803
+            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);
1804
+    }
1721 1805
 
1722 1806
     if (empty($conf->dol_hide_leftmenu) && (!defined('NOREQUIREMENU') || !constant('NOREQUIREMENU'))) {
1723 1807
         // Instantiate hooks of thirdparty module
@@ -1725,8 +1809,10 @@  discard block
 block discarded – undo
1725 1809
 
1726 1810
         print "\n" . '<!-- Begin side-nav id-left -->' . "\n" . '<div class="side-nav"><div id="id-left">' . "\n";
1727 1811
 
1728
-        if ($conf->browser->layout == 'phone')
1729
-            $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1; // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
1812
+        if ($conf->browser->layout == 'phone') {
1813
+                    $conf->global->MAIN_USE_OLD_SEARCH_FORM = 1;
1814
+        }
1815
+        // Select into select2 is awfull on smartphone. TODO Is this still true with select2 v4 ?
1730 1816
 
1731 1817
         print "\n";
1732 1818
 
@@ -1753,8 +1839,9 @@  discard block
 block discarded – undo
1753 1839
         $reshook = $hookmanager->executeHooks('printSearchForm', $parameters);    // Note that $action and $object may have been modified by some hooks
1754 1840
         if (empty($reshook)) {
1755 1841
             $searchform .= $hookmanager->resPrint;
1756
-        } else
1757
-            $searchform = $hookmanager->resPrint;
1842
+        } else {
1843
+                    $searchform = $hookmanager->resPrint;
1844
+        }
1758 1845
 
1759 1846
         // Force special value for $searchform
1760 1847
         if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) || empty($conf->use_javascript_ajax)) {
@@ -1798,38 +1885,49 @@  discard block
 block discarded – undo
1798 1885
         if (empty($conf->global->MAIN_HIDE_VERSION)) {    // Version is already on help picto and on login page.
1799 1886
             $doliurl = 'https://www.dolibarr.org';
1800 1887
             //local communities
1801
-            if (preg_match('/fr/i', $langs->defaultlang))
1802
-                $doliurl = 'https://www.dolibarr.fr';
1803
-            if (preg_match('/es/i', $langs->defaultlang))
1804
-                $doliurl = 'https://www.dolibarr.es';
1805
-            if (preg_match('/de/i', $langs->defaultlang))
1806
-                $doliurl = 'https://www.dolibarr.de';
1807
-            if (preg_match('/it/i', $langs->defaultlang))
1808
-                $doliurl = 'https://www.dolibarr.it';
1809
-            if (preg_match('/gr/i', $langs->defaultlang))
1810
-                $doliurl = 'https://www.dolibarr.gr';
1888
+            if (preg_match('/fr/i', $langs->defaultlang)) {
1889
+                            $doliurl = 'https://www.dolibarr.fr';
1890
+            }
1891
+            if (preg_match('/es/i', $langs->defaultlang)) {
1892
+                            $doliurl = 'https://www.dolibarr.es';
1893
+            }
1894
+            if (preg_match('/de/i', $langs->defaultlang)) {
1895
+                            $doliurl = 'https://www.dolibarr.de';
1896
+            }
1897
+            if (preg_match('/it/i', $langs->defaultlang)) {
1898
+                            $doliurl = 'https://www.dolibarr.it';
1899
+            }
1900
+            if (preg_match('/gr/i', $langs->defaultlang)) {
1901
+                            $doliurl = 'https://www.dolibarr.gr';
1902
+            }
1811 1903
 
1812 1904
             $appli = constant('DOL_APPLICATION_TITLE');
1813 1905
             if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
1814 1906
                 $appli = $conf->global->MAIN_APPLICATION_TITLE;
1815 1907
                 $doliurl = '';
1816 1908
                 if (preg_match('/\d\.\d/', $appli)) {
1817
-                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli))
1818
-                        $appli .= " (" . DOL_VERSION . ")"; // If new title contains a version that is different than core
1819
-                } else
1820
-                    $appli .= " " . DOL_VERSION;
1821
-            } else
1822
-                $appli .= " " . DOL_VERSION;
1909
+                    if (!preg_match('/' . preg_quote(DOL_VERSION) . '/', $appli)) {
1910
+                                            $appli .= " (" . DOL_VERSION . ")";
1911
+                    }
1912
+                    // If new title contains a version that is different than core
1913
+                } else {
1914
+                                    $appli .= " " . DOL_VERSION;
1915
+                }
1916
+            } else {
1917
+                            $appli .= " " . DOL_VERSION;
1918
+            }
1823 1919
             print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
1824
-            if ($doliurl)
1825
-                print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">';
1826
-            else
1827
-                print '<span class="help">';
1920
+            if ($doliurl) {
1921
+                            print '<a class="help" target="_blank" rel="noopener" href="' . $doliurl . '">';
1922
+            } else {
1923
+                            print '<span class="help">';
1924
+            }
1828 1925
             print $appli;
1829
-            if ($doliurl)
1830
-                print '</a>';
1831
-            else
1832
-                print '</span>';
1926
+            if ($doliurl) {
1927
+                            print '</a>';
1928
+            } else {
1929
+                            print '</span>';
1930
+            }
1833 1931
             print '</div>' . "\n";
1834 1932
         }
1835 1933
 
@@ -1876,9 +1974,10 @@  discard block
 block discarded – undo
1876 1974
     print "\n";
1877 1975
     print '<!-- Begin right area -->' . "\n";
1878 1976
 
1879
-    if (empty($leftmenuwithoutmainarea))
1880
-        main_area($title);
1881
-}
1977
+    if (empty($leftmenuwithoutmainarea)) {
1978
+            main_area($title);
1979
+    }
1980
+    }
1882 1981
 
1883 1982
 /**
1884 1983
  *  Begin main area
@@ -1890,16 +1989,18 @@  discard block
 block discarded – undo
1890 1989
 {
1891 1990
     global $conf, $langs;
1892 1991
 
1893
-    if (empty($conf->dol_hide_leftmenu))
1894
-        print '<div id="id-right">';
1992
+    if (empty($conf->dol_hide_leftmenu)) {
1993
+            print '<div id="id-right">';
1994
+    }
1895 1995
 
1896 1996
     print "\n";
1897 1997
 
1898 1998
     print '<!-- Begin div class="fiche" -->' . "\n" . '<div class="fiche">' . "\n";
1899 1999
 
1900
-    if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED))
1901
-        print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED));
1902
-}
2000
+    if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) {
2001
+            print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED));
2002
+    }
2003
+    }
1903 2004
 
1904 2005
 /**
1905 2006
  *  Return helpbaseurl, helppage and mode
@@ -1923,18 +2024,21 @@  discard block
 block discarded – undo
1923 2024
         // If WIKI URL
1924 2025
         if (preg_match('/^es/i', $langs->defaultlang)) {
1925 2026
             $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
1926
-            if (preg_match('/ES:([^|]+)/i', $helppagename, $reg))
1927
-                $helppage = $reg[1];
2027
+            if (preg_match('/ES:([^|]+)/i', $helppagename, $reg)) {
2028
+                            $helppage = $reg[1];
2029
+            }
1928 2030
         }
1929 2031
         if (preg_match('/^fr/i', $langs->defaultlang)) {
1930 2032
             $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
1931
-            if (preg_match('/FR:([^|]+)/i', $helppagename, $reg))
1932
-                $helppage = $reg[1];
2033
+            if (preg_match('/FR:([^|]+)/i', $helppagename, $reg)) {
2034
+                            $helppage = $reg[1];
2035
+            }
1933 2036
         }
1934 2037
         if (empty($helppage)) { // If help page not already found
1935 2038
             $helpbaseurl = 'http://wiki.dolibarr.org/index.php/%s';
1936
-            if (preg_match('/EN:([^|]+)/i', $helppagename, $reg))
1937
-                $helppage = $reg[1];
2039
+            if (preg_match('/EN:([^|]+)/i', $helppagename, $reg)) {
2040
+                            $helppage = $reg[1];
2041
+            }
1938 2042
         }
1939 2043
         $mode = 'wiki';
1940 2044
     }
@@ -1965,8 +2069,9 @@  discard block
 block discarded – undo
1965 2069
     $ret .= '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
1966 2070
     $ret .= '<input type="hidden" name="mode" value="search">';
1967 2071
     $ret .= '<input type="hidden" name="savelogin" value="' . dol_escape_htmltag($user->login) . '">';
1968
-    if ($showtitlebefore)
1969
-        $ret .= $title . ' ';
2072
+    if ($showtitlebefore) {
2073
+            $ret .= $title . ' ';
2074
+    }
1970 2075
     $ret .= '<input type="text" class="flat ' . $htmlmorecss . '"';
1971 2076
     $ret .= ' style="text-indent: 22px; background-image: url(\'' . $img . '\'); background-repeat: no-repeat; background-position: 3px;"';
1972 2077
     $ret .= ($accesskey ? ' accesskey="' . $accesskey . '"' : '');
@@ -2009,10 +2114,12 @@  discard block
 block discarded – undo
2009 2114
             foreach ($user->lastsearch_values_tmp as $key => $val) {
2010 2115
                 unset($_SESSION['lastsearch_values_tmp_' . $key]);   // Clean array to rebuild it just after
2011 2116
                 if (count($val) && empty($_POST['button_removefilter'])) { // If there is search criteria to save and we did not click on 'Clear filter' button
2012
-                    if (empty($val['sortfield']))
2013
-                        unset($val['sortfield']);
2014
-                    if (empty($val['sortorder']))
2015
-                        unset($val['sortorder']);
2117
+                    if (empty($val['sortfield'])) {
2118
+                                            unset($val['sortfield']);
2119
+                    }
2120
+                    if (empty($val['sortorder'])) {
2121
+                                            unset($val['sortorder']);
2122
+                    }
2016 2123
                     dol_syslog('Save lastsearch_values_tmp_' . $key . '=' . json_encode($val, 0) . " (systematic recording of last search criterias)");
2017 2124
                     $_SESSION['lastsearch_values_tmp_' . $key] = json_encode($val);
2018 2125
                     unset($_SESSION['lastsearch_values_' . $key]);
@@ -2023,8 +2130,9 @@  discard block
 block discarded – undo
2023 2130
 
2024 2131
         $relativepathstring = $_SERVER["PHP_SELF"];
2025 2132
         // Clean $relativepathstring
2026
-        if (constant('DOL_BASE_URI'))
2027
-            $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
2133
+        if (constant('DOL_BASE_URI')) {
2134
+                    $relativepathstring = preg_replace('/^' . preg_quote(constant('DOL_BASE_URI'), '/') . '/', '', $relativepathstring);
2135
+        }
2028 2136
         $relativepathstring = preg_replace('/^\//', '', $relativepathstring);
2029 2137
         $relativepathstring = preg_replace('/^custom\//', '', $relativepathstring);
2030 2138
         if (preg_match('/list\.php$/', $relativepathstring)) {
@@ -2032,12 +2140,15 @@  discard block
 block discarded – undo
2032 2140
             unset($_SESSION['lastsearch_page_tmp_' . $relativepathstring]);
2033 2141
             unset($_SESSION['lastsearch_limit_tmp_' . $relativepathstring]);
2034 2142
 
2035
-            if (!empty($contextpage))
2036
-                $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
2037
-            if (!empty($page) && $page > 1)
2038
-                $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
2039
-            if (!empty($limit) && $limit != $conf->limit)
2040
-                $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
2143
+            if (!empty($contextpage)) {
2144
+                            $_SESSION['lastsearch_contextpage_tmp_' . $relativepathstring] = $contextpage;
2145
+            }
2146
+            if (!empty($page) && $page > 1) {
2147
+                            $_SESSION['lastsearch_page_tmp_' . $relativepathstring] = $page;
2148
+            }
2149
+            if (!empty($limit) && $limit != $conf->limit) {
2150
+                            $_SESSION['lastsearch_limit_tmp_' . $relativepathstring] = $limit;
2151
+            }
2041 2152
 
2042 2153
             unset($_SESSION['lastsearch_contextpage_' . $relativepathstring]);
2043 2154
             unset($_SESSION['lastsearch_page_' . $relativepathstring]);
@@ -2064,20 +2175,26 @@  discard block
 block discarded – undo
2064 2175
 
2065 2176
         print '</div> <!-- End div class="fiche" -->' . "\n"; // End div fiche
2066 2177
 
2067
-        if (empty($conf->dol_hide_leftmenu))
2068
-            print '</div> <!-- End div id-right -->' . "\n"; // End div id-right
2178
+        if (empty($conf->dol_hide_leftmenu)) {
2179
+                    print '</div> <!-- End div id-right -->' . "\n";
2180
+        }
2181
+        // End div id-right
2069 2182
 
2070
-        if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile))
2071
-            print '</div> <!-- End div id-container -->' . "\n"; // End div container
2183
+        if (empty($conf->dol_hide_leftmenu) && empty($conf->dol_use_jmobile)) {
2184
+                    print '</div> <!-- End div id-container -->' . "\n";
2185
+        }
2186
+        // End div container
2072 2187
 
2073 2188
         print "\n";
2074
-        if ($comment)
2075
-            print '<!-- ' . $comment . ' -->' . "\n";
2189
+        if ($comment) {
2190
+                    print '<!-- ' . $comment . ' -->' . "\n";
2191
+        }
2076 2192
 
2077 2193
         printCommonFooter($zone);
2078 2194
 
2079
-        if (!empty($delayedhtmlcontent))
2080
-            print $delayedhtmlcontent;
2195
+        if (!empty($delayedhtmlcontent)) {
2196
+                    print $delayedhtmlcontent;
2197
+        }
2081 2198
 
2082 2199
         if (!empty($conf->use_javascript_ajax)) {
2083 2200
             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
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
     public function __construct()
14 14
     {
15
-        $this->searchDir[] = BASE_PATH . '/plugins';
15
+        $this->searchDir[] = BASE_PATH.'/plugins';
16 16
         $this->nameSpaces[] = 'Alixar';
17 17
 
18 18
         parent::__construct();
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
           define('SITE_URL', APP_PROTOCOL . '://' . SERVER_NAME);
42 42
           define('BASE_URI', SITE_URL . APP_URI);
43 43
          */
44
-        define('DOL_BASE_PATH', BASE_PATH . '/dolibarr/htdocs');
45
-        define('DOL_BASE_URI', BASE_URI . '/dolibarr/htdocs');
44
+        define('DOL_BASE_PATH', BASE_PATH.'/dolibarr/htdocs');
45
+        define('DOL_BASE_URI', BASE_URI.'/dolibarr/htdocs');
46 46
         //define('DOL_DOCUMENT_ROOT', DOL_BASE_PATH);
47 47
 
48 48
         define('CORE_FOLDER', '/core');
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
         define('CACHE_FOLDER', '/../cache');
57 57
         //define('VENDOR_FOLDER', BASE_URI . '/vendor');
58 58
 
59
-        define('CORE_PATH', BASE_PATH . CORE_FOLDER);
60
-        define('CONFIG_PATH', BASE_PATH . CONFIG_FOLDER);
61
-        define('CONTROLLERS_PATH', BASE_PATH . CONTROLLERS_FOLDER);
62
-        define('HELPERS_PATH', BASE_PATH . HELPERS_FOLDER);
63
-        define('MODELS_PATH', BASE_PATH . MODELS_FOLDER);
64
-        define('SKINS_PATH', BASE_PATH . SKINS_FOLDER);
65
-        define('TEMPLATES_PATH', BASE_PATH . TEMPLATES_FOLDER);
66
-        define('PLUGINS_PATH', BASE_PATH . PLUGINS_FOLDER);
67
-        define('CACHE_PATH', BASE_PATH . CACHE_FOLDER);
59
+        define('CORE_PATH', BASE_PATH.CORE_FOLDER);
60
+        define('CONFIG_PATH', BASE_PATH.CONFIG_FOLDER);
61
+        define('CONTROLLERS_PATH', BASE_PATH.CONTROLLERS_FOLDER);
62
+        define('HELPERS_PATH', BASE_PATH.HELPERS_FOLDER);
63
+        define('MODELS_PATH', BASE_PATH.MODELS_FOLDER);
64
+        define('SKINS_PATH', BASE_PATH.SKINS_FOLDER);
65
+        define('TEMPLATES_PATH', BASE_PATH.TEMPLATES_FOLDER);
66
+        define('PLUGINS_PATH', BASE_PATH.PLUGINS_FOLDER);
67
+        define('CACHE_PATH', BASE_PATH.CACHE_FOLDER);
68 68
         //define('VENDOR_PATH', BASE_PATH . VENDOR_FOLDER);
69 69
 
70 70
         /**
Please login to merge, or discard this patch.
Base/AlixarView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
         parent::__construct();
34 34
 
35 35
         $this->defaultlang = 'ES';
36
-        $this->favicon = DOL_BASE_URI . '/theme/eldy/img/favicon.ico';
36
+        $this->favicon = DOL_BASE_URI.'/theme/eldy/img/favicon.ico';
37 37
         $this->title = 'Inicio - Alixar 0.0.0-alpha';
38 38
     }
39 39
 
Please login to merge, or discard this patch.