@@ -24,9 +24,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 ' <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 ' <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 |
||
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 |
||
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 |
||
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> <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 | - ' ' . |
|
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> <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 | + ' '. |
|
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 | - ' ' . |
|
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 | + ' '. |
|
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 |
||
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 |
||
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 |
||
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&action=create&menu_handler=' . urlencode($menu_handler) . '">' . $langs->trans("NewMenu") . '</a>'; |
|
386 | + print '<a class="butAction" href="'.DOL_URL_ROOT.'/admin/menus/edit.php?menuId=0&action=create&menu_handler='.urlencode($menu_handler).'">'.$langs->trans("NewMenu").'</a>'; |
|
387 | 387 | print '</div>'; |
388 | 388 | } else { |
389 | 389 | $langs->load("errors"); |
@@ -33,8 +33,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -79,7 +79,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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'] .= '&idmenu=' . $menu['rowid']; |
|
634 | + $tabMenu[$b]['url'] .= '&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; |
@@ -224,7 +224,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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++; |
@@ -101,8 +101,8 @@ discard block |
||
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 |
||
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('/:|:|:/i', $val); // refused string ':' encoded (no reason to have it encoded) to lock 'javascript:...' |
|
137 | + $inj += preg_match('/:|:|:/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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 . '&theme=' . $conf->theme . (GETPOST('optioncss', 'aZ09') ? '&optioncss=' . GETPOST('optioncss', 'aZ09', 1) : '') . '&userid=' . $user->id . '&entity=' . $conf->entity; |
|
1243 | - $themeparam .= ($ext ? '&' . $ext : ''); |
|
1242 | + $themeparam = '&lang='.$langs->defaultlang.'&theme='.$conf->theme.(GETPOST('optioncss', 'aZ09') ? '&optioncss='.GETPOST('optioncss', 'aZ09', 1) : '').'&userid='.$user->id.'&entity='.$conf->entity; |
|
1243 | + $themeparam .= ($ext ? '&'.$ext : ''); |
|
1244 | 1244 | if (!empty($_SESSION['dol_resetcache'])) |
1245 | 1245 | { |
1246 | - $themeparam .= '&dol_resetcache=' . $_SESSION['dol_resetcache']; |
|
1246 | + $themeparam .= '&dol_resetcache='.$_SESSION['dol_resetcache']; |
|
1247 | 1247 | } |
1248 | 1248 | if (GETPOST('dol_hide_topmenu', 'int')) { |
1249 | - $themeparam .= '&dol_hide_topmenu=' . GETPOST('dol_hide_topmenu', 'int'); |
|
1249 | + $themeparam .= '&dol_hide_topmenu='.GETPOST('dol_hide_topmenu', 'int'); |
|
1250 | 1250 | } |
1251 | 1251 | if (GETPOST('dol_hide_leftmenu', 'int')) { |
1252 | - $themeparam .= '&dol_hide_leftmenu=' . GETPOST('dol_hide_leftmenu', 'int'); |
|
1252 | + $themeparam .= '&dol_hide_leftmenu='.GETPOST('dol_hide_leftmenu', 'int'); |
|
1253 | 1253 | } |
1254 | 1254 | if (GETPOST('dol_optimize_smallscreen', 'int')) { |
1255 | - $themeparam .= '&dol_optimize_smallscreen=' . GETPOST('dol_optimize_smallscreen', 'int'); |
|
1255 | + $themeparam .= '&dol_optimize_smallscreen='.GETPOST('dol_optimize_smallscreen', 'int'); |
|
1256 | 1256 | } |
1257 | 1257 | if (GETPOST('dol_no_mouse_hover', 'int')) { |
1258 | - $themeparam .= '&dol_no_mouse_hover=' . GETPOST('dol_no_mouse_hover', 'int'); |
|
1258 | + $themeparam .= '&dol_no_mouse_hover='.GETPOST('dol_no_mouse_hover', 'int'); |
|
1259 | 1259 | } |
1260 | 1260 | if (GETPOST('dol_use_jmobile', 'int')) { |
1261 | - $themeparam .= '&dol_use_jmobile=' . GETPOST('dol_use_jmobile', 'int'); |
|
1261 | + $themeparam .= '&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 |
||
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 |
||
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 = \' \';' . "\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 = \' \';'."\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 ? '&' . $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 ? '&'.$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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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") . ' "' . dol_escape_htmltag(strtr($helppage, '_', ' ')) . '"'; |
|
1659 | + $title .= ' - '.$langs->trans("PageWiki").' "'.dol_escape_htmltag(strtr($helppage, '_', ' ')).'"'; |
|
1660 | 1660 | } |
1661 | 1661 | $text .= '<a class="help" target="_blank" rel="noopener" href="'; |
1662 | 1662 | if ($mode == 'wiki') { |
@@ -1682,7 +1682,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -12,7 +12,7 @@ discard block |
||
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 |
||
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 |
||
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 | /** |
@@ -33,7 +33,7 @@ |
||
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 |