33if (!defined(
'CSRFCHECK_WITH_TOKEN') && (empty($_GET[
'action']) || $_GET[
'action'] !=
'reset')) {
34 define(
'CSRFCHECK_WITH_TOKEN',
'1');
38require
'../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/admin/dolistore/class/dolistore.class.php';
46$langs->loadLangs(array(
"errors",
"admin",
"modulebuilder"));
49if (GETPOSTISSET(
'mode')) {
50 $mode =
GETPOST(
'mode',
'alpha');
51 if ($mode ==
'common' || $mode ==
'commonkanban') {
52 dolibarr_set_const($db,
"MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT", $mode,
'chaine', 0,
'', $conf->entity);
55 $mode = (!
getDolGlobalString(
'MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT') ?
'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT);
58$action =
GETPOST(
'action',
'aZ09');
59$value =
GETPOST(
'value',
'alpha');
61$search_keyword =
GETPOST(
'search_keyword',
'alpha');
62$search_status =
GETPOST(
'search_status',
'alpha');
63$search_nature =
GETPOST(
'search_nature',
'alpha');
64$search_version =
GETPOST(
'search_version',
'alpha');
69$options[
'per_page'] = 20;
73$options[
'search'] =
GETPOST(
'search_keyword',
'alpha');
82 'hr' => array(
'position' =>
'001',
'label' => $langs->trans(
"ModuleFamilyHr")),
83 'crm' => array(
'position' =>
'006',
'label' => $langs->trans(
"ModuleFamilyCrm")),
84 'srm' => array(
'position' =>
'007',
'label' => $langs->trans(
"ModuleFamilySrm")),
85 'financial' => array(
'position' =>
'009',
'label' => $langs->trans(
"ModuleFamilyFinancial")),
86 'products' => array(
'position' =>
'012',
'label' => $langs->trans(
"ModuleFamilyProducts")),
87 'projects' => array(
'position' =>
'015',
'label' => $langs->trans(
"ModuleFamilyProjects")),
88 'ecm' => array(
'position' =>
'018',
'label' => $langs->trans(
"ModuleFamilyECM")),
89 'technic' => array(
'position' =>
'021',
'label' => $langs->trans(
"ModuleFamilyTechnic")),
90 'portal' => array(
'position' =>
'040',
'label' => $langs->trans(
"ModuleFamilyPortal")),
91 'interface' => array(
'position' =>
'050',
'label' => $langs->trans(
"ModuleFamilyInterface")),
92 'base' => array(
'position' =>
'060',
'label' => $langs->trans(
"ModuleFamilyBase")),
93 'other' => array(
'position' =>
'100',
'label' => $langs->trans(
"ModuleFamilyOther")),
97if (!
GETPOST(
'buttonreset',
'alpha')) {
98 if ($search_keyword) {
99 $param .=
'&search_keyword='.urlencode($search_keyword);
101 if ($search_status && $search_status !=
'-1') {
102 $param .=
'&search_status='.urlencode($search_status);
104 if ($search_nature && $search_nature !=
'-1') {
105 $param .=
'&search_nature='.urlencode($search_nature);
107 if ($search_version && $search_version !=
'-1') {
108 $param .=
'&search_version='.urlencode($search_version);
112$dirins = DOL_DOCUMENT_ROOT.
'/custom';
113$urldolibarrmodules =
'https://www.dolistore.com/';
116$hookmanager->initHooks(array(
'adminmodules',
'globaladmin'));
119$max_execution_time_for_deploy =
getDolGlobalInt(
'MODULE_UPLOAD_MAX_EXECUTION_TIME', 300);
120if (!empty($max_execution_time_for_deploy)) {
121 $err = error_reporting();
124 @set_time_limit($max_execution_time_for_deploy);
125 error_reporting($err);
128$max_time = @ini_get(
"max_execution_time");
129if ($max_time && $max_time < $max_execution_time_for_deploy) {
130 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.");
131 @ini_set(
"max_execution_time", $max_execution_time_for_deploy);
135$dolibarrdataroot = preg_replace(
'/([\\/]+)$/i',
'', DOL_DATA_ROOT);
136$allowonlineinstall =
true;
138if (
dol_is_file($dolibarrdataroot.
'/installmodules.lock')) {
139 $allowonlineinstall =
false;
149$parameters = array();
150$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
155if (
GETPOST(
'buttonreset',
'alpha')) {
156 $search_keyword =
'';
159 $search_version =
'';
162if ($action ==
'install' && $allowonlineinstall) {
166 $original_file = basename($_FILES[
"fileinstall"][
"name"]);
167 $original_file = preg_replace(
'/\s*\(\d+\)\.zip$/i',
'.zip', $original_file);
168 $newfile = $conf->admin->dir_temp.
'/'.$original_file.
'/'.$original_file;
170 if (!$original_file) {
171 $langs->load(
"Error");
172 setEventMessages($langs->trans(
"ErrorModuleFileRequired"),
null,
'warnings');
175 if (!$error && !preg_match(
'/\.zip$/i', $original_file)) {
176 $langs->load(
"errors");
177 setEventMessages($langs->trans(
"ErrorFileMustBeADolibarrPackage", $original_file),
null,
'errors');
180 if (!$error && !preg_match(
'/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file)) {
181 $langs->load(
"errors");
182 setEventMessages($langs->trans(
"ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file,
'module_*-x.y*.zip'),
null,
'errors');
185 if (empty($_FILES[
'fileinstall'][
'tmp_name'])) {
186 $langs->load(
"errors");
193 if ($original_file) {
195 dol_mkdir($conf->admin->dir_temp.
'/'.$original_file);
198 $tmpdir = preg_replace(
'/\.zip$/i',
'', $original_file).
'.dir';
201 dol_mkdir($conf->admin->dir_temp.
'/'.$tmpdir);
204 $result =
dol_move_uploaded_file($_FILES[
'fileinstall'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'fileinstall'][
'error']);
206 $result =
dol_uncompress($newfile, $conf->admin->dir_temp.
'/'.$tmpdir);
208 if (!empty($result[
'error'])) {
209 $langs->load(
"errors");
210 setEventMessages($langs->trans($result[
'error'], $original_file),
null,
'errors');
214 $modulename = preg_replace(
'/module_/',
'', $original_file);
215 $modulename = preg_replace(
'/\-([0-9][0-9\.]*)\.zip$/i',
'', $modulename);
217 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulename;
220 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulename;
223 setEventMessages($langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat").
'<br>'.$langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename,
'htdocs/'.$modulename),
null,
'errors');
232 dol_syslog(
"Uncompress of module file is a success.");
235 $modulenamearrays = array();
236 if (
dol_is_file($modulenamedir.
'/metapackage.conf')) {
238 $metafile = file_get_contents($modulenamedir.
'/metapackage.conf');
239 $modulenamearrays = explode(
"\n", $metafile);
241 $modulenamearrays[$modulename] = $modulename;
245 foreach ($modulenamearrays as $modulenameval) {
246 if (strpos($modulenameval,
'#') === 0) {
249 if (strpos($modulenameval,
'//') === 0) {
252 if (!trim($modulenameval)) {
259 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulenameval;
261 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulenameval;
263 dol_syslog(
"We copy now directory ".$submodulenamedir.
" into target dir ".$dirins.
'/'.$modulenameval);
264 $result =
dolCopyDir($submodulenamedir, $dirins.
'/'.$modulenameval,
'0444', 1);
266 dol_syslog(
'Failed to call dolCopyDir result='.$result.
" with param ".$submodulenamedir.
" and ".$dirins.
'/'.$modulenameval, LOG_WARNING);
267 $langs->load(
"errors");
268 setEventMessages($langs->trans(
"ErrorFailToCopyDir", $submodulenamedir, $dirins.
'/'.$modulenameval),
null,
'errors');
275 setEventMessages($langs->trans(
"ErrorFailToRenameFile", $_FILES[
'fileinstall'][
'tmp_name'], $newfile),
null,
'errors');
281 $message = $langs->trans(
"SetupIsReadyForUse", DOL_URL_ROOT.
'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv(
"Home").
' - '.$langs->transnoentitiesnoconv(
"Setup").
' - '.$langs->transnoentitiesnoconv(
"Modules"));
284} elseif ($action ==
'install' && !$allowonlineinstall) {
285 httponly_accessforbidden(
"You try to bypass the protection to disallow deployment of an external module. Hack attempt ?");
288if ($action ==
'set' && $user->admin) {
292 if ($checkOldValue !=
getDolGlobalInt(
'CHECKLASTVERSION_EXTERNALMODULE')) {
293 setEventMessage($langs->trans(
'WarningModuleHasChangedLastVersionCheckParameter', $value),
'warnings');
295 if ($csrfCheckOldValue !=
getDolGlobalInt(
'MAIN_SECURITY_CSRF_WITH_TOKEN')) {
296 setEventMessage($langs->trans(
'WarningModuleHasChangedSecurityCsrfParameter', $value),
'warnings');
299 if (!empty($resarray[
'errors'])) {
303 if ($resarray[
'nbperms'] > 0) {
304 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
305 $resqltmp = $db->query($tmpsql);
307 $obj = $db->fetch_object($resqltmp);
309 if ($obj && $obj->nb > 1) {
310 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
318 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
320} elseif ($action ==
'reset' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
326 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
328} elseif (
getDolGlobalInt(
"MAIN_FEATURES_LEVEL") > 1 && $action ==
'reload' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
330 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
333 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
336 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
337 if (!empty($resarray[
'errors'])) {
340 if ($resarray[
'nbperms'] > 0) {
341 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
342 $resqltmp = $db->query($tmpsql);
344 $obj = $db->fetch_object($resqltmp);
345 if ($obj && $obj->nb > 1) {
346 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
354 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
365$form =
new Form($db);
368$morecss = array(
"/admin/dolistore/css/dolistore.css");
376$help_url =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
377llxHeader(
'', $langs->trans(
"Setup"), $help_url,
'',
'',
'', $morejs, $morecss, 0,
'mod-admin page-modules');
383$arrayofnatures = array(
384 'core' => array(
'label' => $langs->transnoentitiesnoconv(
"NativeModules")),
385 'external' => array(
'label' => $langs->transnoentitiesnoconv(
"External").
' - ['.$langs->trans(
"AllPublishers").
']')
387$arrayofwarnings = array();
388$arrayofwarningsext = array();
393$publisherlogoarray = array();
397$modNameLoaded = array();
399foreach ($modulesdir as $dir) {
402 dol_syslog(
"Scan directory ".$dir.
" for module descriptor files (modXXX.class.php)");
403 $handle = @opendir($dir);
404 if (is_resource($handle)) {
405 while (($file = readdir($handle)) !==
false) {
407 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
408 $modName = substr($file, 0,
dol_strlen($file) - 10);
411 if (!empty($modNameLoaded[$modName])) {
412 $mesg =
"Error: Module ".$modName.
" was found twice: Into ".$modNameLoaded[$modName].
" and ".$dir.
". You probably have an old file on your disk.<br>";
419 $res = include_once $dir.$file;
420 if (class_exists($modName)) {
421 $objMod =
new $modName($db);
422 '@phan-var-force DolibarrModules $objMod';
423 $modNameLoaded[$modName] = $dir;
424 if (!$objMod->numero > 0 && $modName !=
'modUser') {
425 dol_syslog(
'The module descriptor '.$modName.
' must have a numero property', LOG_ERR);
427 $j = $objMod->numero;
429 $modulequalified = 1;
432 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
434 $modulequalified = 0;
437 $modulequalified = 0;
440 $modulequalified = 0;
444 if (!empty($objMod->hidden)) {
445 $modulequalified = 0;
448 if ($modulequalified > 0) {
450 $external = ($objMod->isCoreOrExternalModule() ==
'external');
460 $arrayofnatures[
'external_'.$publisher] = array(
'label' => $langs->trans(
"External").
' - '.$publisher,
'data-html' => $langs->trans(
"External").
' - <span class="opacitymedium inine-block valignmiddle">'.$publisher.
'</span>');
462 $arrayofnatures[
'external_'] = array(
'label' => $langs->trans(
"External").
' - ['.$langs->trans(
"UnknownPublishers").
']');
465 ksort($arrayofnatures);
468 $filename[$i] = $modName;
469 $modules[$modName] = $objMod;
472 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
473 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
474 $familykey = key($objMod->familyinfo);
476 $familykey = $objMod->family;
478 '@phan-var-force string $familykey';
480 $moduleposition = ($objMod->module_position ? $objMod->module_position :
'50');
481 if ($objMod->isCoreOrExternalModule() ==
'external' && $moduleposition < 100000) {
483 $moduleposition =
'80';
487 if (!empty($objMod->warnings_activation)) {
488 $arrayofwarnings[$modName] = $objMod->warnings_activation;
490 if (!empty($objMod->warnings_activation_ext)) {
491 $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
494 $familyposition = (empty($familyinfo[$familykey][
'position']) ?
'0' : $familyinfo[$familykey][
'position']);
495 $listOfOfficialModuleGroups = array(
'hr',
'technic',
'interface',
'technic',
'portal',
'financial',
'crm',
'base',
'products',
'srm',
'ecm',
'projects',
'other');
496 if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
498 if (is_numeric($familyposition)) {
499 $familyposition = sprintf(
"%03d", (
int) $familyposition + 100);
503 $orders[$i] = $familyposition.
"_".$familykey.
"_".$moduleposition.
"_".$j;
506 $specialstring =
'unknown';
507 if ($objMod->version ==
'development' || $objMod->version ==
'experimental') {
508 $specialstring =
'expdev';
510 if (isset($categ[$specialstring])) {
511 $categ[$specialstring]++;
513 $categ[$specialstring] = 1;
518 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
521 print
info_admin(
"admin/modules.php Warning bad descriptor file : ".$dir.$file.
" (Class ".$modName.
" not found into file)", 0, 0,
'1',
'warning');
524 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
531 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
535if ($action ==
'reset_confirm' && $user->admin) {
536 if (!empty($modules[$value])) {
537 $objMod = $modules[$value];
539 if (!empty($objMod->langfiles)) {
540 $langs->loadLangs($objMod->langfiles);
543 $form =
new Form($db);
544 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmUnactivation'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reset',
'',
'no', 1);
548if ($action ==
'reload_confirm' && $user->admin) {
549 if (!empty($modules[$value])) {
550 $objMod = $modules[$value];
552 if (!empty($objMod->langfiles)) {
553 $langs->loadLangs($objMod->langfiles);
556 $form =
new Form($db);
557 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmReload'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reload',
'',
'no', 1);
568$nbofactivatedmodules = count($conf->modules);
571$nbmodulesnotautoenabled = count($conf->modules);
572$listofmodulesautoenabled = array(
'agenda',
'fckeditor',
'export',
'import');
573foreach ($listofmodulesautoenabled as $moduleautoenable) {
574 if (in_array($moduleautoenable, $conf->modules)) {
575 $nbmodulesnotautoenabled--;
583if ($mode ==
'common' || $mode ==
'commonkanban') {
584 $desc = $langs->trans(
"ModulesDesc",
'{picto}');
585 $desc .=
' '.$langs->trans(
"ModulesDesc2",
'{picto2}');
586 $desc = str_replace(
'{picto}',
img_picto(
'',
'switch_off',
'class="size15x"'), $desc);
587 $desc = str_replace(
'{picto2}',
img_picto(
'',
'setup',
'class="size15x"'), $desc);
588 if ($nbmodulesnotautoenabled <=
getDolGlobalInt(
'MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) {
589 $deschelp .=
'<div class="info hideonsmartphone">'.$desc.
"<br></div>\n";
592 $deschelp .=
'<div class="info">'.$langs->trans(
getDolGlobalString(
'MAIN_SETUP_MODULES_INFO')).
"<br></div>\n";
598if ($mode ==
'marketplace') {
601if ($mode ==
'deploy') {
602 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDeployDesc", $langs->transnoentitiesnoconv(
"AvailableModules")).
"<br></div><br>\n";
604if ($mode ==
'develop') {
605 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDevelopDesc").
"<br></div><br>\n";
611if ($mode ==
'common' || $mode ==
'commonkanban') {
614 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
615 print
'<input type="hidden" name="token" value="'.newToken().
'">';
616 if (isset($optioncss) && $optioncss !=
'') {
617 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
619 if (isset($sortfield) && $sortfield !=
'') {
620 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
622 if (isset($sortorder) && $sortorder !=
'') {
623 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
625 if (isset($page) && $page !=
'') {
626 print
'<input type="hidden" name="page" value="'.$page.
'">';
628 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
634 $moreforfilter =
'<div class="valignmiddle">';
636 $moreforfilter .=
'<div class="floatright right pagination paddingtop --module-list"><ul><li>';
637 $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'));
639 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.$param,
'', ($mode ==
'common' ? 2 : 1), array(
'morecss' =>
'reposition'));
640 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=commonkanban'.$param,
'', ($mode ==
'commonkanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
641 $moreforfilter .=
'</li></ul></div>';
643 $moreforfilter .=
'<div class="divfilteralone colorbacktimesheet float valignmiddle">';
644 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
645 $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')).
'">';
646 $moreforfilter .=
'</div>';
647 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
648 $moreforfilter .= $form->selectarray(
'search_nature', $arrayofnatures,
dol_escape_htmltag($search_nature), $langs->trans(
'Origin'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth250', 1);
649 $moreforfilter .=
'</div>';
652 $array_version = array(
'stable' => $langs->transnoentitiesnoconv(
"Stable"));
654 $array_version[
'deprecated'] = $langs->trans(
"Deprecated");
657 $array_version[
'experimental'] = $langs->trans(
"Experimental");
660 $array_version[
'development'] = $langs->trans(
"Development");
662 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
663 $moreforfilter .= $form->selectarray(
'search_version', $array_version, $search_version, $langs->transnoentitiesnoconv(
'Version'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
664 $moreforfilter .=
'</div>';
666 $array_status = array(
'active' => $langs->transnoentitiesnoconv(
"Enabled"),
'disabled' => $langs->transnoentitiesnoconv(
"Disabled"));
667 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
668 $moreforfilter .= $form->selectarray(
'search_status', $array_status, $search_status, $langs->transnoentitiesnoconv(
'Status'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
669 $moreforfilter .=
'</div>';
670 $moreforfilter .=
' ';
671 $moreforfilter .=
'<div class="divsearchfield valignmiddle inline-block">';
672 $moreforfilter .=
'<input type="submit" name="buttonsubmit" class="button small nomarginleft" value="'.dol_escape_htmltag($langs->trans(
"Refresh")).
'">';
673 if ($search_keyword || ($search_nature && $search_nature !=
'-1') || ($search_version && $search_version !=
'-1') || ($search_status && $search_status !=
'-1')) {
674 $moreforfilter .=
' ';
675 $moreforfilter .=
'<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans(
"Reset")).
'">';
677 $moreforfilter .=
'</div>';
678 $moreforfilter .=
'</div>';
680 $moreforfilter .=
'</div>';
682 if (!empty($moreforfilter)) {
683 print $moreforfilter;
684 $parameters = array();
685 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
686 print $hookmanager->resPrint;
691 print
'<div class="clearboth"></div><br>';
694 $parameters = array();
695 $reshook = $hookmanager->executeHooks(
'insertExtraHeader', $parameters,
$object, $action);
700 $disabled_modules = array();
701 if (!empty($_SESSION[
"disablemodules"])) {
702 $disabled_modules = explode(
',', $_SESSION[
"disablemodules"]);
707 $foundoneexternalmodulewithupdate = 0;
709 $atleastonequalified = 0;
710 $atleastoneforfamily = 0;
712 foreach ($orders as $key => $value) {
714 $tab = explode(
'_', $value);
715 $familykey = $tab[1];
716 $module_position = $tab[2];
718 $modName = $filename[$key];
721 $objMod = $modules[$modName];
724 if ($mode ==
'expdev' && $objMod->version !=
'development' && $objMod->version !=
'experimental') {
728 if (!$objMod->getName()) {
729 dol_syslog(
"Error for module ".$key.
" - Property name of module looks empty", LOG_WARNING);
733 $modulenameshort = strtolower(preg_replace(
'/^mod/i',
'', get_class($objMod)));
734 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
737 $modulename = $objMod->getName();
738 $moduletechnicalname = $objMod->name;
739 $moduledesc = $objMod->getDesc();
740 $moduledesclong = $objMod->getDescLong();
741 $moduleauthor = $objMod->getPublisher();
744 if ($search_keyword) {
746 if (preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $modulename)
747 || preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduletechnicalname)
748 || ($moduledesc && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesc))
749 || ($moduledesclong && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesclong))
750 || ($moduleauthor && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduleauthor))
758 if ($search_status) {
766 if ($search_nature) {
767 if (preg_match(
'/^external/', $search_nature) && $objMod->isCoreOrExternalModule() !=
'external') {
771 if (preg_match(
'/^external_(.*)$/', $search_nature, $reg)) {
777 if (!$reg[1] && !empty($publisher)) {
781 if ($search_nature ==
'core' && $objMod->isCoreOrExternalModule() ==
'external') {
785 if ($search_version) {
786 if (($objMod->version ==
'development' || $objMod->version ==
'experimental' || preg_match(
'/deprecated/', $objMod->version)) && $search_version ==
'stable') {
789 if ($objMod->version !=
'development' && ($search_version ==
'development')) {
792 if ($objMod->version !=
'experimental' && ($search_version ==
'experimental')) {
795 if (!preg_match(
'/deprecated/', $objMod->version) && ($search_version ==
'deprecated')) {
800 $atleastonequalified++;
803 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
804 foreach ($objMod->langfiles as $domain) {
805 $langs->load($domain);
810 if ($familykey != $oldfamily) {
812 print
'</table></div><br>';
815 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
819 if ($mode ==
'commonkanban') {
820 print
'<div class="box-flex-container kanban">';
822 print
'<div class="div-table-responsive">';
823 print
'<table class="tagtable liste" summary="list_of_modules">'.
"\n";
826 $atleastoneforfamily = 0;
829 $atleastoneforfamily++;
831 if ($familykey != $oldfamily) {
832 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
833 $oldfamily = $familykey;
837 $version = $objMod->getVersion(0);
840 if (preg_match(
'/development/i', $version)) {
841 $warningstring = $langs->trans(
"Development");
843 if (preg_match(
'/experimental/i', $version)) {
844 $warningstring = $langs->trans(
"Experimental");
846 if (preg_match(
'/deprecated/i', $version)) {
847 $warningstring = $langs->trans(
"Deprecated");
850 if ($objMod->isCoreOrExternalModule() ==
'external' || preg_match(
'/development|experimental|deprecated/i', $version)) {
851 $versiontrans .= $objMod->getVersion(1);
854 if ($objMod->isCoreOrExternalModule() ==
'external'
856 $action ==
'checklastversion'
862 $checkRes = $objMod->checkForUpdate();
864 setEventMessage($objMod->getName().
' : '.$versiontrans.
' -> '.$objMod->lastVersion);
865 } elseif ($checkRes < 0) {
866 setEventMessage($objMod->getName().
' '.$langs->trans(
'CheckVersionFail'),
'warnings');
872 if ($objMod->isCoreOrExternalModule() ==
'external') {
873 $imginfo =
"info_black";
876 $codeenabledisable =
'';
880 if (in_array($modulenameshort, $disabled_modules)) {
881 $objMod->disabled =
true;
888 if (!empty($arrayofwarnings[$modName])) {
889 $codeenabledisable .=
'<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
892 if (!empty($objMod->disabled)) {
893 $codeenabledisable .= $langs->trans(
"Disabled");
894 } elseif (!empty($objMod->always_enabled) || ((isModEnabled(
'multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
896 if (method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
897 $codeenabledisable .= $langs->trans(
"Used");
899 $codeenabledisable .=
img_picto($langs->trans(
"Required"),
'switch_on',
'',
false, 0, 0,
'',
'opacitymedium valignmiddle');
902 if (isModEnabled(
'multicompany') && $user->entity) {
907 if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
908 $codeenabledisable .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$objMod->numero.
'&token='.
newToken().
'&module_position='.$module_position.
'&action=reset_confirm&confirm_message_code='.urlencode($objMod->warnings_unactivation[$mysoc->country_code]).
'&value='.$modName.
'&mode='.$mode.$param.
'">';
909 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
910 $codeenabledisable .=
'</a>';
912 $codeenabledisable .=
' ';
913 $codeenabledisable .=
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$objMod->numero.
'&token='.
newToken().
'&module_position='.$module_position.
'&action=reload_confirm&value='.$modName.
'&mode='.$mode.
'&confirm=yes'.$param.
'">';
914 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
915 $codeenabledisable .=
'</a>';
918 $codeenabledisable .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$objMod->numero.
'&token='.
newToken().
'&module_position='.$module_position.
'&action=reset&value='.$modName.
'&mode='.$mode.
'&confirm=yes'.$param.
'">';
919 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
920 $codeenabledisable .=
'</a>';
922 $codeenabledisable .=
' ';
923 $codeenabledisable .=
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$objMod->numero.
'&token='.
newToken().
'&module_position='.$module_position.
'&action=reload&value='.$modName.
'&mode='.$mode.
'&confirm=yes'.$param.
'">';
924 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
925 $codeenabledisable .=
'</a>';
931 if (!empty($objMod->config_page_url) && !$disableSetup) {
932 $backtourlparam =
'';
933 if ($search_keyword !=
'') {
934 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_keyword='.urlencode($search_keyword);
936 if ($search_nature > -1) {
937 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_nature='.urlencode($search_nature);
939 if ($search_version > -1) {
940 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_version='.urlencode($search_version);
942 if ($search_status > -1) {
943 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_status='.urlencode($search_status);
945 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
948 if (is_array($objMod->config_page_url)) {
950 foreach ($objMod->config_page_url as $page) {
953 $codetoconfig .=
'<a href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
956 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
957 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
958 $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>';
960 $urltouse = $urlpage;
961 $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>';
965 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', (
string) $objMod->config_page_url, $regs)) {
966 $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>';
968 $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>';
971 $codetoconfig .=
img_picto($langs->trans(
"NothingToSetup"),
"setup",
'class="opacitytransp" style="padding-right: 6px"',
false, 0, 0,
'',
'fa-15');
975 if (!empty($objMod->always_enabled)) {
977 $codeenabledisable .=
'<!-- Message to show: an always_enabled module has been disabled -->'.
"\n";
978 $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.
'"';
979 $codeenabledisable .=
'>';
980 $codeenabledisable .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
981 $codeenabledisable .=
"</a>\n";
982 } elseif (!empty($objMod->disabled)) {
983 $codeenabledisable .= $langs->trans(
"Disabled");
986 $warningmessage =
'';
987 if (!empty($arrayofwarnings[$modName])) {
988 $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";
989 foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
990 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
991 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
995 if ($objMod->isCoreOrExternalModule() ==
'external' && !empty($arrayofwarningsext)) {
996 $codeenabledisable .=
'<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
997 foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
998 $keymodulelowercase = strtolower(preg_replace(
'/^mod/',
'', $keymodule));
999 if (in_array($keymodulelowercase, $conf->modules)) {
1000 foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
1001 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
1002 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
1003 $warningmessage .= ($warningmessage ?
"\n" :
"").($warningmessage ?
"\n" :
"").$langs->trans(
"Module").
' : '.$objMod->getName();
1004 if (!empty($objMod->editor_name)) {
1005 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"Publisher").
' : '.$objMod->editor_name;
1007 if (!empty($objMod->editor_name)) {
1008 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"ModuleTriggeringThisWarning").
' : '.$modules[$keymodule]->getName();
1015 $codeenabledisable .=
'<!-- Message to show: '.$warningmessage.
' -->'.
"\n";
1016 $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.
'"';
1017 if ($warningmessage) {
1018 $codeenabledisable .=
' onclick="return confirm(\''.dol_escape_js($warningmessage).
'\');
"';
1020 $codeenabledisable .= '>';
1021 $codeenabledisable .= img_picto($langs->trans("Disabled
"), 'switch_off');
1022 $codeenabledisable .= "</a>\n
";
1025 // Set $codetoconfig
1026 $codetoconfig .= img_picto($langs->trans("NothingToSetup
"), "setup
", 'class="opacitytransp
" style="padding-right: 6px
"');
1029 if ($mode == 'commonkanban') {
1031 print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
1033 print '<tr class="oddeven
'.($warningstring ? ' info-box-content-warning
' : '').'">'."\n
";
1034 if (getDolGlobalString('MAIN_MODULES_SHOW_LINENUMBERS')) {
1035 print '<td class="width50
">'.$linenum.'</td>';
1038 // Picto + Name of module
1039 print ' <td class="tdoverflowmax200 minwidth200imp
" title="'.dol_escape_htmltag($objMod->getName()).'">';
1041 //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
1042 //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
1043 if (!empty($objMod->picto)) {
1044 if (preg_match('/^\//i', $objMod->picto)) {
1045 print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"', 1);
1047 print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"');
1050 print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly
"');
1052 print ' <span class="valignmiddle
">'.$objMod->getName().'</span>';
1056 print '<td class="valignmiddle tdoverflowmax300 minwidth200imp
">';
1057 print nl2br($objMod->getDesc());
1061 print '<td class="center nowrap
" style="width: 82px;
">';
1062 //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
1063 print '<a href="javascript:
document_preview(\
''.DOL_URL_ROOT.
'/admin/modulehelp.php?id='.((
int) $objMod->numero).
'\',\
'text/html\',\''.dol_escape_js($langs->trans(
"Module")).
'\')
">'.img_picto(($objMod->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule
").' - ' : '').$langs->trans("ClickToShowDescription
"), $imginfo).'</a>';
1067 print '<td class="center nowrap width150
" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
1068 if ($objMod->needUpdate) {
1069 $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
1070 print '<span class="badge badge-warning classfortooltip
" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
1072 print $versiontrans;
1076 // Link enable/disable
1077 print '<td class="center valignmiddle left nowraponall
" width="60px
">';
1078 print $codeenabledisable;
1082 print '<td class="tdsetuppicto right valignmiddle
" width="60px
">';
1083 print $codetoconfig;
1088 if ($objMod->needUpdate) {
1089 $foundoneexternalmodulewithupdate++;
1093 if ($action == 'checklastversion') {
1094 if ($foundoneexternalmodulewithupdate) {
1095 setEventMessages($langs->trans("ModuleUpdateAvailable
"), null, 'mesgs');
1097 setEventMessages($langs->trans("NoExternalModuleWithUpdate
"), null, 'mesgs');
1102 if ($mode == 'commonkanban') {
1110 if (!$atleastonequalified) {
1111 print '<br><span class="opacitymedium
">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria
").'</span><br><br>';
1114 print dol_get_fiche_end();
1118 // Show warning about external users
1119 print info_admin(showModulesExludedForExternal($modules))."\n
";
1124if ($mode == 'marketplace') {
1125 print dol_get_fiche_head($head, $mode, '', -1);
1132 print '<div class="div-
table-responsive-no-min
">';
1133 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1134 print '<tr class="liste_titre
">'."\n
";
1135 print '<td class="hideonsmartphone
">'.$form->textwithpicto($langs->trans("Provider
"), $langs->trans("WebSiteDesc
")).'</td>';
1137 print '<td>'.$langs->trans("URL
").'</td>';
1140 print '<tr class="oddeven
">'."\n
";
1141 $url = 'https://www.dolistore.com';
1142 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>';
1143 print '<td><span class="opacitymedium
">'.$langs->trans("DoliStoreDesc
").'</span></td>';
1144 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">'.$url.'</a></td>';
1150 print dol_get_fiche_end();
1154 if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) {
1155 // $options is array with filter criteria
1156 //var_dump($options);
1157 $dolistore->getRemoteCategories();
1158 $dolistore->getRemoteProducts($options);
1160 print '<span class="opacitymedium
">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
1162 $previouslink = $dolistore->get_previous_link();
1163 $nextlink = $dolistore->get_next_link();
1165 print '<div class="liste_titre liste_titre_bydiv centpercent
"><div class="divsearchfield
">';
1167 print '<form method="POST
" class="centpercent
" id="searchFormList
" action="'.$dolistore->url.'">'; ?>
1168 <input type="hidden
" name="token
" value="<?php echo
newToken(); ?>
">
1169 <input type="hidden
" name="mode
" value="marketplace
">
1170 <div class="divsearchfield
">
1171 <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>
1173 <div class="divsearchfield
">
1174 <input class="button buttongen
" value="<?php echo $langs->trans(
'Rechercher') ?>
" type="submit
">
1175 <a class="buttonreset
" href="<?php echo urlencode($dolistore->url) ?>
"><?php echo $langs->trans('Reset') ?></a>
1180 print $previouslink;
1184 print '</div></div>';
1185 print '<div class="clearboth
"></div>';
1188 <div id="category-tree-left
">
1191 echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content?>
1194 <div id="listing-content
">
1195 <table summary="list_of_modules
" id="list_of_modules
" class="productlist centpercent
">
1196 <tbody id="listOfModules
">
1197 <?php echo $dolistore->get_products(); ?>
1206// Install external module
1208if ($mode == 'deploy') {
1209 print dol_get_fiche_head($head, $mode, '', -1);
1211 $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank
" rel="noopener noreferrer
">'.$urldolibarrmodules.'</a>';
1213 if ($allowonlineinstall) {
1214 if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
1215 $message = info_admin($langs->trans("ConfFileMustContainCustom
", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
1219 if (!is_writable(dol_osencode($dirins))) {
1220 $langs->load("errors
");
1221 $message = info_admin($langs->trans("ErrorFailedToWriteInDir
", $dirins), 0, 0, '1', 'warning');
1225 $message = info_admin($langs->trans("NotExistsDirect
", $dirins).$langs->trans("InfDirAlt
").$langs->trans("InfDirExample
"));
1230 if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
1231 // Show clean message
1232 if (!is_numeric(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))) {
1233 $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')), 0, 0, 'warning');
1235 $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'), 0, 0, 'warning');
1238 // Show technical message
1239 $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile
", $dolibarrdataroot.'/installmodules.lock'), 0, 0, 'warning');
1246 if ($allowfromweb < 1) {
1247 print $langs->trans("SomethingMakeInstallFromWebNotPossible
");
1249 //print $langs->trans("SomethingMakeInstallFromWebNotPossible2
");
1255 // $allowfromweb = -1 if installation or setup not correct, 0 if not allowed, 1 if allowed
1256 if ($allowfromweb >= 0) {
1257 if ($allowfromweb == 1) {
1258 //print $langs->trans("ThisIsProcessToFollow
").'<br>';
1260 print $langs->trans("ThisIsAlternativeProcessToFollow
").'<br>';
1261 print '<b>'.$langs->trans("StepNb
", 1).'</b>: ';
1262 print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite
", '{s1}')).'<br>';
1263 print '<b>'.$langs->trans("StepNb
", 2).'</b>: ';
1264 print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite
", '{s1}')).'<br>';
1265 print '<b>'.$langs->trans("StepNb
", 3).'</b>: ';
1268 if ($allowfromweb == 1) {
1269 print '<form enctype="multipart/form-data
" method="POST
" class="noborder
" action="'.$_SERVER["PHP_SELF"].'" name="forminstall
">';
1270 print '<input type="hidden
" name="token
" value="'.newToken().'">';
1271 print '<input type="hidden
" name="action
" value="install
">';
1272 print '<input type="hidden
" name="mode
" value="deploy
">';
1274 print $langs->trans("YouCanSubmitFile
").'<br><br>';
1276 $max = getDolGlobalString('MAIN_UPLOAD_DOC'); // In Kb
1277 $maxphp = @ini_get('upload_max_filesize'); // In unknown
1278 if (preg_match('/k$/i', $maxphp)) {
1279 $maxphp = preg_replace('/k$/i', '', $maxphp);
1282 if (preg_match('/m$/i', $maxphp)) {
1283 $maxphp = preg_replace('/m$/i', '', $maxphp);
1286 if (preg_match('/g$/i', $maxphp)) {
1287 $maxphp = preg_replace('/g$/i', '', $maxphp);
1288 $maxphp *= 1024 * 1024;
1290 if (preg_match('/t$/i', $maxphp)) {
1291 $maxphp = preg_replace('/t$/i', '', $maxphp);
1292 $maxphp *= 1024 * 1024 * 1024;
1294 $maxphp2 = @ini_get('post_max_size'); // In unknown
1295 if (preg_match('/k$/i', $maxphp2)) {
1296 $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
1299 if (preg_match('/m$/i', $maxphp2)) {
1300 $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
1303 if (preg_match('/g$/i', $maxphp2)) {
1304 $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
1305 $maxphp2 *= 1024 * 1024;
1307 if (preg_match('/t$/i', $maxphp2)) {
1308 $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
1309 $maxphp2 *= 1024 * 1024 * 1024;
1311 // Now $max and $maxphp and $maxphp2 are in Kb
1313 $maxphptoshow = $maxphptoshowparam = '';
1315 $maxmin = min($max, $maxphp);
1316 $maxphptoshow = $maxphp;
1317 $maxphptoshowparam = 'upload_max_filesize';
1320 $maxmin = min($max, $maxphp2);
1321 if ($maxphp2 < $maxphp) {
1322 $maxphptoshow = $maxphp2;
1323 $maxphptoshowparam = 'post_max_size';
1328 print '<script type="text/javascript
">
1329 $(document).ready(function() {
1330 jQuery("#fileinstall
").on("change
", function() {
1331 if(this.files[0].size > '.($maxmin * 1024).') {
1332 alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'");
1338 // MAX_FILE_SIZE doit précéder le champ input de type file
1339 print '<input type="hidden
" name="MAX_FILE_SIZE
" value="'.($maxmin * 1024).'">';
1342 print '<input class="flat minwidth400
" type="file
" name="fileinstall
" id="fileinstall
"> ';
1344 print '<input type="submit
" name="send
" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button small
">';
1346 if (getDolGlobalString('MAIN_UPLOAD_DOC')) {
1348 $langs->load('other');
1350 print info_admin($langs->trans("ThisLimitIsDefinedInSetup
", $max, $maxphptoshow, $maxphptoshowparam), 1);
1353 print ' ('.$langs->trans("UploadDisabled
").')';
1361 print '<div class="center
"><div class="logo_setup
"></div></div>';
1363 print $langs->trans("UnpackPackageInModulesRoot
", $dirins).'<br>';
1364 print '<b>'.$langs->trans("StepNb
", 4).'</b>: ';
1365 print $langs->trans("SetupIsReadyForUse
", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home
").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules
")).'<br>';
1369 if (!empty($result['return'])) {
1372 foreach ($result['return'] as $value) {
1377 print dol_get_fiche_end();
1380if ($mode == 'develop') {
1381 print dol_get_fiche_head($head, $mode, '', -1);
1388 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1389 print '<tr class="liste_titre
">'."\n
";
1390 //print '<td>'.$langs->trans("Logo
").'</td>';
1391 print '<td colspan="2
">'.$langs->trans("DevelopYourModuleDesc
").'</td>';
1392 print '<td>'.$langs->trans("URL
").'</td>';
1395 print '<tr class="oddeven
" height="80
">'."\n
";
1396 print '<td class="center
">';
1397 print '<div class="imgmaxheight50 logo_setup
"></div>';
1399 print '<td>'.$langs->trans("TryToUseTheModuleBuilder
", $langs->transnoentitiesnoconv("ModuleBuilder
")).'</td>';
1400 print '<td class="maxwidth300
">';
1401 if (isModEnabled('modulebuilder')) {
1402 print $langs->trans("SeeTopRightMenu
");
1404 print '<span class="opacitymedium
">'.$langs->trans("ModuleMustBeEnabledFirst
", $langs->transnoentitiesnoconv("ModuleBuilder
")).'</span>';
1409 print '<tr class="oddeven
" height="80
">'."\n
";
1410 $url = 'https://partners.dolibarr.org';
1411 print '<td class="center
">';
1412 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>';
1414 print '<td>'.$langs->trans("DoliPartnersDesc
").'</td>';
1415 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">';
1416 print img_picto('', 'url', 'class="pictofixedwidth
"');
1417 print $url.'</a></td>';
1422 print dol_get_fiche_end();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
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.
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='')
Check validity of a file upload from an GUI page, and move it to its final destination.
dol_uncompress($inputfile, $outputdir)
Uncompress a file.
dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement=null, $excludesubdir=0, $excludefileext=null, $excludearchivefiles=0)
Copy a dir to another dir.
dol_is_file($pathoffile)
Return if path is a file.
dol_is_dir($folder)
Test if filename is a directory.
dolGetModulesDirs($subdir='')
Return list of directories that contain modules.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
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...
treeview li table
No Email.
ui state ui widget content ui state ui widget header ui state a ui button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
document_preview(file, type, title)
Function show document preview.
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.