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'));
123 $parameters = array();
124 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
129 if (
GETPOST(
'buttonreset',
'alpha')) {
130 $search_keyword =
'';
133 $search_version =
'';
136 if ($action ==
'install') {
140 $original_file = basename($_FILES[
"fileinstall"][
"name"]);
141 $original_file = preg_replace(
'/\s*\(\d+\)\.zip$/i',
'.zip', $original_file);
142 $newfile = $conf->admin->dir_temp.
'/'.$original_file.
'/'.$original_file;
144 if (!$original_file) {
145 $langs->load(
"Error");
146 setEventMessages($langs->trans(
"ErrorModuleFileRequired"),
null,
'warnings');
149 if (!$error && !preg_match(
'/\.zip$/i', $original_file)) {
150 $langs->load(
"errors");
151 setEventMessages($langs->trans(
"ErrorFileMustBeADolibarrPackage", $original_file),
null,
'errors');
154 if (!$error && !preg_match(
'/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file)) {
155 $langs->load(
"errors");
156 setEventMessages($langs->trans(
"ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file,
'module_*-x.y*.zip'),
null,
'errors');
159 if (empty($_FILES[
'fileinstall'][
'tmp_name'])) {
160 $langs->load(
"errors");
167 if ($original_file) {
169 dol_mkdir($conf->admin->dir_temp.
'/'.$original_file);
172 $tmpdir = preg_replace(
'/\.zip$/i',
'', $original_file).
'.dir';
175 dol_mkdir($conf->admin->dir_temp.
'/'.$tmpdir);
178 $result =
dol_move_uploaded_file($_FILES[
'fileinstall'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'fileinstall'][
'error']);
180 $result =
dol_uncompress($newfile, $conf->admin->dir_temp.
'/'.$tmpdir);
182 if (!empty($result[
'error'])) {
183 $langs->load(
"errors");
184 setEventMessages($langs->trans($result[
'error'], $original_file),
null,
'errors');
188 $modulename = preg_replace(
'/module_/',
'', $original_file);
189 $modulename = preg_replace(
'/\-([0-9][0-9\.]*)\.zip$/i',
'', $modulename);
191 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulename;
194 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulename;
197 setEventMessages($langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat").
'<br>'.$langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename,
'htdocs/'.$modulename),
null,
'errors');
206 dol_syslog(
"Uncompress of module file is a success.");
209 $modulenamearrays = array();
210 if (
dol_is_file($modulenamedir.
'/metapackage.conf')) {
212 $metafile = file_get_contents($modulenamedir.
'/metapackage.conf');
213 $modulenamearrays = explode(
"\n", $metafile);
215 $modulenamearrays[$modulename] = $modulename;
219 foreach ($modulenamearrays as $modulenameval) {
220 if (strpos($modulenameval,
'#') === 0) {
223 if (strpos($modulenameval,
'//') === 0) {
226 if (!trim($modulenameval)) {
233 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulenameval;
235 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulenameval;
237 dol_syslog(
"We copy now directory ".$submodulenamedir.
" into target dir ".$dirins.
'/'.$modulenameval);
238 $result =
dolCopyDir($submodulenamedir, $dirins.
'/'.$modulenameval,
'0444', 1);
240 dol_syslog(
'Failed to call dolCopyDir result='.$result.
" with param ".$submodulenamedir.
" and ".$dirins.
'/'.$modulenameval, LOG_WARNING);
241 $langs->load(
"errors");
242 setEventMessages($langs->trans(
"ErrorFailToCopyDir", $submodulenamedir, $dirins.
'/'.$modulenameval),
null,
'errors');
249 setEventMessages($langs->trans(
"ErrorFailToRenameFile", $_FILES[
'fileinstall'][
'tmp_name'], $newfile),
null,
'errors');
255 setEventMessages($langs->trans(
"SetupIsReadyForUse", DOL_URL_ROOT.
'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv(
"Home").
' - '.$langs->transnoentitiesnoconv(
"Setup").
' - '.$langs->transnoentitiesnoconv(
"Modules")),
null,
'warnings');
259 if ($action ==
'set' && $user->admin) {
263 if ($checkOldValue !=
getDolGlobalInt(
'CHECKLASTVERSION_EXTERNALMODULE')) {
264 setEventMessage($langs->trans(
'WarningModuleHasChangedLastVersionCheckParameter', $value),
'warnings');
266 if ($csrfCheckOldValue !=
getDolGlobalInt(
'MAIN_SECURITY_CSRF_WITH_TOKEN')) {
267 setEventMessage($langs->trans(
'WarningModuleHasChangedSecurityCsrfParameter', $value),
'warnings');
269 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
270 if (!empty($resarray[
'errors'])) {
274 if ($resarray[
'nbperms'] > 0) {
275 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
276 $resqltmp = $db->query($tmpsql);
278 $obj = $db->fetch_object($resqltmp);
280 if ($obj && $obj->nb > 1) {
281 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
289 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
291 } elseif ($action ==
'reset' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
293 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
297 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
299 } elseif (
getDolGlobalInt(
"MAIN_FEATURES_LEVEL") > 1 && $action ==
'reload' && $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);
304 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
307 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
308 if (!empty($resarray[
'errors'])) {
311 if ($resarray[
'nbperms'] > 0) {
312 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
313 $resqltmp = $db->query($tmpsql);
315 $obj = $db->fetch_object($resqltmp);
316 if ($obj && $obj->nb > 1) {
317 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
325 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
339 $morecss = array(
"/admin/dolistore/css/dolistore.css");
347 $help_url =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
348 llxHeader(
'', $langs->trans(
"Setup"),
$help_url,
'',
'',
'', $morejs, $morecss, 0, 0);
354 $arrayofnatures = array(
'core'=>$langs->transnoentitiesnoconv(
"NativeModules"),
'external'=>$langs->transnoentitiesnoconv(
"External").
' - ['.$langs->trans(
"AllPublishers").
']');
355 $arrayofwarnings = array();
356 $arrayofwarningsext = array();
364 $modNameLoaded = array();
366 foreach ($modulesdir as $dir) {
369 dol_syslog(
"Scan directory ".$dir.
" for module descriptor files (modXXX.class.php)");
370 $handle = @opendir($dir);
371 if (is_resource($handle)) {
372 while (($file = readdir($handle)) !==
false) {
374 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
375 $modName = substr($file, 0,
dol_strlen($file) - 10);
378 if (!empty($modNameLoaded[$modName])) {
379 $mesg =
"Error: Module ".$modName.
" was found twice: Into ".$modNameLoaded[$modName].
" and ".$dir.
". You probably have an old file on your disk.<br>";
386 $res = include_once $dir.$file;
387 if (class_exists($modName)) {
388 $objMod =
new $modName($db);
389 $modNameLoaded[$modName] = $dir;
390 if (!$objMod->numero > 0 && $modName !=
'modUser') {
391 dol_syslog(
'The module descriptor '.$modName.
' must have a numero property', LOG_ERR);
393 $j = $objMod->numero;
395 $modulequalified = 1;
398 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
399 if ($objMod->version ==
'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) {
400 $modulequalified = 0;
402 if ($objMod->version ==
'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) {
403 $modulequalified = 0;
405 if (preg_match(
'/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) {
406 $modulequalified = 0;
410 if (!empty($objMod->hidden)) {
411 $modulequalified = 0;
414 if ($modulequalified > 0) {
416 $external = ($objMod->isCoreOrExternalModule() ==
'external');
419 $arrayofnatures[
'external_'.$publisher] = $langs->trans(
"External").
' - '.$publisher;
421 $arrayofnatures[
'external_'] = $langs->trans(
"External").
' - '.$langs->trans(
"UnknownPublishers");
424 ksort($arrayofnatures);
427 $filename[$i] = $modName;
428 $modules[$modName] = $objMod;
431 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
432 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
433 $familykey = key($objMod->familyinfo);
435 $familykey = $objMod->family;
438 $moduleposition = ($objMod->module_position ? $objMod->module_position :
'50');
439 if ($objMod->isCoreOrExternalModule() ==
'external' && $moduleposition < 100000) {
441 $moduleposition =
'80';
445 if (!empty($objMod->warnings_activation)) {
446 $arrayofwarnings[$modName] = $objMod->warnings_activation;
448 if (!empty($objMod->warnings_activation_ext)) {
449 $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
452 $familyposition = (empty($familyinfo[$familykey][
'position']) ? 0 : $familyinfo[$familykey][
'position']);
453 $listOfOfficialModuleGroups = array(
'hr',
'technic',
'interface',
'technic',
'portal',
'financial',
'crm',
'base',
'products',
'srm',
'ecm',
'projects',
'other');
454 if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
456 if (is_numeric($familyposition)) {
457 $familyposition = sprintf(
"%03d", (
int) $familyposition + 100);
461 $orders[$i] = $familyposition.
"_".$familykey.
"_".$moduleposition.
"_".$j;
464 $specialstring =
'unknown';
465 if ($objMod->version ==
'development' || $objMod->version ==
'experimental') {
466 $specialstring =
'expdev';
468 if (isset($categ[$specialstring])) {
469 $categ[$specialstring]++;
471 $categ[$specialstring] = 1;
476 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
479 print
"Warning bad descriptor file : ".$dir.$file.
" (Class ".$modName.
" not found into file)<br>";
482 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
489 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
493 if ($action ==
'reset_confirm' && $user->admin) {
494 if (!empty($modules[$value])) {
495 $objMod = $modules[$value];
497 if (!empty($objMod->langfiles)) {
498 $langs->loadLangs($objMod->langfiles);
502 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmUnactivation'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reset',
'',
'no', 1);
506 if ($action ==
'reload_confirm' && $user->admin) {
507 if (!empty($modules[$value])) {
508 $objMod = $modules[$value];
510 if (!empty($objMod->langfiles)) {
511 $langs->loadLangs($objMod->langfiles);
515 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmReload'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reload',
'',
'no', 1);
526 $nbofactivatedmodules = count($conf->modules);
528 $nbmodulesnotautoenabled = count($conf->modules);
529 if (in_array(
'fckeditor', $conf->modules)) $nbmodulesnotautoenabled--;
530 if (in_array(
'export', $conf->modules)) $nbmodulesnotautoenabled--;
531 if (in_array(
'import', $conf->modules)) $nbmodulesnotautoenabled--;
537 if ($mode ==
'common' || $mode ==
'commonkanban') {
538 $desc = $langs->trans(
"ModulesDesc",
'{picto}');
539 $desc .=
' '.$langs->trans(
"ModulesDesc2",
'{picto2}');
540 $desc = str_replace(
'{picto}',
img_picto(
'',
'switch_off',
'class="size15x"'), $desc);
541 $desc = str_replace(
'{picto2}',
img_picto(
'',
'setup',
'class="size15x"'), $desc);
542 if ($nbmodulesnotautoenabled <=
getDolGlobalInt(
'MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) {
543 $deschelp =
'<div class="info hideonsmartphone">'.$desc.
"<br></div><br>\n";
546 if ($mode ==
'marketplace') {
549 if ($mode ==
'deploy') {
550 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDeployDesc", $langs->transnoentitiesnoconv(
"AvailableModules")).
"<br></div><br>\n";
552 if ($mode ==
'develop') {
553 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDevelopDesc").
"<br></div><br>\n";
559 if ($mode ==
'common' || $mode ==
'commonkanban') {
562 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
563 print
'<input type="hidden" name="token" value="'.newToken().
'">';
564 if (isset($optioncss) && $optioncss !=
'') {
565 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
567 if (isset($sortfield) && $sortfield !=
'') {
568 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
570 if (isset($sortorder) && $sortorder !=
'') {
571 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
573 if (isset($page) && $page !=
'') {
574 print
'<input type="hidden" name="page" value="'.$page.
'">';
576 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
582 $moreforfilter =
'<div class="valignmiddle">';
584 $moreforfilter .=
'<div class="floatright right pagination paddingtop --module-list"><ul><li>';
585 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'CheckForModuleUpdate'), $langs->trans(
'CheckForModuleUpdate').
'<br>'.$langs->trans(
'CheckForModuleUpdateHelp'),
'fa fa-sync', $_SERVER[
"PHP_SELF"].
'?action=checklastversion&token='.
newToken().
'&mode='.$mode.$param,
'', 1, array(
'morecss'=>
'reposition'));
587 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.$param,
'', ($mode ==
'common' ? 2 : 1), array(
'morecss'=>
'reposition'));
588 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=commonkanban'.$param,
'', ($mode ==
'commonkanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
589 $moreforfilter .=
'</li></ul></div>';
591 $moreforfilter .=
'<div class="divfilteralone colorbacktimesheet float valignmiddle">';
592 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
593 $moreforfilter .=
img_picto($langs->trans(
"Filter"),
'filter',
'class="paddingright opacityhigh hideonsmartphone"').
'<input type="text" id="search_keyword" name="search_keyword" class="maxwidth125" value="'.
dol_escape_htmltag($search_keyword).
'" placeholder="'.
dol_escape_htmltag($langs->trans(
'Keyword')).
'">';
594 $moreforfilter .=
'</div>';
595 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
596 $moreforfilter .=
$form->selectarray(
'search_nature', $arrayofnatures,
dol_escape_htmltag($search_nature), $langs->trans(
'Origin'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth250', 1);
597 $moreforfilter .=
'</div>';
600 $array_version = array(
'stable'=>$langs->transnoentitiesnoconv(
"Stable"));
601 if ($conf->global->MAIN_FEATURES_LEVEL < 0) {
602 $array_version[
'deprecated'] = $langs->trans(
"Deprecated");
604 if ($conf->global->MAIN_FEATURES_LEVEL > 0) {
605 $array_version[
'experimental'] = $langs->trans(
"Experimental");
607 if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
608 $array_version[
'development'] = $langs->trans(
"Development");
610 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
611 $moreforfilter .=
$form->selectarray(
'search_version', $array_version, $search_version, $langs->transnoentitiesnoconv(
'Version'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
612 $moreforfilter .=
'</div>';
614 $array_status = array(
'active'=>$langs->transnoentitiesnoconv(
"Enabled"),
'disabled'=>$langs->transnoentitiesnoconv(
"Disabled"));
615 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
616 $moreforfilter .=
$form->selectarray(
'search_status', $array_status, $search_status, $langs->transnoentitiesnoconv(
'Status'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
617 $moreforfilter .=
'</div>';
618 $moreforfilter .=
' ';
619 $moreforfilter .=
'<div class="divsearchfield valignmiddle inline-block">';
620 $moreforfilter .=
'<input type="submit" name="buttonsubmit" class="button small" value="'.dol_escape_htmltag($langs->trans(
"Refresh")).
'">';
621 if ($search_keyword || ($search_nature && $search_nature !=
'-1') || ($search_version && $search_version !=
'-1') || ($search_status && $search_status !=
'-1')) {
622 $moreforfilter .=
' ';
623 $moreforfilter .=
'<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans(
"Reset")).
'">';
625 $moreforfilter .=
'</div>';
626 $moreforfilter .=
'</div>';
628 $moreforfilter .=
'</div>';
630 if (!empty($moreforfilter)) {
631 print $moreforfilter;
632 $parameters = array();
633 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
634 print $hookmanager->resPrint;
639 print
'<div class="clearboth"></div><br>';
641 $object =
new stdClass();
642 $parameters = array();
643 $reshook = $hookmanager->executeHooks(
'insertExtraHeader', $parameters, $object, $action);
648 $disabled_modules = array();
649 if (!empty($_SESSION[
"disablemodules"])) {
650 $disabled_modules = explode(
',', $_SESSION[
"disablemodules"]);
655 $foundoneexternalmodulewithupdate = 0;
657 $atleastonequalified = 0;
658 $atleastoneforfamily = 0;
660 foreach ($orders as $key => $value) {
662 $tab = explode(
'_', $value);
663 $familykey = $tab[1];
664 $module_position = $tab[2];
666 $modName = $filename[$key];
669 $objMod = $modules[$modName];
672 if ($mode ==
'expdev' && $objMod->version !=
'development' && $objMod->version !=
'experimental') {
676 if (!$objMod->getName()) {
677 dol_syslog(
"Error for module ".$key.
" - Property name of module looks empty", LOG_WARNING);
681 $modulenameshort = strtolower(preg_replace(
'/^mod/i',
'', get_class($objMod)));
682 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
685 $modulename = $objMod->getName();
686 $moduletechnicalname = $objMod->name;
687 $moduledesc = $objMod->getDesc();
688 $moduledesclong = $objMod->getDescLong();
689 $moduleauthor = $objMod->getPublisher();
692 if ($search_keyword) {
694 if (preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $modulename)
695 || preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduletechnicalname)
696 || ($moduledesc && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesc))
697 || ($moduledesclong && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesclong))
698 || ($moduleauthor && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduleauthor))
706 if ($search_status) {
707 if ($search_status ==
'active' && empty($conf->global->$const_name)) {
710 if ($search_status ==
'disabled' && !empty($conf->global->$const_name)) {
714 if ($search_nature) {
715 if (preg_match(
'/^external/', $search_nature) && $objMod->isCoreOrExternalModule() !=
'external') {
719 if (preg_match(
'/^external_(.*)$/', $search_nature, $reg)) {
725 if (!$reg[1] && !empty($publisher)) {
729 if ($search_nature ==
'core' && $objMod->isCoreOrExternalModule() ==
'external') {
733 if ($search_version) {
734 if (($objMod->version ==
'development' || $objMod->version ==
'experimental' || preg_match(
'/deprecated/', $objMod->version)) && $search_version ==
'stable') {
737 if ($objMod->version !=
'development' && ($search_version ==
'development')) {
740 if ($objMod->version !=
'experimental' && ($search_version ==
'experimental')) {
743 if (!preg_match(
'/deprecated/', $objMod->version) && ($search_version ==
'deprecated')) {
748 $atleastonequalified++;
751 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
752 foreach ($objMod->langfiles as $domain) {
753 $langs->load($domain);
758 if ($familykey != $oldfamily) {
760 print
'</table></div><br>';
763 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
767 if ($mode ==
'commonkanban') {
768 print
'<div class="box-flex-container kanban">';
770 print
'<div class="div-table-responsive">';
771 print
'<table class="tagtable liste" summary="list_of_modules">'.
"\n";
774 $atleastoneforfamily = 0;
777 $atleastoneforfamily++;
779 if ($familykey != $oldfamily) {
780 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
781 $oldfamily = $familykey;
785 $version = $objMod->getVersion(0);
788 if (preg_match(
'/development/i', $version)) {
789 $warningstring = $langs->trans(
"Development");
791 if (preg_match(
'/experimental/i', $version)) {
792 $warningstring = $langs->trans(
"Experimental");
794 if (preg_match(
'/deprecated/i', $version)) {
795 $warningstring = $langs->trans(
"Deprecated");
798 if ($objMod->isCoreOrExternalModule() ==
'external' || preg_match(
'/development|experimental|deprecated/i', $version)) {
799 $versiontrans .= $objMod->getVersion(1);
802 if ($objMod->isCoreOrExternalModule() ==
'external'
804 $action ==
'checklastversion'
807 || !empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)
810 $checkRes = $objMod->checkForUpdate();
812 setEventMessage($objMod->getName().
' : '.$versiontrans.
' -> '.$objMod->lastVersion);
813 } elseif ($checkRes < 0) {
814 setEventMessage($objMod->getName().
' '.$langs->trans(
'CheckVersionFail'),
'warnings');
820 if ($objMod->isCoreOrExternalModule() ==
'external') {
821 $imginfo =
"info_black";
824 $codeenabledisable =
'';
828 if (in_array($modulenameshort, $disabled_modules)) {
829 $objMod->disabled =
true;
833 if (!empty($conf->global->$const_name)) {
836 if (!empty($arrayofwarnings[$modName])) {
837 $codeenabledisable .=
'<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
840 if (!empty($objMod->disabled)) {
841 $codeenabledisable .= $langs->trans(
"Disabled");
842 } elseif (!empty($objMod->always_enabled) || ((
isModEnabled(
'multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
843 if (method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
844 $codeenabledisable .= $langs->trans(
"Used");
846 $codeenabledisable .=
img_picto($langs->trans(
"Required"),
'switch_on',
'',
false, 0, 0,
'',
'opacitymedium valignmiddle');
853 if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
854 $codeenabledisable .=
'<a class="reposition valignmiddle" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$objMod->numero.
'&token='.
newToken().
'&module_position='.$module_position.
'&action=reset_confirm&confirm_message_code='.urlencode($objMod->warnings_unactivation[$mysoc->country_code]).
'&value='.$modName.
'&mode='.$mode.$param.
'">';
855 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
856 $codeenabledisable .=
'</a>';
858 $codeenabledisable .=
' ';
859 $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.
'">';
860 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
861 $codeenabledisable .=
'</a>';
864 $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.
'">';
865 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
866 $codeenabledisable .=
'</a>';
868 $codeenabledisable .=
' ';
869 $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.
'">';
870 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
871 $codeenabledisable .=
'</a>';
877 if (!empty($objMod->config_page_url) && !$disableSetup) {
878 $backtourlparam =
'';
879 if ($search_keyword !=
'') {
880 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_keyword='.urlencode($search_keyword);
882 if ($search_nature > -1) {
883 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_nature='.urlencode($search_nature);
885 if ($search_version > -1) {
886 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_version='.urlencode($search_version);
888 if ($search_status > -1) {
889 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_status='.urlencode($search_status);
891 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
894 if (is_array($objMod->config_page_url)) {
896 foreach ($objMod->config_page_url as $page) {
899 $codetoconfig .=
'<a href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
902 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
903 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
904 $codetoconfig .=
'<a href="'.$urltouse.(preg_match(
'/\?/', $urltouse) ?
'&' :
'?').
'save_lastsearch_values=1&backtopage='.urlencode($backtourl).
'" title="'.$langs->trans(
"Setup").
'">'.
img_picto($langs->trans(
"Setup"),
"setup",
'style="padding-right: 6px"',
false, 0, 0,
'',
'fa-15').
'</a>';
906 $urltouse = $urlpage;
907 $codetoconfig .=
'<a href="'.$urltouse.(preg_match(
'/\?/', $urltouse) ?
'&' :
'?').
'save_lastsearch_values=1&backtopage='.urlencode($backtourl).
'" title="'.$langs->trans(
"Setup").
'">'.
img_picto($langs->trans(
"Setup"),
"setup",
'style="padding-right: 6px"',
false, 0, 0,
'',
'fa-15').
'</a>';
911 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', (
string) $objMod->config_page_url, $regs)) {
912 $codetoconfig .=
'<a class="valignmiddle" href="'.dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1).
'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).
'" title="'.$langs->trans(
"Setup").
'">'.
img_picto($langs->trans(
"Setup"),
"setup",
'style="padding-right: 6px"',
false, 0, 0,
'',
'fa-15').
'</a>';
914 $codetoconfig .=
'<a class="valignmiddle" href="'.((string) $objMod->config_page_url).
'?save_lastsearch_values=1&backtopage='.urlencode($backtourl).
'" title="'.$langs->trans(
"Setup").
'">'.
img_picto($langs->trans(
"Setup"),
"setup",
'style="padding-right: 6px"',
false, 0, 0,
'',
'fa-15').
'</a>';
917 $codetoconfig .=
img_picto($langs->trans(
"NothingToSetup"),
"setup",
'class="opacitytransp" style="padding-right: 6px"',
false, 0, 0,
'',
'fa-15');
921 if (!empty($objMod->always_enabled)) {
923 } elseif (!empty($objMod->disabled)) {
924 $codeenabledisable .= $langs->trans(
"Disabled");
927 $warningmessage =
'';
928 if (!empty($arrayofwarnings[$modName])) {
929 $codeenabledisable .=
'<!-- This module is a core module and it may have a warning to show when we activate it (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
930 foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
931 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
932 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
936 if ($objMod->isCoreOrExternalModule() ==
'external' && !empty($arrayofwarningsext)) {
937 $codeenabledisable .=
'<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
938 foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
939 $keymodulelowercase = strtolower(preg_replace(
'/^mod/',
'', $keymodule));
940 if (in_array($keymodulelowercase, $conf->modules)) {
941 foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
942 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
943 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
944 $warningmessage .= ($warningmessage ?
"\n" :
"").($warningmessage ?
"\n" :
"").$langs->trans(
"Module").
' : '.$objMod->getName();
945 if (!empty($objMod->editor_name)) {
946 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"Publisher").
' : '.$objMod->editor_name;
948 if (!empty($objMod->editor_name)) {
949 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"ModuleTriggeringThisWarning").
' : '.$modules[$keymodule]->getName();
956 $codeenabledisable .=
'<!-- Message to show: '.$warningmessage.
' -->'.
"\n";
957 $codeenabledisable .=
'<a class="reposition" href="'.$_SERVER[
"PHP_SELF"].
'?id='.$objMod->numero.
'&token='.
newToken().
'&module_position='.$module_position.
'&action=set&token='.
newToken().
'&value='.$modName.
'&mode='.$mode.$param.
'"';
958 if ($warningmessage) {
959 $codeenabledisable .=
' onclick="return confirm(\''.dol_escape_js($warningmessage).
'\');
"';
961 $codeenabledisable .= '>';
962 $codeenabledisable .= img_picto($langs->trans("Disabled
"), 'switch_off');
963 $codeenabledisable .= "</a>\n
";
967 $codetoconfig .= img_picto($langs->trans("NothingToSetup
"), "setup
", 'class="opacitytransp
" style="padding-right: 6px
"');
970 if ($mode == 'commonkanban') {
972 print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
974 print '<tr class="oddeven
'.($warningstring ? ' info-box-content-warning
' : '').'">'."\n
";
975 if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) {
976 print '<td class="width50
">'.$linenum.'</td>';
979 // Picto + Name of module
980 print ' <td class="tdoverflowmax300 maxwidth300
" title="'.dol_escape_htmltag($objMod->getName()).'">';
982 //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
983 //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
984 if (!empty($objMod->picto)) {
985 if (preg_match('/^\//i', $objMod->picto)) {
986 print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"', 1);
988 print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"');
991 print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly
"');
993 print ' <span class="valignmiddle
">'.$objMod->getName().'</span>';
997 print '<td class="valignmiddle tdoverflowmax300
">';
998 print nl2br($objMod->getDesc());
1002 print '<td class="center nowrap
" style="width: 82px;
">';
1003 //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
1004 print '<a href="javascript:
document_preview(\
''.DOL_URL_ROOT.
'/admin/modulehelp.php?id='.$objMod->numero.
'\',\
'text/html\',\''.dol_escape_js($langs->trans(
"Module")).
'\')
">'.img_picto(($objMod->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule
").' - ' : '').$langs->trans("ClickToShowDescription
"), $imginfo).'</a>';
1008 print '<td class="center nowrap
" width="150px
" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
1009 if ($objMod->needUpdate) {
1010 $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
1011 print '<span class="badge badge-warning classfortooltip
" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
1013 print $versiontrans;
1017 // Link enable/disable
1018 print '<td class="center valignmiddle left
" width="60px
">';
1019 print $codeenabledisable;
1023 print '<td class="tdsetuppicto right valignmiddle
" width="60px
">';
1024 print $codetoconfig;
1029 if ($objMod->needUpdate) {
1030 $foundoneexternalmodulewithupdate++;
1034 if ($action == 'checklastversion') {
1035 if ($foundoneexternalmodulewithupdate) {
1036 setEventMessages($langs->trans("ModuleUpdateAvailable
"), null, 'mesgs');
1038 setEventMessages($langs->trans("NoExternalModuleWithUpdate
"), null, 'mesgs');
1043 if ($mode == 'commonkanban') {
1051 if (!$atleastonequalified) {
1052 print '<br><span class="opacitymedium
">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria
").'</span><br><br>';
1055 print dol_get_fiche_end();
1059 // Show warning about external users
1060 print info_admin(showModulesExludedForExternal($modules))."\n
";
1065 if ($mode == 'marketplace') {
1066 print dol_get_fiche_head($head, $mode, '', -1);
1073 print '<div class="div-table-responsive-no-min
">';
1074 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1075 print '<tr class="liste_titre
">'."\n
";
1076 print '<td class="hideonsmartphone
">'.$form->textwithpicto($langs->trans("Provider
"), $langs->trans("WebSiteDesc
")).'</td>';
1078 print '<td>'.$langs->trans("URL
").'</td>';
1081 print '<tr class="oddeven
">'."\n
";
1082 $url = 'https://www.dolistore.com';
1083 print '<td class="hideonsmartphone
"><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
"><img border="0
" class="imgautosize imgmaxwidth180
" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png
"></a></td>';
1084 print '<td><span class="opacitymedium
">'.$langs->trans("DoliStoreDesc
").'</span></td>';
1085 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">'.$url.'</a></td>';
1091 print dol_get_fiche_end();
1095 if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1) {
1096 // $options is array with filter criterias
1097 //var_dump($options);
1098 $dolistore->getRemoteCategories();
1099 $dolistore->getRemoteProducts($options);
1101 print '<span class="opacitymedium
">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
1103 $previouslink = $dolistore->get_previous_link();
1104 $nextlink = $dolistore->get_next_link();
1106 print '<div class="liste_titre liste_titre_bydiv centpercent
"><div class="divsearchfield
">';
1108 print '<form method="POST
" class="centpercent
" id="searchFormList
" action="'.$dolistore->url.'">';
1110 <input type="hidden
" name="token
" value="<?php echo
newToken(); ?>
">
1111 <input type="hidden
" name="mode
" value="marketplace
">
1112 <div class="divsearchfield
">
1113 <input name="search_keyword
" placeholder="<?php echo $langs->trans(
'Keyword') ?>
" id="search_keyword
" type="text
" class="minwidth200
" value="<?php echo
dol_escape_htmltag($options[
'search']) ?>
"><br>
1115 <div class="divsearchfield
">
1116 <input class="button buttongen
" value="<?php echo $langs->trans(
'Rechercher') ?>
" type="submit
">
1117 <a class="buttonreset
" href="<?php echo urlencode($dolistore->url) ?>
"><?php echo $langs->trans('Reset') ?></a>
1122 print $previouslink;
1127 print '</div></div>';
1128 print '<div class="clearboth
"></div>';
1132 <div id="category-tree-left
">
1135 echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content
1139 <div id="listing-content
">
1140 <table summary="list_of_modules
" id="list_of_modules
" class="productlist centpercent
">
1141 <tbody id="listOfModules
">
1142 <?php echo $dolistore->get_products(); ?>
1152 // Install external module
1154 if ($mode == 'deploy') {
1155 print dol_get_fiche_head($head, $mode, '', -1);
1159 $dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
1160 $allowonlineinstall = true;
1162 if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) {
1163 $allowonlineinstall = false;
1166 $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank
" rel="noopener noreferrer
">'.$urldolibarrmodules.'</a>';
1168 if (!empty($allowonlineinstall)) {
1169 if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
1170 $message = info_admin($langs->trans("ConfFileMustContainCustom
", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
1174 if (!is_writable(dol_osencode($dirins))) {
1175 $langs->load("errors
");
1176 $message = info_admin($langs->trans("ErrorFailedToWriteInDir
", $dirins), 0, 0, '1', 'warning');
1180 $message = info_admin($langs->trans("NotExistsDirect
", $dirins).$langs->trans("InfDirAlt
").$langs->trans("InfDirExample
"));
1185 if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
1186 // Show clean message
1187 if (!is_numeric('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
1188 $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')));
1190 $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));
1193 // Show technical message
1194 $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile
", $dolibarrdataroot.'/installmodules.lock'));
1199 if ($allowfromweb < 1) {
1200 print $langs->trans("SomethingMakeInstallFromWebNotPossible
");
1202 //print $langs->trans("SomethingMakeInstallFromWebNotPossible2
");
1208 if ($allowfromweb >= 0) {
1209 if ($allowfromweb == 1) {
1210 //print $langs->trans("ThisIsProcessToFollow
").'<br>';
1212 print $langs->trans("ThisIsAlternativeProcessToFollow
").'<br>';
1213 print '<b>'.$langs->trans("StepNb
", 1).'</b>: ';
1214 print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite
", '{s1}')).'<br>';
1215 print '<b>'.$langs->trans("StepNb
", 2).'</b>: ';
1216 print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite
", '{s1}')).'<br>';
1217 print '<b>'.$langs->trans("StepNb
", 3).'</b>: ';
1220 if ($allowfromweb == 1) {
1221 print '<span class="opacitymedium
">'.$langs->trans("UnpackPackageInModulesRoot
", $dirins).'</span><br>';
1225 print '<form enctype="multipart/form-data
" method="POST
" class="noborder
" action="'.$_SERVER["PHP_SELF"].'" name="forminstall
">';
1226 print '<input type="hidden
" name="token
" value="'.newToken().'">';
1227 print '<input type="hidden
" name="action
" value="install
">';
1228 print '<input type="hidden
" name="mode
" value="deploy
">';
1230 print $langs->trans("YouCanSubmitFile
");
1232 $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
1233 $maxphp = @ini_get('upload_max_filesize'); // In unknown
1234 if (preg_match('/k$/i', $maxphp)) {
1235 $maxphp = preg_replace('/k$/i', '', $maxphp);
1236 $maxphp = $maxphp * 1;
1238 if (preg_match('/m$/i', $maxphp)) {
1239 $maxphp = preg_replace('/m$/i', '', $maxphp);
1240 $maxphp = $maxphp * 1024;
1242 if (preg_match('/g$/i', $maxphp)) {
1243 $maxphp = preg_replace('/g$/i', '', $maxphp);
1244 $maxphp = $maxphp * 1024 * 1024;
1246 if (preg_match('/t$/i', $maxphp)) {
1247 $maxphp = preg_replace('/t$/i', '', $maxphp);
1248 $maxphp = $maxphp * 1024 * 1024 * 1024;
1250 $maxphp2 = @ini_get('post_max_size'); // In unknown
1251 if (preg_match('/k$/i', $maxphp2)) {
1252 $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
1253 $maxphp2 = $maxphp2 * 1;
1255 if (preg_match('/m$/i', $maxphp2)) {
1256 $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
1257 $maxphp2 = $maxphp2 * 1024;
1259 if (preg_match('/g$/i', $maxphp2)) {
1260 $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
1261 $maxphp2 = $maxphp2 * 1024 * 1024;
1263 if (preg_match('/t$/i', $maxphp2)) {
1264 $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
1265 $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
1267 // Now $max and $maxphp and $maxphp2 are in Kb
1269 $maxphptoshow = $maxphptoshowparam = '';
1271 $maxmin = min($max, $maxphp);
1272 $maxphptoshow = $maxphp;
1273 $maxphptoshowparam = 'upload_max_filesize';
1276 $maxmin = min($max, $maxphp2);
1277 if ($maxphp2 < $maxphp) {
1278 $maxphptoshow = $maxphp2;
1279 $maxphptoshowparam = 'post_max_size';
1284 print '<script type="text/javascript
">
1285 $(document).ready(function() {
1286 jQuery("#fileinstall
").on("change
", function() {
1287 if(this.files[0].size > '.($maxmin * 1024).') {
1288 alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'");
1294 // MAX_FILE_SIZE doit précéder le champ input de type file
1295 print '<input type="hidden
" name="MAX_FILE_SIZE
" value="'.($maxmin * 1024).'">';
1298 print '<input class="flat minwidth400
" type="file
" name="fileinstall
" id="fileinstall
"> ';
1300 print '<input type="submit
" name="send
" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button">';
1302 if (!empty($conf->global->MAIN_UPLOAD_DOC)) {
1304 $langs->load('other');
1306 print info_admin($langs->trans("ThisLimitIsDefinedInSetup
", $max, $maxphptoshow, $maxphptoshowparam), 1);
1309 print ' ('.$langs->trans("UploadDisabled
").')';
1317 print '<div class="center
"><div class="logo_setup
"></div></div>';
1319 print $langs->trans("UnpackPackageInModulesRoot
", $dirins).'<br>';
1320 print '<b>'.$langs->trans("StepNb
", 4).'</b>: ';
1321 print $langs->trans("SetupIsReadyForUse
").'<br>';
1325 if (!empty($result['return'])) {
1328 foreach ($result['return'] as $value) {
1333 print dol_get_fiche_end();
1336 if ($mode == 'develop') {
1337 print dol_get_fiche_head($head, $mode, '', -1);
1344 print "<table summary=\
"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
1345 print
"<tr class=\"liste_titre\">\n";
1347 print
'<td colspan="2">'.$langs->trans(
"DevelopYourModuleDesc").
'</td>';
1348 print
'<td>'.$langs->trans(
"URL").
'</td>';
1351 print
'<tr class="oddeven" height="80">'.
"\n";
1352 print
'<td class="left">';
1353 print
'<div class="imgmaxheight50 logo_setup"></div>';
1355 print
'<td>'.$langs->trans(
"TryToUseTheModuleBuilder", $langs->transnoentitiesnoconv(
"ModuleBuilder")).
'</td>';
1356 print
'<td class="maxwidth300">';
1358 print $langs->trans(
"SeeTopRightMenu");
1360 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv(
"ModuleBuilder")).
'</span>';
1365 print
'<tr class="oddeven" height="80">'.
"\n";
1366 $url =
'https://partners.dolibarr.org';
1367 print
'<td class="left">';
1368 print
'<a href="'.$url.
'" target="_blank" rel="noopener noreferrer external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.
'/theme/dolibarr_preferred_partner.png"></a>';
1370 print
'<td>'.$langs->trans(
"DoliPartnersDesc").
'</td>';
1371 print
'<td><a href="'.$url.
'" target="_blank" rel="noopener noreferrer external">'.$url.
'</a></td>';