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