32 if (!defined(
'CSRFCHECK_WITH_TOKEN') && (empty($_GET[
'action']) || $_GET[
'action'] !=
'reset')) {
33 define(
'CSRFCHECK_WITH_TOKEN',
'1');
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';
45 $langs->loadLangs(array(
"errors",
"admin",
"modulebuilder"));
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);
53 $mode = (empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ?
'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT);
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');
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');
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")),
95 if (!
GETPOST(
'buttonreset',
'alpha')) {
96 if ($search_keyword) {
97 $param .=
'&search_keyword='.urlencode($search_keyword);
99 if ($search_status && $search_status !=
'-1') {
100 $param .=
'&search_status='.urlencode($search_status);
102 if ($search_nature && $search_nature !=
'-1') {
103 $param .=
'&search_nature='.urlencode($search_nature);
105 if ($search_version && $search_version !=
'-1') {
106 $param .=
'&search_version='.urlencode($search_version);
110 $dirins = DOL_DOCUMENT_ROOT.
'/custom';
111 $urldolibarrmodules =
'https://www.dolistore.com/';
114 $hookmanager->initHooks(array(
'adminmodules',
'globaladmin'));
117 $max_execution_time_for_deploy = (empty($conf->global->MODULE_UPLOAD_MAX_EXECUTION_TIME) ? 300 : $conf->global->MODULE_UPLOAD_MAX_EXECUTION_TIME);
118 $max_time = @ini_get(
"max_execution_time");
119 if ($max_time && $max_time < $max_execution_time_for_deploy) {
120 dol_syslog(
"max_execution_time=".$max_time.
" is lower than max_execution_time_for_deploy=".$max_execution_time_for_deploy.
". We try to increase it dynamically.");
121 @ini_set(
"max_execution_time", $max_execution_time_for_deploy);
131 $parameters = array();
132 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
137 if (
GETPOST(
'buttonreset',
'alpha')) {
138 $search_keyword =
'';
141 $search_version =
'';
144 if ($action ==
'install') {
148 $original_file = basename($_FILES[
"fileinstall"][
"name"]);
149 $original_file = preg_replace(
'/\s*\(\d+\)\.zip$/i',
'.zip', $original_file);
150 $newfile = $conf->admin->dir_temp.
'/'.$original_file.
'/'.$original_file;
152 if (!$original_file) {
153 $langs->load(
"Error");
154 setEventMessages($langs->trans(
"ErrorModuleFileRequired"),
null,
'warnings');
157 if (!$error && !preg_match(
'/\.zip$/i', $original_file)) {
158 $langs->load(
"errors");
159 setEventMessages($langs->trans(
"ErrorFileMustBeADolibarrPackage", $original_file),
null,
'errors');
162 if (!$error && !preg_match(
'/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file)) {
163 $langs->load(
"errors");
164 setEventMessages($langs->trans(
"ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file,
'module_*-x.y*.zip'),
null,
'errors');
167 if (empty($_FILES[
'fileinstall'][
'tmp_name'])) {
168 $langs->load(
"errors");
175 if ($original_file) {
177 dol_mkdir($conf->admin->dir_temp.
'/'.$original_file);
180 $tmpdir = preg_replace(
'/\.zip$/i',
'', $original_file).
'.dir';
183 dol_mkdir($conf->admin->dir_temp.
'/'.$tmpdir);
186 $result =
dol_move_uploaded_file($_FILES[
'fileinstall'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'fileinstall'][
'error']);
188 $result =
dol_uncompress($newfile, $conf->admin->dir_temp.
'/'.$tmpdir);
190 if (!empty($result[
'error'])) {
191 $langs->load(
"errors");
192 setEventMessages($langs->trans($result[
'error'], $original_file),
null,
'errors');
196 $modulename = preg_replace(
'/module_/',
'', $original_file);
197 $modulename = preg_replace(
'/\-([0-9][0-9\.]*)\.zip$/i',
'', $modulename);
199 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulename;
202 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulename;
205 setEventMessages($langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat").
'<br>'.$langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename,
'htdocs/'.$modulename),
null,
'errors');
214 dol_syslog(
"Uncompress of module file is a success.");
217 $modulenamearrays = array();
218 if (
dol_is_file($modulenamedir.
'/metapackage.conf')) {
220 $metafile = file_get_contents($modulenamedir.
'/metapackage.conf');
221 $modulenamearrays = explode(
"\n", $metafile);
223 $modulenamearrays[$modulename] = $modulename;
227 foreach ($modulenamearrays as $modulenameval) {
228 if (strpos($modulenameval,
'#') === 0) {
231 if (strpos($modulenameval,
'//') === 0) {
234 if (!trim($modulenameval)) {
241 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulenameval;
243 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulenameval;
245 dol_syslog(
"We copy now directory ".$submodulenamedir.
" into target dir ".$dirins.
'/'.$modulenameval);
246 $result =
dolCopyDir($submodulenamedir, $dirins.
'/'.$modulenameval,
'0444', 1);
248 dol_syslog(
'Failed to call dolCopyDir result='.$result.
" with param ".$submodulenamedir.
" and ".$dirins.
'/'.$modulenameval, LOG_WARNING);
249 $langs->load(
"errors");
250 setEventMessages($langs->trans(
"ErrorFailToCopyDir", $submodulenamedir, $dirins.
'/'.$modulenameval),
null,
'errors');
257 setEventMessages($langs->trans(
"ErrorFailToRenameFile", $_FILES[
'fileinstall'][
'tmp_name'], $newfile),
null,
'errors');
263 setEventMessages($langs->trans(
"SetupIsReadyForUse", DOL_URL_ROOT.
'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv(
"Home").
' - '.$langs->transnoentitiesnoconv(
"Setup").
' - '.$langs->transnoentitiesnoconv(
"Modules")),
null,
'warnings');
267 if ($action ==
'set' && $user->admin) {
271 if ($checkOldValue !=
getDolGlobalInt(
'CHECKLASTVERSION_EXTERNALMODULE')) {
272 setEventMessage($langs->trans(
'WarningModuleHasChangedLastVersionCheckParameter', $value),
'warnings');
274 if ($csrfCheckOldValue !=
getDolGlobalInt(
'MAIN_SECURITY_CSRF_WITH_TOKEN')) {
275 setEventMessage($langs->trans(
'WarningModuleHasChangedSecurityCsrfParameter', $value),
'warnings');
277 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
278 if (!empty($resarray[
'errors'])) {
282 if ($resarray[
'nbperms'] > 0) {
283 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
284 $resqltmp = $db->query($tmpsql);
286 $obj = $db->fetch_object($resqltmp);
288 if ($obj && $obj->nb > 1) {
289 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
297 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
299 } elseif ($action ==
'reset' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
301 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
305 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
307 } elseif (
getDolGlobalInt(
"MAIN_FEATURES_LEVEL") > 1 && $action ==
'reload' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
309 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
312 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
315 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
316 if (!empty($resarray[
'errors'])) {
319 if ($resarray[
'nbperms'] > 0) {
320 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
321 $resqltmp = $db->query($tmpsql);
323 $obj = $db->fetch_object($resqltmp);
324 if ($obj && $obj->nb > 1) {
325 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
333 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
347 $morecss = array(
"/admin/dolistore/css/dolistore.css");
355 $help_url =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
356 llxHeader(
'', $langs->trans(
"Setup"),
$help_url,
'',
'',
'', $morejs, $morecss, 0, 0);
362 $arrayofnatures = array(
'core'=>$langs->transnoentitiesnoconv(
"NativeModules"),
'external'=>$langs->transnoentitiesnoconv(
"External").
' - ['.$langs->trans(
"AllPublishers").
']');
363 $arrayofwarnings = array();
364 $arrayofwarningsext = array();
372 $modNameLoaded = array();
374 foreach ($modulesdir as $dir) {
377 dol_syslog(
"Scan directory ".$dir.
" for module descriptor files (modXXX.class.php)");
378 $handle = @opendir($dir);
379 if (is_resource($handle)) {
380 while (($file = readdir($handle)) !==
false) {
382 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
383 $modName = substr($file, 0,
dol_strlen($file) - 10);
386 if (!empty($modNameLoaded[$modName])) {
387 $mesg =
"Error: Module ".$modName.
" was found twice: Into ".$modNameLoaded[$modName].
" and ".$dir.
". You probably have an old file on your disk.<br>";
394 $res = include_once $dir.$file;
395 if (class_exists($modName)) {
396 $objMod =
new $modName($db);
397 $modNameLoaded[$modName] = $dir;
398 if (!$objMod->numero > 0 && $modName !=
'modUser') {
399 dol_syslog(
'The module descriptor '.$modName.
' must have a numero property', LOG_ERR);
401 $j = $objMod->numero;
403 $modulequalified = 1;
406 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
407 if ($objMod->version ==
'development' && (empty($conf->global->$const_name) && (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2))) {
408 $modulequalified = 0;
410 if ($objMod->version ==
'experimental' && (empty($conf->global->$const_name) && (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1))) {
411 $modulequalified = 0;
413 if (preg_match(
'/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) {
414 $modulequalified = 0;
418 if (!empty($objMod->hidden)) {
419 $modulequalified = 0;
422 if ($modulequalified > 0) {
424 $external = ($objMod->isCoreOrExternalModule() ==
'external');
427 $arrayofnatures[
'external_'.$publisher] = $langs->trans(
"External").
' - '.$publisher;
429 $arrayofnatures[
'external_'] = $langs->trans(
"External").
' - '.$langs->trans(
"UnknownPublishers");
432 ksort($arrayofnatures);
435 $filename[$i] = $modName;
436 $modules[$modName] = $objMod;
439 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
440 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
441 $familykey = key($objMod->familyinfo);
443 $familykey = $objMod->family;
446 $moduleposition = ($objMod->module_position ? $objMod->module_position :
'50');
447 if ($objMod->isCoreOrExternalModule() ==
'external' && $moduleposition < 100000) {
449 $moduleposition =
'80';
453 if (!empty($objMod->warnings_activation)) {
454 $arrayofwarnings[$modName] = $objMod->warnings_activation;
456 if (!empty($objMod->warnings_activation_ext)) {
457 $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
460 $familyposition = (empty($familyinfo[$familykey][
'position']) ? 0 : $familyinfo[$familykey][
'position']);
461 $listOfOfficialModuleGroups = array(
'hr',
'technic',
'interface',
'technic',
'portal',
'financial',
'crm',
'base',
'products',
'srm',
'ecm',
'projects',
'other');
462 if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
464 if (is_numeric($familyposition)) {
465 $familyposition = sprintf(
"%03d", (
int) $familyposition + 100);
469 $orders[$i] = $familyposition.
"_".$familykey.
"_".$moduleposition.
"_".$j;
472 $specialstring =
'unknown';
473 if ($objMod->version ==
'development' || $objMod->version ==
'experimental') {
474 $specialstring =
'expdev';
476 if (isset($categ[$specialstring])) {
477 $categ[$specialstring]++;
479 $categ[$specialstring] = 1;
484 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
487 print
"admin/modules.php Warning bad descriptor file : ".$dir.$file.
" (Class ".$modName.
" not found into file)<br>";
490 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
497 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
501 if ($action ==
'reset_confirm' && $user->admin) {
502 if (!empty($modules[$value])) {
503 $objMod = $modules[$value];
505 if (!empty($objMod->langfiles)) {
506 $langs->loadLangs($objMod->langfiles);
510 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmUnactivation'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reset',
'',
'no', 1);
514 if ($action ==
'reload_confirm' && $user->admin) {
515 if (!empty($modules[$value])) {
516 $objMod = $modules[$value];
518 if (!empty($objMod->langfiles)) {
519 $langs->loadLangs($objMod->langfiles);
523 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmReload'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reload',
'',
'no', 1);
534 $nbofactivatedmodules = count($conf->modules);
536 $nbmodulesnotautoenabled = count($conf->modules);
537 if (in_array(
'fckeditor', $conf->modules)) $nbmodulesnotautoenabled--;
538 if (in_array(
'export', $conf->modules)) $nbmodulesnotautoenabled--;
539 if (in_array(
'import', $conf->modules)) $nbmodulesnotautoenabled--;
545 if ($mode ==
'common' || $mode ==
'commonkanban') {
546 $desc = $langs->trans(
"ModulesDesc",
'{picto}');
547 $desc .=
' '.$langs->trans(
"ModulesDesc2",
'{picto2}');
548 $desc = str_replace(
'{picto}',
img_picto(
'',
'switch_off',
'class="size15x"'), $desc);
549 $desc = str_replace(
'{picto2}',
img_picto(
'',
'setup',
'class="size15x"'), $desc);
550 if ($nbmodulesnotautoenabled <=
getDolGlobalInt(
'MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) {
551 $deschelp .=
'<div class="info hideonsmartphone">'.$desc.
"<br></div>\n";
553 if (!empty($conf->global->MAIN_SETUP_MODULES_INFO)) {
554 $deschelp .=
'<div class="info">'.$langs->trans($conf->global->MAIN_SETUP_MODULES_INFO).
"<br></div>\n";
560 if ($mode ==
'marketplace') {
563 if ($mode ==
'deploy') {
564 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDeployDesc", $langs->transnoentitiesnoconv(
"AvailableModules")).
"<br></div><br>\n";
566 if ($mode ==
'develop') {
567 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDevelopDesc").
"<br></div><br>\n";
573 if ($mode ==
'common' || $mode ==
'commonkanban') {
576 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
577 print
'<input type="hidden" name="token" value="'.newToken().
'">';
578 if (isset($optioncss) && $optioncss !=
'') {
579 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
581 if (isset($sortfield) && $sortfield !=
'') {
582 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
584 if (isset($sortorder) && $sortorder !=
'') {
585 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
587 if (isset($page) && $page !=
'') {
588 print
'<input type="hidden" name="page" value="'.$page.
'">';
590 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
596 $moreforfilter =
'<div class="valignmiddle">';
598 $moreforfilter .=
'<div class="floatright right pagination paddingtop --module-list"><ul><li>';
599 $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'));
601 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.$param,
'', ($mode ==
'common' ? 2 : 1), array(
'morecss'=>
'reposition'));
602 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=commonkanban'.$param,
'', ($mode ==
'commonkanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
603 $moreforfilter .=
'</li></ul></div>';
605 $moreforfilter .=
'<div class="divfilteralone colorbacktimesheet float valignmiddle">';
606 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
607 $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')).
'">';
608 $moreforfilter .=
'</div>';
609 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
610 $moreforfilter .=
$form->selectarray(
'search_nature', $arrayofnatures,
dol_escape_htmltag($search_nature), $langs->trans(
'Origin'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth250', 1);
611 $moreforfilter .=
'</div>';
614 $array_version = array(
'stable'=>$langs->transnoentitiesnoconv(
"Stable"));
616 $array_version[
'deprecated'] = $langs->trans(
"Deprecated");
618 if ($conf->global->MAIN_FEATURES_LEVEL > 0) {
619 $array_version[
'experimental'] = $langs->trans(
"Experimental");
621 if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
622 $array_version[
'development'] = $langs->trans(
"Development");
624 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
625 $moreforfilter .=
$form->selectarray(
'search_version', $array_version, $search_version, $langs->transnoentitiesnoconv(
'Version'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
626 $moreforfilter .=
'</div>';
628 $array_status = array(
'active'=>$langs->transnoentitiesnoconv(
"Enabled"),
'disabled'=>$langs->transnoentitiesnoconv(
"Disabled"));
629 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
630 $moreforfilter .=
$form->selectarray(
'search_status', $array_status, $search_status, $langs->transnoentitiesnoconv(
'Status'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
631 $moreforfilter .=
'</div>';
632 $moreforfilter .=
' ';
633 $moreforfilter .=
'<div class="divsearchfield valignmiddle inline-block">';
634 $moreforfilter .=
'<input type="submit" name="buttonsubmit" class="button small" value="'.dol_escape_htmltag($langs->trans(
"Refresh")).
'">';
635 if ($search_keyword || ($search_nature && $search_nature !=
'-1') || ($search_version && $search_version !=
'-1') || ($search_status && $search_status !=
'-1')) {
636 $moreforfilter .=
' ';
637 $moreforfilter .=
'<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans(
"Reset")).
'">';
639 $moreforfilter .=
'</div>';
640 $moreforfilter .=
'</div>';
642 $moreforfilter .=
'</div>';
644 if (!empty($moreforfilter)) {
645 print $moreforfilter;
646 $parameters = array();
647 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
648 print $hookmanager->resPrint;
653 print
'<div class="clearboth"></div><br>';
655 $object =
new stdClass();
656 $parameters = array();
657 $reshook = $hookmanager->executeHooks(
'insertExtraHeader', $parameters, $object, $action);
662 $disabled_modules = array();
663 if (!empty($_SESSION[
"disablemodules"])) {
664 $disabled_modules = explode(
',', $_SESSION[
"disablemodules"]);
669 $foundoneexternalmodulewithupdate = 0;
671 $atleastonequalified = 0;
672 $atleastoneforfamily = 0;
674 foreach ($orders as $key => $value) {
676 $tab = explode(
'_', $value);
677 $familykey = $tab[1];
678 $module_position = $tab[2];
680 $modName = $filename[$key];
683 $objMod = $modules[$modName];
686 if ($mode ==
'expdev' && $objMod->version !=
'development' && $objMod->version !=
'experimental') {
690 if (!$objMod->getName()) {
691 dol_syslog(
"Error for module ".$key.
" - Property name of module looks empty", LOG_WARNING);
695 $modulenameshort = strtolower(preg_replace(
'/^mod/i',
'', get_class($objMod)));
696 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
699 $modulename = $objMod->getName();
700 $moduletechnicalname = $objMod->name;
701 $moduledesc = $objMod->getDesc();
702 $moduledesclong = $objMod->getDescLong();
703 $moduleauthor = $objMod->getPublisher();
706 if ($search_keyword) {
708 if (preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $modulename)
709 || preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduletechnicalname)
710 || ($moduledesc && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesc))
711 || ($moduledesclong && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesclong))
712 || ($moduleauthor && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduleauthor))
720 if ($search_status) {
721 if ($search_status ==
'active' && empty($conf->global->$const_name)) {
724 if ($search_status ==
'disabled' && !empty($conf->global->$const_name)) {
728 if ($search_nature) {
729 if (preg_match(
'/^external/', $search_nature) && $objMod->isCoreOrExternalModule() !=
'external') {
733 if (preg_match(
'/^external_(.*)$/', $search_nature, $reg)) {
739 if (!$reg[1] && !empty($publisher)) {
743 if ($search_nature ==
'core' && $objMod->isCoreOrExternalModule() ==
'external') {
747 if ($search_version) {
748 if (($objMod->version ==
'development' || $objMod->version ==
'experimental' || preg_match(
'/deprecated/', $objMod->version)) && $search_version ==
'stable') {
751 if ($objMod->version !=
'development' && ($search_version ==
'development')) {
754 if ($objMod->version !=
'experimental' && ($search_version ==
'experimental')) {
757 if (!preg_match(
'/deprecated/', $objMod->version) && ($search_version ==
'deprecated')) {
762 $atleastonequalified++;
765 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
766 foreach ($objMod->langfiles as $domain) {
767 $langs->load($domain);
772 if ($familykey != $oldfamily) {
774 print
'</table></div><br>';
777 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
781 if ($mode ==
'commonkanban') {
782 print
'<div class="box-flex-container kanban">';
784 print
'<div class="div-table-responsive">';
785 print
'<table class="tagtable liste" summary="list_of_modules">'.
"\n";
788 $atleastoneforfamily = 0;
791 $atleastoneforfamily++;
793 if ($familykey != $oldfamily) {
794 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
795 $oldfamily = $familykey;
799 $version = $objMod->getVersion(0);
802 if (preg_match(
'/development/i', $version)) {
803 $warningstring = $langs->trans(
"Development");
805 if (preg_match(
'/experimental/i', $version)) {
806 $warningstring = $langs->trans(
"Experimental");
808 if (preg_match(
'/deprecated/i', $version)) {
809 $warningstring = $langs->trans(
"Deprecated");
812 if ($objMod->isCoreOrExternalModule() ==
'external' || preg_match(
'/development|experimental|deprecated/i', $version)) {
813 $versiontrans .= $objMod->getVersion(1);
816 if ($objMod->isCoreOrExternalModule() ==
'external'
818 $action ==
'checklastversion'
821 || !empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)
824 $checkRes = $objMod->checkForUpdate();
826 setEventMessage($objMod->getName().
' : '.$versiontrans.
' -> '.$objMod->lastVersion);
827 } elseif ($checkRes < 0) {
828 setEventMessage($objMod->getName().
' '.$langs->trans(
'CheckVersionFail'),
'warnings');
834 if ($objMod->isCoreOrExternalModule() ==
'external') {
835 $imginfo =
"info_black";
838 $codeenabledisable =
'';
842 if (in_array($modulenameshort, $disabled_modules)) {
843 $objMod->disabled =
true;
847 if (!empty($conf->global->$const_name)) {
850 if (!empty($arrayofwarnings[$modName])) {
851 $codeenabledisable .=
'<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
854 if (!empty($objMod->disabled)) {
855 $codeenabledisable .= $langs->trans(
"Disabled");
856 } elseif (!empty($objMod->always_enabled) || ((
isModEnabled(
'multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
857 if (method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
858 $codeenabledisable .= $langs->trans(
"Used");
860 $codeenabledisable .=
img_picto($langs->trans(
"Required"),
'switch_on',
'',
false, 0, 0,
'',
'opacitymedium valignmiddle');
867 if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
868 $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.
'">';
869 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
870 $codeenabledisable .=
'</a>';
872 $codeenabledisable .=
' ';
873 $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.
'">';
874 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
875 $codeenabledisable .=
'</a>';
878 $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.
'">';
879 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
880 $codeenabledisable .=
'</a>';
882 $codeenabledisable .=
' ';
883 $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.
'">';
884 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
885 $codeenabledisable .=
'</a>';
891 if (!empty($objMod->config_page_url) && !$disableSetup) {
892 $backtourlparam =
'';
893 if ($search_keyword !=
'') {
894 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_keyword='.urlencode($search_keyword);
896 if ($search_nature > -1) {
897 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_nature='.urlencode($search_nature);
899 if ($search_version > -1) {
900 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_version='.urlencode($search_version);
902 if ($search_status > -1) {
903 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_status='.urlencode($search_status);
905 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
908 if (is_array($objMod->config_page_url)) {
910 foreach ($objMod->config_page_url as $page) {
913 $codetoconfig .=
'<a href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
916 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
917 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
918 $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>';
920 $urltouse = $urlpage;
921 $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>';
925 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', (
string) $objMod->config_page_url, $regs)) {
926 $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>';
928 $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>';
931 $codetoconfig .=
img_picto($langs->trans(
"NothingToSetup"),
"setup",
'class="opacitytransp" style="padding-right: 6px"',
false, 0, 0,
'',
'fa-15');
935 if (!empty($objMod->always_enabled)) {
937 } elseif (!empty($objMod->disabled)) {
938 $codeenabledisable .= $langs->trans(
"Disabled");
941 $warningmessage =
'';
942 if (!empty($arrayofwarnings[$modName])) {
943 $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";
944 foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
945 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
946 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
950 if ($objMod->isCoreOrExternalModule() ==
'external' && !empty($arrayofwarningsext)) {
951 $codeenabledisable .=
'<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
952 foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
953 $keymodulelowercase = strtolower(preg_replace(
'/^mod/',
'', $keymodule));
954 if (in_array($keymodulelowercase, $conf->modules)) {
955 foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
956 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
957 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
958 $warningmessage .= ($warningmessage ?
"\n" :
"").($warningmessage ?
"\n" :
"").$langs->trans(
"Module").
' : '.$objMod->getName();
959 if (!empty($objMod->editor_name)) {
960 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"Publisher").
' : '.$objMod->editor_name;
962 if (!empty($objMod->editor_name)) {
963 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"ModuleTriggeringThisWarning").
' : '.$modules[$keymodule]->getName();
970 $codeenabledisable .=
'<!-- Message to show: '.$warningmessage.
' -->'.
"\n";
971 $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.
'"';
972 if ($warningmessage) {
973 $codeenabledisable .=
' onclick="return confirm(\''.dol_escape_js($warningmessage).
'\');
"';
975 $codeenabledisable .= '>';
976 $codeenabledisable .= img_picto($langs->trans("Disabled
"), 'switch_off');
977 $codeenabledisable .= "</a>\n
";
981 $codetoconfig .= img_picto($langs->trans("NothingToSetup
"), "setup
", 'class="opacitytransp
" style="padding-right: 6px
"');
984 if ($mode == 'commonkanban') {
986 print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
988 print '<tr class="oddeven
'.($warningstring ? ' info-box-content-warning
' : '').'">'."\n
";
989 if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) {
990 print '<td class="width50
">'.$linenum.'</td>';
993 // Picto + Name of module
994 print ' <td class="tdoverflowmax300 maxwidth300
" title="'.dol_escape_htmltag($objMod->getName()).'">';
996 //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
997 //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
998 if (!empty($objMod->picto)) {
999 if (preg_match('/^\//i', $objMod->picto)) {
1000 print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"', 1);
1002 print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"');
1005 print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly
"');
1007 print ' <span class="valignmiddle
">'.$objMod->getName().'</span>';
1011 print '<td class="valignmiddle tdoverflowmax300
">';
1012 print nl2br($objMod->getDesc());
1016 print '<td class="center nowrap
" style="width: 82px;
">';
1017 //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
1018 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>';
1022 print '<td class="center nowrap
" width="150px
" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
1023 if ($objMod->needUpdate) {
1024 $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
1025 print '<span class="badge badge-warning classfortooltip
" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
1027 print $versiontrans;
1031 // Link enable/disable
1032 print '<td class="center valignmiddle left
" width="60px
">';
1033 print $codeenabledisable;
1037 print '<td class="tdsetuppicto right valignmiddle
" width="60px
">';
1038 print $codetoconfig;
1043 if ($objMod->needUpdate) {
1044 $foundoneexternalmodulewithupdate++;
1048 if ($action == 'checklastversion') {
1049 if ($foundoneexternalmodulewithupdate) {
1050 setEventMessages($langs->trans("ModuleUpdateAvailable
"), null, 'mesgs');
1052 setEventMessages($langs->trans("NoExternalModuleWithUpdate
"), null, 'mesgs');
1057 if ($mode == 'commonkanban') {
1065 if (!$atleastonequalified) {
1066 print '<br><span class="opacitymedium
">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria
").'</span><br><br>';
1069 print dol_get_fiche_end();
1073 // Show warning about external users
1074 print info_admin(showModulesExludedForExternal($modules))."\n
";
1079 if ($mode == 'marketplace') {
1080 print dol_get_fiche_head($head, $mode, '', -1);
1087 print '<div class="div-table-responsive-no-min
">';
1088 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1089 print '<tr class="liste_titre
">'."\n
";
1090 print '<td class="hideonsmartphone
">'.$form->textwithpicto($langs->trans("Provider
"), $langs->trans("WebSiteDesc
")).'</td>';
1092 print '<td>'.$langs->trans("URL
").'</td>';
1095 print '<tr class="oddeven
">'."\n
";
1096 $url = 'https://www.dolistore.com';
1097 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>';
1098 print '<td><span class="opacitymedium
">'.$langs->trans("DoliStoreDesc
").'</span></td>';
1099 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">'.$url.'</a></td>';
1105 print dol_get_fiche_end();
1109 if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1) {
1110 // $options is array with filter criterias
1111 //var_dump($options);
1112 $dolistore->getRemoteCategories();
1113 $dolistore->getRemoteProducts($options);
1115 print '<span class="opacitymedium
">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
1117 $previouslink = $dolistore->get_previous_link();
1118 $nextlink = $dolistore->get_next_link();
1120 print '<div class="liste_titre liste_titre_bydiv centpercent
"><div class="divsearchfield
">';
1122 print '<form method="POST
" class="centpercent
" id="searchFormList
" action="'.$dolistore->url.'">';
1124 <input type="hidden
" name="token
" value="<?php echo
newToken(); ?>
">
1125 <input type="hidden
" name="mode
" value="marketplace
">
1126 <div class="divsearchfield
">
1127 <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>
1129 <div class="divsearchfield
">
1130 <input class="button buttongen
" value="<?php echo $langs->trans(
'Rechercher') ?>
" type="submit
">
1131 <a class="buttonreset
" href="<?php echo urlencode($dolistore->url) ?>
"><?php echo $langs->trans('Reset') ?></a>
1136 print $previouslink;
1141 print '</div></div>';
1142 print '<div class="clearboth
"></div>';
1146 <div id="category-tree-left
">
1149 echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content
1153 <div id="listing-content
">
1154 <table summary="list_of_modules
" id="list_of_modules
" class="productlist centpercent
">
1155 <tbody id="listOfModules
">
1156 <?php echo $dolistore->get_products(); ?>
1166 // Install external module
1168 if ($mode == 'deploy') {
1169 print dol_get_fiche_head($head, $mode, '', -1);
1173 $dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
1174 $allowonlineinstall = true;
1176 if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) {
1177 $allowonlineinstall = false;
1180 $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank
" rel="noopener noreferrer
">'.$urldolibarrmodules.'</a>';
1182 if ($allowonlineinstall) {
1183 if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
1184 $message = info_admin($langs->trans("ConfFileMustContainCustom
", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
1188 if (!is_writable(dol_osencode($dirins))) {
1189 $langs->load("errors
");
1190 $message = info_admin($langs->trans("ErrorFailedToWriteInDir
", $dirins), 0, 0, '1', 'warning');
1194 $message = info_admin($langs->trans("NotExistsDirect
", $dirins).$langs->trans("InfDirAlt
").$langs->trans("InfDirExample
"));
1199 if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
1200 // Show clean message
1201 if (!is_numeric(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))) {
1202 $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')));
1204 $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));
1207 // Show technical message
1208 $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile
", $dolibarrdataroot.'/installmodules.lock'));
1213 if ($allowfromweb < 1) {
1214 print $langs->trans("SomethingMakeInstallFromWebNotPossible
");
1216 //print $langs->trans("SomethingMakeInstallFromWebNotPossible2
");
1222 if ($allowfromweb >= 0) {
1223 if ($allowfromweb == 1) {
1224 //print $langs->trans("ThisIsProcessToFollow
").'<br>';
1226 print $langs->trans("ThisIsAlternativeProcessToFollow
").'<br>';
1227 print '<b>'.$langs->trans("StepNb
", 1).'</b>: ';
1228 print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite
", '{s1}')).'<br>';
1229 print '<b>'.$langs->trans("StepNb
", 2).'</b>: ';
1230 print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite
", '{s1}')).'<br>';
1231 print '<b>'.$langs->trans("StepNb
", 3).'</b>: ';
1234 if ($allowfromweb == 1) {
1235 print '<span class="opacitymedium
">'.$langs->trans("UnpackPackageInModulesRoot
", $dirins).'</span><br>';
1239 print '<form enctype="multipart/form-data
" method="POST
" class="noborder
" action="'.$_SERVER["PHP_SELF"].'" name="forminstall
">';
1240 print '<input type="hidden
" name="token
" value="'.newToken().'">';
1241 print '<input type="hidden
" name="action
" value="install
">';
1242 print '<input type="hidden
" name="mode
" value="deploy
">';
1244 print $langs->trans("YouCanSubmitFile
");
1246 $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
1247 $maxphp = @ini_get('upload_max_filesize'); // In unknown
1248 if (preg_match('/k$/i', $maxphp)) {
1249 $maxphp = preg_replace('/k$/i', '', $maxphp);
1250 $maxphp = $maxphp * 1;
1252 if (preg_match('/m$/i', $maxphp)) {
1253 $maxphp = preg_replace('/m$/i', '', $maxphp);
1254 $maxphp = $maxphp * 1024;
1256 if (preg_match('/g$/i', $maxphp)) {
1257 $maxphp = preg_replace('/g$/i', '', $maxphp);
1258 $maxphp = $maxphp * 1024 * 1024;
1260 if (preg_match('/t$/i', $maxphp)) {
1261 $maxphp = preg_replace('/t$/i', '', $maxphp);
1262 $maxphp = $maxphp * 1024 * 1024 * 1024;
1264 $maxphp2 = @ini_get('post_max_size'); // In unknown
1265 if (preg_match('/k$/i', $maxphp2)) {
1266 $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
1267 $maxphp2 = $maxphp2 * 1;
1269 if (preg_match('/m$/i', $maxphp2)) {
1270 $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
1271 $maxphp2 = $maxphp2 * 1024;
1273 if (preg_match('/g$/i', $maxphp2)) {
1274 $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
1275 $maxphp2 = $maxphp2 * 1024 * 1024;
1277 if (preg_match('/t$/i', $maxphp2)) {
1278 $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
1279 $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
1281 // Now $max and $maxphp and $maxphp2 are in Kb
1283 $maxphptoshow = $maxphptoshowparam = '';
1285 $maxmin = min($max, $maxphp);
1286 $maxphptoshow = $maxphp;
1287 $maxphptoshowparam = 'upload_max_filesize';
1290 $maxmin = min($max, $maxphp2);
1291 if ($maxphp2 < $maxphp) {
1292 $maxphptoshow = $maxphp2;
1293 $maxphptoshowparam = 'post_max_size';
1298 print '<script type="text/javascript
">
1299 $(document).ready(function() {
1300 jQuery("#fileinstall
").on("change
", function() {
1301 if(this.files[0].size > '.($maxmin * 1024).') {
1302 alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'");
1308 // MAX_FILE_SIZE doit précéder le champ input de type file
1309 print '<input type="hidden
" name="MAX_FILE_SIZE
" value="'.($maxmin * 1024).'">';
1312 print '<input class="flat minwidth400
" type="file
" name="fileinstall
" id="fileinstall
"> ';
1314 print '<input type="submit
" name="send
" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button">';
1316 if (!empty($conf->global->MAIN_UPLOAD_DOC)) {
1318 $langs->load('other');
1320 print info_admin($langs->trans("ThisLimitIsDefinedInSetup
", $max, $maxphptoshow, $maxphptoshowparam), 1);
1323 print ' ('.$langs->trans("UploadDisabled
").')';
1331 print '<div class="center
"><div class="logo_setup
"></div></div>';
1333 print $langs->trans("UnpackPackageInModulesRoot
", $dirins).'<br>';
1334 print '<b>'.$langs->trans("StepNb
", 4).'</b>: ';
1335 print $langs->trans("SetupIsReadyForUse
").'<br>';
1339 if (!empty($result['return'])) {
1342 foreach ($result['return'] as $value) {
1347 print dol_get_fiche_end();
1350 if ($mode == 'develop') {
1351 print dol_get_fiche_head($head, $mode, '', -1);
1358 print "<table summary=\
"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
1359 print
"<tr class=\"liste_titre\">\n";
1361 print
'<td colspan="2">'.$langs->trans(
"DevelopYourModuleDesc").
'</td>';
1362 print
'<td>'.$langs->trans(
"URL").
'</td>';
1365 print
'<tr class="oddeven" height="80">'.
"\n";
1366 print
'<td class="left">';
1367 print
'<div class="imgmaxheight50 logo_setup"></div>';
1369 print
'<td>'.$langs->trans(
"TryToUseTheModuleBuilder", $langs->transnoentitiesnoconv(
"ModuleBuilder")).
'</td>';
1370 print
'<td class="maxwidth300">';
1372 print $langs->trans(
"SeeTopRightMenu");
1374 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv(
"ModuleBuilder")).
'</span>';
1379 print
'<tr class="oddeven" height="80">'.
"\n";
1380 $url =
'https://partners.dolibarr.org';
1381 print
'<td class="left">';
1382 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>';
1384 print
'<td>'.$langs->trans(
"DoliPartnersDesc").
'</td>';
1385 print
'<td><a href="'.$url.
'" target="_blank" rel="noopener noreferrer external">'.$url.
'</a></td>';