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-2024 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 /*
271 if (!$error) {
272 if (GETPOST('checkforcompliance')) {
273 $dir = $dirins;
274 $file = $modulenameval;
275 // $installedmodule
276 try {
277 $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error.
278 $modName = substr($file, 0, dol_strlen($file) - 10);
279 if ($modName) {
280 if (class_exists($modName)) {
281 $objMod = new $modName($db);
282 '@phan-var-force DolibarrModules $objMod';
283
284 //var_dump($objMod);
285 }
286 }
287 } catch(Exception $e) {
288 // Nothing done
289 }
290 }
291 }
292 */
293
294 if (!$error) {
295 setEventMessages($langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")), null, 'warnings');
296 }
297} elseif ($action == 'install' && !$allowonlineinstall) {
298 httponly_accessforbidden("You try to bypass the protection to disallow deployment of an external module. Hack attempt ?");
299}
300
301if ($action == 'set' && $user->admin) {
302 $checkOldValue = getDolGlobalInt('CHECKLASTVERSION_EXTERNALMODULE');
303 $csrfCheckOldValue = getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN');
304 $resarray = activateModule($value);
305 if ($checkOldValue != getDolGlobalInt('CHECKLASTVERSION_EXTERNALMODULE')) {
306 setEventMessage($langs->trans('WarningModuleHasChangedLastVersionCheckParameter', $value), 'warnings');
307 }
308 if ($csrfCheckOldValue != getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN')) {
309 setEventMessage($langs->trans('WarningModuleHasChangedSecurityCsrfParameter', $value), 'warnings');
310 }
311 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
312 if (!empty($resarray['errors'])) {
313 setEventMessages('', $resarray['errors'], 'errors');
314 } else {
315 //var_dump($resarray);exit;
316 if ($resarray['nbperms'] > 0) {
317 $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
318 $resqltmp = $db->query($tmpsql);
319 if ($resqltmp) {
320 $obj = $db->fetch_object($resqltmp);
321 //var_dump($obj->nb);exit;
322 if ($obj && $obj->nb > 1) {
323 $msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
324 setEventMessages($msg, null, 'warnings');
325 }
326 } else {
327 dol_print_error($db);
328 }
329 }
330 }
331 header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
332 exit;
333} elseif ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes') {
334 $result = unActivateModule($value);
335 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", getDolGlobalInt('MAIN_IHM_PARAMS_REV') + 1, 'chaine', 0, '', $conf->entity);
336 if ($result) {
337 setEventMessages($result, null, 'errors');
338 }
339 header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
340 exit;
341} elseif (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1 && $action == 'reload' && $user->admin && GETPOST('confirm') == 'yes') {
342 $result = unActivateModule($value, 0);
343 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
344 if ($result) {
345 setEventMessages($result, null, 'errors');
346 header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
347 }
348 $resarray = activateModule($value, 0, 1);
349 dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
350 if (!empty($resarray['errors'])) {
351 setEventMessages('', $resarray['errors'], 'errors');
352 } else {
353 if ($resarray['nbperms'] > 0) {
354 $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
355 $resqltmp = $db->query($tmpsql);
356 if ($resqltmp) {
357 $obj = $db->fetch_object($resqltmp);
358 if ($obj && $obj->nb > 1) {
359 $msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
360 setEventMessages($msg, null, 'warnings');
361 }
362 } else {
363 dol_print_error($db);
364 }
365 }
366 }
367 header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
368 exit;
369}
370
371
372
373
374/*
375 * View
376 */
377
378$form = new Form($db);
379
380$morejs = array();
381$morecss = array("/admin/dolistore/css/dolistore.css");
382
383// Set dir where external modules are installed
384if (!dol_is_dir($dirins)) {
385 dol_mkdir($dirins);
386}
387$dirins_ok = (dol_is_dir($dirins));
388
389$help_url = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
390llxHeader('', $langs->trans("Setup"), $help_url, '', '', '', $morejs, $morecss, 0, 0);
391
392
393// Search modules dirs
394$modulesdir = dolGetModulesDirs();
395
396$arrayofnatures = array('core'=>$langs->transnoentitiesnoconv("NativeModules"), 'external'=>$langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']');
397$arrayofwarnings = array(); // Array of warning each module want to show when activated
398$arrayofwarningsext = array(); // Array of warning each module want to show when we activate an external module
399$filename = array();
400$modules = array();
401$orders = array();
402$categ = array();
403
404$i = 0; // is a sequencer of modules found
405$j = 0; // j is module number. Automatically affected if module number not defined.
406$modNameLoaded = array();
407
408foreach ($modulesdir as $dir) {
409 // Load modules attributes in arrays (name, numero, orders) from dir directory
410 //print $dir."\n<br>";
411 dol_syslog("Scan directory ".$dir." for module descriptor files (modXXX.class.php)");
412 $handle = @opendir($dir);
413 if (is_resource($handle)) {
414 while (($file = readdir($handle)) !== false) {
415 //print "$i ".$file."\n<br>";
416 if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
417 $modName = substr($file, 0, dol_strlen($file) - 10);
418
419 if ($modName) {
420 if (!empty($modNameLoaded[$modName])) { // In cache of already loaded modules ?
421 $mesg = "Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>";
422 setEventMessages($mesg, null, 'warnings');
423 dol_syslog($mesg, LOG_ERR);
424 continue;
425 }
426
427 try {
428 $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error.
429 if (class_exists($modName)) {
430 $objMod = new $modName($db);
431 $modNameLoaded[$modName] = $dir;
432 if (!$objMod->numero > 0 && $modName != 'modUser') {
433 dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
434 }
435 $j = $objMod->numero;
436
437 $modulequalified = 1;
438
439 // We discard modules according to features level (PS: if module is activated we always show it)
440 $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
441 if ($objMod->version == 'development' && (!getDolGlobalString($const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2))) {
442 $modulequalified = 0;
443 }
444 if ($objMod->version == 'experimental' && (!getDolGlobalString($const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1))) {
445 $modulequalified = 0;
446 }
447 if (preg_match('/deprecated/', $objMod->version) && (!getDolGlobalString($const_name) && (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 0))) {
448 $modulequalified = 0;
449 }
450
451 // We discard modules according to property ->hidden
452 if (!empty($objMod->hidden)) {
453 $modulequalified = 0;
454 }
455
456 if ($modulequalified > 0) {
457 $publisher = dol_escape_htmltag($objMod->getPublisher());
458 $external = ($objMod->isCoreOrExternalModule() == 'external');
459 if ($external) {
460 if ($publisher) {
461 $arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
462 } else {
463 $arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
464 }
465 }
466 ksort($arrayofnatures);
467
468 // Define array $categ with categ with at least one qualified module
469 $filename[$i] = $modName;
470 $modules[$modName] = $objMod;
471
472 // Gives the possibility to the module, to provide his own family info and position of this family
473 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
474 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
475 $familykey = key($objMod->familyinfo);
476 } else {
477 $familykey = $objMod->family;
478 }
479
480 $moduleposition = ($objMod->module_position ? $objMod->module_position : '50');
481 if ($objMod->isCoreOrExternalModule() == 'external' && $moduleposition < 100000) {
482 // an external module should never return a value lower than '80'.
483 $moduleposition = '80'; // External modules at end by default
484 }
485
486 // Add list of warnings to show into arrayofwarnings and arrayofwarningsext
487 if (!empty($objMod->warnings_activation)) {
488 $arrayofwarnings[$modName] = $objMod->warnings_activation;
489 }
490 if (!empty($objMod->warnings_activation_ext)) {
491 $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
492 }
493
494 $familyposition = (empty($familyinfo[$familykey]['position']) ? 0 : $familyinfo[$familykey]['position']);
495 $listOfOfficialModuleGroups = array('hr', 'technic', 'interface', 'technic', 'portal', 'financial', 'crm', 'base', 'products', 'srm', 'ecm', 'projects', 'other');
496 if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
497 // 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).
498 if (is_numeric($familyposition)) {
499 $familyposition = sprintf("%03d", (int) $familyposition + 100);
500 }
501 }
502
503 $orders[$i] = $familyposition."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
504
505 // Set categ[$i]
506 $specialstring = 'unknown';
507 if ($objMod->version == 'development' || $objMod->version == 'experimental') {
508 $specialstring = 'expdev';
509 }
510 if (isset($categ[$specialstring])) {
511 $categ[$specialstring]++; // Array of all different modules categories
512 } else {
513 $categ[$specialstring] = 1;
514 }
515 $j++;
516 $i++;
517 } else {
518 dol_syslog("Module ".get_class($objMod)." not qualified");
519 }
520 } else {
521 print "admin/modules.php Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
522 }
523 } catch (Exception $e) {
524 dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
525 }
526 }
527 }
528 }
529 closedir($handle);
530 } else {
531 dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
532 }
533}
534
535if ($action == 'reset_confirm' && $user->admin) {
536 if (!empty($modules[$value])) {
537 $objMod = $modules[$value];
538
539 if (!empty($objMod->langfiles)) {
540 $langs->loadLangs($objMod->langfiles);
541 }
542
543 $form = new Form($db);
544 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmUnactivation'), $langs->trans(GETPOST('confirm_message_code')), 'reset', '', 'no', 1);
545 }
546}
547
548if ($action == 'reload_confirm' && $user->admin) {
549 if (!empty($modules[$value])) {
550 $objMod = $modules[$value];
551
552 if (!empty($objMod->langfiles)) {
553 $langs->loadLangs($objMod->langfiles);
554 }
555
556 $form = new Form($db);
557 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmReload'), $langs->trans(GETPOST('confirm_message_code')), 'reload', '', 'no', 1);
558 }
559}
560
561print $formconfirm;
562
563asort($orders);
564//var_dump($orders);
565//var_dump($categ);
566//var_dump($modules);
567
568$nbofactivatedmodules = count($conf->modules);
569
570$nbmodulesnotautoenabled = count($conf->modules);
571if (in_array('fckeditor', $conf->modules)) {
572 $nbmodulesnotautoenabled--;
573}
574if (in_array('export', $conf->modules)) {
575 $nbmodulesnotautoenabled--;
576}
577if (in_array('import', $conf->modules)) {
578 $nbmodulesnotautoenabled--;
579}
580
581print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup');
582
583// Start to show page
584$deschelp = '';
585if ($mode == 'common' || $mode == 'commonkanban') {
586 $desc = $langs->trans("ModulesDesc", '{picto}');
587 $desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}');
588 $desc = str_replace('{picto}', img_picto('', 'switch_off', 'class="size15x"'), $desc);
589 $desc = str_replace('{picto2}', img_picto('', 'setup', 'class="size15x"'), $desc);
590 if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
591 $deschelp .= '<div class="info hideonsmartphone">'.$desc."<br></div>\n";
592 }
593 if (getDolGlobalString('MAIN_SETUP_MODULES_INFO')) { // Show a custom message
594 $deschelp .= '<div class="info">'.$langs->trans($conf->global->MAIN_SETUP_MODULES_INFO)."<br></div>\n";
595 }
596 if ($deschelp) {
597 $deschelp .= '<br>';
598 }
599}
600if ($mode == 'marketplace') {
601 //$deschelp = '<div class="info hideonsmartphone">'.$langs->trans("ModulesMarketPlaceDesc")."<br></div><br>\n";
602}
603if ($mode == 'deploy') {
604 $deschelp = '<div class="info hideonsmartphone">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."<br></div><br>\n";
605}
606if ($mode == 'develop') {
607 $deschelp = '<div class="info hideonsmartphone">'.$langs->trans("ModulesDevelopDesc")."<br></div><br>\n";
608}
609
610$head = modules_prepare_head($nbofactivatedmodules, count($modules), $nbmodulesnotautoenabled);
611
612
613if ($mode == 'common' || $mode == 'commonkanban') {
614 dol_set_focus('#search_keyword');
615
616 print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
617 print '<input type="hidden" name="token" value="'.newToken().'">';
618 if (isset($optioncss) && $optioncss != '') {
619 print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
620 }
621 if (isset($sortfield) && $sortfield != '') {
622 print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
623 }
624 if (isset($sortorder) && $sortorder != '') {
625 print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
626 }
627 if (isset($page) && $page != '') {
628 print '<input type="hidden" name="page" value="'.$page.'">';
629 }
630 print '<input type="hidden" name="mode" value="'.$mode.'">';
631
632 print dol_get_fiche_head($head, 'modules', '', -1);
633
634 print $deschelp;
635
636 $moreforfilter = '<div class="valignmiddle">';
637
638 $moreforfilter .= '<div class="floatright right pagination paddingtop --module-list"><ul><li>';
639 $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'));
640 $moreforfilter .= dolGetButtonTitleSeparator();
641 $moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
642 $moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
643 $moreforfilter .= '</li></ul></div>';
644
645 $moreforfilter .= '<div class="divfilteralone colorbacktimesheet float valignmiddle">';
646 $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
647 $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')).'">';
648 $moreforfilter .= '</div>';
649 $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
650 $moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth250', 1);
651 $moreforfilter .= '</div>';
652
653 if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
654 $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
655 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 0) {
656 $array_version['deprecated'] = $langs->trans("Deprecated");
657 }
658 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 0) {
659 $array_version['experimental'] = $langs->trans("Experimental");
660 }
661 if (getDolGlobalInt('MAIN_FEATURES_LEVEL') > 1) {
662 $array_version['development'] = $langs->trans("Development");
663 }
664 $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
665 $moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->transnoentitiesnoconv('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
666 $moreforfilter .= '</div>';
667 }
668 $array_status = array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled"));
669 $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
670 $moreforfilter .= $form->selectarray('search_status', $array_status, $search_status, $langs->transnoentitiesnoconv('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
671 $moreforfilter .= '</div>';
672 $moreforfilter .= ' ';
673 $moreforfilter .= '<div class="divsearchfield valignmiddle inline-block">';
674 $moreforfilter .= '<input type="submit" name="buttonsubmit" class="button small" value="'.dol_escape_htmltag($langs->trans("Refresh")).'">';
675 if ($search_keyword || ($search_nature && $search_nature != '-1') || ($search_version && $search_version != '-1') || ($search_status && $search_status != '-1')) {
676 $moreforfilter .= ' ';
677 $moreforfilter .= '<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
678 }
679 $moreforfilter .= '</div>';
680 $moreforfilter .= '</div>';
681
682 $moreforfilter .= '</div>';
683
684 if (!empty($moreforfilter)) {
685 print $moreforfilter;
686 $parameters = array();
687 $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
688 print $hookmanager->resPrint;
689 }
690
691 $moreforfilter = '';
692
693 print '<div class="clearboth"></div><br>';
694
695 $object = new stdClass();
696 $parameters = array();
697 $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
698 if ($reshook < 0) {
699 setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
700 }
701
702 $disabled_modules = array();
703 if (!empty($_SESSION["disablemodules"])) {
704 $disabled_modules = explode(',', $_SESSION["disablemodules"]);
705 }
706
707 // Show list of modules
708 $oldfamily = '';
709 $foundoneexternalmodulewithupdate = 0;
710 $linenum = 0;
711 $atleastonequalified = 0;
712 $atleastoneforfamily = 0;
713
714 foreach ($orders as $key => $value) {
715 $linenum++;
716 $tab = explode('_', $value);
717 $familykey = $tab[1];
718 $module_position = $tab[2];
719
720 $modName = $filename[$key];
721
723 $objMod = $modules[$modName];
724
725 //print $objMod->name." - ".$key." - ".$objMod->version."<br>";
726 if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') {
727 continue; // Discard if not for current tab
728 }
729
730 if (!$objMod->getName()) {
731 dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
732 continue;
733 }
734
735 $modulenameshort = strtolower(preg_replace('/^mod/i', '', get_class($objMod)));
736 $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
737
738 // Check filters
739 $modulename = $objMod->getName();
740 $moduletechnicalname = $objMod->name;
741 $moduledesc = $objMod->getDesc();
742 $moduledesclong = $objMod->getDescLong();
743 $moduleauthor = $objMod->getPublisher();
744
745 // We discard showing according to filters
746 if ($search_keyword) {
747 $qualified = 0;
748 if (preg_match('/'.preg_quote($search_keyword, '/').'/i', $modulename)
749 || preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduletechnicalname)
750 || ($moduledesc && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduledesc))
751 || ($moduledesclong && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduledesclong))
752 || ($moduleauthor && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduleauthor))
753 ) {
754 $qualified = 1;
755 }
756 if (!$qualified) {
757 continue;
758 }
759 }
760 if ($search_status) {
761 if ($search_status == 'active' && !getDolGlobalString($const_name)) {
762 continue;
763 }
764 if ($search_status == 'disabled' && getDolGlobalString($const_name)) {
765 continue;
766 }
767 }
768 if ($search_nature) {
769 if (preg_match('/^external/', $search_nature) && $objMod->isCoreOrExternalModule() != 'external') {
770 continue;
771 }
772 $reg = array();
773 if (preg_match('/^external_(.*)$/', $search_nature, $reg)) {
774 //print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher());
775 $publisher = dol_escape_htmltag($objMod->getPublisher());
776 if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) {
777 continue;
778 }
779 if (!$reg[1] && !empty($publisher)) {
780 continue;
781 }
782 }
783 if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') {
784 continue;
785 }
786 }
787 if ($search_version) {
788 if (($objMod->version == 'development' || $objMod->version == 'experimental' || preg_match('/deprecated/', $objMod->version)) && $search_version == 'stable') {
789 continue;
790 }
791 if ($objMod->version != 'development' && ($search_version == 'development')) {
792 continue;
793 }
794 if ($objMod->version != 'experimental' && ($search_version == 'experimental')) {
795 continue;
796 }
797 if (!preg_match('/deprecated/', $objMod->version) && ($search_version == 'deprecated')) {
798 continue;
799 }
800 }
801
802 $atleastonequalified++;
803
804 // Load all language files of the qualified module
805 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
806 foreach ($objMod->langfiles as $domain) {
807 $langs->load($domain);
808 }
809 }
810
811 // Print a separator if we change family
812 if ($familykey != $oldfamily) {
813 if ($oldfamily) {
814 print '</table></div><br>';
815 }
816
817 $familytext = empty($familyinfo[$familykey]['label']) ? $familykey : $familyinfo[$familykey]['label'];
818
819 print load_fiche_titre($familytext, '', '', 0, '', 'modulefamilygroup');
820
821 if ($mode == 'commonkanban') {
822 print '<div class="box-flex-container kanban">';
823 } else {
824 print '<div class="div-table-responsive">';
825 print '<table class="tagtable liste" summary="list_of_modules">'."\n";
826 }
827
828 $atleastoneforfamily = 0;
829 }
830
831 $atleastoneforfamily++;
832
833 if ($familykey != $oldfamily) {
834 $familytext = empty($familyinfo[$familykey]['label']) ? $familykey : $familyinfo[$familykey]['label'];
835 $oldfamily = $familykey;
836 }
837
838 // Version (with picto warning or not)
839 $version = $objMod->getVersion(0);
840 $versiontrans = '';
841 $warningstring = '';
842 if (preg_match('/development/i', $version)) {
843 $warningstring = $langs->trans("Development");
844 }
845 if (preg_match('/experimental/i', $version)) {
846 $warningstring = $langs->trans("Experimental");
847 }
848 if (preg_match('/deprecated/i', $version)) {
849 $warningstring = $langs->trans("Deprecated");
850 }
851
852 if ($objMod->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) {
853 $versiontrans .= $objMod->getVersion(1);
854 }
855
856 if ($objMod->isCoreOrExternalModule() == 'external'
857 && (
858 $action == 'checklastversion'
859 // 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.
860 // Adding a cron job could be a good idea: see DolibarrModules::checkForUpdate()
861 || getDolGlobalString('CHECKLASTVERSION_EXTERNALMODULE')
862 )
863 ) {
864 $checkRes = $objMod->checkForUpdate(); // Check for update version
865 if ($checkRes > 0) {
866 setEventMessage($objMod->getName().' : '.$versiontrans.' -> '.$objMod->lastVersion);
867 } elseif ($checkRes < 0) {
868 setEventMessage($objMod->getName().': '.$langs->trans('CheckVersionFail'), 'warnings');
869 }
870 }
871
872 if ($objMod->isCoreOrExternalModule() == 'external' && $action == 'checklastversion' && !getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES')) {
873 $checkRes = $objMod->checkForCompliance(); // Check if module is reported as non compliant with Dolibarr rules and law
874 if (!is_numeric($checkRes) && $checkRes != '') {
875 $langs->load("errors");
876 setEventMessages($objMod->getName().' : '.$langs->trans($checkRes), null, 'errors');
877 }
878 }
879
880 // Define imginfo
881 $imginfo = "info";
882 if ($objMod->isCoreOrExternalModule() == 'external') {
883 $imginfo = "info_black";
884 }
885
886 $codeenabledisable = '';
887 $codetoconfig = '';
888
889 // Force disable of module disabled into session (for demo for example)
890 if (in_array($modulenameshort, $disabled_modules)) {
891 $objMod->disabled = true;
892 }
893
894 // Activate/Disable and Setup (2 columns)
895 if (getDolGlobalString($const_name)) { // If module is already activated
896 // Set $codeenabledisable
897 $disableSetup = 0;
898 if (!empty($arrayofwarnings[$modName])) {
899 $codeenabledisable .= '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
900 }
901
902 if (!empty($objMod->disabled)) {
903 $codeenabledisable .= $langs->trans("Disabled");
904 } elseif (!empty($objMod->always_enabled) || ((isModEnabled('multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
905 if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
906 $codeenabledisable .= $langs->trans("Used");
907 } else {
908 $codeenabledisable .= img_picto($langs->trans("Required"), 'switch_on', '', false, 0, 0, '', 'opacitymedium valignmiddle');
909 //print $langs->trans("Required");
910 }
911 if (isModEnabled('multicompany') && $user->entity) {
912 $disableSetup++;
913 }
914 } else {
915 if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
916 $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.'">';
917 $codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on');
918 $codeenabledisable .= '</a>';
919 if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) {
920 $codeenabledisable .= '&nbsp;';
921 $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.'">';
922 $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"');
923 $codeenabledisable .= '</a>';
924 }
925 } else {
926 $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.'">';
927 $codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on');
928 $codeenabledisable .= '</a>';
929 if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) {
930 $codeenabledisable .= '&nbsp;';
931 $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.'">';
932 $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"');
933 $codeenabledisable .= '</a>';
934 }
935 }
936 }
937
938 // Set $codetoconfig
939 if (!empty($objMod->config_page_url) && !$disableSetup) {
940 $backtourlparam = '';
941 if ($search_keyword != '') {
942 $backtourlparam .= ($backtourlparam ? '&' : '?').'search_keyword='.urlencode($search_keyword); // No urlencode here, done later
943 }
944 if ($search_nature > -1) {
945 $backtourlparam .= ($backtourlparam ? '&' : '?').'search_nature='.urlencode($search_nature); // No urlencode here, done later
946 }
947 if ($search_version > -1) {
948 $backtourlparam .= ($backtourlparam ? '&' : '?').'search_version='.urlencode($search_version); // No urlencode here, done later
949 }
950 if ($search_status > -1) {
951 $backtourlparam .= ($backtourlparam ? '&' : '?').'search_status='.urlencode($search_status); // No urlencode here, done later
952 }
953 $backtourl = $_SERVER["PHP_SELF"].$backtourlparam;
954
955 $regs = array();
956 if (is_array($objMod->config_page_url)) {
957 $i = 0;
958 foreach ($objMod->config_page_url as $page) {
959 $urlpage = $page;
960 if ($i++) {
961 $codetoconfig .= '<a href="'.$urlpage.'" title="'.$langs->trans($page).'">'.img_picto(ucfirst($page), "setup").'</a>';
962 // print '<a href="'.$page.'">'.ucfirst($page).'</a>&nbsp;';
963 } else {
964 if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
965 $urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1);
966 $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>';
967 } else {
968 $urltouse = $urlpage;
969 $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>';
970 }
971 }
972 }
973 } elseif (preg_match('/^([^@]+)@([^@]+)$/i', (string) $objMod->config_page_url, $regs)) {
974 $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>';
975 } else {
976 $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>';
977 }
978 } else {
979 $codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"', false, 0, 0, '', 'fa-15');
980 }
981 } else { // Module not yet activated
982 // Set $codeenabledisable
983 if (!empty($objMod->always_enabled)) {
984 // A 'always_enabled' module should not never be disabled. If this happen, we keep a link to reenable it.
985 $codeenabledisable .= '<!-- Message to show: an always_enabled module has been disabled -->'."\n";
986 $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.'"';
987 $codeenabledisable .= '>';
988 $codeenabledisable .= img_picto($langs->trans("Disabled"), 'switch_off');
989 $codeenabledisable .= "</a>\n";
990 } elseif (!empty($objMod->disabled)) {
991 $codeenabledisable .= $langs->trans("Disabled");
992 } else {
993 // Module qualified for activation
994 $warningmessage = '';
995 if (!empty($arrayofwarnings[$modName])) {
996 $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";
997 foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
998 if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) {
999 $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
1000 }
1001 }
1002 }
1003 if ($objMod->isCoreOrExternalModule() == 'external' && !empty($arrayofwarningsext)) {
1004 $codeenabledisable .= '<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.') -->'."\n";
1005 foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
1006 $keymodulelowercase = strtolower(preg_replace('/^mod/', '', $keymodule));
1007 if (in_array($keymodulelowercase, $conf->modules)) { // If module that request warning is on
1008 foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
1009 if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) {
1010 $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
1011 $warningmessage .= ($warningmessage ? "\n" : "").($warningmessage ? "\n" : "").$langs->trans("Module").' : '.$objMod->getName();
1012 if (!empty($objMod->editor_name)) {
1013 $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("Publisher").' : '.$objMod->editor_name;
1014 }
1015 if (!empty($objMod->editor_name)) {
1016 $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("ModuleTriggeringThisWarning").' : '.$modules[$keymodule]->getName();
1017 }
1018 }
1019 }
1020 }
1021 }
1022 }
1023 $codeenabledisable .= '<!-- Message to show: '.$warningmessage.' -->'."\n";
1024 $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.'"';
1025 if ($warningmessage) {
1026 $codeenabledisable .= ' onclick="return confirm(\''.dol_escape_js($warningmessage).'\');"';
1027 }
1028 $codeenabledisable .= '>';
1029 $codeenabledisable .= img_picto($langs->trans("Disabled"), 'switch_off');
1030 $codeenabledisable .= "</a>\n";
1031 }
1032
1033 // Set $codetoconfig
1034 $codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"');
1035 }
1036
1037 if ($mode == 'commonkanban') {
1038 // Output Kanban
1039 print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
1040 } else {
1041 print '<tr class="oddeven'.($warningstring ? ' info-box-content-warning' : '').'">'."\n";
1042 if (getDolGlobalString('MAIN_MODULES_SHOW_LINENUMBERS')) {
1043 print '<td class="width50">'.$linenum.'</td>';
1044 }
1045
1046 // Picto + Name of module
1047 print ' <td class="tdoverflowmax200 minwidth200imp" title="'.dol_escape_htmltag($objMod->getName()).'">';
1048 $alttext = '';
1049 //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
1050 //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
1051 if (!empty($objMod->picto)) {
1052 if (preg_match('/^\//i', $objMod->picto)) {
1053 print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"', 1);
1054 } else {
1055 print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"');
1056 }
1057 } else {
1058 print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly"');
1059 }
1060 print ' <span class="valignmiddle">'.$objMod->getName().'</span>';
1061 print "</td>\n";
1062
1063 // Desc
1064 print '<td class="valignmiddle tdoverflowmax300 minwidth200imp">';
1065 print nl2br($objMod->getDesc());
1066 print "</td>\n";
1067
1068 // Help
1069 print '<td class="center nowrap" style="width: 82px;">';
1070 //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
1071 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>';
1072 print '</td>';
1073
1074 // Version
1075 print '<td class="center nowrap width150" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
1076 if ($objMod->needUpdate) {
1077 $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
1078 print '<span class="badge badge-warning classfortooltip" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
1079 } else {
1080 print $versiontrans;
1081 }
1082 print "</td>\n";
1083
1084 // Link enable/disable
1085 print '<td class="center valignmiddle left nowraponall" width="60px">';
1086 print $codeenabledisable;
1087 print "</td>\n";
1088
1089 // Link config
1090 print '<td class="tdsetuppicto right valignmiddle" width="60px">';
1091 print $codetoconfig;
1092 print '</td>';
1093
1094 print "</tr>\n";
1095 }
1096 if ($objMod->needUpdate) {
1097 $foundoneexternalmodulewithupdate++;
1098 }
1099 }
1100
1101 if ($action == 'checklastversion') {
1102 if ($foundoneexternalmodulewithupdate) {
1103 setEventMessages($langs->trans("ModuleUpdateAvailable"), null, 'mesgs');
1104 } else {
1105 setEventMessages($langs->trans("NoExternalModuleWithUpdate"), null, 'mesgs');
1106 }
1107 }
1108
1109 if ($oldfamily) {
1110 if ($mode == 'commonkanban') {
1111 print '</div>';
1112 } else {
1113 print "</table>\n";
1114 print '</div>';
1115 }
1116 }
1117
1118 if (!$atleastonequalified) {
1119 print '<br><span class="opacitymedium">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria").'</span><br><br>';
1120 }
1121
1122 print dol_get_fiche_end();
1123
1124 print '<br>';
1125
1126 // Show warning about external users
1127 print info_admin(showModulesExludedForExternal($modules))."\n";
1128
1129 print '</form>';
1130}
1131
1132if ($mode == 'marketplace') {
1133 print dol_get_fiche_head($head, $mode, '', -1);
1134
1135 print $deschelp;
1136
1137 print '<br>';
1138
1139 // Marketplace
1140 print '<div class="div-table-responsive-no-min">';
1141 print '<table summary="list_of_modules" class="noborder centpercent">'."\n";
1142 print '<tr class="liste_titre">'."\n";
1143 print '<td class="hideonsmartphone">'.$form->textwithpicto($langs->trans("Provider"), $langs->trans("WebSiteDesc")).'</td>';
1144 print '<td></td>';
1145 print '<td>'.$langs->trans("URL").'</td>';
1146 print '</tr>';
1147
1148 print '<tr class="oddeven">'."\n";
1149 $url = 'https://www.dolistore.com';
1150 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>';
1151 print '<td><span class="opacitymedium">'.$langs->trans("DoliStoreDesc").'</span></td>';
1152 print '<td><a href="'.$url.'" target="_blank" rel="noopener noreferrer external">'.$url.'</a></td>';
1153 print '</tr>';
1154
1155 print "</table>\n";
1156 print '</div>';
1157
1158 print dol_get_fiche_end();
1159
1160 print '<br>';
1161
1162 if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) {
1163 // $options is array with filter criterias
1164 //var_dump($options);
1165 $dolistore->getRemoteCategories();
1166 $dolistore->getRemoteProducts($options);
1167
1168 print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
1169
1170 $previouslink = $dolistore->get_previous_link();
1171 $nextlink = $dolistore->get_next_link();
1172
1173 print '<div class="liste_titre liste_titre_bydiv centpercent"><div class="divsearchfield">';
1174
1175 print '<form method="POST" class="centpercent" id="searchFormList" action="'.$dolistore->url.'">'; ?>
1176 <input type="hidden" name="token" value="<?php echo newToken(); ?>">
1177 <input type="hidden" name="mode" value="marketplace">
1178 <div class="divsearchfield">
1179 <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>
1180 </div>
1181 <div class="divsearchfield">
1182 <input class="button buttongen" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
1183 <a class="buttonreset" href="<?php echo urlencode($dolistore->url) ?>"><?php echo $langs->trans('Reset') ?></a>
1184
1185 &nbsp;
1186 </div>
1187 <?php
1188 print $previouslink;
1189 print $nextlink;
1190 print '</form>';
1191
1192
1193 print '</div></div>';
1194 print '<div class="clearboth"></div>'; ?>
1195
1196 <div id="category-tree-left">
1197 <ul class="tree">
1198 <?php
1199 echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content?>
1200 </ul>
1201 </div>
1202 <div id="listing-content">
1203 <table summary="list_of_modules" id="list_of_modules" class="productlist centpercent">
1204 <tbody id="listOfModules">
1205 <?php echo $dolistore->get_products(); ?>
1206 </tbody>
1207 </table>
1208 </div>
1209 <?php
1210 }
1211}
1212
1213
1214// Install external module
1215
1216if ($mode == 'deploy') {
1217 print dol_get_fiche_head($head, $mode, '', -1);
1218
1219 $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank" rel="noopener noreferrer">'.$urldolibarrmodules.'</a>';
1220 $message = '';
1221 if ($allowonlineinstall) {
1222 if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
1223 $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
1224 $allowfromweb = -1;
1225 } else {
1226 if ($dirins_ok) {
1227 if (!is_writable(dol_osencode($dirins))) {
1228 $langs->load("errors");
1229 $message = info_admin($langs->trans("ErrorFailedToWriteInDir", $dirins), 0, 0, '1', 'warning');
1230 $allowfromweb = 0;
1231 }
1232 } else {
1233 $message = info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
1234 $allowfromweb = 0;
1235 }
1236 }
1237 } else {
1238 if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
1239 // Show clean message
1240 if (!is_numeric(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))) {
1241 $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')));
1242 } else {
1243 $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));
1244 }
1245 } else {
1246 // Show technical message
1247 $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock'));
1248 }
1249 $allowfromweb = 0;
1250 }
1251
1252 print $deschelp;
1253
1254 if ($allowfromweb < 1) {
1255 print $langs->trans("SomethingMakeInstallFromWebNotPossible");
1256 print $message;
1257 //print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
1258 print '<br>';
1259 }
1260
1261 print '<br>';
1262
1263 // $allowfromweb = -1 if installation or setup not correct, 0 if not allowed, 1 if allowed
1264 if ($allowfromweb >= 0) {
1265 if ($allowfromweb == 1) {
1266 //print $langs->trans("ThisIsProcessToFollow").'<br>';
1267 } else {
1268 print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
1269 print '<b>'.$langs->trans("StepNb", 1).'</b>: ';
1270 print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite", '{s1}')).'<br>';
1271 print '<b>'.$langs->trans("StepNb", 2).'</b>: ';
1272 print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite", '{s1}')).'<br>';
1273 print '<b>'.$langs->trans("StepNb", 3).'</b>: ';
1274 }
1275
1276 if ($allowfromweb == 1) {
1277 print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
1278 print '<input type="hidden" name="token" value="'.newToken().'">';
1279 print '<input type="hidden" name="action" value="install">';
1280 print '<input type="hidden" name="mode" value="deploy">';
1281
1282 print $langs->trans("YouCanSubmitFile").'<br><br>';
1283
1284 $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
1285 $maxphp = @ini_get('upload_max_filesize'); // In unknown
1286 if (preg_match('/k$/i', $maxphp)) {
1287 $maxphp = preg_replace('/k$/i', '', $maxphp);
1288 $maxphp = $maxphp * 1;
1289 }
1290 if (preg_match('/m$/i', $maxphp)) {
1291 $maxphp = preg_replace('/m$/i', '', $maxphp);
1292 $maxphp = $maxphp * 1024;
1293 }
1294 if (preg_match('/g$/i', $maxphp)) {
1295 $maxphp = preg_replace('/g$/i', '', $maxphp);
1296 $maxphp = $maxphp * 1024 * 1024;
1297 }
1298 if (preg_match('/t$/i', $maxphp)) {
1299 $maxphp = preg_replace('/t$/i', '', $maxphp);
1300 $maxphp = $maxphp * 1024 * 1024 * 1024;
1301 }
1302 $maxphp2 = @ini_get('post_max_size'); // In unknown
1303 if (preg_match('/k$/i', $maxphp2)) {
1304 $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
1305 $maxphp2 = $maxphp2 * 1;
1306 }
1307 if (preg_match('/m$/i', $maxphp2)) {
1308 $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
1309 $maxphp2 = $maxphp2 * 1024;
1310 }
1311 if (preg_match('/g$/i', $maxphp2)) {
1312 $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
1313 $maxphp2 = $maxphp2 * 1024 * 1024;
1314 }
1315 if (preg_match('/t$/i', $maxphp2)) {
1316 $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
1317 $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
1318 }
1319 // Now $max and $maxphp and $maxphp2 are in Kb
1320 $maxmin = $max;
1321 $maxphptoshow = $maxphptoshowparam = '';
1322 if ($maxphp > 0) {
1323 $maxmin = min($max, $maxphp);
1324 $maxphptoshow = $maxphp;
1325 $maxphptoshowparam = 'upload_max_filesize';
1326 }
1327 if ($maxphp2 > 0) {
1328 $maxmin = min($max, $maxphp2);
1329 if ($maxphp2 < $maxphp) {
1330 $maxphptoshow = $maxphp2;
1331 $maxphptoshowparam = 'post_max_size';
1332 }
1333 }
1334
1335 if ($maxmin > 0) {
1336 print '<script type="text/javascript">
1337 $(document).ready(function() {
1338 jQuery("#fileinstall").on("change", function() {
1339 if(this.files[0].size > '.($maxmin * 1024).') {
1340 alert("'.dol_escape_js($langs->transnoentitiesnoconv("ErrorFileSizeTooLarge")).'");
1341 this.value = "";
1342 }
1343 });
1344 });
1345 </script>'."\n";
1346 // MAX_FILE_SIZE doit précéder le champ input de type file
1347 print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';
1348 }
1349
1350 print '<input class="flat minwidth400" type="file" name="fileinstall" id="fileinstall"> ';
1351
1352 print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button">';
1353
1354 if (getDolGlobalString('MAIN_UPLOAD_DOC')) {
1355 if ($user->admin) {
1356 $langs->load('other');
1357 print ' ';
1358 print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow, $maxphptoshowparam), 1);
1359 }
1360 } else {
1361 print ' ('.$langs->trans("UploadDisabled").')';
1362 }
1363
1364 print '</form>';
1365
1366 print '<br>';
1367 print '<br>';
1368
1369 print '<div class="center"><div class="logo_setup"></div></div>';
1370 } else {
1371 print $langs->trans("UnpackPackageInModulesRoot", $dirins).'<br>';
1372 print '<b>'.$langs->trans("StepNb", 4).'</b>: ';
1373 print $langs->trans("SetupIsReadyForUse").'<br>';
1374 }
1375 }
1376
1377 if (!empty($result['return'])) {
1378 print '<br>';
1379
1380 foreach ($result['return'] as $value) {
1381 echo $value.'<br>';
1382 }
1383 }
1384
1385 print dol_get_fiche_end();
1386}
1387
1388if ($mode == 'develop') {
1389 print dol_get_fiche_head($head, $mode, '', -1);
1390
1391 print $deschelp;
1392
1393 print '<br>';
1394
1395 // Marketplace
1396 print '<table summary="list_of_modules" class="noborder centpercent">'."\n";
1397 print '<tr class="liste_titre">'."\n";
1398 //print '<td>'.$langs->trans("Logo").'</td>';
1399 print '<td colspan="2">'.$langs->trans("DevelopYourModuleDesc").'</td>';
1400 print '<td>'.$langs->trans("URL").'</td>';
1401 print '</tr>';
1402
1403 print '<tr class="oddeven" height="80">'."\n";
1404 print '<td class="center">';
1405 print '<div class="imgmaxheight50 logo_setup"></div>';
1406 print '</td>';
1407 print '<td>'.$langs->trans("TryToUseTheModuleBuilder", $langs->transnoentitiesnoconv("ModuleBuilder")).'</td>';
1408 print '<td class="maxwidth300">';
1409 if (isModEnabled('modulebuilder')) {
1410 print $langs->trans("SeeTopRightMenu");
1411 } else {
1412 print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("ModuleBuilder")).'</span>';
1413 }
1414 print '</td>';
1415 print '</tr>';
1416
1417 print '<tr class="oddeven" height="80">'."\n";
1418 $url = 'https://partners.dolibarr.org';
1419 print '<td class="center">';
1420 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>';
1421 print '</td>';
1422 print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
1423 print '<td><a href="'.$url.'" target="_blank" rel="noopener noreferrer external">';
1424 print img_picto('', 'url', 'class="pictofixedwidth"');
1425 print $url.'</a></td>';
1426 print '</tr>';
1427
1428 print "</table>\n";
1429
1430 print dol_get_fiche_end();
1431}
1432
1433// End of page
1434llxFooter();
1435$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.