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