dolibarr 19.0.3
modules.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
4 * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
5 * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
6 * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
7 * Copyright (C) 2011-2023 Juanjo Menent <jmenent@2byte.es>
8 * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
9 * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
10 * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
11 * Copyright (C) 2021-2023 Frédéric France <frederic.france@netlogic.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
32if (!defined('CSRFCHECK_WITH_TOKEN') && (empty($_GET['action']) || $_GET['action'] != 'reset')) { // We force security except to disable modules so we can do it if problem of a module
33 define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
34}
35
36// Load Dolibarr environment
37require '../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
39require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
40require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
41require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
42require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
43
44// Load translation files required by the page
45$langs->loadLangs(array("errors", "admin", "modulebuilder"));
46
47// if we set another view list mode, we keep it (till we change one more time)
48if (GETPOSTISSET('mode')) {
49 $mode = GETPOST('mode', 'alpha');
50 if ($mode =='common' || $mode =='commonkanban') {
51 dolibarr_set_const($db, "MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT", $mode, 'chaine', 0, '', $conf->entity);
52 }
53} else {
54 $mode = (!getDolGlobalString('MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT') ? 'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT);
55}
56
57$action = GETPOST('action', 'aZ09');
58$value = GETPOST('value', 'alpha');
59$page_y = GETPOST('page_y', 'int');
60$search_keyword = GETPOST('search_keyword', 'alpha');
61$search_status = GETPOST('search_status', 'alpha');
62$search_nature = GETPOST('search_nature', 'alpha');
63$search_version = GETPOST('search_version', 'alpha');
64
65
66// For dolistore search
67$options = array();
68$options['per_page'] = 20;
69$options['categorie'] = ((int) (GETPOST('categorie', 'int') ? GETPOST('categorie', 'int') : 0));
70$options['start'] = ((int) (GETPOST('start', 'int') ? GETPOST('start', 'int') : 0));
71$options['end'] = ((int) (GETPOST('end', 'int') ? GETPOST('end', 'int') : 0));
72$options['search'] = GETPOST('search_keyword', 'alpha');
73$dolistore = new Dolistore(false);
74
75
76if (!$user->admin) {
78}
79
80$familyinfo = array(
81 'hr'=>array('position'=>'001', 'label'=>$langs->trans("ModuleFamilyHr")),
82 'crm'=>array('position'=>'006', 'label'=>$langs->trans("ModuleFamilyCrm")),
83 'srm'=>array('position'=>'007', 'label'=>$langs->trans("ModuleFamilySrm")),
84 'financial'=>array('position'=>'009', 'label'=>$langs->trans("ModuleFamilyFinancial")),
85 'products'=>array('position'=>'012', 'label'=>$langs->trans("ModuleFamilyProducts")),
86 'projects'=>array('position'=>'015', 'label'=>$langs->trans("ModuleFamilyProjects")),
87 'ecm'=>array('position'=>'018', 'label'=>$langs->trans("ModuleFamilyECM")),
88 'technic'=>array('position'=>'021', 'label'=>$langs->trans("ModuleFamilyTechnic")),
89 'portal'=>array('position'=>'040', 'label'=>$langs->trans("ModuleFamilyPortal")),
90 'interface'=>array('position'=>'050', 'label'=>$langs->trans("ModuleFamilyInterface")),
91 'base'=>array('position'=>'060', 'label'=>$langs->trans("ModuleFamilyBase")),
92 'other'=>array('position'=>'100', 'label'=>$langs->trans("ModuleFamilyOther")),
93);
94
95$param = '';
96if (!GETPOST('buttonreset', 'alpha')) {
97 if ($search_keyword) {
98 $param .= '&search_keyword='.urlencode($search_keyword);
99 }
100 if ($search_status && $search_status != '-1') {
101 $param .= '&search_status='.urlencode($search_status);
102 }
103 if ($search_nature && $search_nature != '-1') {
104 $param .= '&search_nature='.urlencode($search_nature);
105 }
106 if ($search_version && $search_version != '-1') {
107 $param .= '&search_version='.urlencode($search_version);
108 }
109}
110
111$dirins = DOL_DOCUMENT_ROOT.'/custom';
112$urldolibarrmodules = 'https://www.dolistore.com/';
113
114// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
115$hookmanager->initHooks(array('adminmodules', 'globaladmin'));
116
117// Execution Time
118$max_execution_time_for_deploy = (!getDolGlobalString('MODULE_UPLOAD_MAX_EXECUTION_TIME') ? 300 : $conf->global->MODULE_UPLOAD_MAX_EXECUTION_TIME); // 5mn if not defined
119$max_time = @ini_get("max_execution_time");
120if ($max_time && $max_time < $max_execution_time_for_deploy) {
121 dol_syslog("max_execution_time=".$max_time." is lower than max_execution_time_for_deploy=".$max_execution_time_for_deploy.". We try to increase it dynamically.");
122 @ini_set("max_execution_time", $max_execution_time_for_deploy); // This work only if safe mode is off. also web servers has timeout of 300
123}
124
125$dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
126$allowonlineinstall = true;
127$allowfromweb = 1;
128if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) {
129 $allowonlineinstall = false;
130}
131
132
133/*
134 * Actions
135 */
136
137$formconfirm = '';
138
139$parameters = array();
140$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
141if ($reshook < 0) {
142 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
143}
144
145if (GETPOST('buttonreset', 'alpha')) {
146 $search_keyword = '';
147 $search_status = '';
148 $search_nature = '';
149 $search_version = '';
150}
151
152if ($action == 'install' && $allowonlineinstall) {
153 $error = 0;
154
155 // $original_file should match format module_modulename-x.y[.z].zip
156 $original_file = basename($_FILES["fileinstall"]["name"]);
157 $original_file = preg_replace('/\s*\‍(\d+\‍)\.zip$/i', '.zip', $original_file);
158 $newfile = $conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
159
160 if (!$original_file) {
161 $langs->load("Error");
162 setEventMessages($langs->trans("ErrorModuleFileRequired"), null, 'warnings');
163 $error++;
164 } else {
165 if (!$error && !preg_match('/\.zip$/i', $original_file)) {
166 $langs->load("errors");
167 setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage", $original_file), null, 'errors');
168 $error++;
169 }
170 if (!$error && !preg_match('/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file)) {
171 $langs->load("errors");
172 setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file, 'module_*-x.y*.zip'), null, 'errors');
173 $error++;
174 }
175 if (empty($_FILES['fileinstall']['tmp_name'])) {
176 $langs->load("errors");
177 setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
178 $error++;
179 }
180 }
181
182 if (!$error) {
183 if ($original_file) {
184 @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
185 dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
186 }
187
188 $tmpdir = preg_replace('/\.zip$/i', '', $original_file).'.dir';
189 if ($tmpdir) {
190 @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir);
191 dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir);
192 }
193
194 $result = dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'], $newfile, 1, 0, $_FILES['fileinstall']['error']);
195 if ($result > 0) {
196 $result = dol_uncompress($newfile, $conf->admin->dir_temp.'/'.$tmpdir);
197
198 if (!empty($result['error'])) {
199 $langs->load("errors");
200 setEventMessages($langs->trans($result['error'], $original_file), null, 'errors');
201 $error++;
202 } else {
203 // Now we move the dir of the module
204 $modulename = preg_replace('/module_/', '', $original_file);
205 $modulename = preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename);
206 // Search dir $modulename
207 $modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example ./mymodule
208
209 if (!dol_is_dir($modulenamedir)) {
210 $modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example ./htdocs/mymodule
211 //var_dump($modulenamedir);
212 if (!dol_is_dir($modulenamedir)) {
213 setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'<br>'.$langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename, 'htdocs/'.$modulename), null, 'errors');
214 $error++;
215 }
216 }
217
218 if (!$error) {
219 // TODO Make more test
220 }
221
222 dol_syslog("Uncompress of module file is a success.");
223
224 // We check if this is a metapackage
225 $modulenamearrays = array();
226 if (dol_is_file($modulenamedir.'/metapackage.conf')) {
227 // This is a meta package
228 $metafile = file_get_contents($modulenamedir.'/metapackage.conf');
229 $modulenamearrays = explode("\n", $metafile);
230 }
231 $modulenamearrays[$modulename] = $modulename;
232 //var_dump($modulenamearrays);exit;
233
234 // Lop on each packacge of the metapackage
235 foreach ($modulenamearrays as $modulenameval) {
236 if (strpos($modulenameval, '#') === 0) {
237 continue; // Discard comments
238 }
239 if (strpos($modulenameval, '//') === 0) {
240 continue; // Discard comments
241 }
242 if (!trim($modulenameval)) {
243 continue;
244 }
245
246 // Now we install the module
247 if (!$error) {
248 @dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the target directory
249 $submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulenameval;
250 if (!dol_is_dir($submodulenamedir)) {
251 $submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval;
252 }
253 dol_syslog("We copy now directory ".$submodulenamedir." into target dir ".$dirins.'/'.$modulenameval);
254 $result = dolCopyDir($submodulenamedir, $dirins.'/'.$modulenameval, '0444', 1);
255 if ($result <= 0) {
256 dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$submodulenamedir." and ".$dirins.'/'.$modulenameval, LOG_WARNING);
257 $langs->load("errors");
258 setEventMessages($langs->trans("ErrorFailToCopyDir", $submodulenamedir, $dirins.'/'.$modulenameval), null, 'errors');
259 $error++;
260 }
261 }
262 }
263 }
264 } else {
265 setEventMessages($langs->trans("ErrorFailToRenameFile", $_FILES['fileinstall']['tmp_name'], $newfile), null, 'errors');
266 $error++;
267 }
268 }
269
270 if (!$error) {
271 setEventMessages($langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")), null, 'warnings');
272 }
273} elseif ($action == 'install' && !$allowonlineinstall) {
274 httponly_accessforbidden("You try to bypass the protection to disallow deployment of an external module. Hack attempt ?");
275}
276
277if ($action == 'set' && $user->admin) {
278 $checkOldValue = getDolGlobalInt('CHECKLASTVERSION_EXTERNALMODULE');
279 $csrfCheckOldValue = getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN');
280 $resarray = activateModule($value);
281 if ($checkOldValue != getDolGlobalInt('CHECKLASTVERSION_EXTERNALMODULE')) {
282 setEventMessage($langs->trans('WarningModuleHasChangedLastVersionCheckParameter', $value), 'warnings');
283 }
284 if ($csrfCheckOldValue != getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN')) {
285 setEventMessage($langs->trans('WarningModuleHasChangedSecurityCsrfParameter', $value), 'warnings');
286 }
287 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
288 if (!empty($resarray['errors'])) {
289 setEventMessages('', $resarray['errors'], 'errors');
290 } else {
291 //var_dump($resarray);exit;
292 if ($resarray['nbperms'] > 0) {
293 $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
294 $resqltmp = $db->query($tmpsql);
295 if ($resqltmp) {
296 $obj = $db->fetch_object($resqltmp);
297 //var_dump($obj->nb);exit;
298 if ($obj && $obj->nb > 1) {
299 $msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
300 setEventMessages($msg, null, 'warnings');
301 }
302 } else {
303 dol_print_error($db);
304 }
305 }
306 }
307 header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
308 exit;
309} elseif ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes') {
310 $result = unActivateModule($value);
311 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
312 if ($result) {
313 setEventMessages($result, null, 'errors');
314 }
315 header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
316 exit;
317} elseif (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1 && $action == 'reload' && $user->admin && GETPOST('confirm') == 'yes') {
318 $result = unActivateModule($value, 0);
319 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
320 if ($result) {
321 setEventMessages($result, null, 'errors');
322 header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
323 }
324 $resarray = activateModule($value, 0, 1);
325 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
326 if (!empty($resarray['errors'])) {
327 setEventMessages('', $resarray['errors'], 'errors');
328 } else {
329 if ($resarray['nbperms'] > 0) {
330 $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
331 $resqltmp = $db->query($tmpsql);
332 if ($resqltmp) {
333 $obj = $db->fetch_object($resqltmp);
334 if ($obj && $obj->nb > 1) {
335 $msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
336 setEventMessages($msg, null, 'warnings');
337 }
338 } else {
339 dol_print_error($db);
340 }
341 }
342 }
343 header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
344 exit;
345}
346
347
348
349
350/*
351 * View
352 */
353
354$form = new Form($db);
355
356$morejs = array();
357$morecss = array("/admin/dolistore/css/dolistore.css");
358
359// Set dir where external modules are installed
360if (!dol_is_dir($dirins)) {
361 dol_mkdir($dirins);
362}
363$dirins_ok = (dol_is_dir($dirins));
364
365$help_url = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
366llxHeader('', $langs->trans("Setup"), $help_url, '', '', '', $morejs, $morecss, 0, 0);
367
368
369// Search modules dirs
370$modulesdir = dolGetModulesDirs();
371
372$arrayofnatures = array('core'=>$langs->transnoentitiesnoconv("NativeModules"), 'external'=>$langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']');
373$arrayofwarnings = array(); // Array of warning each module want to show when activated
374$arrayofwarningsext = array(); // Array of warning each module want to show when we activate an external module
375$filename = array();
376$modules = array();
377$orders = array();
378$categ = array();
379
380$i = 0; // is a sequencer of modules found
381$j = 0; // j is module number. Automatically affected if module number not defined.
382$modNameLoaded = array();
383
384foreach ($modulesdir as $dir) {
385 // Load modules attributes in arrays (name, numero, orders) from dir directory
386 //print $dir."\n<br>";
387 dol_syslog("Scan directory ".$dir." for module descriptor files (modXXX.class.php)");
388 $handle = @opendir($dir);
389 if (is_resource($handle)) {
390 while (($file = readdir($handle)) !== false) {
391 //print "$i ".$file."\n<br>";
392 if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
393 $modName = substr($file, 0, dol_strlen($file) - 10);
394
395 if ($modName) {
396 if (!empty($modNameLoaded[$modName])) { // In cache of already loaded modules ?
397 $mesg = "Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>";
398 setEventMessages($mesg, null, 'warnings');
399 dol_syslog($mesg, LOG_ERR);
400 continue;
401 }
402
403 try {
404 $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error.
405 if (class_exists($modName)) {
406 $objMod = new $modName($db);
407 $modNameLoaded[$modName] = $dir;
408 if (!$objMod->numero > 0 && $modName != 'modUser') {
409 dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
410 }
411 $j = $objMod->numero;
412
413 $modulequalified = 1;
414
415 // We discard modules according to features level (PS: if module is activated we always show it)
416 $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
417 if ($objMod->version == 'development' && (!getDolGlobalString($const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2))) {
418 $modulequalified = 0;
419 }
420 if ($objMod->version == 'experimental' && (!getDolGlobalString($const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1))) {
421 $modulequalified = 0;
422 }
423 if (preg_match('/deprecated/', $objMod->version) && (!getDolGlobalString($const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 0))) {
424 $modulequalified = 0;
425 }
426
427 // We discard modules according to property ->hidden
428 if (!empty($objMod->hidden)) {
429 $modulequalified = 0;
430 }
431
432 if ($modulequalified > 0) {
433 $publisher = dol_escape_htmltag($objMod->getPublisher());
434 $external = ($objMod->isCoreOrExternalModule() == 'external');
435 if ($external) {
436 if ($publisher) {
437 $arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
438 } else {
439 $arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
440 }
441 }
442 ksort($arrayofnatures);
443
444 // Define array $categ with categ with at least one qualified module
445 $filename[$i] = $modName;
446 $modules[$modName] = $objMod;
447
448 // Gives the possibility to the module, to provide his own family info and position of this family
449 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
450 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
451 $familykey = key($objMod->familyinfo);
452 } else {
453 $familykey = $objMod->family;
454 }
455
456 $moduleposition = ($objMod->module_position ? $objMod->module_position : '50');
457 if ($objMod->isCoreOrExternalModule() == 'external' && $moduleposition < 100000) {
458 // an external module should never return a value lower than '80'.
459 $moduleposition = '80'; // External modules at end by default
460 }
461
462 // Add list of warnings to show into arrayofwarnings and arrayofwarningsext
463 if (!empty($objMod->warnings_activation)) {
464 $arrayofwarnings[$modName] = $objMod->warnings_activation;
465 }
466 if (!empty($objMod->warnings_activation_ext)) {
467 $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
468 }
469
470 $familyposition = (empty($familyinfo[$familykey]['position']) ? 0 : $familyinfo[$familykey]['position']);
471 $listOfOfficialModuleGroups = array('hr', 'technic', 'interface', 'technic', 'portal', 'financial', 'crm', 'base', 'products', 'srm', 'ecm', 'projects', 'other');
472 if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
473 // If module is extern and into a custom group (not into an official predefined one), it must appear at end (custom groups should not be before official groups).
474 if (is_numeric($familyposition)) {
475 $familyposition = sprintf("%03d", (int) $familyposition + 100);
476 }
477 }
478
479 $orders[$i] = $familyposition."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
480
481 // Set categ[$i]
482 $specialstring = 'unknown';
483 if ($objMod->version == 'development' || $objMod->version == 'experimental') {
484 $specialstring = 'expdev';
485 }
486 if (isset($categ[$specialstring])) {
487 $categ[$specialstring]++; // Array of all different modules categories
488 } else {
489 $categ[$specialstring] = 1;
490 }
491 $j++;
492 $i++;
493 } else {
494 dol_syslog("Module ".get_class($objMod)." not qualified");
495 }
496 } else {
497 print "admin/modules.php Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
498 }
499 } catch (Exception $e) {
500 dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
501 }
502 }
503 }
504 }
505 closedir($handle);
506 } else {
507 dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
508 }
509}
510
511if ($action == 'reset_confirm' && $user->admin) {
512 if (!empty($modules[$value])) {
513 $objMod = $modules[$value];
514
515 if (!empty($objMod->langfiles)) {
516 $langs->loadLangs($objMod->langfiles);
517 }
518
519 $form = new Form($db);
520 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmUnactivation'), $langs->trans(GETPOST('confirm_message_code')), 'reset', '', 'no', 1);
521 }
522}
523
524if ($action == 'reload_confirm' && $user->admin) {
525 if (!empty($modules[$value])) {
526 $objMod = $modules[$value];
527
528 if (!empty($objMod->langfiles)) {
529 $langs->loadLangs($objMod->langfiles);
530 }
531
532 $form = new Form($db);
533 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmReload'), $langs->trans(GETPOST('confirm_message_code')), 'reload', '', 'no', 1);
534 }
535}
536
537print $formconfirm;
538
539asort($orders);
540//var_dump($orders);
541//var_dump($categ);
542//var_dump($modules);
543
544$nbofactivatedmodules = count($conf->modules);
545
546$nbmodulesnotautoenabled = count($conf->modules);
547if (in_array('fckeditor', $conf->modules)) {
548 $nbmodulesnotautoenabled--;
549}
550if (in_array('export', $conf->modules)) {
551 $nbmodulesnotautoenabled--;
552}
553if (in_array('import', $conf->modules)) {
554 $nbmodulesnotautoenabled--;
555}
556
557print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup');
558
559// Start to show page
560$deschelp = '';
561if ($mode == 'common' || $mode == 'commonkanban') {
562 $desc = $langs->trans("ModulesDesc", '{picto}');
563 $desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}');
564 $desc = str_replace('{picto}', img_picto('', 'switch_off', 'class="size15x"'), $desc);
565 $desc = str_replace('{picto2}', img_picto('', 'setup', 'class="size15x"'), $desc);
566 if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
567 $deschelp .= '<div class="info hideonsmartphone">'.$desc."<br></div>\n";
568 }
569 if (getDolGlobalString('MAIN_SETUP_MODULES_INFO')) { // Show a custom message
570 $deschelp .= '<div class="info">'.$langs->trans($conf->global->MAIN_SETUP_MODULES_INFO)."<br></div>\n";
571 }
572 if ($deschelp) {
573 $deschelp .= '<br>';
574 }
575}
576if ($mode == 'marketplace') {
577 //$deschelp = '<div class="info hideonsmartphone">'.$langs->trans("ModulesMarketPlaceDesc")."<br></div><br>\n";
578}
579if ($mode == 'deploy') {
580 $deschelp = '<div class="info hideonsmartphone">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."<br></div><br>\n";
581}
582if ($mode == 'develop') {
583 $deschelp = '<div class="info hideonsmartphone">'.$langs->trans("ModulesDevelopDesc")."<br></div><br>\n";
584}
585
586$head = modules_prepare_head($nbofactivatedmodules, count($modules), $nbmodulesnotautoenabled);
587
588
589if ($mode == 'common' || $mode == 'commonkanban') {
590 dol_set_focus('#search_keyword');
591
592 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
593 print '<input type="hidden" name="token" value="'.newToken().'">';
594 if (isset($optioncss) && $optioncss != '') {
595 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
596 }
597 if (isset($sortfield) && $sortfield != '') {
598 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
599 }
600 if (isset($sortorder) && $sortorder != '') {
601 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
602 }
603 if (isset($page) && $page != '') {
604 print '<input type="hidden" name="page" value="'.$page.'">';
605 }
606 print '<input type="hidden" name="mode" value="'.$mode.'">';
607
608 print dol_get_fiche_head($head, 'modules', '', -1);
609
610 print $deschelp;
611
612 $moreforfilter = '<div class="valignmiddle">';
613
614 $moreforfilter .= '<div class="floatright right pagination paddingtop --module-list"><ul><li>';
615 $moreforfilter .= dolGetButtonTitle($langs->trans('CheckForModuleUpdate'), $langs->trans('CheckForModuleUpdate').'<br>'.$langs->trans('CheckForModuleUpdateHelp'), 'fa fa-sync', $_SERVER["PHP_SELF"].'?action=checklastversion&token='.newToken().'&mode='.$mode.$param, '', 1, array('morecss'=>'reposition'));
616 $moreforfilter .= dolGetButtonTitleSeparator();
617 $moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
618 $moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
619 $moreforfilter .= '</li></ul></div>';
620
621 $moreforfilter .= '<div class="divfilteralone colorbacktimesheet float valignmiddle">';
622 $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
623 $moreforfilter .= img_picto($langs->trans("Filter"), 'filter', 'class="paddingright opacityhigh hideonsmartphone"').'<input type="text" id="search_keyword" name="search_keyword" class="maxwidth125" value="'.dol_escape_htmltag($search_keyword).'" placeholder="'.dol_escape_htmltag($langs->trans('Keyword')).'">';
624 $moreforfilter .= '</div>';
625 $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
626 $moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth250', 1);
627 $moreforfilter .= '</div>';
628
629 if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
630 $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
631 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 0) {
632 $array_version['deprecated'] = $langs->trans("Deprecated");
633 }
634 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 0) {
635 $array_version['experimental'] = $langs->trans("Experimental");
636 }
637 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 1) {
638 $array_version['development'] = $langs->trans("Development");
639 }
640 $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
641 $moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->transnoentitiesnoconv('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
642 $moreforfilter .= '</div>';
643 }
644 $array_status = array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled"));
645 $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
646 $moreforfilter .= $form->selectarray('search_status', $array_status, $search_status, $langs->transnoentitiesnoconv('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
647 $moreforfilter .= '</div>';
648 $moreforfilter .= ' ';
649 $moreforfilter .= '<div class="divsearchfield valignmiddle inline-block">';
650 $moreforfilter .= '<input type="submit" name="buttonsubmit" class="button small" value="'.dol_escape_htmltag($langs->trans("Refresh")).'">';
651 if ($search_keyword || ($search_nature && $search_nature != '-1') || ($search_version && $search_version != '-1') || ($search_status && $search_status != '-1')) {
652 $moreforfilter .= ' ';
653 $moreforfilter .= '<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
654 }
655 $moreforfilter .= '</div>';
656 $moreforfilter .= '</div>';
657
658 $moreforfilter .= '</div>';
659
660 if (!empty($moreforfilter)) {
661 print $moreforfilter;
662 $parameters = array();
663 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
664 print $hookmanager->resPrint;
665 }
666
667 $moreforfilter = '';
668
669 print '<div class="clearboth"></div><br>';
670
671 $object = new stdClass();
672 $parameters = array();
673 $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
674 if ($reshook < 0) {
675 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
676 }
677
678 $disabled_modules = array();
679 if (!empty($_SESSION["disablemodules"])) {
680 $disabled_modules = explode(',', $_SESSION["disablemodules"]);
681 }
682
683 // Show list of modules
684 $oldfamily = '';
685 $foundoneexternalmodulewithupdate = 0;
686 $linenum = 0;
687 $atleastonequalified = 0;
688 $atleastoneforfamily = 0;
689
690 foreach ($orders as $key => $value) {
691 $linenum++;
692 $tab = explode('_', $value);
693 $familykey = $tab[1];
694 $module_position = $tab[2];
695
696 $modName = $filename[$key];
697
699 $objMod = $modules[$modName];
700
701 //print $objMod->name." - ".$key." - ".$objMod->version."<br>";
702 if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') {
703 continue; // Discard if not for current tab
704 }
705
706 if (!$objMod->getName()) {
707 dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
708 continue;
709 }
710
711 $modulenameshort = strtolower(preg_replace('/^mod/i', '', get_class($objMod)));
712 $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
713
714 // Check filters
715 $modulename = $objMod->getName();
716 $moduletechnicalname = $objMod->name;
717 $moduledesc = $objMod->getDesc();
718 $moduledesclong = $objMod->getDescLong();
719 $moduleauthor = $objMod->getPublisher();
720
721 // We discard showing according to filters
722 if ($search_keyword) {
723 $qualified = 0;
724 if (preg_match('/'.preg_quote($search_keyword, '/').'/i', $modulename)
725 || preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduletechnicalname)
726 || ($moduledesc && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduledesc))
727 || ($moduledesclong && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduledesclong))
728 || ($moduleauthor && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduleauthor))
729 ) {
730 $qualified = 1;
731 }
732 if (!$qualified) {
733 continue;
734 }
735 }
736 if ($search_status) {
737 if ($search_status == 'active' && !getDolGlobalString($const_name)) {
738 continue;
739 }
740 if ($search_status == 'disabled' && getDolGlobalString($const_name)) {
741 continue;
742 }
743 }
744 if ($search_nature) {
745 if (preg_match('/^external/', $search_nature) && $objMod->isCoreOrExternalModule() != 'external') {
746 continue;
747 }
748 $reg = array();
749 if (preg_match('/^external_(.*)$/', $search_nature, $reg)) {
750 //print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher());
751 $publisher = dol_escape_htmltag($objMod->getPublisher());
752 if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) {
753 continue;
754 }
755 if (!$reg[1] && !empty($publisher)) {
756 continue;
757 }
758 }
759 if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') {
760 continue;
761 }
762 }
763 if ($search_version) {
764 if (($objMod->version == 'development' || $objMod->version == 'experimental' || preg_match('/deprecated/', $objMod->version)) && $search_version == 'stable') {
765 continue;
766 }
767 if ($objMod->version != 'development' && ($search_version == 'development')) {
768 continue;
769 }
770 if ($objMod->version != 'experimental' && ($search_version == 'experimental')) {
771 continue;
772 }
773 if (!preg_match('/deprecated/', $objMod->version) && ($search_version == 'deprecated')) {
774 continue;
775 }
776 }
777
778 $atleastonequalified++;
779
780 // Load all language files of the qualified module
781 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
782 foreach ($objMod->langfiles as $domain) {
783 $langs->load($domain);
784 }
785 }
786
787 // Print a separator if we change family
788 if ($familykey != $oldfamily) {
789 if ($oldfamily) {
790 print '</table></div><br>';
791 }
792
793 $familytext = empty($familyinfo[$familykey]['label']) ? $familykey : $familyinfo[$familykey]['label'];
794
795 print load_fiche_titre($familytext, '', '', 0, '', 'modulefamilygroup');
796
797 if ($mode == 'commonkanban') {
798 print '<div class="box-flex-container kanban">';
799 } else {
800 print '<div class="div-table-responsive">';
801 print '<table class="tagtable liste" summary="list_of_modules">'."\n";
802 }
803
804 $atleastoneforfamily = 0;
805 }
806
807 $atleastoneforfamily++;
808
809 if ($familykey != $oldfamily) {
810 $familytext = empty($familyinfo[$familykey]['label']) ? $familykey : $familyinfo[$familykey]['label'];
811 $oldfamily = $familykey;
812 }
813
814 // Version (with picto warning or not)
815 $version = $objMod->getVersion(0);
816 $versiontrans = '';
817 $warningstring = '';
818 if (preg_match('/development/i', $version)) {
819 $warningstring = $langs->trans("Development");
820 }
821 if (preg_match('/experimental/i', $version)) {
822 $warningstring = $langs->trans("Experimental");
823 }
824 if (preg_match('/deprecated/i', $version)) {
825 $warningstring = $langs->trans("Deprecated");
826 }
827
828 if ($objMod->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) {
829 $versiontrans .= $objMod->getVersion(1);
830 }
831
832 if ($objMod->isCoreOrExternalModule() == 'external'
833 && (
834 $action == 'checklastversion'
835 // This is a bad practice to activate a check on an external access during the building of the admin page. 1 external module can hang the application.
836 // Adding a cron job could be a good idea: see DolibarrModules::checkForUpdate()
837 || getDolGlobalString('CHECKLASTVERSION_EXTERNALMODULE')
838 )
839 ) {
840 $checkRes = $objMod->checkForUpdate();
841 if ($checkRes > 0) {
842 setEventMessage($objMod->getName().' : '.$versiontrans.' -> '.$objMod->lastVersion);
843 } elseif ($checkRes < 0) {
844 setEventMessage($objMod->getName().' '.$langs->trans('CheckVersionFail'), 'warnings');
845 }
846 }
847
848 // Define imginfo
849 $imginfo = "info";
850 if ($objMod->isCoreOrExternalModule() == 'external') {
851 $imginfo = "info_black";
852 }
853
854 $codeenabledisable = '';
855 $codetoconfig = '';
856
857 // Force disable of module disabled into session (for demo for example)
858 if (in_array($modulenameshort, $disabled_modules)) {
859 $objMod->disabled = true;
860 }
861
862 // Activate/Disable and Setup (2 columns)
863 if (getDolGlobalString($const_name)) { // If module is already activated
864 // Set $codeenabledisable
865 $disableSetup = 0;
866 if (!empty($arrayofwarnings[$modName])) {
867 $codeenabledisable .= '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
868 }
869
870 if (!empty($objMod->disabled)) {
871 $codeenabledisable .= $langs->trans("Disabled");
872 } elseif (!empty($objMod->always_enabled) || ((isModEnabled('multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
873 if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
874 $codeenabledisable .= $langs->trans("Used");
875 } else {
876 $codeenabledisable .= img_picto($langs->trans("Required"), 'switch_on', '', false, 0, 0, '', 'opacitymedium valignmiddle');
877 //print $langs->trans("Required");
878 }
879 if (isModEnabled('multicompany') && $user->entity) {
880 $disableSetup++;
881 }
882 } else {
883 if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
884 $codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reset_confirm&amp;confirm_message_code='.urlencode($objMod->warnings_unactivation[$mysoc->country_code]).'&amp;value='.$modName.'&amp;mode='.$mode.$param.'">';
885 $codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on');
886 $codeenabledisable .= '</a>';
887 if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) {
888 $codeenabledisable .= '&nbsp;';
889 $codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reload_confirm&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
890 $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"');
891 $codeenabledisable .= '</a>';
892 }
893 } else {
894 $codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reset&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
895 $codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on');
896 $codeenabledisable .= '</a>';
897 if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) {
898 $codeenabledisable .= '&nbsp;';
899 $codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reload&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
900 $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"');
901 $codeenabledisable .= '</a>';
902 }
903 }
904 }
905
906 // Set $codetoconfig
907 if (!empty($objMod->config_page_url) && !$disableSetup) {
908 $backtourlparam = '';
909 if ($search_keyword != '') {
910 $backtourlparam .= ($backtourlparam ? '&' : '?').'search_keyword='.urlencode($search_keyword); // No urlencode here, done later
911 }
912 if ($search_nature > -1) {
913 $backtourlparam .= ($backtourlparam ? '&' : '?').'search_nature='.urlencode($search_nature); // No urlencode here, done later
914 }
915 if ($search_version > -1) {
916 $backtourlparam .= ($backtourlparam ? '&' : '?').'search_version='.urlencode($search_version); // No urlencode here, done later
917 }
918 if ($search_status > -1) {
919 $backtourlparam .= ($backtourlparam ? '&' : '?').'search_status='.urlencode($search_status); // No urlencode here, done later
920 }
921 $backtourl = $_SERVER["PHP_SELF"].$backtourlparam;
922
923 $regs = array();
924 if (is_array($objMod->config_page_url)) {
925 $i = 0;
926 foreach ($objMod->config_page_url as $page) {
927 $urlpage = $page;
928 if ($i++) {
929 $codetoconfig .= '<a href="'.$urlpage.'" title="'.$langs->trans($page).'">'.img_picto(ucfirst($page), "setup").'</a>';
930 // print '<a href="'.$page.'">'.ucfirst($page).'</a>&nbsp;';
931 } else {
932 if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
933 $urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1);
934 $codetoconfig .= '<a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
935 } else {
936 $urltouse = $urlpage;
937 $codetoconfig .= '<a href="'.$urltouse.(preg_match('/\?/', $urltouse) ? '&' : '?').'save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
938 }
939 }
940 }
941 } elseif (preg_match('/^([^@]+)@([^@]+)$/i', (string) $objMod->config_page_url, $regs)) {
942 $codetoconfig .= '<a class="valignmiddle" href="'.dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1).'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
943 } else {
944 $codetoconfig .= '<a class="valignmiddle" href="'.((string) $objMod->config_page_url).'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).'" title="'.$langs->trans("Setup").'">'.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').'</a>';
945 }
946 } else {
947 $codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"', false, 0, 0, '', 'fa-15');
948 }
949 } else { // Module not yet activated
950 // Set $codeenabledisable
951 if (!empty($objMod->always_enabled)) {
952 // A 'always_enabled' module should not never be disabled. If this happen, we keep a link to reenable it.
953 $codeenabledisable .= '<!-- Message to show: an always_enabled module has been disabled -->'."\n";
954 $codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&token='.newToken().'&module_position='.$module_position.'&action=set&token='.newToken().'&value='.$modName.'&mode='.$mode.$param.'"';
955 $codeenabledisable .= '>';
956 $codeenabledisable .= img_picto($langs->trans("Disabled"), 'switch_off');
957 $codeenabledisable .= "</a>\n";
958 } elseif (!empty($objMod->disabled)) {
959 $codeenabledisable .= $langs->trans("Disabled");
960 } else {
961 // Module qualified for activation
962 $warningmessage = '';
963 if (!empty($arrayofwarnings[$modName])) {
964 $codeenabledisable .= '<!-- This module is a core module and it may have a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
965 foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
966 if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) {
967 $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
968 }
969 }
970 }
971 if ($objMod->isCoreOrExternalModule() == 'external' && !empty($arrayofwarningsext)) {
972 $codeenabledisable .= '<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.') -->'."\n";
973 foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
974 $keymodulelowercase = strtolower(preg_replace('/^mod/', '', $keymodule));
975 if (in_array($keymodulelowercase, $conf->modules)) { // If module that request warning is on
976 foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
977 if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) {
978 $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
979 $warningmessage .= ($warningmessage ? "\n" : "").($warningmessage ? "\n" : "").$langs->trans("Module").' : '.$objMod->getName();
980 if (!empty($objMod->editor_name)) {
981 $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("Publisher").' : '.$objMod->editor_name;
982 }
983 if (!empty($objMod->editor_name)) {
984 $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("ModuleTriggeringThisWarning").' : '.$modules[$keymodule]->getName();
985 }
986 }
987 }
988 }
989 }
990 }
991 $codeenabledisable .= '<!-- Message to show: '.$warningmessage.' -->'."\n";
992 $codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&token='.newToken().'&module_position='.$module_position.'&action=set&token='.newToken().'&value='.$modName.'&mode='.$mode.$param.'"';
993 if ($warningmessage) {
994 $codeenabledisable .= ' onclick="return confirm(\''.dol_escape_js($warningmessage).'\');"';
995 }
996 $codeenabledisable .= '>';
997 $codeenabledisable .= img_picto($langs->trans("Disabled"), 'switch_off');
998 $codeenabledisable .= "</a>\n";
999 }
1000
1001 // Set $codetoconfig
1002 $codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"');
1003 }
1004
1005 if ($mode == 'commonkanban') {
1006 // Output Kanban
1007 print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
1008 } else {
1009 print '<tr class="oddeven'.($warningstring ? ' info-box-content-warning' : '').'">'."\n";
1010 if (getDolGlobalString('MAIN_MODULES_SHOW_LINENUMBERS')) {
1011 print '<td class="width50">'.$linenum.'</td>';
1012 }
1013
1014 // Picto + Name of module
1015 print ' <td class="tdoverflowmax200 minwidth200imp" title="'.dol_escape_htmltag($objMod->getName()).'">';
1016 $alttext = '';
1017 //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
1018 //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
1019 if (!empty($objMod->picto)) {
1020 if (preg_match('/^\//i', $objMod->picto)) {
1021 print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"', 1);
1022 } else {
1023 print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"');
1024 }
1025 } else {
1026 print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly"');
1027 }
1028 print ' <span class="valignmiddle">'.$objMod->getName().'</span>';
1029 print "</td>\n";
1030
1031 // Desc
1032 print '<td class="valignmiddle tdoverflowmax300 minwidth200imp">';
1033 print nl2br($objMod->getDesc());
1034 print "</td>\n";
1035
1036 // Help
1037 print '<td class="center nowrap" style="width: 82px;">';
1038 //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
1039 print '<a href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.((int) $objMod->numero).'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto(($objMod->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule").' - ' : '').$langs->trans("ClickToShowDescription"), $imginfo).'</a>';
1040 print '</td>';
1041
1042 // Version
1043 print '<td class="center nowrap width150" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
1044 if ($objMod->needUpdate) {
1045 $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
1046 print '<span class="badge badge-warning classfortooltip" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
1047 } else {
1048 print $versiontrans;
1049 }
1050 print "</td>\n";
1051
1052 // Link enable/disable
1053 print '<td class="center valignmiddle left nowraponall" width="60px">';
1054 print $codeenabledisable;
1055 print "</td>\n";
1056
1057 // Link config
1058 print '<td class="tdsetuppicto right valignmiddle" width="60px">';
1059 print $codetoconfig;
1060 print '</td>';
1061
1062 print "</tr>\n";
1063 }
1064 if ($objMod->needUpdate) {
1065 $foundoneexternalmodulewithupdate++;
1066 }
1067 }
1068
1069 if ($action == 'checklastversion') {
1070 if ($foundoneexternalmodulewithupdate) {
1071 setEventMessages($langs->trans("ModuleUpdateAvailable"), null, 'mesgs');
1072 } else {
1073 setEventMessages($langs->trans("NoExternalModuleWithUpdate"), null, 'mesgs');
1074 }
1075 }
1076
1077 if ($oldfamily) {
1078 if ($mode == 'commonkanban') {
1079 print '</div>';
1080 } else {
1081 print "</table>\n";
1082 print '</div>';
1083 }
1084 }
1085
1086 if (!$atleastonequalified) {
1087 print '<br><span class="opacitymedium">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria").'</span><br><br>';
1088 }
1089
1090 print dol_get_fiche_end();
1091
1092 print '<br>';
1093
1094 // Show warning about external users
1095 print info_admin(showModulesExludedForExternal($modules))."\n";
1096
1097 print '</form>';
1098}
1099
1100if ($mode == 'marketplace') {
1101 print dol_get_fiche_head($head, $mode, '', -1);
1102
1103 print $deschelp;
1104
1105 print '<br>';
1106
1107 // Marketplace
1108 print '<div class="div-table-responsive-no-min">';
1109 print '<table summary="list_of_modules" class="noborder centpercent">'."\n";
1110 print '<tr class="liste_titre">'."\n";
1111 print '<td class="hideonsmartphone">'.$form->textwithpicto($langs->trans("Provider"), $langs->trans("WebSiteDesc")).'</td>';
1112 print '<td></td>';
1113 print '<td>'.$langs->trans("URL").'</td>';
1114 print '</tr>';
1115
1116 print '<tr class="oddeven">'."\n";
1117 $url = 'https://www.dolistore.com';
1118 print '<td class="hideonsmartphone"><a href="'.$url.'" target="_blank" rel="noopener noreferrer external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
1119 print '<td><span class="opacitymedium">'.$langs->trans("DoliStoreDesc").'</span></td>';
1120 print '<td><a href="'.$url.'" target="_blank" rel="noopener noreferrer external">'.$url.'</a></td>';
1121 print '</tr>';
1122
1123 print "</table>\n";
1124 print '</div>';
1125
1126 print dol_get_fiche_end();
1127
1128 print '<br>';
1129
1130 if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) {
1131 // $options is array with filter criterias
1132 //var_dump($options);
1133 $dolistore->getRemoteCategories();
1134 $dolistore->getRemoteProducts($options);
1135
1136 print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
1137
1138 $previouslink = $dolistore->get_previous_link();
1139 $nextlink = $dolistore->get_next_link();
1140
1141 print '<div class="liste_titre liste_titre_bydiv centpercent"><div class="divsearchfield">';
1142
1143 print '<form method="POST" class="centpercent" id="searchFormList" action="'.$dolistore->url.'">'; ?>
1144 <input type="hidden" name="token" value="<?php echo newToken(); ?>">
1145 <input type="hidden" name="mode" value="marketplace">
1146 <div class="divsearchfield">
1147 <input name="search_keyword" placeholder="<?php echo $langs->trans('Keyword') ?>" id="search_keyword" type="text" class="minwidth200" value="<?php echo dol_escape_htmltag($options['search']) ?>"><br>
1148 </div>
1149 <div class="divsearchfield">
1150 <input class="button buttongen" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
1151 <a class="buttonreset" href="<?php echo urlencode($dolistore->url) ?>"><?php echo $langs->trans('Reset') ?></a>
1152
1153 &nbsp;
1154 </div>
1155 <?php
1156 print $previouslink;
1157 print $nextlink;
1158 print '</form>';
1159
1160
1161 print '</div></div>';
1162 print '<div class="clearboth"></div>'; ?>
1163
1164 <div id="category-tree-left">
1165 <ul class="tree">
1166 <?php
1167 echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content?>
1168 </ul>
1169 </div>
1170 <div id="listing-content">
1171 <table summary="list_of_modules" id="list_of_modules" class="productlist centpercent">
1172 <tbody id="listOfModules">
1173 <?php echo $dolistore->get_products(); ?>
1174 </tbody>
1175 </table>
1176 </div>
1177 <?php
1178 }
1179}
1180
1181
1182// Install external module
1183
1184if ($mode == 'deploy') {
1185 print dol_get_fiche_head($head, $mode, '', -1);
1186
1187 $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank" rel="noopener noreferrer">'.$urldolibarrmodules.'</a>';
1188 $message = '';
1189 if ($allowonlineinstall) {
1190 if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
1191 $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
1192 $allowfromweb = -1;
1193 } else {
1194 if ($dirins_ok) {
1195 if (!is_writable(dol_osencode($dirins))) {
1196 $langs->load("errors");
1197 $message = info_admin($langs->trans("ErrorFailedToWriteInDir", $dirins), 0, 0, '1', 'warning');
1198 $allowfromweb = 0;
1199 }
1200 } else {
1201 $message = info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
1202 $allowfromweb = 0;
1203 }
1204 }
1205 } else {
1206 if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
1207 // Show clean message
1208 if (!is_numeric(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))) {
1209 $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')));
1210 } else {
1211 $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));
1212 }
1213 } else {
1214 // Show technical message
1215 $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock'));
1216 }
1217 $allowfromweb = 0;
1218 }
1219
1220 print $deschelp;
1221
1222 if ($allowfromweb < 1) {
1223 print $langs->trans("SomethingMakeInstallFromWebNotPossible");
1224 print $message;
1225 //print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
1226 print '<br>';
1227 }
1228
1229 print '<br>';
1230
1231 // $allowfromweb = -1 if installation or setup not correct, 0 if not allowed, 1 if allowed
1232 if ($allowfromweb >= 0) {
1233 if ($allowfromweb == 1) {
1234 //print $langs->trans("ThisIsProcessToFollow").'<br>';
1235 } else {
1236 print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
1237 print '<b>'.$langs->trans("StepNb", 1).'</b>: ';
1238 print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite", '{s1}')).'<br>';
1239 print '<b>'.$langs->trans("StepNb", 2).'</b>: ';
1240 print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite", '{s1}')).'<br>';
1241 print '<b>'.$langs->trans("StepNb", 3).'</b>: ';
1242 }
1243
1244 if ($allowfromweb == 1) {
1245 print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
1246 print '<input type="hidden" name="token" value="'.newToken().'">';
1247 print '<input type="hidden" name="action" value="install">';
1248 print '<input type="hidden" name="mode" value="deploy">';
1249
1250 print $langs->trans("YouCanSubmitFile").'<br><br>';
1251
1252 $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
1253 $maxphp = @ini_get('upload_max_filesize'); // In unknown
1254 if (preg_match('/k$/i', $maxphp)) {
1255 $maxphp = preg_replace('/k$/i', '', $maxphp);
1256 $maxphp = $maxphp * 1;
1257 }
1258 if (preg_match('/m$/i', $maxphp)) {
1259 $maxphp = preg_replace('/m$/i', '', $maxphp);
1260 $maxphp = $maxphp * 1024;
1261 }
1262 if (preg_match('/g$/i', $maxphp)) {
1263 $maxphp = preg_replace('/g$/i', '', $maxphp);
1264 $maxphp = $maxphp * 1024 * 1024;
1265 }
1266 if (preg_match('/t$/i', $maxphp)) {
1267 $maxphp = preg_replace('/t$/i', '', $maxphp);
1268 $maxphp = $maxphp * 1024 * 1024 * 1024;
1269 }
1270 $maxphp2 = @ini_get('post_max_size'); // In unknown
1271 if (preg_match('/k$/i', $maxphp2)) {
1272 $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
1273 $maxphp2 = $maxphp2 * 1;
1274 }
1275 if (preg_match('/m$/i', $maxphp2)) {
1276 $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
1277 $maxphp2 = $maxphp2 * 1024;
1278 }
1279 if (preg_match('/g$/i', $maxphp2)) {
1280 $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
1281 $maxphp2 = $maxphp2 * 1024 * 1024;
1282 }
1283 if (preg_match('/t$/i', $maxphp2)) {
1284 $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
1285 $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
1286 }
1287 // Now $max and $maxphp and $maxphp2 are in Kb
1288 $maxmin = $max;
1289 $maxphptoshow = $maxphptoshowparam = '';
1290 if ($maxphp > 0) {
1291 $maxmin = min($max, $maxphp);
1292 $maxphptoshow = $maxphp;
1293 $maxphptoshowparam = 'upload_max_filesize';
1294 }
1295 if ($maxphp2 > 0) {
1296 $maxmin = min($max, $maxphp2);
1297 if ($maxphp2 < $maxphp) {
1298 $maxphptoshow = $maxphp2;
1299 $maxphptoshowparam = 'post_max_size';
1300 }
1301 }
1302
1303 if ($maxmin > 0) {
1304 print '<script type="text/javascript">
1305 $(document).ready(function() {
1306 jQuery("#fileinstall").on("change", function() {
1307 if(this.files[0].size > '.($maxmin * 1024).') {
1308 alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'");
1309 this.value = "";
1310 }
1311 });
1312 });
1313 </script>'."\n";
1314 // MAX_FILE_SIZE doit précéder le champ input de type file
1315 print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';
1316 }
1317
1318 print '<input class="flat minwidth400" type="file" name="fileinstall" id="fileinstall"> ';
1319
1320 print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button">';
1321
1322 if (getDolGlobalString('MAIN_UPLOAD_DOC')) {
1323 if ($user->admin) {
1324 $langs->load('other');
1325 print ' ';
1326 print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow, $maxphptoshowparam), 1);
1327 }
1328 } else {
1329 print ' ('.$langs->trans("UploadDisabled").')';
1330 }
1331
1332 print '</form>';
1333
1334 print '<br>';
1335 print '<br>';
1336
1337 print '<div class="center"><div class="logo_setup"></div></div>';
1338 } else {
1339 print $langs->trans("UnpackPackageInModulesRoot", $dirins).'<br>';
1340 print '<b>'.$langs->trans("StepNb", 4).'</b>: ';
1341 print $langs->trans("SetupIsReadyForUse").'<br>';
1342 }
1343 }
1344
1345 if (!empty($result['return'])) {
1346 print '<br>';
1347
1348 foreach ($result['return'] as $value) {
1349 echo $value.'<br>';
1350 }
1351 }
1352
1353 print dol_get_fiche_end();
1354}
1355
1356if ($mode == 'develop') {
1357 print dol_get_fiche_head($head, $mode, '', -1);
1358
1359 print $deschelp;
1360
1361 print '<br>';
1362
1363 // Marketplace
1364 print '<table summary="list_of_modules" class="noborder centpercent">'."\n";
1365 print '<tr class="liste_titre">'."\n";
1366 //print '<td>'.$langs->trans("Logo").'</td>';
1367 print '<td colspan="2">'.$langs->trans("DevelopYourModuleDesc").'</td>';
1368 print '<td>'.$langs->trans("URL").'</td>';
1369 print '</tr>';
1370
1371 print '<tr class="oddeven" height="80">'."\n";
1372 print '<td class="center">';
1373 print '<div class="imgmaxheight50 logo_setup"></div>';
1374 print '</td>';
1375 print '<td>'.$langs->trans("TryToUseTheModuleBuilder", $langs->transnoentitiesnoconv("ModuleBuilder")).'</td>';
1376 print '<td class="maxwidth300">';
1377 if (isModEnabled('modulebuilder')) {
1378 print $langs->trans("SeeTopRightMenu");
1379 } else {
1380 print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("ModuleBuilder")).'</span>';
1381 }
1382 print '</td>';
1383 print '</tr>';
1384
1385 print '<tr class="oddeven" height="80">'."\n";
1386 $url = 'https://partners.dolibarr.org';
1387 print '<td class="center">';
1388 print'<a href="'.$url.'" target="_blank" rel="noopener noreferrer external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner.png"></a>';
1389 print '</td>';
1390 print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
1391 print '<td><a href="'.$url.'" target="_blank" rel="noopener noreferrer external">';
1392 print img_picto('', 'url', 'class="pictofixedwidth"');
1393 print $url.'</a></td>';
1394 print '</tr>';
1395
1396 print "</table>\n";
1397
1398 print dol_get_fiche_end();
1399}
1400
1401// End of page
1402llxFooter();
1403$db->close();
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).
unActivateModule($value, $requiredby=1)
Disable a module.
activateModule($value, $withdeps=1, $noconfverification=0)
Enable a module.
modules_prepare_head($nbofactivatedmodules, $nboftotalmodules, $nbmodulesnotautoenabled)
Prepare array with list of tabs.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
Class Dolistore.
Class to manage generation of HTML components Only common components must be here.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Make control on an uploaded file from an GUI page and move it to final destination.
dol_uncompress($inputfile, $outputdir)
Uncompress a file.
dol_is_file($pathoffile)
Return if path is a file.
dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement=null, $excludesubdir=0, $excludefileext=null)
Copy a dir to another dir.
dol_is_dir($folder)
Test if filename is a directory.
dolGetModulesDirs($subdir='')
Return list of modules directories.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getDolGlobalString($key, $default='')
Return 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_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
document_preview(file, type, title)
Function show document preview.
ui dialog ui datepicker calendar ui widget content ui state ui datepicker calendar ui widget header ui state ui datepicker calendar ui button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
httponly_accessforbidden($message=1, $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.