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');
281 $message = $langs->trans(
"SetupIsReadyForUse", DOL_URL_ROOT.
'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv(
"Home").
' - '.$langs->transnoentitiesnoconv(
"Setup").
' - '.$langs->transnoentitiesnoconv(
"Modules"));
284} elseif ($action ==
'install' && !$allowonlineinstall) {
285 httponly_accessforbidden(
"You try to bypass the protection to disallow deployment of an external module. Hack attempt ?");
288if ($action ==
'set' && $user->admin) {
293 if ($checkOldValue !=
getDolGlobalInt(
'CHECKLASTVERSION_EXTERNALMODULE')) {
294 setEventMessage($langs->trans(
'WarningModuleHasChangedLastVersionCheckParameter', $value),
'warnings');
296 if ($csrfCheckOldValue !=
getDolGlobalInt(
'MAIN_SECURITY_CSRF_WITH_TOKEN')) {
297 setEventMessage($langs->trans(
'WarningModuleHasChangedSecurityCsrfParameter', $value),
'warnings');
301 if (!empty($resarray[
'errors'])) {
305 if ($resarray[
'nbperms'] > 0) {
306 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
307 $resqltmp = $db->query($tmpsql);
309 $obj = $db->fetch_object($resqltmp);
311 if ($obj && $obj->nb > 1) {
312 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
320 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
322} elseif ($action ==
'reset' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
328 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
330} elseif (
getDolGlobalInt(
"MAIN_FEATURES_LEVEL") > 1 && $action ==
'reload' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
332 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
335 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
338 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
339 if (!empty($resarray[
'errors'])) {
342 if ($resarray[
'nbperms'] > 0) {
343 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
344 $resqltmp = $db->query($tmpsql);
346 $obj = $db->fetch_object($resqltmp);
347 if ($obj && $obj->nb > 1) {
348 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
356 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
367$form =
new Form($db);
370$morecss = array(
"/admin/dolistore/css/dolistore.css");
378$help_url =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
379llxHeader(
'', $langs->trans(
"Setup"), $help_url,
'',
'',
'', $morejs, $morecss, 0,
'mod-admin page-modules');
385$arrayofnatures = array(
386 'core' => array(
'label' => $langs->transnoentitiesnoconv(
"NativeModules")),
387 'external' => array(
'label' => $langs->transnoentitiesnoconv(
"External").
' - ['.$langs->trans(
"AllPublishers").
']')
389$arrayofwarnings = array();
390$arrayofwarningsext = array();
395$publisherlogoarray = array();
399$modNameLoaded = array();
401foreach ($modulesdir as $dir) {
404 dol_syslog(
"Scan directory ".$dir.
" for module descriptor files (modXXX.class.php)");
405 $handle = @opendir($dir);
406 if (is_resource($handle)) {
407 while (($file = readdir($handle)) !==
false) {
409 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
410 $modName = substr($file, 0,
dol_strlen($file) - 10);
413 if (!empty($modNameLoaded[$modName])) {
414 $mesg =
"Error: Module ".$modName.
" was found twice: Into ".$modNameLoaded[$modName].
" and ".$dir.
". You probably have an old file on your disk.<br>";
421 $res = include_once $dir.$file;
422 if (class_exists($modName)) {
423 $objMod =
new $modName($db);
424 '@phan-var-force DolibarrModules $objMod';
425 $modNameLoaded[$modName] = $dir;
426 if (!$objMod->numero > 0 && $modName !=
'modUser') {
427 dol_syslog(
'The module descriptor '.$modName.
' must have a numero property', LOG_ERR);
429 $j = $objMod->numero;
431 $modulequalified = 1;
434 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
436 $modulequalified = 0;
439 $modulequalified = 0;
442 $modulequalified = 0;
446 if (!empty($objMod->hidden)) {
447 $modulequalified = 0;
450 if ($modulequalified > 0) {
452 $external = ($objMod->isCoreOrExternalModule() ==
'external');
462 $arrayofnatures[
'external_'.$publisher] = array(
'label' => $langs->trans(
"External").
' - '.$publisher,
'data-html' => $langs->trans(
"External").
' - <span class="opacitymedium inine-block valignmiddle">'.$publisher.
'</span>');
464 $arrayofnatures[
'external_'] = array(
'label' => $langs->trans(
"External").
' - ['.$langs->trans(
"UnknownPublishers").
']');
467 ksort($arrayofnatures);
470 $filename[$i] = $modName;
471 $modules[$modName] = $objMod;
474 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
475 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
476 $familykey = key($objMod->familyinfo);
478 $familykey = $objMod->family;
480 '@phan-var-force string $familykey';
482 $moduleposition = ($objMod->module_position ? $objMod->module_position :
'50');
483 if ($objMod->isCoreOrExternalModule() ==
'external' && $moduleposition < 100000) {
485 $moduleposition =
'80';
489 if (!empty($objMod->warnings_activation)) {
490 $arrayofwarnings[$modName] = $objMod->warnings_activation;
492 if (!empty($objMod->warnings_activation_ext)) {
493 $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
496 $familyposition = (empty($familyinfo[$familykey][
'position']) ?
'0' : $familyinfo[$familykey][
'position']);
497 $listOfOfficialModuleGroups = array(
'hr',
'technic',
'interface',
'technic',
'portal',
'financial',
'crm',
'base',
'products',
'srm',
'ecm',
'projects',
'other');
498 if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
500 if (is_numeric($familyposition)) {
501 $familyposition = sprintf(
"%03d", (
int) $familyposition + 100);
505 $orders[$i] = $familyposition.
"_".$familykey.
"_".$moduleposition.
"_".$j;
508 $specialstring =
'unknown';
509 if ($objMod->version ==
'development' || $objMod->version ==
'experimental') {
510 $specialstring =
'expdev';
512 if (isset($categ[$specialstring])) {
513 $categ[$specialstring]++;
515 $categ[$specialstring] = 1;
520 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
523 print
info_admin(
"admin/modules.php Warning bad descriptor file : ".$dir.$file.
" (Class ".$modName.
" not found into file)", 0, 0,
'1',
'warning');
526 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
533 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
537if ($action ==
'reset_confirm' && $user->admin) {
538 if (!empty($modules[$value])) {
539 $objMod = $modules[$value];
541 if (!empty($objMod->langfiles)) {
542 $langs->loadLangs($objMod->langfiles);
545 $form =
new Form($db);
546 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmUnactivation'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reset',
'',
'no', 1);
550if ($action ==
'reload_confirm' && $user->admin) {
551 if (!empty($modules[$value])) {
552 $objMod = $modules[$value];
554 if (!empty($objMod->langfiles)) {
555 $langs->loadLangs($objMod->langfiles);
558 $form =
new Form($db);
559 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmReload'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reload',
'',
'no', 1);
570$nbofactivatedmodules = count($conf->modules);
573$nbmodulesnotautoenabled = count($conf->modules);
574$listofmodulesautoenabled = array(
'agenda',
'fckeditor',
'export',
'import');
575foreach ($listofmodulesautoenabled as $moduleautoenable) {
576 if (in_array($moduleautoenable, $conf->modules)) {
577 $nbmodulesnotautoenabled--;
585if ($mode ==
'common' || $mode ==
'commonkanban') {
586 $desc = $langs->trans(
"ModulesDesc",
'{picto}');
587 $desc .=
' '.$langs->trans(
"ModulesDesc2",
'{picto2}');
588 $desc = str_replace(
'{picto}',
img_picto(
'',
'switch_off',
'class="size15x"'), $desc);
589 $desc = str_replace(
'{picto2}',
img_picto(
'',
'setup',
'class="size15x"'), $desc);
590 if ($nbmodulesnotautoenabled <=
getDolGlobalInt(
'MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) {
591 $deschelp .=
'<div class="info hideonsmartphone">'.$desc.
"<br></div>\n";
594 $deschelp .=
'<div class="info">'.$langs->trans(
getDolGlobalString(
'MAIN_SETUP_MODULES_INFO')).
"<br></div>\n";
600if ($mode ==
'marketplace') {
603if ($mode ==
'deploy') {
604 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDeployDesc", $langs->transnoentitiesnoconv(
"AvailableModules")).
"<br></div><br>\n";
606if ($mode ==
'develop') {
607 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDevelopDesc").
"<br></div><br>\n";
613if ($mode ==
'common' || $mode ==
'commonkanban') {
616 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
617 print
'<input type="hidden" name="token" value="'.newToken().
'">';
618 if (isset($optioncss) && $optioncss !=
'') {
619 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
621 if (isset($sortfield) && $sortfield !=
'') {
622 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
624 if (isset($sortorder) && $sortorder !=
'') {
625 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
627 if (isset($page) && $page !=
'') {
628 print
'<input type="hidden" name="page" value="'.$page.
'">';
630 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
636 $moreforfilter =
'<div class="valignmiddle">';
638 $moreforfilter .=
'<div class="floatright right pagination paddingtop --module-list"><ul><li>';
639 $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'));
641 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.$param,
'', ($mode ==
'common' ? 2 : 1), array(
'morecss' =>
'reposition'));
642 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=commonkanban'.$param,
'', ($mode ==
'commonkanban' ? 2 : 1), array(
'morecss' =>
'reposition'));
643 $moreforfilter .=
'</li></ul></div>';
645 $moreforfilter .=
'<div class="divfilteralone colorbacktimesheet float valignmiddle">';
646 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
647 $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')).
'">';
648 $moreforfilter .=
'</div>';
649 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
650 $moreforfilter .= $form->selectarray(
'search_nature', $arrayofnatures,
dol_escape_htmltag($search_nature), $langs->trans(
'Origin'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth250', 1);
651 $moreforfilter .=
'</div>';
654 $array_version = array(
'stable' => $langs->transnoentitiesnoconv(
"Stable"));
656 $array_version[
'deprecated'] = $langs->trans(
"Deprecated");
659 $array_version[
'experimental'] = $langs->trans(
"Experimental");
662 $array_version[
'development'] = $langs->trans(
"Development");
664 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
665 $moreforfilter .= $form->selectarray(
'search_version', $array_version, $search_version, $langs->transnoentitiesnoconv(
'Version'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
666 $moreforfilter .=
'</div>';
668 $array_status = array(
'active' => $langs->transnoentitiesnoconv(
"Enabled"),
'disabled' => $langs->transnoentitiesnoconv(
"Disabled"));
669 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
670 $moreforfilter .= $form->selectarray(
'search_status', $array_status, $search_status, $langs->transnoentitiesnoconv(
'Status'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
671 $moreforfilter .=
'</div>';
672 $moreforfilter .=
' ';
673 $moreforfilter .=
'<div class="divsearchfield valignmiddle inline-block">';
674 $moreforfilter .=
'<input type="submit" name="buttonsubmit" class="button small nomarginleft" value="'.dol_escape_htmltag($langs->trans(
"Refresh")).
'">';
675 if ($search_keyword || ($search_nature && $search_nature !=
'-1') || ($search_version && $search_version !=
'-1') || ($search_status && $search_status !=
'-1')) {
676 $moreforfilter .=
' ';
677 $moreforfilter .=
'<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans(
"Reset")).
'">';
679 $moreforfilter .=
'</div>';
680 $moreforfilter .=
'</div>';
682 $moreforfilter .=
'</div>';
684 if (!empty($moreforfilter)) {
685 print $moreforfilter;
686 $parameters = array();
687 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters,
$object, $action);
688 print $hookmanager->resPrint;
693 print
'<div class="clearboth"></div><br>';
696 $parameters = array();
697 $reshook = $hookmanager->executeHooks(
'insertExtraHeader', $parameters,
$object, $action);
702 $disabled_modules = array();
703 if (!empty($_SESSION[
"disablemodules"])) {
704 $disabled_modules = explode(
',', $_SESSION[
"disablemodules"]);
709 $foundoneexternalmodulewithupdate = 0;
711 $atleastonequalified = 0;
712 $atleastoneforfamily = 0;
714 foreach ($orders as $key => $value) {
716 $tab = explode(
'_', $value);
717 $familykey = $tab[1];
718 $module_position = $tab[2];
720 $modName = $filename[$key];
723 $objMod = $modules[$modName];
726 if ($mode ==
'expdev' && $objMod->version !=
'development' && $objMod->version !=
'experimental') {
730 if (!$objMod->getName()) {
731 dol_syslog(
"Error for module ".$key.
" - Property name of module looks empty", LOG_WARNING);
735 $modulenameshort = strtolower(preg_replace(
'/^mod/i',
'', get_class($objMod)));
736 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
739 $modulename = $objMod->getName();
740 $moduletechnicalname = $objMod->name;
741 $moduledesc = $objMod->getDesc();
742 $moduledesclong = $objMod->getDescLong();
743 $moduleauthor = $objMod->getPublisher();
746 if ($search_keyword) {
748 if (preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $modulename)
749 || preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduletechnicalname)
750 || ($moduledesc && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesc))
751 || ($moduledesclong && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesclong))
752 || ($moduleauthor && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduleauthor))
760 if ($search_status) {
768 if ($search_nature) {
769 if (preg_match(
'/^external/', $search_nature) && $objMod->isCoreOrExternalModule() !=
'external') {
773 if (preg_match(
'/^external_(.*)$/', $search_nature, $reg)) {
779 if (!$reg[1] && !empty($publisher)) {
783 if ($search_nature ==
'core' && $objMod->isCoreOrExternalModule() ==
'external') {
787 if ($search_version) {
788 if (($objMod->version ==
'development' || $objMod->version ==
'experimental' || preg_match(
'/deprecated/', $objMod->version)) && $search_version ==
'stable') {
791 if ($objMod->version !=
'development' && ($search_version ==
'development')) {
794 if ($objMod->version !=
'experimental' && ($search_version ==
'experimental')) {
797 if (!preg_match(
'/deprecated/', $objMod->version) && ($search_version ==
'deprecated')) {
802 $atleastonequalified++;
805 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
806 foreach ($objMod->langfiles as $domain) {
807 $langs->load($domain);
812 if ($familykey != $oldfamily) {
814 print
'</table></div><br>';
817 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
821 if ($mode ==
'commonkanban') {
822 print
'<div class="box-flex-container kanban">';
824 print
'<div class="div-table-responsive">';
825 print
'<table class="tagtable liste" summary="list_of_modules">'.
"\n";
828 $atleastoneforfamily = 0;
831 $atleastoneforfamily++;
833 if ($familykey != $oldfamily) {
834 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
835 $oldfamily = $familykey;
839 $version = $objMod->getVersion(0);
842 if (preg_match(
'/development/i', $version)) {
843 $warningstring = $langs->trans(
"Development");
845 if (preg_match(
'/experimental/i', $version)) {
846 $warningstring = $langs->trans(
"Experimental");
848 if (preg_match(
'/deprecated/i', $version)) {
849 $warningstring = $langs->trans(
"Deprecated");
852 if ($objMod->isCoreOrExternalModule() ==
'external' || preg_match(
'/development|experimental|deprecated/i', $version)) {
853 $versiontrans .= $objMod->getVersion(1);
856 if ($objMod->isCoreOrExternalModule() ==
'external'
858 $action ==
'checklastversion'
864 $checkRes = $objMod->checkForUpdate();
866 setEventMessages($objMod->getName().
' : '.preg_replace(
'/[^a-z0-9_\.\-\s]/i',
'', $versiontrans).
' -> '.preg_replace(
'/[^a-z0-9_\.\-\s]/i',
'', $objMod->lastVersion),
null,
'mesgs');
867 } elseif ($checkRes < 0) {
868 setEventMessages($objMod->getName().
' '.$langs->trans(
'CheckVersionFail'),
null,
'warnings');
874 if ($objMod->isCoreOrExternalModule() ==
'external') {
875 $imginfo =
"info_black";
878 $codeenabledisable =
'';
882 if (in_array($modulenameshort, $disabled_modules)) {
883 $objMod->disabled =
true;
890 if (!empty($arrayofwarnings[$modName])) {
891 $codeenabledisable .=
'<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
894 if (!empty($objMod->disabled)) {
895 $codeenabledisable .= $langs->trans(
"Disabled");
896 } elseif (!empty($objMod->always_enabled) || ((isModEnabled(
'multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
898 if (method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
899 $codeenabledisable .= $langs->trans(
"Used");
901 $codeenabledisable .=
img_picto($langs->trans(
"Required"),
'switch_on',
'',
false, 0, 0,
'',
'opacitymedium valignmiddle');
904 if (isModEnabled(
'multicompany') && $user->entity) {
909 if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
910 $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.
'">';
911 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
912 $codeenabledisable .=
'</a>';
914 $codeenabledisable .=
' ';
915 $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.
'">';
916 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
917 $codeenabledisable .=
'</a>';
920 $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.
'">';
921 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
922 $codeenabledisable .=
'</a>';
924 $codeenabledisable .=
' ';
925 $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.
'">';
926 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
927 $codeenabledisable .=
'</a>';
933 if (!empty($objMod->config_page_url) && !$disableSetup) {
934 $backtourlparam =
'';
935 if ($search_keyword !=
'') {
936 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_keyword='.urlencode($search_keyword);
938 if ($search_nature > -1) {
939 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_nature='.urlencode($search_nature);
941 if ($search_version > -1) {
942 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_version='.urlencode($search_version);
944 if ($search_status > -1) {
945 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_status='.urlencode($search_status);
947 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
950 if (is_array($objMod->config_page_url)) {
952 foreach ($objMod->config_page_url as $page) {
955 $codetoconfig .=
'<a href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
958 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
959 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
960 $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>';
962 $urltouse = $urlpage;
963 $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>';
967 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', (
string) $objMod->config_page_url, $regs)) {
968 $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>';
970 $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>';
973 $codetoconfig .=
img_picto($langs->trans(
"NothingToSetup"),
"setup",
'class="opacitytransp" style="padding-right: 6px"',
false, 0, 0,
'',
'fa-15');
977 if (!empty($objMod->always_enabled)) {
979 $codeenabledisable .=
'<!-- Message to show: an always_enabled module has been disabled -->'.
"\n";
980 $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.
'"';
981 $codeenabledisable .=
'>';
982 $codeenabledisable .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
983 $codeenabledisable .=
"</a>\n";
984 } elseif (!empty($objMod->disabled)) {
985 $codeenabledisable .= $langs->trans(
"Disabled");
988 $warningmessage =
'';
989 if (!empty($arrayofwarnings[$modName])) {
990 $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";
991 foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
992 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
993 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
997 if ($objMod->isCoreOrExternalModule() ==
'external' && !empty($arrayofwarningsext)) {
998 $codeenabledisable .=
'<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
999 foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
1000 $keymodulelowercase = strtolower(preg_replace(
'/^mod/',
'', $keymodule));
1001 if (in_array($keymodulelowercase, $conf->modules)) {
1002 foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
1003 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
1004 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
1005 $warningmessage .= ($warningmessage ?
"\n" :
"").($warningmessage ?
"\n" :
"").$langs->trans(
"Module").
' : '.$objMod->getName();
1006 if (!empty($objMod->editor_name)) {
1007 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"Publisher").
' : '.$objMod->editor_name;
1009 if (!empty($objMod->editor_name)) {
1010 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"ModuleTriggeringThisWarning").
' : '.$modules[$keymodule]->getName();
1017 $codeenabledisable .=
'<!-- Message to show: '.$warningmessage.
' -->'.
"\n";
1018 $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.
'"';
1019 if ($warningmessage) {
1020 $codeenabledisable .=
' onclick="return confirm(\''.dol_escape_js($warningmessage).
'\');
"';
1022 $codeenabledisable .= '>';
1023 $codeenabledisable .= img_picto($langs->trans("Disabled
"), 'switch_off');
1024 $codeenabledisable .= "</a>\n
";
1027 // Set $codetoconfig
1028 $codetoconfig .= img_picto($langs->trans("NothingToSetup
"), "setup
", 'class="opacitytransp
" style="padding-right: 6px
"');
1031 if ($mode == 'commonkanban') {
1033 print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
1035 print '<tr class="oddeven
'.($warningstring ? ' info-box-content-warning
' : '').'">'."\n
";
1036 if (getDolGlobalString('MAIN_MODULES_SHOW_LINENUMBERS')) {
1037 print '<td class="width50
">'.$linenum.'</td>';
1040 // Picto + Name of module
1041 print ' <td class="tdoverflowmax200 minwidth200imp
" title="'.dol_escape_htmltag($objMod->getName()).'">';
1043 //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
1044 //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
1045 if (!empty($objMod->picto)) {
1046 if (preg_match('/^\//i', $objMod->picto)) {
1047 print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"', 1);
1049 print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"');
1052 print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly
"');
1054 print ' <span class="valignmiddle
">'.$objMod->getName().'</span>';
1058 print '<td class="valignmiddle tdoverflowmax300 minwidth200imp
">';
1059 print nl2br($objMod->getDesc());
1063 print '<td class="center nowrap
" style="width: 82px;
">';
1064 //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
1065 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>';
1069 print '<td class="center nowrap width150
" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
1070 if ($objMod->needUpdate) {
1071 $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
1072 print '<span class="badge badge-warning classfortooltip
" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
1074 print $versiontrans;
1078 // Link enable/disable
1079 print '<td class="center valignmiddle left nowraponall
" width="60px
">';
1080 print $codeenabledisable;
1084 print '<td class="tdsetuppicto right valignmiddle
" width="60px
">';
1085 print $codetoconfig;
1090 if ($objMod->needUpdate) {
1091 $foundoneexternalmodulewithupdate++;
1095 if ($action == 'checklastversion') {
1096 if ($foundoneexternalmodulewithupdate) {
1097 setEventMessages($langs->trans("ModuleUpdateAvailable
"), null, 'mesgs');
1099 setEventMessages($langs->trans("NoExternalModuleWithUpdate
"), null, 'mesgs');
1104 if ($mode == 'commonkanban') {
1112 if (!$atleastonequalified) {
1113 print '<br><span class="opacitymedium
">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria
").'</span><br><br>';
1116 print dol_get_fiche_end();
1120 // Show warning about external users
1121 print info_admin(showModulesExludedForExternal($modules))."\n
";
1126if ($mode == 'marketplace') {
1127 print dol_get_fiche_head($head, $mode, '', -1);
1134 print '<div class="div-
table-responsive-no-min
">';
1135 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1136 print '<tr class="liste_titre
">'."\n
";
1137 print '<td class="hideonsmartphone
">'.$form->textwithpicto($langs->trans("Provider
"), $langs->trans("WebSiteDesc
")).'</td>';
1139 print '<td>'.$langs->trans("URL
").'</td>';
1142 print '<tr class="oddeven
">'."\n
";
1143 $url = 'https://www.dolistore.com';
1144 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>';
1145 print '<td><span class="opacitymedium
">'.$langs->trans("DoliStoreDesc
").'</span></td>';
1146 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">'.$url.'</a></td>';
1152 print dol_get_fiche_end();
1156 if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) {
1157 // $options is array with filter criteria
1158 //var_dump($options);
1159 $dolistore->getRemoteCategories();
1160 $dolistore->getRemoteProducts($options);
1162 print '<span class="opacitymedium
">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
1164 $previouslink = $dolistore->get_previous_link();
1165 $nextlink = $dolistore->get_next_link();
1167 print '<div class="liste_titre liste_titre_bydiv centpercent
"><div class="divsearchfield
">';
1169 print '<form method="POST
" class="centpercent
" id="searchFormList
" action="'.$dolistore->url.'">'; ?>
1170 <input type="hidden
" name="token
" value="<?php echo
newToken(); ?>
">
1171 <input type="hidden
" name="mode
" value="marketplace
">
1172 <div class="divsearchfield
">
1173 <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>
1175 <div class="divsearchfield
">
1176 <input class="button buttongen
" value="<?php echo $langs->trans(
'Rechercher') ?>
" type="submit
">
1177 <a class="buttonreset
" href="<?php echo urlencode($dolistore->url) ?>
"><?php echo $langs->trans('Reset') ?></a>
1182 print $previouslink;
1186 print '</div></div>';
1187 print '<div class="clearboth
"></div>';
1190 <div id="category-tree-left
">
1193 echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content?>
1196 <div id="listing-content
">
1197 <table summary="list_of_modules
" id="list_of_modules
" class="productlist centpercent
">
1198 <tbody id="listOfModules
">
1199 <?php echo $dolistore->get_products(); ?>
1208// Install external module
1210if ($mode == 'deploy') {
1211 print dol_get_fiche_head($head, $mode, '', -1);
1213 $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank
" rel="noopener noreferrer
">'.$urldolibarrmodules.'</a>';
1215 if ($allowonlineinstall) {
1216 if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
1217 $message = info_admin($langs->trans("ConfFileMustContainCustom
", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
1221 if (!is_writable(dol_osencode($dirins))) {
1222 $langs->load("errors
");
1223 $message = info_admin($langs->trans("ErrorFailedToWriteInDir
", $dirins), 0, 0, '1', 'warning');
1227 $message = info_admin($langs->trans("NotExistsDirect
", $dirins).$langs->trans("InfDirAlt
").$langs->trans("InfDirExample
"));
1232 if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
1233 // Show clean message
1234 if (!is_numeric(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))) {
1235 $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')), 0, 0, 'warning');
1237 $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'), 0, 0, 'warning');
1240 // Show technical message
1241 $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile
", $dolibarrdataroot.'/installmodules.lock'), 0, 0, 'warning');
1248 if ($allowfromweb < 1) {
1249 print $langs->trans("SomethingMakeInstallFromWebNotPossible
");
1251 //print $langs->trans("SomethingMakeInstallFromWebNotPossible2
");
1257 // $allowfromweb = -1 if installation or setup not correct, 0 if not allowed, 1 if allowed
1258 if ($allowfromweb >= 0) {
1259 if ($allowfromweb == 1) {
1260 //print $langs->trans("ThisIsProcessToFollow
").'<br>';
1262 print $langs->trans("ThisIsAlternativeProcessToFollow
").'<br>';
1263 print '<b>'.$langs->trans("StepNb
", 1).'</b>: ';
1264 print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite
", '{s1}')).'<br>';
1265 print '<b>'.$langs->trans("StepNb
", 2).'</b>: ';
1266 print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite
", '{s1}')).'<br>';
1267 print '<b>'.$langs->trans("StepNb
", 3).'</b>: ';
1270 if ($allowfromweb == 1) {
1271 print '<form enctype="multipart/form-data
" method="POST
" class="noborder
" action="'.$_SERVER["PHP_SELF"].'" name="forminstall
">';
1272 print '<input type="hidden
" name="token
" value="'.newToken().'">';
1273 print '<input type="hidden
" name="action
" value="install
">';
1274 print '<input type="hidden
" name="mode
" value="deploy
">';
1276 print $langs->trans("YouCanSubmitFile
").'<br><br>';
1278 $max = getDolGlobalString('MAIN_UPLOAD_DOC'); // In Kb
1279 $maxphp = @ini_get('upload_max_filesize'); // In unknown
1280 if (preg_match('/k$/i', $maxphp)) {
1281 $maxphp = preg_replace('/k$/i', '', $maxphp);
1284 if (preg_match('/m$/i', $maxphp)) {
1285 $maxphp = preg_replace('/m$/i', '', $maxphp);
1288 if (preg_match('/g$/i', $maxphp)) {
1289 $maxphp = preg_replace('/g$/i', '', $maxphp);
1290 $maxphp *= 1024 * 1024;
1292 if (preg_match('/t$/i', $maxphp)) {
1293 $maxphp = preg_replace('/t$/i', '', $maxphp);
1294 $maxphp *= 1024 * 1024 * 1024;
1296 $maxphp2 = @ini_get('post_max_size'); // In unknown
1297 if (preg_match('/k$/i', $maxphp2)) {
1298 $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
1301 if (preg_match('/m$/i', $maxphp2)) {
1302 $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
1305 if (preg_match('/g$/i', $maxphp2)) {
1306 $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
1307 $maxphp2 *= 1024 * 1024;
1309 if (preg_match('/t$/i', $maxphp2)) {
1310 $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
1311 $maxphp2 *= 1024 * 1024 * 1024;
1313 // Now $max and $maxphp and $maxphp2 are in Kb
1315 $maxphptoshow = $maxphptoshowparam = '';
1317 $maxmin = min($max, $maxphp);
1318 $maxphptoshow = $maxphp;
1319 $maxphptoshowparam = 'upload_max_filesize';
1322 $maxmin = min($max, $maxphp2);
1323 if ($maxphp2 < $maxphp) {
1324 $maxphptoshow = $maxphp2;
1325 $maxphptoshowparam = 'post_max_size';
1330 print '<script type="text/javascript
">
1331 $(document).ready(function() {
1332 jQuery("#fileinstall
").on("change
", function() {
1333 if(this.files[0].size > '.($maxmin * 1024).') {
1334 alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'");
1340 // MAX_FILE_SIZE doit précéder le champ input de type file
1341 print '<input type="hidden
" name="MAX_FILE_SIZE
" value="'.($maxmin * 1024).'">';
1344 print '<input class="flat minwidth400
" type="file
" name="fileinstall
" id="fileinstall
"> ';
1346 print '<input type="submit
" name="send
" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button small
">';
1348 if (getDolGlobalString('MAIN_UPLOAD_DOC')) {
1350 $langs->load('other');
1352 print info_admin($langs->trans("ThisLimitIsDefinedInSetup
", $max, $maxphptoshow, $maxphptoshowparam), 1);
1355 print ' ('.$langs->trans("UploadDisabled
").')';
1363 print '<div class="center
"><div class="logo_setup
"></div></div>';
1365 print $langs->trans("UnpackPackageInModulesRoot
", $dirins).'<br>';
1366 print '<b>'.$langs->trans("StepNb
", 4).'</b>: ';
1367 print $langs->trans("SetupIsReadyForUse
", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home
").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules
")).'<br>';
1371 if (!empty($result['return'])) {
1374 foreach ($result['return'] as $value) {
1379 print dol_get_fiche_end();
1382if ($mode == 'develop') {
1383 print dol_get_fiche_head($head, $mode, '', -1);
1390 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1391 print '<tr class="liste_titre
">'."\n
";
1392 //print '<td>'.$langs->trans("Logo
").'</td>';
1393 print '<td colspan="2
">'.$langs->trans("DevelopYourModuleDesc
").'</td>';
1394 print '<td>'.$langs->trans("URL
").'</td>';
1397 print '<tr class="oddeven
" height="80
">'."\n
";
1398 print '<td class="center
">';
1399 print '<div class="imgmaxheight50 logo_setup
"></div>';
1401 print '<td>'.$langs->trans("TryToUseTheModuleBuilder
", $langs->transnoentitiesnoconv("ModuleBuilder
")).'</td>';
1402 print '<td class="maxwidth300
">';
1403 if (isModEnabled('modulebuilder')) {
1404 print $langs->trans("SeeTopRightMenu
");
1406 print '<span class="opacitymedium
">'.$langs->trans("ModuleMustBeEnabledFirst
", $langs->transnoentitiesnoconv("ModuleBuilder
")).'</span>';
1411 print '<tr class="oddeven
" height="80
">'."\n
";
1412 $url = 'https://partners.dolibarr.org';
1413 print '<td class="center
">';
1414 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>';
1416 print '<td>'.$langs->trans("DoliPartnersDesc
").'</td>';
1417 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">';
1418 print img_picto('', 'url', 'class="pictofixedwidth
"');
1419 print $url.'</a></td>';
1424 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.