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 –