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.
'/core/modules/DolibarrModules.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/admin/remotestore/class/dolistore.class.php';
47@phan-var-force string $dolibarr_main_url_root_alt
62$langs->loadLangs(array(
"errors",
"admin",
"modulebuilder"));
65if (GETPOSTISSET(
'mode')) {
66 $mode =
GETPOST(
'mode',
'alpha');
67 if ($mode ==
'common' || $mode ==
'commonkanban') {
74$action =
GETPOST(
'action',
'aZ09');
75$value =
GETPOST(
'value',
'alpha');
77$search_keyword =
GETPOST(
'search_keyword',
'alpha');
78$search_status =
GETPOST(
'search_status',
'alpha');
79$search_nature =
GETPOST(
'search_nature',
'alpha');
80$search_version =
GETPOST(
'search_version',
'alpha');
85$options[
'per_page'] = 10;
89$options[
'search'] =
GETPOST(
'search_keyword',
'alpha');
99 'hr' => array(
'position' =>
'001',
'label' => $langs->trans(
"ModuleFamilyHr")),
100 'crm' => array(
'position' =>
'006',
'label' => $langs->trans(
"ModuleFamilyCrm")),
101 'srm' => array(
'position' =>
'007',
'label' => $langs->trans(
"ModuleFamilySrm")),
102 'financial' => array(
'position' =>
'009',
'label' => $langs->trans(
"ModuleFamilyFinancial")),
103 'products' => array(
'position' =>
'012',
'label' => $langs->trans(
"ModuleFamilyProducts")),
104 'projects' => array(
'position' =>
'015',
'label' => $langs->trans(
"ModuleFamilyProjects")),
105 'ecm' => array(
'position' =>
'018',
'label' => $langs->trans(
"ModuleFamilyECM")),
106 'technic' => array(
'position' =>
'021',
'label' => $langs->trans(
"ModuleFamilyTechnic")),
107 'portal' => array(
'position' =>
'040',
'label' => $langs->trans(
"ModuleFamilyPortal")),
108 'interface' => array(
'position' =>
'050',
'label' => $langs->trans(
"ModuleFamilyInterface")),
109 'base' => array(
'position' =>
'060',
'label' => $langs->trans(
"ModuleFamilyBase")),
110 'other' => array(
'position' =>
'100',
'label' => $langs->trans(
"ModuleFamilyOther")),
114if (!
GETPOST(
'buttonreset',
'alpha')) {
115 if ($search_keyword) {
116 $param .=
'&search_keyword='.urlencode($search_keyword);
118 if ($search_status && $search_status !=
'-1') {
119 $param .=
'&search_status='.urlencode($search_status);
121 if ($search_nature && $search_nature !=
'-1') {
122 $param .=
'&search_nature='.urlencode($search_nature);
124 if ($search_version && $search_version !=
'-1') {
125 $param .=
'&search_version='.urlencode($search_version);
129$dirins = DOL_DOCUMENT_ROOT.
'/custom';
130$urldolibarrmodules =
'https://www.dolistore.com/';
133$hookmanager->initHooks(array(
'adminmodules',
'globaladmin'));
136$max_execution_time_for_deploy =
getDolGlobalInt(
'MODULE_UPLOAD_MAX_EXECUTION_TIME', 300);
137if (!empty($max_execution_time_for_deploy)) {
138 $err = error_reporting();
141 @set_time_limit($max_execution_time_for_deploy);
142 error_reporting($err);
145$max_time = @ini_get(
"max_execution_time");
146if ($max_time && $max_time < $max_execution_time_for_deploy) {
147 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.");
148 @ini_set(
"max_execution_time", $max_execution_time_for_deploy);
152$dolibarrdataroot = preg_replace(
'/([\\/]+)$/i',
'', DOL_DATA_ROOT);
153$allowonlineinstall =
true;
155if (
dol_is_file($dolibarrdataroot.
'/installmodules.lock')) {
156 $allowonlineinstall =
false;
166$parameters = array();
167$reshook = $hookmanager->executeHooks(
'doActions', $parameters,
$object, $action);
172if (
GETPOST(
'buttonreset',
'alpha')) {
173 $search_keyword =
'';
176 $search_version =
'';
179if ($action ==
'install' && $allowonlineinstall) {
183 $original_file = basename($_FILES[
"fileinstall"][
"name"]);
184 $original_file = preg_replace(
'/\s*\(\d+\)\.zip$/i',
'.zip', $original_file);
185 $newfile =
$conf->admin->dir_temp.
'/'.$original_file.
'/'.$original_file;
187 if (!$original_file) {
188 $langs->load(
"Error");
189 setEventMessages($langs->trans(
"ErrorModuleFileRequired"),
null,
'warnings');
192 if (!$error && !preg_match(
'/\.zip$/i', $original_file)) {
193 $langs->load(
"errors");
194 setEventMessages($langs->trans(
"ErrorFileMustBeADolibarrPackage", $original_file),
null,
'errors');
197 if (!$error && !preg_match(
'/^(module[a-zA-Z0-9]*_|theme_|).*\-([0-9][0-9\.]*)(\s\(\d+\)\s)?\.zip$/i', $original_file)) {
198 $langs->load(
"errors");
199 setEventMessages($langs->trans(
"ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file,
'modulename-x[.y.z].zip'),
null,
'errors');
202 if (empty($_FILES[
'fileinstall'][
'tmp_name'])) {
203 $langs->load(
"errors");
210 if ($original_file) {
215 $tmpdir = preg_replace(
'/\.zip$/i',
'', $original_file).
'.dir';
221 $result =
dol_move_uploaded_file($_FILES[
'fileinstall'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'fileinstall'][
'error']);
225 if (!empty($result[
'error'])) {
226 $langs->load(
"errors");
227 setEventMessages($langs->trans($result[
'error'], $original_file),
null,
'errors');
231 $modulename = preg_replace(
'/module_/',
'', $original_file);
232 $modulename = preg_replace(
'/\-([0-9][0-9\.]*)\.zip$/i',
'', $modulename);
234 $modulenamedir =
$conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulename;
237 $modulenamedir =
$conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulename;
240 setEventMessages($langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat").
'<br>'.$langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename,
'htdocs/'.$modulename),
null,
'errors');
245 dol_syslog(
"Uncompress of module file is a success.");
284 if (
GETPOST(
'checkforcompliance') ==
'on') {
286 $res = include_once DOL_DOCUMENT_ROOT.
'/core/modules/DolibarrModules.class.php';
288 $checkRes = $dolibarrmodule->checkForcompliance($modulename);
290 if (!is_numeric($checkRes) && $checkRes !=
'') {
291 $langs->load(
"errors");
292 setEventMessages($modulename.
' : '.$langs->trans($checkRes),
null,
'errors');
306 $modulenamearrays = array();
307 if (
dol_is_file($modulenamedir.
'/metapackage.conf')) {
309 $metafile = file_get_contents($modulenamedir.
'/metapackage.conf');
310 $modulenamearrays = explode(
"\n", $metafile);
312 $modulenamearrays[$modulename] = $modulename;
317 foreach ($modulenamearrays as $modulenameval) {
318 if (strpos($modulenameval,
'#') === 0) {
321 if (strpos($modulenameval,
'//') === 0) {
324 if (!trim($modulenameval)) {
331 $submodulenamedir =
$conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulenameval;
333 $submodulenamedir =
$conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulenameval;
335 dol_syslog(
"We copy now directory ".$submodulenamedir.
" into target dir ".$dirins.
'/'.$modulenameval);
336 $result =
dolCopyDir($submodulenamedir, $dirins.
'/'.$modulenameval,
'0444', 1);
338 dol_syslog(
'Failed to call dolCopyDir result='.$result.
" with param ".$submodulenamedir.
" and ".$dirins.
'/'.$modulenameval, LOG_WARNING);
339 $langs->load(
"errors");
340 setEventMessages($langs->trans(
"ErrorFailToCopyDir", $submodulenamedir, $dirins.
'/'.$modulenameval),
null,
'errors');
348 setEventMessages($langs->trans(
"ErrorFailToRenameFile", $_FILES[
'fileinstall'][
'tmp_name'], $newfile),
null,
'errors');
378 $searchParams = array(
379 'search_keyword' => $modulenameval,
380 'search_status' =>
'-1',
381 'search_nature' =>
'-1',
382 'search_version' =>
'-1'
384 $queryString = http_build_query($searchParams);
385 $redirectUrl = DOL_URL_ROOT .
'/admin/modules.php?' . $queryString;
387 $message = $langs->trans(
"SetupIsReadyForUse", $redirectUrl, $langs->transnoentitiesnoconv(
"Home").
' - '.$langs->transnoentitiesnoconv(
"Setup").
' - '.$langs->transnoentitiesnoconv(
"Modules"));
391} elseif ($action ==
'install' && !$allowonlineinstall) {
392 httponly_accessforbidden(
"You try to bypass the protection to disallow deployment of an external module. Hack attempt ?");
395if ($action ==
'set' && $user->admin) {
400 if ($checkOldValue !=
getDolGlobalInt(
'CHECKLASTVERSION_EXTERNALMODULE')) {
401 setEventMessage($langs->trans(
'WarningModuleHasChangedLastVersionCheckParameter', $value),
'warnings');
403 if ($csrfCheckOldValue !=
getDolGlobalInt(
'MAIN_SECURITY_CSRF_WITH_TOKEN')) {
404 setEventMessage($langs->trans(
'WarningModuleHasChangedSecurityCsrfParameter', $value),
'warnings');
408 if (!empty($resarray[
'errors'])) {
412 if ($resarray[
'nbperms'] > 0) {
413 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
414 $resqltmp = $db->query($tmpsql);
416 $obj = $db->fetch_object($resqltmp);
418 if ($obj && $obj->nb > 1) {
419 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
427 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
429} elseif ($action ==
'reset' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
435 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
437} elseif (
getDolGlobalInt(
"MAIN_FEATURES_LEVEL") > 1 && $action ==
'reload' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
442 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
446 if (!empty($resarray[
'errors'])) {
449 if ($resarray[
'nbperms'] > 0) {
450 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
451 $resqltmp = $db->query($tmpsql);
453 $obj = $db->fetch_object($resqltmp);
454 if ($obj && $obj->nb > 1) {
455 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
463 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
474$form =
new Form($db);
477$morecss = array(
"/admin/remotestore/css/store.css");
485$help_url =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
486llxHeader(
'', $langs->trans(
"Setup"), $help_url,
'', 0, 0, $morejs, $morecss,
'',
'mod-admin page-modules');
492$arrayofnatures = array(
493 'core' => array(
'label' => $langs->transnoentitiesnoconv(
"NativeModules")),
494 'external' => array(
'label' => $langs->transnoentitiesnoconv(
"External").
' - ['.$langs->trans(
"AllPublishers").
']')
496$arrayofwarnings = array();
497$arrayofwarningsext = array();
502$publisherlogoarray = array();
506$modNameLoaded = array();
508foreach ($modulesdir as $dir) {
511 dol_syslog(
"Scan directory ".$dir.
" for module descriptor files (modXXX.class.php)");
512 $handle = @opendir($dir);
513 if (is_resource($handle)) {
514 while (($file = readdir($handle)) !==
false) {
516 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
517 $modName = substr($file, 0,
dol_strlen($file) - 10);
520 if (!empty($modNameLoaded[$modName])) {
521 $mesg =
"Error: Module ".$modName.
" was found twice: Into ".$modNameLoaded[$modName].
" and ".$dir.
". You probably have an old file on your disk.<br>";
528 $res = include_once $dir.$file;
529 if (class_exists($modName)) {
530 $objMod =
new $modName($db);
531 '@phan-var-force DolibarrModules $objMod';
532 $modNameLoaded[$modName] = $dir;
533 if (!$objMod->numero > 0 && $modName !=
'modUser') {
534 dol_syslog(
'The module descriptor '.$modName.
' must have a numero property', LOG_ERR);
536 $j = $objMod->numero;
538 $modulequalified = 1;
541 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
543 $modulequalified = 0;
546 $modulequalified = 0;
549 $modulequalified = 0;
553 if (!empty($objMod->hidden)) {
554 $modulequalified = 0;
557 if ($modulequalified > 0) {
559 $external = ($objMod->isCoreOrExternalModule() ==
'external');
569 $arrayofnatures[
'external_'.$publisher] = array(
'label' => $langs->trans(
"External").
' - '.$publisher,
'data-html' => $langs->trans(
"External").
' - <span class="opacitymedium inine-block valignmiddle">'.$publisher.
'</span>');
571 $arrayofnatures[
'external_'] = array(
'label' => $langs->trans(
"External").
' - ['.$langs->trans(
"UnknownPublishers").
']');
574 ksort($arrayofnatures);
577 $filename[$i] = $modName;
578 $modules[$modName] = $objMod;
581 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
582 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
583 $familykey = key($objMod->familyinfo);
585 $familykey = $objMod->family;
587 '@phan-var-force string $familykey';
589 $moduleposition = ($objMod->module_position ? $objMod->module_position :
'50');
590 if ($objMod->isCoreOrExternalModule() ==
'external' && $moduleposition < 100000) {
592 $moduleposition =
'80';
596 if (!empty($objMod->warnings_activation)) {
597 $arrayofwarnings[$modName] = $objMod->warnings_activation;
599 if (!empty($objMod->warnings_activation_ext)) {
600 $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
603 $familyposition = (empty($familyinfo[$familykey][
'position']) ?
'0' : $familyinfo[$familykey][
'position']);
604 $listOfOfficialModuleGroups = array(
'hr',
'technic',
'interface',
'technic',
'portal',
'financial',
'crm',
'base',
'products',
'srm',
'ecm',
'projects',
'other');
605 if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
607 if (is_numeric($familyposition)) {
608 $familyposition = sprintf(
"%03d", (
int) $familyposition + 100);
612 $orders[$i] = $familyposition.
"_".$familykey.
"_".$moduleposition.
"_".$j;
615 $specialstring =
'unknown';
616 if ($objMod->version ==
'development' || $objMod->version ==
'experimental') {
617 $specialstring =
'expdev';
619 if (isset($categ[$specialstring])) {
620 $categ[$specialstring]++;
622 $categ[$specialstring] = 1;
627 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
630 print
info_admin(
"admin/modules.php Warning bad descriptor file : ".$dir.$file.
" (Class ".$modName.
" not found into file)", 0, 0,
'1',
'warning');
633 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
640 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
644'@phan-var-force array<string,DolibarrModules> $modules';
646if ($action ==
'reset_confirm' && $user->admin) {
647 if (!empty($modules[$value])) {
648 $objMod = $modules[$value];
650 if (!empty($objMod->langfiles)) {
651 $langs->loadLangs($objMod->langfiles);
654 $form =
new Form($db);
655 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmUnactivation'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reset',
'',
'no', 1);
659if ($action ==
'reload_confirm' && $user->admin) {
660 if (!empty($modules[$value])) {
661 $objMod = $modules[$value];
663 if (!empty($objMod->langfiles)) {
664 $langs->loadLangs($objMod->langfiles);
667 $form =
new Form($db);
668 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmReload'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reload',
'',
'no', 1);
679$nbofactivatedmodules = count(
$conf->modules);
682$nbmodulesnotautoenabled = count(
$conf->modules);
683$listofmodulesautoenabled = array(
'agenda',
'fckeditor',
'export',
'import');
684foreach ($listofmodulesautoenabled as $moduleautoenable) {
685 if (in_array($moduleautoenable,
$conf->modules)) {
686 $nbmodulesnotautoenabled--;
694if ($mode ==
'common' || $mode ==
'commonkanban') {
695 $desc = $langs->trans(
"ModulesDesc",
'{picto}');
696 $desc .=
' '.$langs->trans(
"ModulesDesc2",
'{picto2}');
697 $desc = str_replace(
'{picto}',
img_picto(
'',
'switch_off',
'class="size15x"'), $desc);
698 $desc = str_replace(
'{picto2}',
img_picto(
'',
'setup',
'class="size15x"'), $desc);
699 if ($nbmodulesnotautoenabled <=
getDolGlobalInt(
'MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) {
700 $deschelp .=
'<div class="info hideonsmartphone">'.$desc.
"<br></div>\n";
703 $deschelp .=
'<div class="info">'.$langs->trans(
getDolGlobalString(
'MAIN_SETUP_MODULES_INFO')).
"<br></div>\n";
712if ($mode ==
'deploy') {
713 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDeployDesc", $langs->transnoentitiesnoconv(
"AvailableModules")).
"<br></div><br>\n";
715if ($mode ==
'develop') {
716 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDevelopDesc").
"<br></div><br>\n";
722if ($mode ==
'common' || $mode ==
'commonkanban') {
725 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
726 print
'<input type="hidden" name="token" value="'.newToken().
'">';
727 if (isset($optioncss) && $optioncss !=
'') {
728 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
730 if (isset($sortfield) && $sortfield !=
'') {
731 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
733 if (isset($sortorder) && $sortorder !=
'') {
734 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
736 if (isset($page) && $page !=
'') {
737 print
'<input type="hidden" name="page" value="'.$page.
'">';
739 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
745 $moreforfilter =
'<div class="valignmiddle">';
747 $moreforfilter .=
'<div class="floatright right pagination paddingtop --module-list"><ul><li>';
748 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'CheckForModuleUpdate'), $langs->trans(
'CheckForModuleUpdate').
'<br><br>'.
img_warning(
'',
'',
'paddingright').$langs->trans(
'CheckForModuleUpdateHelp').
' '.$langs->trans(
'CheckForModuleUpdateHelp2', DolibarrModules::URL_FOR_BLACKLISTED_MODULES).
'<br>'.$langs->trans(
"YourIPWillBeRevealedToThisExternalProviders"),
'fa fa-sync', $_SERVER[
"PHP_SELF"].
'?action=checklastversion&token='.
newToken().
'&mode='.$mode.$param,
'', 1, array(
'morecss' =>
'reposition'));
750 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.$param,
'', ($mode ==
'common' ? 2 : 1), array(
'morecss' =>
'reposition'));
751 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=commonkanban'.$param,
'', ($mode ==
'commonkanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
752 $moreforfilter .=
'</li></ul></div>';
754 $moreforfilter .=
'<div class="divfilteralone colorbacktimesheet float valignmiddle">';
755 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
756 $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')).
'">';
757 $moreforfilter .=
'</div>';
758 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
759 $moreforfilter .= $form->selectarray(
'search_nature', $arrayofnatures,
dol_escape_htmltag($search_nature), $langs->trans(
'Origin'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth250', 1);
760 $moreforfilter .=
'</div>';
763 $array_version = array(
'stable' => $langs->transnoentitiesnoconv(
"Stable"));
765 $array_version[
'deprecated'] = $langs->trans(
"Deprecated");
768 $array_version[
'experimental'] = $langs->trans(
"Experimental");
771 $array_version[
'development'] = $langs->trans(
"Development");
773 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
774 $moreforfilter .= $form->selectarray(
'search_version', $array_version, $search_version, $langs->transnoentitiesnoconv(
'Version'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
775 $moreforfilter .=
'</div>';
777 $array_status = array(
'active' => $langs->transnoentitiesnoconv(
"Enabled"),
'disabled' => $langs->transnoentitiesnoconv(
"Disabled"));
778 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
779 $moreforfilter .= $form->selectarray(
'search_status', $array_status, $search_status, $langs->transnoentitiesnoconv(
'Status'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
780 $moreforfilter .=
'</div>';
781 $moreforfilter .=
' ';
782 $moreforfilter .=
'<div class="divsearchfield valignmiddle inline-block">';
783 $moreforfilter .=
'<input type="submit" name="buttonsubmit" class="button small nomarginleft" value="'.dol_escape_htmltag($langs->trans(
"Refresh")).
'">';
784 if ($search_keyword || ($search_nature && $search_nature !=
'-1') || ($search_version && $search_version !=
'-1') || ($search_status && $search_status !=
'-1')) {
785 $moreforfilter .=
' ';
786 $moreforfilter .=
'<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans(
"Reset")).
'">';
788 $moreforfilter .=
'</div>';
789 $moreforfilter .=
'</div>';
791 $moreforfilter .=
'</div>';
793 print $moreforfilter;
794 $parameters = array();
795 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
796 print $hookmanager->resPrint;
800 print
'<div class="clearboth"></div><br>';
803 $parameters = array();
804 $reshook = $hookmanager->executeHooks(
'insertExtraHeader', $parameters,
$object, $action);
809 $disabled_modules = array();
810 if (!empty($_SESSION[
"disablemodules"])) {
811 $disabled_modules = explode(
',', $_SESSION[
"disablemodules"]);
816 $foundoneexternalmodulewithupdate = 0;
818 $atleastonequalified = 0;
819 $atleastoneforfamily = 0;
821 foreach ($orders as $key => $value) {
823 $tab = explode(
'_', $value);
824 $familykey = $tab[1];
825 $module_position = $tab[2];
827 $modName = $filename[$key];
830 $objMod = $modules[$modName];
832 if (!is_object($objMod)) {
837 if ($mode ==
'expdev' && $objMod->version !=
'development' && $objMod->version !=
'experimental') {
841 if (!$objMod->getName()) {
842 dol_syslog(
"Error for module ".$key.
" - Property name of module looks empty", LOG_WARNING);
846 $modulenameshort = strtolower(preg_replace(
'/^mod/i',
'', get_class($objMod)));
847 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
850 $modulename = $objMod->getName();
851 $moduletechnicalname = $objMod->name;
852 $moduledesc = $objMod->getDesc();
853 $moduledesclong = $objMod->getDescLong();
854 $moduleauthor = $objMod->getPublisher();
857 if ($search_keyword) {
859 if (preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $modulename)
860 || preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduletechnicalname)
861 || ($moduledesc && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesc))
862 || ($moduledesclong && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesclong))
863 || ($moduleauthor && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduleauthor))
871 if ($search_status) {
879 if ($search_nature) {
880 if (preg_match(
'/^external/', $search_nature) && $objMod->isCoreOrExternalModule() !=
'external') {
884 if (preg_match(
'/^external_(.*)$/', $search_nature, $reg)) {
890 if (!$reg[1] && !empty($publisher)) {
894 if ($search_nature ==
'core' && $objMod->isCoreOrExternalModule() ==
'external') {
898 if ($search_version) {
899 if (($objMod->version ==
'development' || $objMod->version ==
'experimental' || preg_match(
'/deprecated/', $objMod->version)) && $search_version ==
'stable') {
902 if ($objMod->version !=
'development' && ($search_version ==
'development')) {
905 if ($objMod->version !=
'experimental' && ($search_version ==
'experimental')) {
908 if (!preg_match(
'/deprecated/', $objMod->version) && ($search_version ==
'deprecated')) {
913 $atleastonequalified++;
916 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
917 foreach ($objMod->langfiles as $domain) {
918 $langs->load($domain);
923 if ($familykey != $oldfamily) {
925 print
'</table></div><br>';
928 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
932 if ($mode ==
'commonkanban') {
933 print
'<div class="box-flex-container kanban">';
935 print
'<div class="div-table-responsive">';
936 print
'<table class="tagtable liste" summary="list_of_modules">'.
"\n";
939 $atleastoneforfamily = 0;
942 $atleastoneforfamily++;
944 if ($familykey != $oldfamily) {
945 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
946 $oldfamily = $familykey;
950 $version = $objMod->getVersion(0);
953 if (preg_match(
'/development/i', $version)) {
954 $warningstring = $langs->trans(
"Development");
956 if (preg_match(
'/experimental/i', $version)) {
957 $warningstring = $langs->trans(
"Experimental");
959 if (preg_match(
'/deprecated/i', $version)) {
960 $warningstring = $langs->trans(
"Deprecated");
963 if ($objMod->isCoreOrExternalModule() ==
'external' || preg_match(
'/development|experimental|deprecated/i', $version)) {
964 $versiontrans .= $objMod->getVersion(1);
967 if ($objMod->isCoreOrExternalModule() ==
'external' && ($action ==
'checklastversion' ||
getDolGlobalString(
'CHECKLASTVERSION_EXTERNALMODULE'))) {
971 $checkRes = $objMod->checkForUpdate();
973 setEventMessages($objMod->getName().
' : '.preg_replace(
'/[^a-z0-9_\.\-\s]/i',
'', $versiontrans).
' -> '.preg_replace(
'/[^a-z0-9_\.\-\s]/i',
'', $objMod->lastVersion),
null,
'warnings');
974 } elseif ($checkRes < 0) {
975 setEventMessages($objMod->getName().
' '.$langs->trans(
'CheckVersionFail'),
null,
'errors');
979 if ($objMod->isCoreOrExternalModule() ==
'external' && $action ==
'checklastversion' && !
getDolGlobalString(
'DISABLE_CHECK_ON_MALWARE_MODULES')) {
980 $checkRes = $objMod->checkForCompliance();
981 if (!is_numeric($checkRes) && $checkRes !=
'') {
982 $langs->load(
"errors");
983 setEventMessages($objMod->getName().
' : '.$langs->trans($checkRes),
null,
'errors');
989 if ($objMod->isCoreOrExternalModule() ==
'external') {
990 $imginfo =
"info_black";
993 $codeenabledisable =
'';
997 if (in_array($modulenameshort, $disabled_modules)) {
998 $objMod->disabled =
true;
1005 if (!empty($arrayofwarnings[$modName])) {
1006 $codeenabledisable .=
'<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
1009 if (!empty($objMod->disabled)) {
1010 $codeenabledisable .= $langs->trans(
"Disabled");
1011 } elseif (is_object($objMod)
1012 && (!empty($objMod->always_enabled) || ((isModEnabled(
'multicompany') && $objMod->core_enabled) && ($user->entity ||
$conf->entity != 1)))) {
1014 if (method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
1015 $codeenabledisable .= $langs->trans(
"Used");
1017 $codeenabledisable .=
img_picto($langs->trans(
"Required"),
'switch_on',
'', 0, 0, 0,
'',
'opacitymedium valignmiddle');
1020 if (isModEnabled(
'multicompany') && $user->entity) {
1025 if (is_object($objMod) && !empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
1026 $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.
'">';
1027 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
1028 $codeenabledisable .=
'</a>';
1030 $codeenabledisable .=
' ';
1031 $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.
'">';
1032 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
1033 $codeenabledisable .=
'</a>';
1036 $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.
'">';
1037 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
1038 $codeenabledisable .=
'</a>';
1040 $codeenabledisable .=
' ';
1041 $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.
'">';
1042 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
1043 $codeenabledisable .=
'</a>';
1049 if (!empty($objMod->config_page_url) && !$disableSetup) {
1050 $backtourlparam =
'';
1051 if ($search_keyword !=
'') {
1052 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_keyword='.urlencode($search_keyword);
1054 if ($search_nature > -1) {
1055 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_nature='.urlencode($search_nature);
1057 if ($search_version > -1) {
1058 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_version='.urlencode($search_version);
1060 if ($search_status > -1) {
1061 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_status='.urlencode($search_status);
1063 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
1066 if (is_array($objMod->config_page_url)) {
1068 foreach ($objMod->config_page_url as $page) {
1071 $codetoconfig .=
'<a href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
1074 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
1075 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
1076 $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"', 0, 0, 0,
'',
'fa-15').
'</a>';
1078 $urltouse = $urlpage;
1079 $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"', 0, 0, 0,
'',
'fa-15').
'</a>';
1083 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', (
string) $objMod->config_page_url, $regs)) {
1084 $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"', 0, 0, 0,
'',
'fa-15').
'</a>';
1086 $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"', 0, 0, 0,
'',
'fa-15').
'</a>';
1089 $codetoconfig .=
img_picto($langs->trans(
"NothingToSetup"),
"setup",
'class="opacitytransp" style="padding-right: 6px"', 0, 0, 0,
'',
'fa-15');
1093 if (!empty($objMod->always_enabled)) {
1095 $codeenabledisable .=
'<!-- Message to show: an always_enabled module has been disabled -->'.
"\n";
1096 $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.
'"';
1097 $codeenabledisable .=
'>';
1098 $codeenabledisable .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
1099 $codeenabledisable .=
"</a>\n";
1100 } elseif (!empty($objMod->disabled)) {
1101 $codeenabledisable .= $langs->trans(
"Disabled");
1104 $warningmessage =
'';
1105 if (!empty($arrayofwarnings[$modName])) {
1106 $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";
1107 foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
1108 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
1109 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
1113 if ($objMod->isCoreOrExternalModule() ==
'external' && !empty($arrayofwarningsext)) {
1114 $codeenabledisable .=
'<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
1115 foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
1116 $keymodulelowercase = strtolower(preg_replace(
'/^mod/',
'', $keymodule));
1117 if (in_array($keymodulelowercase,
$conf->modules)) {
1118 foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
1119 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
1120 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
1121 $warningmessage .= ($warningmessage ?
"\n" :
"").($warningmessage ?
"\n" :
"").$langs->trans(
"Module").
' : '.$objMod->getName();
1122 if (!empty($objMod->editor_name)) {
1123 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"Publisher").
' : '.$objMod->editor_name;
1125 if (!empty($objMod->editor_name)) {
1126 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"ModuleTriggeringThisWarning").
' : '.$modules[$keymodule]->getName();
1133 $codeenabledisable .=
'<!-- Message to show: '.$warningmessage.
' -->'.
"\n";
1134 $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.
'"';
1135 if ($warningmessage) {
1136 $codeenabledisable .=
' onclick="return confirm(\''.dol_escape_js($warningmessage).
'\');
"';
1138 $codeenabledisable .= '>';
1139 $codeenabledisable .= img_picto($langs->trans("Disabled
"), 'switch_off');
1140 $codeenabledisable .= "</a>\n
";
1143 // Set $codetoconfig
1144 $codetoconfig .= img_picto($langs->trans("NothingToSetup
"), "setup
", 'class="opacitytransp
" style="padding-right: 6px
"');
1147 if ($mode == 'commonkanban') {
1149 print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
1151 print '<tr class="oddeven
'.($warningstring ? ' info-box-content-warning
' : '').'">'."\n
";
1152 if (getDolGlobalString('MAIN_MODULES_SHOW_LINENUMBERS')) {
1153 print '<td class="width50
">'.$linenum.'</td>';
1156 // Picto + Name of module
1157 print ' <td class="tdoverflowmax200 minwidth200imp
" title="'.dol_escape_htmltag($objMod->getName()).'">';
1159 //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
1160 //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
1161 if (!empty($objMod->picto)) {
1162 if (preg_match('/^\//i', $objMod->picto)) {
1163 print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"', 1);
1165 print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"');
1168 print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly
"');
1170 print ' <span class="valignmiddle
">'.$objMod->getName().'</span>';
1174 print '<td class="valignmiddle tdoverflowmax300 minwidth200imp
">';
1175 print nl2br($objMod->getDesc());
1179 print '<td class="center nowrap
" style="width: 82px;
">';
1180 //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
1181 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>';
1185 print '<td class="center nowrap width150
" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
1186 if ($objMod->needUpdate) {
1187 $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
1188 print '<span class="badge badge-warning classfortooltip
" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
1190 print $versiontrans;
1194 // Link enable/disable
1195 print '<td class="center valignmiddle left nowraponall
" width="60px
">';
1196 print $codeenabledisable;
1200 print '<td class="tdsetuppicto right valignmiddle
" width="60px
">';
1201 print $codetoconfig;
1206 if ($objMod->needUpdate) {
1207 $foundoneexternalmodulewithupdate++;
1211 if ($action == 'checklastversion') {
1212 if ($foundoneexternalmodulewithupdate) {
1213 setEventMessages($langs->trans("ModuleUpdateAvailable
"), null, 'warnings', '', 0, 1);
1215 setEventMessages($langs->trans("NoExternalModuleWithUpdate
"), null, 'mesgs');
1220 if ($mode == 'commonkanban') {
1228 if (!$atleastonequalified) {
1229 print '<br><span class="opacitymedium
">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria
").'</span><br><br>';
1232 print dol_get_fiche_end();
1236 // Show warning about external users
1237 print info_admin(showModulesExludedForExternal($modules))."\n
";
1242if ($mode == 'marketplace') {
1243 print dol_get_fiche_head($head, $mode, '', -1);
1250 print '<div class="div-
table-responsive-no-min
">';
1251 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1252 print '<tr class="liste_titre
">'."\n
";
1253 print '<td class="hideonsmartphone
">'.$form->textwithpicto($langs->trans("Provider
"), $langs->trans("WebSiteDesc
")).'</td>';
1255 print '<td>'.$langs->trans("URL
").'</td>';
1258 print '<tr class="oddeven
">'."\n
";
1259 $url = 'https://www.dolistore.com';
1260 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>';
1261 print '<td><span class="opacitymedium
">'.$langs->trans("DoliStoreDesc
").'</span></td>';
1262 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">'.$url.'</a></td>';
1268 print dol_get_fiche_end();
1272 $conf->global->MAIN_DISABLE_DOLISTORE_SEARCH = 1; // avoid warning with the new Dolistore website
1274 if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
1275 // $options is array with filter criteria
1277 if (getDolGlobalInt('MAIN_ENANLE_OLD_DOLISTORE')) {
1278 $nbmaxtoshow = $options['per_page'];
1279 $options['per_page']++;
1281 $remotestore->getRemoteCategories();
1282 $remotestore->getRemoteProducts($options);
1284 print '<span class="opacitymedium
">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
1286 $previouslink = $remotestore->get_previous_link();
1287 $nextlink = $remotestore->get_next_link();
1289 print '<div class="liste_titre liste_titre_bydiv centpercent
"><div class="divsearchfield
">';
1291 print '<form method="POST
" class="centpercent
" id="searchFormList
" action="'.$remotestore->url.'">'; ?>
1292 <input type="hidden
" name="token
" value="<?php echo
newToken(); ?>
">
1293 <input type="hidden
" name="mode
" value="marketplace
">
1294 <div class="divsearchfield
">
1295 <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>
1297 <div class="divsearchfield
">
1298 <input class="button buttongen
" value="<?php echo $langs->trans(
'Rechercher') ?>
" type="submit
">
1299 <a class="buttonreset
" href="<?php echo $_SERVER[
"PHP_SELF"].
'?mode=marketplace'; ?>
"><?php echo $langs->trans('Reset') ?></a>
1304 print $previouslink;
1308 print '</div></div>';
1309 print '<div class="clearboth
"></div>';
1312 <div id="category-tree-left
">
1315 echo $remotestore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content?>
1319 <div id="listing-content
">
1320 <table summary="list_of_modules
" id="list_of_modules
" class="productlist centpercent
">
1321 <tbody id="listOfModules
">
1322 <?php echo $remotestore->get_products($nbmaxtoshow); ?>
1332// Form to install an external module
1334if ($mode == 'deploy') {
1335 print dol_get_fiche_head($head, $mode, '', -1);
1337 $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank
" rel="noopener noreferrer
">'.$urldolibarrmodules.'</a>';
1339 if ($allowonlineinstall) {
1340 if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
1341 $message = info_admin($langs->trans("ConfFileMustContainCustom
", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
1345 if (!is_writable(dol_osencode($dirins))) {
1346 $langs->load("errors
");
1347 $message = info_admin($langs->trans("ErrorFailedToWriteInDir
", $dirins), 0, 0, '1', 'warning');
1351 $message = info_admin($langs->trans("NotExistsDirect
", $dirins).$langs->trans("InfDirAlt
").$langs->trans("InfDirExample
"));
1356 if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
1357 // Show clean message
1358 if (!is_numeric(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))) {
1359 $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')), 0, 0, 'warning');
1361 $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'), 0, 0, 'warning');
1364 // Show technical message
1365 $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile
", $dolibarrdataroot.'/installmodules.lock'), 0, 0, 'warning');
1372 if ($allowfromweb < 1) {
1373 print $langs->trans("SomethingMakeInstallFromWebNotPossible
");
1375 //print $langs->trans("SomethingMakeInstallFromWebNotPossible2
");
1379 // $allowfromweb = -1 if installation or setup not correct, 0 if not allowed, 1 if allowed
1380 if ($allowfromweb >= 0) {
1381 if ($allowfromweb == 1) {
1382 //print $langs->trans("ThisIsProcessToFollow
").'<br>';
1386 print $langs->trans("ThisIsAlternativeProcessToFollow
").'<br>';
1387 print '<b>'.$langs->trans("StepNb
", 1).'</b>: ';
1388 print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite
", '{s1}')).'<br>';
1389 print '<b>'.$langs->trans("StepNb
", 2).'</b>: ';
1390 print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite
", '{s1}')).'<br>';
1391 print '<b>'.$langs->trans("StepNb
", 3).'</b>: ';
1394 if ($allowfromweb == 1) {
1395 print '<form enctype="multipart/form-data
" method="POST
" class="noborder
" action="'.$_SERVER["PHP_SELF"].'" name="forminstall
">';
1396 print '<input type="hidden
" name="token
" value="'.newToken().'">';
1397 print '<input type="hidden
" name="action
" value="install
">';
1398 print '<input type="hidden
" name="mode
" value="deploy
">';
1400 print $langs->trans("YouCanSubmitFile
").'<br><br><br>';
1402 print '<span class="opacitymedium
"><input class="paddingright
" type="checkbox
" name="checkforcompliance
" id="checkforcompliance
"'.(getDolGlobalString('DISABLE_CHECK_ON_MALWARE_MODULES') ? ' disabled="disabled"' : 'checked="checked
"').'>';
1403 print '<label for="checkforcompliance
">'.$form->textwithpicto($langs->trans("CheckIfModuleIsNotBlackListed
"), $langs->trans("CheckIfModuleIsNotBlackListedHelp
")).'</label>';
1404 print '</span><br><br>';
1406 $max = getDolGlobalString('MAIN_UPLOAD_DOC'); // In Kb
1407 $maxphp = @ini_get('upload_max_filesize'); // In unknown
1408 if (preg_match('/k$/i', $maxphp)) {
1409 $maxphp = preg_replace('/k$/i', '', $maxphp);
1412 if (preg_match('/m$/i', $maxphp)) {
1413 $maxphp = preg_replace('/m$/i', '', $maxphp);
1416 if (preg_match('/g$/i', $maxphp)) {
1417 $maxphp = preg_replace('/g$/i', '', $maxphp);
1418 $maxphp *= 1024 * 1024;
1420 if (preg_match('/t$/i', $maxphp)) {
1421 $maxphp = preg_replace('/t$/i', '', $maxphp);
1422 $maxphp *= 1024 * 1024 * 1024;
1424 $maxphp2 = @ini_get('post_max_size'); // In unknown
1425 if (preg_match('/k$/i', $maxphp2)) {
1426 $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
1429 if (preg_match('/m$/i', $maxphp2)) {
1430 $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
1433 if (preg_match('/g$/i', $maxphp2)) {
1434 $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
1435 $maxphp2 *= 1024 * 1024;
1437 if (preg_match('/t$/i', $maxphp2)) {
1438 $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
1439 $maxphp2 *= 1024 * 1024 * 1024;
1441 // Now $max and $maxphp and $maxphp2 are in Kb
1443 $maxphptoshow = $maxphptoshowparam = '';
1445 $maxmin = min($max, $maxphp);
1446 $maxphptoshow = $maxphp;
1447 $maxphptoshowparam = 'upload_max_filesize';
1450 $maxmin = min($max, $maxphp2);
1451 if ($maxphp2 < $maxphp) {
1452 $maxphptoshow = $maxphp2;
1453 $maxphptoshowparam = 'post_max_size';
1458 print '<script type="text/javascript
">
1459 $(document).ready(function() {
1460 jQuery("#fileinstall
").on("change
", function() {
1461 if(this.files[0].size > '.($maxmin * 1024).') {
1462 alert("'.dol_escape_js($langs->transnoentitiesnoconv("ErrorFileSizeTooLarge")).'");
1468 // MAX_FILE_SIZE doit précéder le champ input de type file
1469 print '<input type="hidden
" name="MAX_FILE_SIZE
" value="'.($maxmin * 1024).'">';
1472 print '<input class="flat minwidth400
" type="file
" name="fileinstall
" id="fileinstall
">';
1474 print '<input type="submit
" name="send
" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button small
">';
1476 if (getDolGlobalString('MAIN_UPLOAD_DOC')) {
1478 $langs->load('other');
1480 print info_admin($langs->trans("ThisLimitIsDefinedInSetup
", $max, $maxphptoshow, $maxphptoshowparam), 1);
1483 print ' ('.$langs->trans("UploadDisabled
").')';
1491 print '<div class="center
"><div class="logo_setup
"></div></div>';
1493 print $langs->trans("UnpackPackageInModulesRoot
", $dirins).'<br>';
1494 print '<b>'.$langs->trans("StepNb
", 4).'</b>: ';
1495 print $langs->trans("SetupIsReadyForUse
", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home
").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules
")).'<br>';
1499 if (!empty($result['return'])) {
1502 foreach ($result['return'] as $value) {
1507 print dol_get_fiche_end();
1510if ($mode == 'develop') {
1511 print dol_get_fiche_head($head, $mode, '', -1);
1518 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1519 print '<tr class="liste_titre
">'."\n
";
1520 //print '<td>'.$langs->trans("Logo
").'</td>';
1521 print '<td colspan="2
">'.$langs->trans("DevelopYourModuleDesc
").'</td>';
1522 print '<td>'.$langs->trans("URL
").'</td>';
1525 print '<tr class="oddeven
" height="80
">'."\n
";
1526 print '<td class="center
">';
1527 print '<div class="imgmaxheight50 logo_setup
"></div>';
1529 print '<td>'.$langs->trans("TryToUseTheModuleBuilder
", $langs->transnoentitiesnoconv("ModuleBuilder
")).'</td>';
1530 print '<td class="maxwidth300
">';
1531 if (isModEnabled('modulebuilder')) {
1532 print $langs->trans("SeeTopRightMenu
");
1534 print '<span class="opacitymedium
">'.$langs->trans("ModuleMustBeEnabledFirst
", $langs->transnoentitiesnoconv("ModuleBuilder
")).'</span>';
1539 print '<tr class="oddeven
" height="80
">'."\n
";
1540 $url = 'https://partners.dolibarr.org';
1541 print '<td class="center
">';
1542 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>';
1544 print '<td>'.$langs->trans("DoliPartnersDesc
").'</td>';
1545 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">';
1546 print img_picto('', 'url', 'class="pictofixedwidth
"');
1547 print $url.'</a></td>';
1552 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($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
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_delete_dir_recursive($dir, $count=0, $nophperrors=0, $onlysub=0, &$countdeleted=0, $indexdatabase=1, $nolog=0, $level=0)
Remove a directory $dir and its subdirectories (or only files and subdirectories)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
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, $attop=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.
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 a 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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
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.