33if (!defined(
'CSRFCHECK_WITH_TOKEN') && (empty($_GET[
'action']) || $_GET[
'action'] !=
'reset')) {
34 define(
'CSRFCHECK_WITH_TOKEN',
'1');
38require
'../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/admin/dolistore/class/dolistore.class.php';
46$langs->loadLangs(array(
"errors",
"admin",
"modulebuilder"));
49if (GETPOSTISSET(
'mode')) {
50 $mode =
GETPOST(
'mode',
'alpha');
51 if ($mode ==
'common' || $mode ==
'commonkanban') {
52 dolibarr_set_const($db,
"MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT", $mode,
'chaine', 0,
'', $conf->entity);
55 $mode = (!
getDolGlobalString(
'MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT') ?
'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT);
58$action =
GETPOST(
'action',
'aZ09');
59$value =
GETPOST(
'value',
'alpha');
61$search_keyword =
GETPOST(
'search_keyword',
'alpha');
62$search_status =
GETPOST(
'search_status',
'alpha');
63$search_nature =
GETPOST(
'search_nature',
'alpha');
64$search_version =
GETPOST(
'search_version',
'alpha');
69$options[
'per_page'] = 20;
73$options[
'search'] =
GETPOST(
'search_keyword',
'alpha');
82 'hr' => array(
'position' =>
'001',
'label' => $langs->trans(
"ModuleFamilyHr")),
83 'crm' => array(
'position' =>
'006',
'label' => $langs->trans(
"ModuleFamilyCrm")),
84 'srm' => array(
'position' =>
'007',
'label' => $langs->trans(
"ModuleFamilySrm")),
85 'financial' => array(
'position' =>
'009',
'label' => $langs->trans(
"ModuleFamilyFinancial")),
86 'products' => array(
'position' =>
'012',
'label' => $langs->trans(
"ModuleFamilyProducts")),
87 'projects' => array(
'position' =>
'015',
'label' => $langs->trans(
"ModuleFamilyProjects")),
88 'ecm' => array(
'position' =>
'018',
'label' => $langs->trans(
"ModuleFamilyECM")),
89 'technic' => array(
'position' =>
'021',
'label' => $langs->trans(
"ModuleFamilyTechnic")),
90 'portal' => array(
'position' =>
'040',
'label' => $langs->trans(
"ModuleFamilyPortal")),
91 'interface' => array(
'position' =>
'050',
'label' => $langs->trans(
"ModuleFamilyInterface")),
92 'base' => array(
'position' =>
'060',
'label' => $langs->trans(
"ModuleFamilyBase")),
93 'other' => array(
'position' =>
'100',
'label' => $langs->trans(
"ModuleFamilyOther")),
97if (!
GETPOST(
'buttonreset',
'alpha')) {
98 if ($search_keyword) {
99 $param .=
'&search_keyword='.urlencode($search_keyword);
101 if ($search_status && $search_status !=
'-1') {
102 $param .=
'&search_status='.urlencode($search_status);
104 if ($search_nature && $search_nature !=
'-1') {
105 $param .=
'&search_nature='.urlencode($search_nature);
107 if ($search_version && $search_version !=
'-1') {
108 $param .=
'&search_version='.urlencode($search_version);
112$dirins = DOL_DOCUMENT_ROOT.
'/custom';
113$urldolibarrmodules =
'https://www.dolistore.com/';
116$hookmanager->initHooks(array(
'adminmodules',
'globaladmin'));
119$max_execution_time_for_deploy =
getDolGlobalInt(
'MODULE_UPLOAD_MAX_EXECUTION_TIME', 300);
120if (!empty($max_execution_time_for_deploy)) {
121 $err = error_reporting();
124 @set_time_limit($max_execution_time_for_deploy);
125 error_reporting($err);
128$max_time = @ini_get(
"max_execution_time");
129if ($max_time && $max_time < $max_execution_time_for_deploy) {
130 dol_syslog(
"max_execution_time=".$max_time.
" is lower than max_execution_time_for_deploy=".$max_execution_time_for_deploy.
". We try to increase it dynamically.");
131 @ini_set(
"max_execution_time", $max_execution_time_for_deploy);
135$dolibarrdataroot = preg_replace(
'/([\\/]+)$/i',
'', DOL_DATA_ROOT);
136$allowonlineinstall =
true;
138if (
dol_is_file($dolibarrdataroot.
'/installmodules.lock')) {
139 $allowonlineinstall =
false;
149$parameters = array();
150$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
155if (
GETPOST(
'buttonreset',
'alpha')) {
156 $search_keyword =
'';
159 $search_version =
'';
162if ($action ==
'install' && $allowonlineinstall) {
166 $original_file = basename($_FILES[
"fileinstall"][
"name"]);
167 $original_file = preg_replace(
'/\s*\(\d+\)\.zip$/i',
'.zip', $original_file);
168 $newfile = $conf->admin->dir_temp.
'/'.$original_file.
'/'.$original_file;
170 if (!$original_file) {
171 $langs->load(
"Error");
172 setEventMessages($langs->trans(
"ErrorModuleFileRequired"),
null,
'warnings');
175 if (!$error && !preg_match(
'/\.zip$/i', $original_file)) {
176 $langs->load(
"errors");
177 setEventMessages($langs->trans(
"ErrorFileMustBeADolibarrPackage", $original_file),
null,
'errors');
180 if (!$error && !preg_match(
'/^(module[a-zA-Z0-9]*_|theme_|).*\-([0-9][0-9\.]*)(\s\(\d+\)\s)?\.zip$/i', $original_file)) {
181 $langs->load(
"errors");
182 setEventMessages($langs->trans(
"ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file,
'modulename-x[.y.z].zip'),
null,
'errors');
185 if (empty($_FILES[
'fileinstall'][
'tmp_name'])) {
186 $langs->load(
"errors");
193 if ($original_file) {
195 dol_mkdir($conf->admin->dir_temp.
'/'.$original_file);
198 $tmpdir = preg_replace(
'/\.zip$/i',
'', $original_file).
'.dir';
201 dol_mkdir($conf->admin->dir_temp.
'/'.$tmpdir);
204 $result =
dol_move_uploaded_file($_FILES[
'fileinstall'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'fileinstall'][
'error']);
206 $result =
dol_uncompress($newfile, $conf->admin->dir_temp.
'/'.$tmpdir);
208 if (!empty($result[
'error'])) {
209 $langs->load(
"errors");
210 setEventMessages($langs->trans($result[
'error'], $original_file),
null,
'errors');
214 $modulename = preg_replace(
'/module_/',
'', $original_file);
215 $modulename = preg_replace(
'/\-([0-9][0-9\.]*)\.zip$/i',
'', $modulename);
217 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulename;
220 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulename;
223 setEventMessages($langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat").
'<br>'.$langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename,
'htdocs/'.$modulename),
null,
'errors');
232 dol_syslog(
"Uncompress of module file is a success.");
235 $modulenamearrays = array();
236 if (
dol_is_file($modulenamedir.
'/metapackage.conf')) {
238 $metafile = file_get_contents($modulenamedir.
'/metapackage.conf');
239 $modulenamearrays = explode(
"\n", $metafile);
241 $modulenamearrays[$modulename] = $modulename;
245 foreach ($modulenamearrays as $modulenameval) {
246 if (strpos($modulenameval,
'#') === 0) {
249 if (strpos($modulenameval,
'//') === 0) {
252 if (!trim($modulenameval)) {
259 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulenameval;
261 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulenameval;
263 dol_syslog(
"We copy now directory ".$submodulenamedir.
" into target dir ".$dirins.
'/'.$modulenameval);
264 $result =
dolCopyDir($submodulenamedir, $dirins.
'/'.$modulenameval,
'0444', 1);
266 dol_syslog(
'Failed to call dolCopyDir result='.$result.
" with param ".$submodulenamedir.
" and ".$dirins.
'/'.$modulenameval, LOG_WARNING);
267 $langs->load(
"errors");
268 setEventMessages($langs->trans(
"ErrorFailToCopyDir", $submodulenamedir, $dirins.
'/'.$modulenameval),
null,
'errors');
275 setEventMessages($langs->trans(
"ErrorFailToRenameFile", $_FILES[
'fileinstall'][
'tmp_name'], $newfile),
null,
'errors');
305 $message = $langs->trans(
"SetupIsReadyForUse", DOL_URL_ROOT.
'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv(
"Home").
' - '.$langs->transnoentitiesnoconv(
"Setup").
' - '.$langs->transnoentitiesnoconv(
"Modules"));
308} elseif ($action ==
'install' && !$allowonlineinstall) {
309 httponly_accessforbidden(
"You try to bypass the protection to disallow deployment of an external module. Hack attempt ?");
312if ($action ==
'set' && $user->admin) {
317 if ($checkOldValue !=
getDolGlobalInt(
'CHECKLASTVERSION_EXTERNALMODULE')) {
318 setEventMessage($langs->trans(
'WarningModuleHasChangedLastVersionCheckParameter', $value),
'warnings');
320 if ($csrfCheckOldValue !=
getDolGlobalInt(
'MAIN_SECURITY_CSRF_WITH_TOKEN')) {
321 setEventMessage($langs->trans(
'WarningModuleHasChangedSecurityCsrfParameter', $value),
'warnings');
325 if (!empty($resarray[
'errors'])) {
329 if ($resarray[
'nbperms'] > 0) {
330 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
331 $resqltmp = $db->query($tmpsql);
333 $obj = $db->fetch_object($resqltmp);
335 if ($obj && $obj->nb > 1) {
336 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
344 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
346} elseif ($action ==
'reset' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
352 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
354} elseif (
getDolGlobalInt(
"MAIN_FEATURES_LEVEL") > 1 && $action ==
'reload' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
356 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
359 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
362 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
363 if (!empty($resarray[
'errors'])) {
366 if ($resarray[
'nbperms'] > 0) {
367 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
368 $resqltmp = $db->query($tmpsql);
370 $obj = $db->fetch_object($resqltmp);
371 if ($obj && $obj->nb > 1) {
372 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
380 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
391$form =
new Form($db);
394$morecss = array(
"/admin/dolistore/css/dolistore.css");
402$help_url =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
403llxHeader(
'', $langs->trans(
"Setup"), $help_url,
'',
'',
'', $morejs, $morecss, 0,
'mod-admin page-modules');
409$arrayofnatures = array(
410 'core' => array(
'label' => $langs->transnoentitiesnoconv(
"NativeModules")),
411 'external' => array(
'label' => $langs->transnoentitiesnoconv(
"External").
' - ['.$langs->trans(
"AllPublishers").
']')
413$arrayofwarnings = array();
414$arrayofwarningsext = array();
419$publisherlogoarray = array();
423$modNameLoaded = array();
425foreach ($modulesdir as $dir) {
428 dol_syslog(
"Scan directory ".$dir.
" for module descriptor files (modXXX.class.php)");
429 $handle = @opendir($dir);
430 if (is_resource($handle)) {
431 while (($file = readdir($handle)) !==
false) {
433 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
434 $modName = substr($file, 0,
dol_strlen($file) - 10);
437 if (!empty($modNameLoaded[$modName])) {
438 $mesg =
"Error: Module ".$modName.
" was found twice: Into ".$modNameLoaded[$modName].
" and ".$dir.
". You probably have an old file on your disk.<br>";
445 $res = include_once $dir.$file;
446 if (class_exists($modName)) {
447 $objMod =
new $modName($db);
448 '@phan-var-force DolibarrModules $objMod';
449 $modNameLoaded[$modName] = $dir;
450 if (!$objMod->numero > 0 && $modName !=
'modUser') {
451 dol_syslog(
'The module descriptor '.$modName.
' must have a numero property', LOG_ERR);
453 $j = $objMod->numero;
455 $modulequalified = 1;
458 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
460 $modulequalified = 0;
463 $modulequalified = 0;
466 $modulequalified = 0;
470 if (!empty($objMod->hidden)) {
471 $modulequalified = 0;
474 if ($modulequalified > 0) {
476 $external = ($objMod->isCoreOrExternalModule() ==
'external');
486 $arrayofnatures[
'external_'.$publisher] = array(
'label' => $langs->trans(
"External").
' - '.$publisher,
'data-html' => $langs->trans(
"External").
' - <span class="opacitymedium inine-block valignmiddle">'.$publisher.
'</span>');
488 $arrayofnatures[
'external_'] = array(
'label' => $langs->trans(
"External").
' - ['.$langs->trans(
"UnknownPublishers").
']');
491 ksort($arrayofnatures);
494 $filename[$i] = $modName;
495 $modules[$modName] = $objMod;
498 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
499 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
500 $familykey = key($objMod->familyinfo);
502 $familykey = $objMod->family;
504 '@phan-var-force string $familykey';
506 $moduleposition = ($objMod->module_position ? $objMod->module_position :
'50');
507 if ($objMod->isCoreOrExternalModule() ==
'external' && $moduleposition < 100000) {
509 $moduleposition =
'80';
513 if (!empty($objMod->warnings_activation)) {
514 $arrayofwarnings[$modName] = $objMod->warnings_activation;
516 if (!empty($objMod->warnings_activation_ext)) {
517 $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
520 $familyposition = (empty($familyinfo[$familykey][
'position']) ?
'0' : $familyinfo[$familykey][
'position']);
521 $listOfOfficialModuleGroups = array(
'hr',
'technic',
'interface',
'technic',
'portal',
'financial',
'crm',
'base',
'products',
'srm',
'ecm',
'projects',
'other');
522 if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
524 if (is_numeric($familyposition)) {
525 $familyposition = sprintf(
"%03d", (
int) $familyposition + 100);
529 $orders[$i] = $familyposition.
"_".$familykey.
"_".$moduleposition.
"_".$j;
532 $specialstring =
'unknown';
533 if ($objMod->version ==
'development' || $objMod->version ==
'experimental') {
534 $specialstring =
'expdev';
536 if (isset($categ[$specialstring])) {
537 $categ[$specialstring]++;
539 $categ[$specialstring] = 1;
544 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
547 print
info_admin(
"admin/modules.php Warning bad descriptor file : ".$dir.$file.
" (Class ".$modName.
" not found into file)", 0, 0,
'1',
'warning');
550 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
557 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
561if ($action ==
'reset_confirm' && $user->admin) {
562 if (!empty($modules[$value])) {
563 $objMod = $modules[$value];
565 if (!empty($objMod->langfiles)) {
566 $langs->loadLangs($objMod->langfiles);
569 $form =
new Form($db);
570 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmUnactivation'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reset',
'',
'no', 1);
574if ($action ==
'reload_confirm' && $user->admin) {
575 if (!empty($modules[$value])) {
576 $objMod = $modules[$value];
578 if (!empty($objMod->langfiles)) {
579 $langs->loadLangs($objMod->langfiles);
582 $form =
new Form($db);
583 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmReload'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reload',
'',
'no', 1);
594$nbofactivatedmodules = count($conf->modules);
597$nbmodulesnotautoenabled = count($conf->modules);
598$listofmodulesautoenabled = array(
'agenda',
'fckeditor',
'export',
'import');
599foreach ($listofmodulesautoenabled as $moduleautoenable) {
600 if (in_array($moduleautoenable, $conf->modules)) {
601 $nbmodulesnotautoenabled--;
609if ($mode ==
'common' || $mode ==
'commonkanban') {
610 $desc = $langs->trans(
"ModulesDesc",
'{picto}');
611 $desc .=
' '.$langs->trans(
"ModulesDesc2",
'{picto2}');
612 $desc = str_replace(
'{picto}',
img_picto(
'',
'switch_off',
'class="size15x"'), $desc);
613 $desc = str_replace(
'{picto2}',
img_picto(
'',
'setup',
'class="size15x"'), $desc);
614 if ($nbmodulesnotautoenabled <=
getDolGlobalInt(
'MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) {
615 $deschelp .=
'<div class="info hideonsmartphone">'.$desc.
"<br></div>\n";
618 $deschelp .=
'<div class="info">'.$langs->trans(
getDolGlobalString(
'MAIN_SETUP_MODULES_INFO')).
"<br></div>\n";
624if ($mode ==
'marketplace') {
627if ($mode ==
'deploy') {
628 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDeployDesc", $langs->transnoentitiesnoconv(
"AvailableModules")).
"<br></div><br>\n";
630if ($mode ==
'develop') {
631 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDevelopDesc").
"<br></div><br>\n";
637if ($mode ==
'common' || $mode ==
'commonkanban') {
640 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
641 print
'<input type="hidden" name="token" value="'.newToken().
'">';
642 if (isset($optioncss) && $optioncss !=
'') {
643 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
645 if (isset($sortfield) && $sortfield !=
'') {
646 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
648 if (isset($sortorder) && $sortorder !=
'') {
649 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
651 if (isset($page) && $page !=
'') {
652 print
'<input type="hidden" name="page" value="'.$page.
'">';
654 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
660 $moreforfilter =
'<div class="valignmiddle">';
662 $moreforfilter .=
'<div class="floatright right pagination paddingtop --module-list"><ul><li>';
663 $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'));
665 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.$param,
'', ($mode ==
'common' ? 2 : 1), array(
'morecss' =>
'reposition'));
666 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=commonkanban'.$param,
'', ($mode ==
'commonkanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
667 $moreforfilter .=
'</li></ul></div>';
669 $moreforfilter .=
'<div class="divfilteralone colorbacktimesheet float valignmiddle">';
670 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
671 $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')).
'">';
672 $moreforfilter .=
'</div>';
673 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
674 $moreforfilter .= $form->selectarray(
'search_nature', $arrayofnatures,
dol_escape_htmltag($search_nature), $langs->trans(
'Origin'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth250', 1);
675 $moreforfilter .=
'</div>';
678 $array_version = array(
'stable' => $langs->transnoentitiesnoconv(
"Stable"));
680 $array_version[
'deprecated'] = $langs->trans(
"Deprecated");
683 $array_version[
'experimental'] = $langs->trans(
"Experimental");
686 $array_version[
'development'] = $langs->trans(
"Development");
688 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
689 $moreforfilter .= $form->selectarray(
'search_version', $array_version, $search_version, $langs->transnoentitiesnoconv(
'Version'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
690 $moreforfilter .=
'</div>';
692 $array_status = array(
'active' => $langs->transnoentitiesnoconv(
"Enabled"),
'disabled' => $langs->transnoentitiesnoconv(
"Disabled"));
693 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
694 $moreforfilter .= $form->selectarray(
'search_status', $array_status, $search_status, $langs->transnoentitiesnoconv(
'Status'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
695 $moreforfilter .=
'</div>';
696 $moreforfilter .=
' ';
697 $moreforfilter .=
'<div class="divsearchfield valignmiddle inline-block">';
698 $moreforfilter .=
'<input type="submit" name="buttonsubmit" class="button small nomarginleft" value="'.dol_escape_htmltag($langs->trans(
"Refresh")).
'">';
699 if ($search_keyword || ($search_nature && $search_nature !=
'-1') || ($search_version && $search_version !=
'-1') || ($search_status && $search_status !=
'-1')) {
700 $moreforfilter .=
' ';
701 $moreforfilter .=
'<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans(
"Reset")).
'">';
703 $moreforfilter .=
'</div>';
704 $moreforfilter .=
'</div>';
706 $moreforfilter .=
'</div>';
708 if (!empty($moreforfilter)) {
709 print $moreforfilter;
710 $parameters = array();
711 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
712 print $hookmanager->resPrint;
717 print
'<div class="clearboth"></div><br>';
720 $parameters = array();
721 $reshook = $hookmanager->executeHooks(
'insertExtraHeader', $parameters,
$object, $action);
726 $disabled_modules = array();
727 if (!empty($_SESSION[
"disablemodules"])) {
728 $disabled_modules = explode(
',', $_SESSION[
"disablemodules"]);
733 $foundoneexternalmodulewithupdate = 0;
735 $atleastonequalified = 0;
736 $atleastoneforfamily = 0;
738 foreach ($orders as $key => $value) {
740 $tab = explode(
'_', $value);
741 $familykey = $tab[1];
742 $module_position = $tab[2];
744 $modName = $filename[$key];
747 $objMod = $modules[$modName];
750 if ($mode ==
'expdev' && $objMod->version !=
'development' && $objMod->version !=
'experimental') {
754 if (!$objMod->getName()) {
755 dol_syslog(
"Error for module ".$key.
" - Property name of module looks empty", LOG_WARNING);
759 $modulenameshort = strtolower(preg_replace(
'/^mod/i',
'', get_class($objMod)));
760 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
763 $modulename = $objMod->getName();
764 $moduletechnicalname = $objMod->name;
765 $moduledesc = $objMod->getDesc();
766 $moduledesclong = $objMod->getDescLong();
767 $moduleauthor = $objMod->getPublisher();
770 if ($search_keyword) {
772 if (preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $modulename)
773 || preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduletechnicalname)
774 || ($moduledesc && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesc))
775 || ($moduledesclong && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesclong))
776 || ($moduleauthor && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduleauthor))
784 if ($search_status) {
792 if ($search_nature) {
793 if (preg_match(
'/^external/', $search_nature) && $objMod->isCoreOrExternalModule() !=
'external') {
797 if (preg_match(
'/^external_(.*)$/', $search_nature, $reg)) {
803 if (!$reg[1] && !empty($publisher)) {
807 if ($search_nature ==
'core' && $objMod->isCoreOrExternalModule() ==
'external') {
811 if ($search_version) {
812 if (($objMod->version ==
'development' || $objMod->version ==
'experimental' || preg_match(
'/deprecated/', $objMod->version)) && $search_version ==
'stable') {
815 if ($objMod->version !=
'development' && ($search_version ==
'development')) {
818 if ($objMod->version !=
'experimental' && ($search_version ==
'experimental')) {
821 if (!preg_match(
'/deprecated/', $objMod->version) && ($search_version ==
'deprecated')) {
826 $atleastonequalified++;
829 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
830 foreach ($objMod->langfiles as $domain) {
831 $langs->load($domain);
836 if ($familykey != $oldfamily) {
838 print
'</table></div><br>';
841 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
845 if ($mode ==
'commonkanban') {
846 print
'<div class="box-flex-container kanban">';
848 print
'<div class="div-table-responsive">';
849 print
'<table class="tagtable liste" summary="list_of_modules">'.
"\n";
852 $atleastoneforfamily = 0;
855 $atleastoneforfamily++;
857 if ($familykey != $oldfamily) {
858 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
859 $oldfamily = $familykey;
863 $version = $objMod->getVersion(0);
866 if (preg_match(
'/development/i', $version)) {
867 $warningstring = $langs->trans(
"Development");
869 if (preg_match(
'/experimental/i', $version)) {
870 $warningstring = $langs->trans(
"Experimental");
872 if (preg_match(
'/deprecated/i', $version)) {
873 $warningstring = $langs->trans(
"Deprecated");
876 if ($objMod->isCoreOrExternalModule() ==
'external' || preg_match(
'/development|experimental|deprecated/i', $version)) {
877 $versiontrans .= $objMod->getVersion(1);
880 if ($objMod->isCoreOrExternalModule() ==
'external'
882 $action ==
'checklastversion'
888 $checkRes = $objMod->checkForUpdate();
890 setEventMessages($objMod->getName().
' : '.preg_replace(
'/[^a-z0-9_\.\-\s]/i',
'', $versiontrans).
' -> '.preg_replace(
'/[^a-z0-9_\.\-\s]/i',
'', $objMod->lastVersion),
null,
'mesgs');
891 } elseif ($checkRes < 0) {
892 setEventMessages($objMod->getName().
' '.$langs->trans(
'CheckVersionFail'),
null,
'warnings');
896 if ($objMod->isCoreOrExternalModule() ==
'external' && $action ==
'checklastversion' && !
getDolGlobalString(
'DISABLE_CHECK_ON_MALWARE_MODULES')) {
897 $checkRes = $objMod->checkForCompliance();
898 if (!is_numeric($checkRes) && $checkRes !=
'') {
899 $langs->load(
"errors");
900 setEventMessages($objMod->getName().
' : '.$langs->trans($checkRes),
null,
'errors');
906 if ($objMod->isCoreOrExternalModule() ==
'external') {
907 $imginfo =
"info_black";
910 $codeenabledisable =
'';
914 if (in_array($modulenameshort, $disabled_modules)) {
915 $objMod->disabled =
true;
922 if (!empty($arrayofwarnings[$modName])) {
923 $codeenabledisable .=
'<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
926 if (!empty($objMod->disabled)) {
927 $codeenabledisable .= $langs->trans(
"Disabled");
928 } elseif (!empty($objMod->always_enabled) || ((isModEnabled(
'multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
930 if (method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
931 $codeenabledisable .= $langs->trans(
"Used");
933 $codeenabledisable .=
img_picto($langs->trans(
"Required"),
'switch_on',
'',
false, 0, 0,
'',
'opacitymedium valignmiddle');
936 if (isModEnabled(
'multicompany') && $user->entity) {
941 if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
942 $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.
'">';
943 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
944 $codeenabledisable .=
'</a>';
946 $codeenabledisable .=
' ';
947 $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.
'">';
948 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
949 $codeenabledisable .=
'</a>';
952 $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.
'">';
953 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
954 $codeenabledisable .=
'</a>';
956 $codeenabledisable .=
' ';
957 $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.
'">';
958 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
959 $codeenabledisable .=
'</a>';
965 if (!empty($objMod->config_page_url) && !$disableSetup) {
966 $backtourlparam =
'';
967 if ($search_keyword !=
'') {
968 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_keyword='.urlencode($search_keyword);
970 if ($search_nature > -1) {
971 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_nature='.urlencode($search_nature);
973 if ($search_version > -1) {
974 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_version='.urlencode($search_version);
976 if ($search_status > -1) {
977 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_status='.urlencode($search_status);
979 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
982 if (is_array($objMod->config_page_url)) {
984 foreach ($objMod->config_page_url as $page) {
987 $codetoconfig .=
'<a href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
990 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
991 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
992 $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>';
994 $urltouse = $urlpage;
995 $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>';
999 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', (
string) $objMod->config_page_url, $regs)) {
1000 $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>';
1002 $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>';
1005 $codetoconfig .=
img_picto($langs->trans(
"NothingToSetup"),
"setup",
'class="opacitytransp" style="padding-right: 6px"',
false, 0, 0,
'',
'fa-15');
1009 if (!empty($objMod->always_enabled)) {
1011 $codeenabledisable .=
'<!-- Message to show: an always_enabled module has been disabled -->'.
"\n";
1012 $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.
'"';
1013 $codeenabledisable .=
'>';
1014 $codeenabledisable .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
1015 $codeenabledisable .=
"</a>\n";
1016 } elseif (!empty($objMod->disabled)) {
1017 $codeenabledisable .= $langs->trans(
"Disabled");
1020 $warningmessage =
'';
1021 if (!empty($arrayofwarnings[$modName])) {
1022 $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";
1023 foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
1024 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
1025 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
1029 if ($objMod->isCoreOrExternalModule() ==
'external' && !empty($arrayofwarningsext)) {
1030 $codeenabledisable .=
'<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
1031 foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
1032 $keymodulelowercase = strtolower(preg_replace(
'/^mod/',
'', $keymodule));
1033 if (in_array($keymodulelowercase, $conf->modules)) {
1034 foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
1035 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
1036 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
1037 $warningmessage .= ($warningmessage ?
"\n" :
"").($warningmessage ?
"\n" :
"").$langs->trans(
"Module").
' : '.$objMod->getName();
1038 if (!empty($objMod->editor_name)) {
1039 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"Publisher").
' : '.$objMod->editor_name;
1041 if (!empty($objMod->editor_name)) {
1042 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"ModuleTriggeringThisWarning").
' : '.$modules[$keymodule]->getName();
1049 $codeenabledisable .=
'<!-- Message to show: '.$warningmessage.
' -->'.
"\n";
1050 $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.
'"';
1051 if ($warningmessage) {
1052 $codeenabledisable .=
' onclick="return confirm(\''.dol_escape_js($warningmessage).
'\');
"';
1054 $codeenabledisable .= '>';
1055 $codeenabledisable .= img_picto($langs->trans("Disabled
"), 'switch_off');
1056 $codeenabledisable .= "</a>\n
";
1059 // Set $codetoconfig
1060 $codetoconfig .= img_picto($langs->trans("NothingToSetup
"), "setup
", 'class="opacitytransp
" style="padding-right: 6px
"');
1063 if ($mode == 'commonkanban') {
1065 print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
1067 print '<tr class="oddeven
'.($warningstring ? ' info-box-content-warning
' : '').'">'."\n
";
1068 if (getDolGlobalString('MAIN_MODULES_SHOW_LINENUMBERS')) {
1069 print '<td class="width50
">'.$linenum.'</td>';
1072 // Picto + Name of module
1073 print ' <td class="tdoverflowmax200 minwidth200imp
" title="'.dol_escape_htmltag($objMod->getName()).'">';
1075 //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
1076 //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
1077 if (!empty($objMod->picto)) {
1078 if (preg_match('/^\//i', $objMod->picto)) {
1079 print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"', 1);
1081 print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"');
1084 print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly
"');
1086 print ' <span class="valignmiddle
">'.$objMod->getName().'</span>';
1090 print '<td class="valignmiddle tdoverflowmax300 minwidth200imp
">';
1091 print nl2br($objMod->getDesc());
1095 print '<td class="center nowrap
" style="width: 82px;
">';
1096 //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
1097 print '<a href="javascript:
document_preview(\
''.DOL_URL_ROOT.
'/admin/modulehelp.php?id='.((
int) $objMod->numero).
'\',\
'text/html\',\''.dol_escape_js($langs->trans(
"Module")).
'\')
">'.img_picto(($objMod->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule
").' - ' : '').$langs->trans("ClickToShowDescription
"), $imginfo).'</a>';
1101 print '<td class="center nowrap width150
" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
1102 if ($objMod->needUpdate) {
1103 $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
1104 print '<span class="badge badge-warning classfortooltip
" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
1106 print $versiontrans;
1110 // Link enable/disable
1111 print '<td class="center valignmiddle left nowraponall
" width="60px
">';
1112 print $codeenabledisable;
1116 print '<td class="tdsetuppicto right valignmiddle
" width="60px
">';
1117 print $codetoconfig;
1122 if ($objMod->needUpdate) {
1123 $foundoneexternalmodulewithupdate++;
1127 if ($action == 'checklastversion') {
1128 if ($foundoneexternalmodulewithupdate) {
1129 setEventMessages($langs->trans("ModuleUpdateAvailable
"), null, 'mesgs');
1131 setEventMessages($langs->trans("NoExternalModuleWithUpdate
"), null, 'mesgs');
1136 if ($mode == 'commonkanban') {
1144 if (!$atleastonequalified) {
1145 print '<br><span class="opacitymedium
">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria
").'</span><br><br>';
1148 print dol_get_fiche_end();
1152 // Show warning about external users
1153 print info_admin(showModulesExludedForExternal($modules))."\n
";
1158if ($mode == 'marketplace') {
1159 print dol_get_fiche_head($head, $mode, '', -1);
1166 print '<div class="div-
table-responsive-no-min
">';
1167 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1168 print '<tr class="liste_titre
">'."\n
";
1169 print '<td class="hideonsmartphone
">'.$form->textwithpicto($langs->trans("Provider
"), $langs->trans("WebSiteDesc
")).'</td>';
1171 print '<td>'.$langs->trans("URL
").'</td>';
1174 print '<tr class="oddeven
">'."\n
";
1175 $url = 'https://www.dolistore.com';
1176 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>';
1177 print '<td><span class="opacitymedium
">'.$langs->trans("DoliStoreDesc
").'</span></td>';
1178 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">'.$url.'</a></td>';
1184 print dol_get_fiche_end();
1188 if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) {
1189 // $options is array with filter criteria
1190 //var_dump($options);
1191 $dolistore->getRemoteCategories();
1192 $dolistore->getRemoteProducts($options);
1194 print '<span class="opacitymedium
">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
1196 $previouslink = $dolistore->get_previous_link();
1197 $nextlink = $dolistore->get_next_link();
1199 print '<div class="liste_titre liste_titre_bydiv centpercent
"><div class="divsearchfield
">';
1201 print '<form method="POST
" class="centpercent
" id="searchFormList
" action="'.$dolistore->url.'">'; ?>
1202 <input type="hidden
" name="token
" value="<?php echo
newToken(); ?>
">
1203 <input type="hidden
" name="mode
" value="marketplace
">
1204 <div class="divsearchfield
">
1205 <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>
1207 <div class="divsearchfield
">
1208 <input class="button buttongen
" value="<?php echo $langs->trans(
'Rechercher') ?>
" type="submit
">
1209 <a class="buttonreset
" href="<?php echo urlencode($dolistore->url) ?>
"><?php echo $langs->trans('Reset') ?></a>
1214 print $previouslink;
1218 print '</div></div>';
1219 print '<div class="clearboth
"></div>';
1222 <div id="category-tree-left
">
1225 echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content?>
1228 <div id="listing-content
">
1229 <table summary="list_of_modules
" id="list_of_modules
" class="productlist centpercent
">
1230 <tbody id="listOfModules
">
1231 <?php echo $dolistore->get_products(); ?>
1240// Install external module
1242if ($mode == 'deploy') {
1243 print dol_get_fiche_head($head, $mode, '', -1);
1245 $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank
" rel="noopener noreferrer
">'.$urldolibarrmodules.'</a>';
1247 if ($allowonlineinstall) {
1248 if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
1249 $message = info_admin($langs->trans("ConfFileMustContainCustom
", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
1253 if (!is_writable(dol_osencode($dirins))) {
1254 $langs->load("errors
");
1255 $message = info_admin($langs->trans("ErrorFailedToWriteInDir
", $dirins), 0, 0, '1', 'warning');
1259 $message = info_admin($langs->trans("NotExistsDirect
", $dirins).$langs->trans("InfDirAlt
").$langs->trans("InfDirExample
"));
1264 if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
1265 // Show clean message
1266 if (!is_numeric(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))) {
1267 $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')), 0, 0, 'warning');
1269 $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'), 0, 0, 'warning');
1272 // Show technical message
1273 $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile
", $dolibarrdataroot.'/installmodules.lock'), 0, 0, 'warning');
1280 if ($allowfromweb < 1) {
1281 print $langs->trans("SomethingMakeInstallFromWebNotPossible
");
1283 //print $langs->trans("SomethingMakeInstallFromWebNotPossible2
");
1289 // $allowfromweb = -1 if installation or setup not correct, 0 if not allowed, 1 if allowed
1290 if ($allowfromweb >= 0) {
1291 if ($allowfromweb == 1) {
1292 //print $langs->trans("ThisIsProcessToFollow
").'<br>';
1294 print $langs->trans("ThisIsAlternativeProcessToFollow
").'<br>';
1295 print '<b>'.$langs->trans("StepNb
", 1).'</b>: ';
1296 print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite
", '{s1}')).'<br>';
1297 print '<b>'.$langs->trans("StepNb
", 2).'</b>: ';
1298 print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite
", '{s1}')).'<br>';
1299 print '<b>'.$langs->trans("StepNb
", 3).'</b>: ';
1302 if ($allowfromweb == 1) {
1303 print '<form enctype="multipart/form-data
" method="POST
" class="noborder
" action="'.$_SERVER["PHP_SELF"].'" name="forminstall
">';
1304 print '<input type="hidden
" name="token
" value="'.newToken().'">';
1305 print '<input type="hidden
" name="action
" value="install
">';
1306 print '<input type="hidden
" name="mode
" value="deploy
">';
1308 print $langs->trans("YouCanSubmitFile
").'<br><br>';
1310 $max = getDolGlobalString('MAIN_UPLOAD_DOC'); // In Kb
1311 $maxphp = @ini_get('upload_max_filesize'); // In unknown
1312 if (preg_match('/k$/i', $maxphp)) {
1313 $maxphp = preg_replace('/k$/i', '', $maxphp);
1316 if (preg_match('/m$/i', $maxphp)) {
1317 $maxphp = preg_replace('/m$/i', '', $maxphp);
1320 if (preg_match('/g$/i', $maxphp)) {
1321 $maxphp = preg_replace('/g$/i', '', $maxphp);
1322 $maxphp *= 1024 * 1024;
1324 if (preg_match('/t$/i', $maxphp)) {
1325 $maxphp = preg_replace('/t$/i', '', $maxphp);
1326 $maxphp *= 1024 * 1024 * 1024;
1328 $maxphp2 = @ini_get('post_max_size'); // In unknown
1329 if (preg_match('/k$/i', $maxphp2)) {
1330 $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
1333 if (preg_match('/m$/i', $maxphp2)) {
1334 $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
1337 if (preg_match('/g$/i', $maxphp2)) {
1338 $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
1339 $maxphp2 *= 1024 * 1024;
1341 if (preg_match('/t$/i', $maxphp2)) {
1342 $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
1343 $maxphp2 *= 1024 * 1024 * 1024;
1345 // Now $max and $maxphp and $maxphp2 are in Kb
1347 $maxphptoshow = $maxphptoshowparam = '';
1349 $maxmin = min($max, $maxphp);
1350 $maxphptoshow = $maxphp;
1351 $maxphptoshowparam = 'upload_max_filesize';
1354 $maxmin = min($max, $maxphp2);
1355 if ($maxphp2 < $maxphp) {
1356 $maxphptoshow = $maxphp2;
1357 $maxphptoshowparam = 'post_max_size';
1362 print '<script type="text/javascript
">
1363 $(document).ready(function() {
1364 jQuery("#fileinstall
").on("change
", function() {
1365 if(this.files[0].size > '.($maxmin * 1024).') {
1366 alert("'.dol_escape_js($langs->transnoentitiesnoconv("ErrorFileSizeTooLarge")).'");
1372 // MAX_FILE_SIZE doit précéder le champ input de type file
1373 print '<input type="hidden
" name="MAX_FILE_SIZE
" value="'.($maxmin * 1024).'">';
1376 print '<input class="flat minwidth400
" type="file
" name="fileinstall
" id="fileinstall
"> ';
1378 print '<input type="submit
" name="send
" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button small
">';
1380 if (getDolGlobalString('MAIN_UPLOAD_DOC')) {
1382 $langs->load('other');
1384 print info_admin($langs->trans("ThisLimitIsDefinedInSetup
", $max, $maxphptoshow, $maxphptoshowparam), 1);
1387 print ' ('.$langs->trans("UploadDisabled
").')';
1395 print '<div class="center
"><div class="logo_setup
"></div></div>';
1397 print $langs->trans("UnpackPackageInModulesRoot
", $dirins).'<br>';
1398 print '<b>'.$langs->trans("StepNb
", 4).'</b>: ';
1399 print $langs->trans("SetupIsReadyForUse
", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home
").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules
")).'<br>';
1403 if (!empty($result['return'])) {
1406 foreach ($result['return'] as $value) {
1411 print dol_get_fiche_end();
1414if ($mode == 'develop') {
1415 print dol_get_fiche_head($head, $mode, '', -1);
1422 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1423 print '<tr class="liste_titre
">'."\n
";
1424 //print '<td>'.$langs->trans("Logo
").'</td>';
1425 print '<td colspan="2
">'.$langs->trans("DevelopYourModuleDesc
").'</td>';
1426 print '<td>'.$langs->trans("URL
").'</td>';
1429 print '<tr class="oddeven
" height="80
">'."\n
";
1430 print '<td class="center
">';
1431 print '<div class="imgmaxheight50 logo_setup
"></div>';
1433 print '<td>'.$langs->trans("TryToUseTheModuleBuilder
", $langs->transnoentitiesnoconv("ModuleBuilder
")).'</td>';
1434 print '<td class="maxwidth300
">';
1435 if (isModEnabled('modulebuilder')) {
1436 print $langs->trans("SeeTopRightMenu
");
1438 print '<span class="opacitymedium
">'.$langs->trans("ModuleMustBeEnabledFirst
", $langs->transnoentitiesnoconv("ModuleBuilder
")).'</span>';
1443 print '<tr class="oddeven
" height="80
">'."\n
";
1444 $url = 'https://partners.dolibarr.org';
1445 print '<td class="center
">';
1446 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>';
1448 print '<td>'.$langs->trans("DoliPartnersDesc
").'</td>';
1449 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">';
1450 print img_picto('', 'url', 'class="pictofixedwidth
"');
1451 print $url.'</a></td>';
1456 print dol_get_fiche_end();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
unActivateModule($value, $requiredby=1)
Disable a module.
activateModule($value, $withdeps=1, $noconfverification=0)
Enable a module.
modules_prepare_head($nbofactivatedmodules, $nboftotalmodules, $nbmodulesnotautoenabled)
Prepare array with list of tabs.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
dol_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disablevirusscan=0, $uploaderrorcode=0, $nohook=0, $varfiles='addedfile', $upload_dir='')
Check validity of a file upload from an GUI page, and move it to its final destination.
dol_uncompress($inputfile, $outputdir)
Uncompress a file.
dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement=null, $excludesubdir=0, $excludefileext=null, $excludearchivefiles=0)
Copy a dir to another dir.
dol_is_file($pathoffile)
Return if path is a file.
dol_is_dir($folder)
Test if filename is a directory.
dolGetModulesDirs($subdir='')
Return list of directories that contain modules.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dolGetButtonTitle($label, $helpText='', $iconClass='fa fa-file', $url='', $id='', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
treeview li table
No Email.
ui state ui widget content ui state ui widget header ui state a ui button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
document_preview(file, type, title)
Function show document preview.
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.