dolibarr 25.0.0-alpha
ihm.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
6 * Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
7 * Copyright (C) 2021-2025 Alexandre Spangaro <alexandre@inovea-conseil.com>
8 * Copyright (C) 2021-2023 Anthony Berton <anthony.berton@bb2a.fr>
9 * Copyright (C) 2023 Eric Seigne <eric.seigne@cap-rel.fr>
10 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
11 * Copyright (C) 2024-2026 Frédéric France <frederic.france@free.fr>
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 */
26
32// Load Dolibarr environment
33require '../main.inc.php';
42require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php';
43require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
44require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
45require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
46require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
47require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
48require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
49
50// Load translation files required by the page
51$langs->loadLangs(array('admin', 'languages', 'other', 'companies', 'products', 'members', 'projects', 'hrm', 'agenda'));
52
53if (!$user->admin) {
55}
56
57$action = GETPOST('action', 'aZ09');
58$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'adminihm'; // To manage different context of search
59$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'other'; // 'template', 'dashboard', 'login', 'other'
60
61if (!defined("MAIN_MOTD")) {
62 define("MAIN_MOTD", "");
63}
64
65$object = new stdClass();
66
67
68/*
69 * Action
70 */
71
72$parameters = array();
73$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
74if ($reshook < 0) {
75 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
76}
77
78if (GETPOST('cancel', 'alpha')) {
79 $action = '';
80}
81
82// Convert action set_XXX and del_XXX to set var (this is used when no javascript on for ajax_constantonoff)
83$regs = array();
84if (preg_match('/^(set|del)_([A-Z_]+)$/', $action, $regs)) {
85 if ($regs[1] == 'set') {
86 dolibarr_set_const($db, $regs[2], 1, 'chaine', 0, '', $conf->entity);
87 } else {
88 dolibarr_del_const($db, $regs[2], $conf->entity);
89 }
90}
91
92if ($action == 'removebackgroundlogin' && getDolGlobalString('MAIN_LOGIN_BACKGROUND')) {
93 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
94 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
95
96 $logofile = $conf->mycompany->dir_output.'/logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND');
97 dol_delete_file($logofile);
98 dolibarr_del_const($db, "MAIN_LOGIN_BACKGROUND", $conf->entity);
99 $mysoc->logo = '';
100
101 /*$logosmallfile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
102 dol_delete_file($logosmallfile);
103 dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_SMALL",$conf->entity);
104 $mysoc->logo_small='';
105
106 $logominifile=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini;
107 dol_delete_file($logominifile);
108 dolibarr_del_const($db, "MAIN_INFO_SOCIETE_LOGO_MINI",$conf->entity);
109 $mysoc->logo_mini='';*/
110}
111
112if ($action == 'update') {
113 $error = 0;
114
115 if ($mode == 'template') {
116 //dolibarr_del_const($db, "MAIN_THEME", 0); // To be sure we don't have this constant set for all entities
117
118 dolibarr_set_const($db, "MAIN_THEME", GETPOST("main_theme", 'aZ09'), 'chaine', 0, '', $conf->entity);
119 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
120
121 if (GETPOSTISSET('THEME_ELDY_USECOMOACTROW')) {
122 dolibarr_set_const($db, "THEME_ELDY_USECOMOACTROW", GETPOST('THEME_ELDY_USECOMOACTROW'), 'chaine', 0, '', $conf->entity);
123 }
124
125 if (GETPOSTISSET('THEME_DARKMODEENABLED')) {
126 $val = GETPOST('THEME_DARKMODEENABLED');
127 if (!$val) {
128 dolibarr_del_const($db, "THEME_DARKMODEENABLED", $conf->entity);
129 }
130 if ($val) {
131 dolibarr_set_const($db, "THEME_DARKMODEENABLED", $val, 'chaine', 0, '', $conf->entity);
132 }
133 }
134
135 if (GETPOSTISSET('THEME_TOPMENU_DISABLE_IMAGE')) {
136 $val = GETPOST('THEME_TOPMENU_DISABLE_IMAGE');
137 if (!$val) {
138 dolibarr_del_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', $conf->entity);
139 } else {
140 dolibarr_set_const($db, 'THEME_TOPMENU_DISABLE_IMAGE', GETPOST('THEME_TOPMENU_DISABLE_IMAGE'), 'chaine', 0, '', $conf->entity);
141 }
142 }
143
144 if (GETPOSTISSET('THEME_ELDY_BORDER_RADIUS')) {
145 $val = GETPOST('THEME_ELDY_BORDER_RADIUS');
146 dolibarr_set_const($db, 'THEME_ELDY_BORDER_RADIUS', GETPOSTINT('THEME_ELDY_BORDER_RADIUS'), 'chaine', 0, '', $conf->entity);
147 }
148
149 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKBODY'), array()))));
150 if ($val == '') {
151 dolibarr_del_const($db, 'THEME_ELDY_BACKBODY', $conf->entity);
152 } else {
153 dolibarr_set_const($db, 'THEME_ELDY_BACKBODY', $val, 'chaine', 0, '', $conf->entity);
154 }
155
156 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TOPMENU_BACK1'), array()))));
157 if ($val == '') {
158 dolibarr_del_const($db, 'THEME_ELDY_TOPMENU_BACK1', $conf->entity);
159 } else {
160 dolibarr_set_const($db, 'THEME_ELDY_TOPMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
161 }
162
163 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_VERMENU_BACK1'), array()))));
164 if ($val == '') {
165 dolibarr_del_const($db, 'THEME_ELDY_VERMENU_BACK1', $conf->entity);
166 } else {
167 dolibarr_set_const($db, 'THEME_ELDY_VERMENU_BACK1', $val, 'chaine', 0, '', $conf->entity);
168 }
169
170 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLENOTAB'), array()))));
171 if ($val == '') {
172 dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $conf->entity);
173 } else {
174 dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLENOTAB', $val, 'chaine', 0, '', $conf->entity);
175 }
176
177 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BACKTITLE1'), array()))));
178 if ($val == '') {
179 dolibarr_del_const($db, 'THEME_ELDY_BACKTITLE1', $conf->entity);
180 } else {
181 dolibarr_set_const($db, 'THEME_ELDY_BACKTITLE1', $val, 'chaine', 0, '', $conf->entity);
182 }
183
184 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLE'), array()))));
185 if ($val == '') {
186 dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLE', $conf->entity);
187 } else {
188 dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLE', $val, 'chaine', 0, '', $conf->entity);
189 }
190
191 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTTITLELINK'), array()))));
192 if ($val == '') {
193 dolibarr_del_const($db, 'THEME_ELDY_TEXTTITLELINK', $conf->entity);
194 } else {
195 dolibarr_set_const($db, 'THEME_ELDY_TEXTTITLELINK', $val, 'chaine', 0, '', $conf->entity);
196 }
197
198 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
199 if ($val == '') {
200 dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR1', $conf->entity);
201 } else {
202 dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR1', $val, 'chaine', 0, '', $conf->entity);
203 }
204 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEIMPAIR1'), array()))));
205 if ($val == '') {
206 dolibarr_del_const($db, 'THEME_ELDY_LINEIMPAIR2', $conf->entity);
207 } else {
208 dolibarr_set_const($db, 'THEME_ELDY_LINEIMPAIR2', $val, 'chaine', 0, '', $conf->entity);
209 }
210
211 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
212 if ($val == '') {
213 dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR1', $conf->entity);
214 } else {
215 dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR1', $val, 'chaine', 0, '', $conf->entity);
216 }
217 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_LINEPAIR1'), array()))));
218 if ($val == '') {
219 dolibarr_del_const($db, 'THEME_ELDY_LINEPAIR2', $conf->entity);
220 } else {
221 dolibarr_set_const($db, 'THEME_ELDY_LINEPAIR2', $val, 'chaine', 0, '', $conf->entity);
222 }
223
224 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTLINK'), array()))));
225 if ($val == '') {
226 dolibarr_del_const($db, 'THEME_ELDY_TEXTLINK', $conf->entity);
227 } else {
228 dolibarr_set_const($db, 'THEME_ELDY_TEXTLINK', $val, 'chaine', 0, '', $conf->entity);
229 }
230
231 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_HOVER'), array()))));
232 if ($val == '') {
233 dolibarr_del_const($db, 'THEME_ELDY_USE_HOVER', $conf->entity);
234 } else {
235 dolibarr_set_const($db, "THEME_ELDY_USE_HOVER", $val, 'chaine', 0, '', $conf->entity);
236 }
237
238 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_USE_CHECKED'), array()))));
239 if ($val == '') {
240 dolibarr_del_const($db, 'THEME_ELDY_USE_CHECKED', $conf->entity);
241 } else {
242 dolibarr_set_const($db, "THEME_ELDY_USE_CHECKED", $val, 'chaine', 0, '', $conf->entity);
243 }
244
245 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_BTNACTION'), array()))));
246 if ($val == '') {
247 dolibarr_del_const($db, 'THEME_ELDY_BTNACTION', $conf->entity);
248 } else {
249 dolibarr_set_const($db, 'THEME_ELDY_BTNACTION', $val, 'chaine', 0, '', $conf->entity);
250 }
251
252 $val = (implode(',', (colorStringToArray(GETPOST('THEME_ELDY_TEXTBTNACTION'), array()))));
253 if ($val == '') {
254 dolibarr_del_const($db, 'THEME_ELDY_TEXTBTNACTION', $conf->entity);
255 } else {
256 dolibarr_set_const($db, 'THEME_ELDY_TEXTBTNACTION', $val, 'chaine', 0, '', $conf->entity);
257 }
258
259 setEventMessages($langs->trans("SetupSaved"), null);
260 }
261
262 if ($mode == 'dashboard') {
263 dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'restricthtml')), 'chaine', 0, '', $conf->entity);
264
265 setEventMessages($langs->trans("SetupSaved"), null);
266 }
267
268 if ($mode == 'other') {
269 dolibarr_set_const($db, "MAIN_LANG_DEFAULT", GETPOST("MAIN_LANG_DEFAULT", 'aZ09'), 'chaine', 0, '', $conf->entity);
270 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
271
272 dolibarr_set_const($db, "MAIN_SIZE_LISTE_LIMIT", GETPOSTINT("MAIN_SIZE_LISTE_LIMIT"), 'chaine', 0, '', $conf->entity);
273 dolibarr_set_const($db, "MAIN_SIZE_SHORTLIST_LIMIT", GETPOSTINT("MAIN_SIZE_SHORTLIST_LIMIT"), 'chaine', 0, '', $conf->entity);
274
275 if (GETPOSTISSET("MAIN_CHECKBOX_LEFT_COLUMN")) {
276 dolibarr_set_const($db, "MAIN_CHECKBOX_LEFT_COLUMN", GETPOSTINT("MAIN_CHECKBOX_LEFT_COLUMN"), 'chaine', 0, '', $conf->entity);
277 }
278
279 if (GETPOSTISSET("MAIN_ROW_SINGLECLICK_TOSELECT")) {
280 dolibarr_set_const($db, "MAIN_ROW_SINGLECLICK_TOSELECT", GETPOSTINT("MAIN_ROW_SINGLECLICK_TOSELECT"), 'chaine', 0, '', $conf->entity);
281 }
282
283 //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity);
284 //dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
285 //dolibarr_set_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED", GETPOST("MAIN_MENU_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity);
286 dolibarr_set_const($db, "MAIN_START_WEEK", GETPOSTINT("MAIN_START_WEEK"), 'chaine', 0, '', $conf->entity);
287
288 dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
289 dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
290
291 dolibarr_set_const($db, "MAIN_BUGTRACK_ENABLELINK", GETPOST("MAIN_BUGTRACK_ENABLELINK", 'alpha'), 'chaine', 0, '', $conf->entity);
292
293 dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity);
294
295
296 setEventMessages($langs->trans("SetupSaved"), null);
297 }
298
299 if ($mode == 'login') {
300 dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'restricthtml')), 'chaine', 0, '', $conf->entity);
301 //dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities
302
303 $varforimage = 'imagebackground';
304 $dirforimage = $conf->mycompany->dir_output . '/logos/';
305 if (!empty($_FILES[$varforimage]["tmp_name"])) {
306 $reg = array();
307 if (preg_match('/([^\\/:]+)$/i', (string) $_FILES[$varforimage]["name"], $reg)) {
308 $original_file = $reg[1];
309
310 $isimage = image_format_supported($original_file);
311 if ($isimage >= 0) {
312 dol_syslog("Move file " . $_FILES[$varforimage]["tmp_name"] . " to " . $dirforimage . $original_file);
313 if (!is_dir($dirforimage)) {
314 dol_mkdir($dirforimage);
315 }
316 $result = dol_move_uploaded_file($_FILES[$varforimage]["tmp_name"], $dirforimage . $original_file, 1, 0, $_FILES[$varforimage]['error']);
317 // Note: a refused file is reported with a string, and in PHP 8 such a string is > 0, so we must test is_numeric() first
318 if (is_numeric($result) && $result > 0) {
319 dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND", $original_file, 'chaine', 0, '', $conf->entity);
320 } elseif (!is_numeric($result)) { // $result is a translation key
321 $error++;
322 $langs->load("errors");
323 setEventMessages($langs->trans($result), null, 'errors');
324 } else {
325 $error++;
326 setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors');
327 }
328 } else {
329 $error++;
330 $langs->load("errors");
331 setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors');
332 }
333 }
334 }
335
336 if (!$error) {
337 setEventMessages($langs->trans("SetupSaved"), null);
338 }
339 }
340
341 if ($mode == 'css') {
342 $csscontent = GETPOST('MAIN_IHM_CUSTOM_CSS', 'restricthtml'); // Will return a sanitized HTML content (so with double spaes that may be replaced with one, ...
343 $csscontent = dol_string_nohtmltag($csscontent, 2, 'UTF-8', 0, 0);
344
345 dolibarr_set_const($db, "MAIN_IHM_CUSTOM_CSS", $csscontent, 'chaine', 0, '', $conf->entity);
346
347 setEventMessages($langs->trans("SetupSaved"), null);
348 }
349
350 $_SESSION["mainmenu"] = ""; // The menu manager may have changed
351
352 if (GETPOST('dol_resetcache')) {
353 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
354 }
355
356 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup&mode=".$mode.(GETPOSTISSET('page_y') ? '&page_y='.GETPOSTINT('page_y') : ''));
357 exit;
358}
359
360
361/*
362 * View
363 */
364
365$wikihelp = 'EN:First_setup|FR:Premiers_param&eacute;trages|ES:Primeras_configuraciones';
366
368 '',
369 $langs->trans("Setup"),
370 $wikihelp,
371 '',
372 0,
373 0,
374 array(
375 '/includes/ace/src/ace.js',
376 '/includes/ace/src/ext-statusbar.js',
377 '/includes/ace/src/ext-language_tools.js',
378 ),
379 array(),
380 '',
381 'mod-admin page-ihm'
382);
383
384$form = new Form($db);
385$formother = new FormOther($db);
386$formadmin = new FormAdmin($db);
387
388print load_fiche_titre($form->textwithpicto($langs->trans("GUISetup"), $langs->trans("DisplayDesc")), '', 'title_setup');
389
390
391// WYSIWYG Editor
392require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
393
394print '<form enctype="multipart/form-data" method="POST" action="'.dolBuildUrl($_SERVER["PHP_SELF"]).'" spellcheck="false">';
395print '<input type="hidden" name="token" value="'.newToken().'">';
396print '<input type="hidden" name="action" value="update">';
397print '<input type="hidden" name="page_y" value="">';
398print '<input type="hidden" id="mode" name="mode" value="'.dol_escape_htmltag($mode).'">';
399print '<input type="hidden" name="dol_resetcache" value="1">';
400
401$head = ihm_prepare_head();
402
403print dol_get_fiche_head($head, $mode, '', -1, '');
404
405print '<br>';
406
407clearstatcache();
408
409if ($mode == 'other') {
410 print '<div class="div-table-responsive-no-min">';
411 print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
412
413 print '<tr class="liste_titre"><td class="titlefieldmiddle">';
414 print $langs->trans("Language");
415 print '</td><td>';
416 print '</td></tr>';
417
418 // Default language
419 print '<tr class="oddeven"><td>'.$langs->trans("DefaultLanguage").'</td><td>';
420 print img_picto('', 'language', 'class="pictofixedwidth"');
421 print $formadmin->select_language(getDolGlobalString('MAIN_LANG_DEFAULT'), 'MAIN_LANG_DEFAULT', 1, array(), '', 0, 0, 'minwidth300', 2);
422 //print '<input class="button button-save smallpaddingimp" type="submit" name="submit" value="'.$langs->trans("Save").'">';
423 print '</td>';
424 print '</tr>';
425
426 // Multilingual GUI
427 print '<tr class="oddeven"><td>' . $langs->trans("EnableMultilangInterface") . '</td><td>';
428 print ajax_constantonoff("MAIN_MULTILANGS", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'language');
429 print '</td>';
430 print '</tr>';
431
432 print '</table>' . "\n";
433 print '</div>';
434
435 print '<div class="center">';
436 print '<input class="button button-save reposition" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
437 print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
438 print '</div>';
439
440 print '<br>';
441 print '<br>';
442
443 // Other
444 print '<div class="div-table-responsive-no-min">';
445 print '<table summary="otherparameters" class="noborder centpercent editmode tableforfield">';
446
447 print '<tr class="liste_titre"><td class="titlefieldmiddle">';
448 print $langs->trans("Miscellaneous");
449 print '</td>';
450 print '<td></td>';
451 print '</tr>';
452
453 if (!empty($conf->use_javascript_ajax)) {
454 // Show Quick Add link
455 print '<tr class="oddeven"><td>' . $langs->trans("ShowQuickAddLink") . '</td><td>';
456 print ajax_constantonoff("MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
457 print '</td>';
458 print '</tr>';
459 }
460
461 // Hide wiki link on login page
462 $pictohelp = '<span class="fa fa-question-circle"></span>';
463 print '<tr class="oddeven"><td>' . str_replace('{picto}', $pictohelp, $langs->trans("DisableLinkToHelp", '{picto}')) . '</td><td>';
464 print ajax_constantonoff("MAIN_HELP_DISABLELINK", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
465 print '</td>';
466 print '</tr>';
467
468 // Max size of lists
469 print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeList") . '</td><td><input class="flat width50" name="MAIN_SIZE_LISTE_LIMIT" value="';
470 if (getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT') > 0) {
471 print getDolGlobalString('MAIN_SIZE_LISTE_LIMIT');
472 }
473 print '">';
474 if (getDolGlobalInt('MAIN_SIZE_LISTE_LIMIT') <= 0) {
475 print ' &nbsp; <span class="opacitymedium">('.$langs->trans("Automatic").')</span>';
476 }
477 print '</td>';
478 print '</tr>';
479
480 // Max size of short lists on customer card
481 print '<tr class="oddeven"><td>' . $langs->trans("DefaultMaxSizeShortList") . '</td><td><input class="flat width50" name="MAIN_SIZE_SHORTLIST_LIMIT" value="' . getDolGlobalString('MAIN_SIZE_SHORTLIST_LIMIT') . '"></td>';
482 print '</tr>';
483
484 // Display checkboxes and fields menu left / right
485 print '<tr class="oddeven"><td>' . $langs->trans("MAIN_CHECKBOX_LEFT_COLUMN") . '</td><td>';
486 print ajax_constantonoff("MAIN_CHECKBOX_LEFT_COLUMN", array(), $conf->entity, 0, 0, 1, 0, 0, 1, '', 'other');
487 print '</td>';
488 print '</tr>';
489
490 // Single click to select/unselect a list row
491 print '<tr class="oddeven"><td>' . $form->textwithpicto($langs->trans("RowSingleClickToSelect"), $langs->trans("RowSingleClickToSelectDesc")) . '</td><td>';
492 print ajax_constantonoff("MAIN_ROW_SINGLECLICK_TOSELECT", array(), $conf->entity, 0, 0, 1, 0, 0, 1, '', 'other');
493 print '</td>';
494 print '</tr>';
495
496 // First day for weeks
497 print '<tr class="oddeven"><td>' . $langs->trans("WeekStartOnDay") . '</td><td>';
498 print $formother->select_dayofweek(getDolGlobalString('MAIN_START_WEEK', '1'), 'MAIN_START_WEEK', 0);
499 print '</td>';
500 print '</tr>';
501
502 // DefaultWorkingDays
503 print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingDays") . '</td><td>';
504 print '<input type="text" name="MAIN_DEFAULT_WORKING_DAYS" size="5" value="' . getDolGlobalString('MAIN_DEFAULT_WORKING_DAYS', '1-5') . '">';
505 print '</td>';
506 print '</tr>';
507
508 // DefaultWorkingHours
509 print '<tr class="oddeven"><td>' . $langs->trans("DefaultWorkingHours") . '</td><td>';
510 print '<input type="text" name="MAIN_DEFAULT_WORKING_HOURS" size="5" value="' . getDolGlobalString('MAIN_DEFAULT_WORKING_HOURS', '9-18') . '">';
511 print '</td>';
512 print '</tr>';
513
514 // Firstname/Name
515 print '<tr class="oddeven"><td>' . $langs->trans("FirstnameNamePosition") . '</td><td>';
516 $array = array(0 => $langs->trans("Firstname") . ' ' . $langs->trans("Lastname"), 1 => $langs->trans("Lastname") . ' ' . $langs->trans("Firstname"));
517 print $form->selectarray('MAIN_FIRSTNAME_NAME_POSITION', $array, getDolGlobalInt('MAIN_FIRSTNAME_NAME_POSITION', 0));
518 print '</td>';
519 print '</tr>';
520
521 // Hide unauthorized menus
522 print '<tr class="oddeven"><td>' . $form->textwithpicto($langs->trans("HideUnauthorizedMenu"), $langs->trans("JustGrayedOtherwise")) . '</td><td>';
523 print ajax_constantonoff("MAIN_MENU_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
524 print '</td>';
525 print '</tr>';
526
527 // Hide unauthorized button
528 print '<tr class="oddeven"><td>' . $form->textwithpicto($langs->trans("ButtonHideUnauthorized"), $langs->trans("JustGrayedOtherwise")) . '</td><td>';
529 print ajax_constantonoff("MAIN_BUTTON_HIDE_UNAUTHORIZED", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
530 print '</td>';
531 print '</tr>';
532
533 // Hide version link
534 /*
535
536 print '<tr><td>'.$langs->trans("HideVersionLink").'</td><td>';
537 print $form->selectyesno('MAIN_HIDE_VERSION',$conf->global->MAIN_HIDE_VERSION,1);
538 print '</td>';
539 print '</tr>';
540 */
541
542
543 // Show search area in top menu
544 print '<tr class="oddeven"><td>' . img_picto('', 'search', 'class="pictofixedwidth"'). ' '.$langs->trans("ShowSearchAreaInTopMenu") .'</td><td>';
545 print ajax_constantonoff("MAIN_USE_TOP_MENU_SEARCH_DROPDOWN", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
546 print '</td>';
547 print '</tr>';
548
549 // Show bugtrack link
550 print '<tr class="oddeven"><td>';
551 print $form->textwithpicto($langs->trans("ShowBugTrackLink", $langs->transnoentitiesnoconv("FindBug")), $langs->trans("ShowBugTrackLinkDesc"));
552 print '</td><td>';
553 print '<input type="text" name="MAIN_BUGTRACK_ENABLELINK" value="' . getDolGlobalString('MAIN_BUGTRACK_ENABLELINK') . '">';
554 print '</td>';
555 print '</tr>';
556
557 // Disable javascript and ajax
558 print '<tr class="oddeven"><td>' . $form->textwithpicto($langs->trans("DisableJavascript"), $langs->trans("DisableJavascriptNote")) . '</td><td>';
559 print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '', 'other');
560 print '</td>';
561 print '</tr>';
562
563 print '</table>' . "\n";
564 print '</div>';
565}
566
567
568if ($mode == 'template') {
569 // Themes and themes options
570 showSkins(null, 1);
571}
572
573
574if ($mode == 'dashboard') {
575 print '<div class="div-table-responsive-no-min">';
576 print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
577
578 // Message of the day on home page
579 $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'));
580 complete_substitutions_array($substitutionarray, $langs);
581
582 print '<tr class="oddeven width25p"><td>';
583 $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
584 foreach ($substitutionarray as $key => $val) {
585 $texthelp .= $key . '<br>';
586 }
587 print $form->textwithpicto($langs->trans("MessageOfDay"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessageofday');
588
589 print '</td><td>';
590
591 $doleditor = new DolEditor('main_motd', getDolGlobalString('MAIN_MOTD'), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
592 $doleditor->Create();
593
594 print '</td></tr>'."\n";
595
596 print '</table>';
597 print '</div>';
598
599 print '<br>';
600
601 print '<div class="div-table-responsive-no-min">';
602 print '<table summary="blockdashboard" class="noborder centpercent editmode tableforfield">';
603
604 print '<tr class="liste_titre"><td class="titlefieldmiddle">';
605 print $langs->trans("DashboardDisableBlocks");
606 print '</td><td class="titlefieldmiddle">';
607 print '</td></tr>';
608
609 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableGlobal') . '</td><td>';
610 print ajax_constantonoff("MAIN_DISABLE_GLOBAL_WORKBOARD", array(), $conf->entity, 0, 0, 1, 0, 0, 0, '_red', 'dashboard');
611 print '</td>';
612 print '</tr>';
613
614 if (!getDolGlobalString('MAIN_DISABLE_GLOBAL_WORKBOARD')) {
615 // Block meteo
616 print '<tr class="oddeven"><td>' . $langs->trans('MAIN_DISABLE_METEO') . '</td><td>';
617 print ajax_constantonoff("MAIN_DISABLE_METEO", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
618 print '</td>';
619 print '</tr>';
620
621 // Block agenda
622 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAgenda') . '</td><td>';
623 print ajax_constantonoff("MAIN_DISABLE_BLOCK_AGENDA", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
624 print '</td>';
625 print '</tr>';
626
627 // Block agenda
628 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockProject') . '</td><td>';
629 print ajax_constantonoff("MAIN_DISABLE_BLOCK_PROJECT", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
630 print '</td>';
631 print '</tr>';
632
633 // Block customer
634 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockCustomer') . '</td><td>';
635 print ajax_constantonoff("MAIN_DISABLE_BLOCK_CUSTOMER", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
636 print '</td>';
637 print '</tr>';
638
639 // Block supplier
640 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockSupplier') . '</td><td>';
641 print ajax_constantonoff("MAIN_DISABLE_BLOCK_SUPPLIER", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
642 print '</td>';
643 print '</tr>';
644
645 // Block contract
646 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockContract') . '</td><td>';
647 print ajax_constantonoff("MAIN_DISABLE_BLOCK_CONTRACT", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
648 print '</td>';
649 print '</tr>';
650
651 // Block ticket
652 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockTicket') . '</td><td>';
653 print ajax_constantonoff("MAIN_DISABLE_BLOCK_TICKET", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
654 print '</td>';
655 print '</tr>';
656
657 // Block bank
658 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockBank') . '</td><td>';
659 print ajax_constantonoff("MAIN_DISABLE_BLOCK_BANK", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
660 print '</td>';
661 print '</tr>';
662
663 // Block adherent
664 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockAdherent') . '</td><td>';
665 print ajax_constantonoff("MAIN_DISABLE_BLOCK_ADHERENT", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
666 print '</td>';
667 print '</tr>';
668
669 // Block expense report
670 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockExpenseReport') . '</td><td>';
671 print ajax_constantonoff("MAIN_DISABLE_BLOCK_EXPENSEREPORT", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
672 print '</td>';
673 print '</tr>';
674
675 // Block holiday
676 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockHoliday') . '</td><td>';
677 print ajax_constantonoff("MAIN_DISABLE_BLOCK_HOLIDAY", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
678 print '</td>';
679 print '</tr>';
680
681 // Block mrp
682 print '<tr class="oddeven"><td>' . $langs->trans('DashboardDisableBlockMrp') . '</td><td>';
683 print ajax_constantonoff("MAIN_DISABLE_BLOCK_MRP", array(), $conf->entity, 0, 0, 0, 0, 0, 0, '_red', 'dashboard');
684 print '</td>';
685 print '</tr>';
686 }
687
688 print '</table>' . "\n";
689 print '</div>';
690}
691
692
693if ($mode == 'login') {
694 // Other
695 print '<div class="div-table-responsive-no-min">';
696 print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
697
698 print '<tr class="liste_titre"><td class="titlefieldmax45">';
699 print $langs->trans("Parameter");
700 print '</td><td>';
701 print '</td></tr>';
702
703 // Message on login page
704 $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user'));
705 complete_substitutions_array($substitutionarray, $langs);
706 print '<tr class="oddeven"><td>';
707 $texthelp = $langs->trans("FollowingConstantsWillBeSubstituted") . '<br>';
708 foreach ($substitutionarray as $key => $val) {
709 $texthelp .= $key . '<br>';
710 }
711 print $form->textwithpicto($langs->trans("MessageLogin"), $texthelp, 1, 'help', '', 0, 2, 'tooltipmessagelogin');
712 print '</td><td>';
713 $doleditor = new DolEditor('main_home', getDolGlobalString('MAIN_HOME'), '', 142, 'dolibarr_notes', 'In', false, true, true, ROWS_4, '90%');
714 $doleditor->Create();
715 print '</td></tr>' . "\n";
716
717 // Background
718 print '<tr class="oddeven"><td><label for="imagebackground">' . $langs->trans("BackgroundImageLogin") . ' (png,jpg)</label></td><td>';
719 print '<div class="centpercent inline-block">';
720 $disabled = '';
721 if (getDolGlobalString('ADD_UNSPLASH_LOGIN_BACKGROUND')) {
722 $disabled = ' disabled="disabled"';
723 }
724 $maxfilesizearray = getMaxFileSizeArray();
725 $maxmin = $maxfilesizearray['maxmin'];
726 if ($maxmin > 0) {
727 print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">'; // MAX_FILE_SIZE must precede the field type=file
728 }
729 print '<input type="file" class="flat maxwidthinputfileonsmartphone" name="imagebackground" id="imagebackground"' . $disabled . '>';
730 if ($disabled) {
731 print '(' . $langs->trans("DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND") . ') ';
732 }
733 if (getDolGlobalString('MAIN_LOGIN_BACKGROUND')) {
734 print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?action=removebackgroundlogin&token='.newToken().'&mode=login">' . img_delete($langs->trans("Delete")) . '</a>';
735 if (file_exists($conf->mycompany->dir_output . '/logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND'))) {
736 print ' &nbsp; ';
737 print '<img class="marginleftonly boxshadow valignmiddle" width="100" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=mycompany&amp;file=' . urlencode('logos/' . getDolGlobalString('MAIN_LOGIN_BACKGROUND')) . '">';
738 }
739 } else {
740 print '<img class="marginleftonly valignmiddle" width="100" src="' . DOL_URL_ROOT . '/public/theme/common/nophoto.png">';
741 }
742 print '</div>';
743 print '</td></tr>';
744
745 print '</table>' . "\n";
746 print '</div>';
747}
748
749if ($mode == 'css') {
750 print '<div class="div-table-responsive-no-min">';
751 print '<table summary="edit" class="noborder centpercent editmode tableforfield">';
752
753 print '<tr class="liste_titre">';
754 print '<td colspan="2">';
755
756 //$customcssValue = file_get_contents(DOL_DATA_ROOT.'/admin/customcss.css');
757 $customcssValue = getDolGlobalString('MAIN_IHM_CUSTOM_CSS');
758
759 $doleditor = new DolEditor('MAIN_IHM_CUSTOM_CSS', $customcssValue, '80%', 400, 'Basic', 'In', true, false, 'ace', 10, '90%');
760 $doleditor->Create(0, '', true, 'css', 'css');
761 print '</td></tr>'."\n";
762
763 print '</table>'."\n";
764 print '</div>';
765}
766
767
768print '<div class="center">';
769print '<input class="button button-save reposition buttonforacesave" type="submit" name="submit" value="' . $langs->trans("Save") . '">';
770print '<input class="button button-cancel reposition" type="submit" name="cancel" value="' . $langs->trans("Cancel") . '">';
771print '</div>';
772
773print '</form>';
774
775
776// End of page
777llxFooter();
778$db->close();
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
ihm_prepare_head()
Prepare array with list of tabs.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:91
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:73
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
Class to manage a WYSIWYG editor.
Class to generate html code for admin pages.
Class to manage generation of HTML components Only common components must be here.
Class to help generate other html components Only common components are here.
global $mysoc
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $keyforsourcefile='addedfile', $upload_dir='', $mode=0)
Check validity of a file upload from an GUI page, and move it to its final destination.
colorStringToArray($stringcolor, $colorifnotfound=array(88, 88, 88))
Convert a string RGB value ('FFFFFF', '255,255,255') into an array RGB array(255,255,...
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_htmlcleanlastbr($stringtodecode)
This function remove all ending and br at end.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
GETPOSTINT($paramname, $method=0, $nodefault=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
Definition html.lib.php:542
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
getMaxFileSizeArray()
Return the max allowed for file upload.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
showSkins($fuser, $edit=0, $foruserprofile=false)
Show list of themes.