32if (!defined(
'CSRFCHECK_WITH_TOKEN') && (empty($_GET[
'action']) || $_GET[
'action'] !=
'reset')) {
33 define(
'CSRFCHECK_WITH_TOKEN',
'1');
37require
'../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/admin/dolistore/class/dolistore.class.php';
45$langs->loadLangs(array(
"errors",
"admin",
"modulebuilder"));
48if (GETPOSTISSET(
'mode')) {
49 $mode =
GETPOST(
'mode',
'alpha');
50 if ($mode ==
'common' || $mode ==
'commonkanban') {
51 dolibarr_set_const($db,
"MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT", $mode,
'chaine', 0,
'', $conf->entity);
54 $mode = (!
getDolGlobalString(
'MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT') ?
'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT);
57$action =
GETPOST(
'action',
'aZ09');
58$value =
GETPOST(
'value',
'alpha');
59$page_y =
GETPOST(
'page_y',
'int');
60$search_keyword =
GETPOST(
'search_keyword',
'alpha');
61$search_status =
GETPOST(
'search_status',
'alpha');
62$search_nature =
GETPOST(
'search_nature',
'alpha');
63$search_version =
GETPOST(
'search_version',
'alpha');
68$options[
'per_page'] = 20;
69$options[
'categorie'] = ((int) (
GETPOST(
'categorie',
'int') ?
GETPOST(
'categorie',
'int') : 0));
70$options[
'start'] = ((int) (
GETPOST(
'start',
'int') ?
GETPOST(
'start',
'int') : 0));
71$options[
'end'] = ((int) (
GETPOST(
'end',
'int') ?
GETPOST(
'end',
'int') : 0));
72$options[
'search'] =
GETPOST(
'search_keyword',
'alpha');
81 'hr'=>array(
'position'=>
'001',
'label'=>$langs->trans(
"ModuleFamilyHr")),
82 'crm'=>array(
'position'=>
'006',
'label'=>$langs->trans(
"ModuleFamilyCrm")),
83 'srm'=>array(
'position'=>
'007',
'label'=>$langs->trans(
"ModuleFamilySrm")),
84 'financial'=>array(
'position'=>
'009',
'label'=>$langs->trans(
"ModuleFamilyFinancial")),
85 'products'=>array(
'position'=>
'012',
'label'=>$langs->trans(
"ModuleFamilyProducts")),
86 'projects'=>array(
'position'=>
'015',
'label'=>$langs->trans(
"ModuleFamilyProjects")),
87 'ecm'=>array(
'position'=>
'018',
'label'=>$langs->trans(
"ModuleFamilyECM")),
88 'technic'=>array(
'position'=>
'021',
'label'=>$langs->trans(
"ModuleFamilyTechnic")),
89 'portal'=>array(
'position'=>
'040',
'label'=>$langs->trans(
"ModuleFamilyPortal")),
90 'interface'=>array(
'position'=>
'050',
'label'=>$langs->trans(
"ModuleFamilyInterface")),
91 'base'=>array(
'position'=>
'060',
'label'=>$langs->trans(
"ModuleFamilyBase")),
92 'other'=>array(
'position'=>
'100',
'label'=>$langs->trans(
"ModuleFamilyOther")),
96if (!
GETPOST(
'buttonreset',
'alpha')) {
97 if ($search_keyword) {
98 $param .=
'&search_keyword='.urlencode($search_keyword);
100 if ($search_status && $search_status !=
'-1') {
101 $param .=
'&search_status='.urlencode($search_status);
103 if ($search_nature && $search_nature !=
'-1') {
104 $param .=
'&search_nature='.urlencode($search_nature);
106 if ($search_version && $search_version !=
'-1') {
107 $param .=
'&search_version='.urlencode($search_version);
111$dirins = DOL_DOCUMENT_ROOT.
'/custom';
112$urldolibarrmodules =
'https://www.dolistore.com/';
115$hookmanager->initHooks(array(
'adminmodules',
'globaladmin'));
118$max_execution_time_for_deploy = (!
getDolGlobalString(
'MODULE_UPLOAD_MAX_EXECUTION_TIME') ? 300 : $conf->global->MODULE_UPLOAD_MAX_EXECUTION_TIME);
119$max_time = @ini_get(
"max_execution_time");
120if ($max_time && $max_time < $max_execution_time_for_deploy) {
121 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.");
122 @ini_set(
"max_execution_time", $max_execution_time_for_deploy);
125$dolibarrdataroot = preg_replace(
'/([\\/]+)$/i',
'', DOL_DATA_ROOT);
126$allowonlineinstall =
true;
128if (
dol_is_file($dolibarrdataroot.
'/installmodules.lock')) {
129 $allowonlineinstall =
false;
139$parameters = array();
140$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
145if (
GETPOST(
'buttonreset',
'alpha')) {
146 $search_keyword =
'';
149 $search_version =
'';
152if ($action ==
'install' && $allowonlineinstall) {
156 $original_file = basename($_FILES[
"fileinstall"][
"name"]);
157 $original_file = preg_replace(
'/\s*\(\d+\)\.zip$/i',
'.zip', $original_file);
158 $newfile = $conf->admin->dir_temp.
'/'.$original_file.
'/'.$original_file;
160 if (!$original_file) {
161 $langs->load(
"Error");
162 setEventMessages($langs->trans(
"ErrorModuleFileRequired"),
null,
'warnings');
165 if (!$error && !preg_match(
'/\.zip$/i', $original_file)) {
166 $langs->load(
"errors");
167 setEventMessages($langs->trans(
"ErrorFileMustBeADolibarrPackage", $original_file),
null,
'errors');
170 if (!$error && !preg_match(
'/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file)) {
171 $langs->load(
"errors");
172 setEventMessages($langs->trans(
"ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file,
'module_*-x.y*.zip'),
null,
'errors');
175 if (empty($_FILES[
'fileinstall'][
'tmp_name'])) {
176 $langs->load(
"errors");
183 if ($original_file) {
185 dol_mkdir($conf->admin->dir_temp.
'/'.$original_file);
188 $tmpdir = preg_replace(
'/\.zip$/i',
'', $original_file).
'.dir';
191 dol_mkdir($conf->admin->dir_temp.
'/'.$tmpdir);
194 $result =
dol_move_uploaded_file($_FILES[
'fileinstall'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'fileinstall'][
'error']);
196 $result =
dol_uncompress($newfile, $conf->admin->dir_temp.
'/'.$tmpdir);
198 if (!empty($result[
'error'])) {
199 $langs->load(
"errors");
200 setEventMessages($langs->trans($result[
'error'], $original_file),
null,
'errors');
204 $modulename = preg_replace(
'/module_/',
'', $original_file);
205 $modulename = preg_replace(
'/\-([0-9][0-9\.]*)\.zip$/i',
'', $modulename);
207 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulename;
210 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulename;
213 setEventMessages($langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat").
'<br>'.$langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename,
'htdocs/'.$modulename),
null,
'errors');
222 dol_syslog(
"Uncompress of module file is a success.");
225 $modulenamearrays = array();
226 if (
dol_is_file($modulenamedir.
'/metapackage.conf')) {
228 $metafile = file_get_contents($modulenamedir.
'/metapackage.conf');
229 $modulenamearrays = explode(
"\n", $metafile);
231 $modulenamearrays[$modulename] = $modulename;
235 foreach ($modulenamearrays as $modulenameval) {
236 if (strpos($modulenameval,
'#') === 0) {
239 if (strpos($modulenameval,
'//') === 0) {
242 if (!trim($modulenameval)) {
249 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulenameval;
251 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulenameval;
253 dol_syslog(
"We copy now directory ".$submodulenamedir.
" into target dir ".$dirins.
'/'.$modulenameval);
254 $result =
dolCopyDir($submodulenamedir, $dirins.
'/'.$modulenameval,
'0444', 1);
256 dol_syslog(
'Failed to call dolCopyDir result='.$result.
" with param ".$submodulenamedir.
" and ".$dirins.
'/'.$modulenameval, LOG_WARNING);
257 $langs->load(
"errors");
258 setEventMessages($langs->trans(
"ErrorFailToCopyDir", $submodulenamedir, $dirins.
'/'.$modulenameval),
null,
'errors');
265 setEventMessages($langs->trans(
"ErrorFailToRenameFile", $_FILES[
'fileinstall'][
'tmp_name'], $newfile),
null,
'errors');
295 setEventMessages($langs->trans(
"SetupIsReadyForUse", DOL_URL_ROOT.
'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv(
"Home").
' - '.$langs->transnoentitiesnoconv(
"Setup").
' - '.$langs->transnoentitiesnoconv(
"Modules")),
null,
'warnings');
297} elseif ($action ==
'install' && !$allowonlineinstall) {
298 httponly_accessforbidden(
"You try to bypass the protection to disallow deployment of an external module. Hack attempt ?");
301if ($action ==
'set' && $user->admin) {
305 if ($checkOldValue !=
getDolGlobalInt(
'CHECKLASTVERSION_EXTERNALMODULE')) {
306 setEventMessage($langs->trans(
'WarningModuleHasChangedLastVersionCheckParameter', $value),
'warnings');
308 if ($csrfCheckOldValue !=
getDolGlobalInt(
'MAIN_SECURITY_CSRF_WITH_TOKEN')) {
309 setEventMessage($langs->trans(
'WarningModuleHasChangedSecurityCsrfParameter', $value),
'warnings');
312 if (!empty($resarray[
'errors'])) {
316 if ($resarray[
'nbperms'] > 0) {
317 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
318 $resqltmp = $db->query($tmpsql);
320 $obj = $db->fetch_object($resqltmp);
322 if ($obj && $obj->nb > 1) {
323 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
331 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
333} elseif ($action ==
'reset' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
339 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
341} elseif (
getDolGlobalInt(
"MAIN_FEATURES_LEVEL") > 1 && $action ==
'reload' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
343 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
346 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
349 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
350 if (!empty($resarray[
'errors'])) {
353 if ($resarray[
'nbperms'] > 0) {
354 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
355 $resqltmp = $db->query($tmpsql);
357 $obj = $db->fetch_object($resqltmp);
358 if ($obj && $obj->nb > 1) {
359 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
367 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
378$form =
new Form($db);
381$morecss = array(
"/admin/dolistore/css/dolistore.css");
389$help_url =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
390llxHeader(
'', $langs->trans(
"Setup"), $help_url,
'',
'',
'', $morejs, $morecss, 0, 0);
396$arrayofnatures = array(
'core'=>$langs->transnoentitiesnoconv(
"NativeModules"),
'external'=>$langs->transnoentitiesnoconv(
"External").
' - ['.$langs->trans(
"AllPublishers").
']');
397$arrayofwarnings = array();
398$arrayofwarningsext = array();
406$modNameLoaded = array();
408foreach ($modulesdir as $dir) {
411 dol_syslog(
"Scan directory ".$dir.
" for module descriptor files (modXXX.class.php)");
412 $handle = @opendir($dir);
413 if (is_resource($handle)) {
414 while (($file = readdir($handle)) !==
false) {
416 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
417 $modName = substr($file, 0,
dol_strlen($file) - 10);
420 if (!empty($modNameLoaded[$modName])) {
421 $mesg =
"Error: Module ".$modName.
" was found twice: Into ".$modNameLoaded[$modName].
" and ".$dir.
". You probably have an old file on your disk.<br>";
428 $res = include_once $dir.$file;
429 if (class_exists($modName)) {
430 $objMod =
new $modName($db);
431 $modNameLoaded[$modName] = $dir;
432 if (!$objMod->numero > 0 && $modName !=
'modUser') {
433 dol_syslog(
'The module descriptor '.$modName.
' must have a numero property', LOG_ERR);
435 $j = $objMod->numero;
437 $modulequalified = 1;
440 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
442 $modulequalified = 0;
445 $modulequalified = 0;
448 $modulequalified = 0;
452 if (!empty($objMod->hidden)) {
453 $modulequalified = 0;
456 if ($modulequalified > 0) {
458 $external = ($objMod->isCoreOrExternalModule() ==
'external');
461 $arrayofnatures[
'external_'.$publisher] = $langs->trans(
"External").
' - '.$publisher;
463 $arrayofnatures[
'external_'] = $langs->trans(
"External").
' - '.$langs->trans(
"UnknownPublishers");
466 ksort($arrayofnatures);
469 $filename[$i] = $modName;
470 $modules[$modName] = $objMod;
473 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
474 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
475 $familykey = key($objMod->familyinfo);
477 $familykey = $objMod->family;
480 $moduleposition = ($objMod->module_position ? $objMod->module_position :
'50');
481 if ($objMod->isCoreOrExternalModule() ==
'external' && $moduleposition < 100000) {
483 $moduleposition =
'80';
487 if (!empty($objMod->warnings_activation)) {
488 $arrayofwarnings[$modName] = $objMod->warnings_activation;
490 if (!empty($objMod->warnings_activation_ext)) {
491 $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
494 $familyposition = (empty($familyinfo[$familykey][
'position']) ? 0 : $familyinfo[$familykey][
'position']);
495 $listOfOfficialModuleGroups = array(
'hr',
'technic',
'interface',
'technic',
'portal',
'financial',
'crm',
'base',
'products',
'srm',
'ecm',
'projects',
'other');
496 if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
498 if (is_numeric($familyposition)) {
499 $familyposition = sprintf(
"%03d", (
int) $familyposition + 100);
503 $orders[$i] = $familyposition.
"_".$familykey.
"_".$moduleposition.
"_".$j;
506 $specialstring =
'unknown';
507 if ($objMod->version ==
'development' || $objMod->version ==
'experimental') {
508 $specialstring =
'expdev';
510 if (isset($categ[$specialstring])) {
511 $categ[$specialstring]++;
513 $categ[$specialstring] = 1;
518 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
521 print
"admin/modules.php Warning bad descriptor file : ".$dir.$file.
" (Class ".$modName.
" not found into file)<br>";
524 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
531 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
535if ($action ==
'reset_confirm' && $user->admin) {
536 if (!empty($modules[$value])) {
537 $objMod = $modules[$value];
539 if (!empty($objMod->langfiles)) {
540 $langs->loadLangs($objMod->langfiles);
543 $form =
new Form($db);
544 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmUnactivation'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reset',
'',
'no', 1);
548if ($action ==
'reload_confirm' && $user->admin) {
549 if (!empty($modules[$value])) {
550 $objMod = $modules[$value];
552 if (!empty($objMod->langfiles)) {
553 $langs->loadLangs($objMod->langfiles);
556 $form =
new Form($db);
557 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmReload'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reload',
'',
'no', 1);
568$nbofactivatedmodules = count($conf->modules);
570$nbmodulesnotautoenabled = count($conf->modules);
571if (in_array(
'fckeditor', $conf->modules)) {
572 $nbmodulesnotautoenabled--;
574if (in_array(
'export', $conf->modules)) {
575 $nbmodulesnotautoenabled--;
577if (in_array(
'import', $conf->modules)) {
578 $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($conf->global->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" 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);
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 setEventMessage($objMod->getName().
' : '.$versiontrans.
' -> '.$objMod->lastVersion);
867 } elseif ($checkRes < 0) {
868 setEventMessage($objMod->getName().
': '.$langs->trans(
'CheckVersionFail'),
'warnings');
872 if ($objMod->isCoreOrExternalModule() ==
'external' && $action ==
'checklastversion' && !
getDolGlobalString(
'DISABLE_CHECK_ON_MALWARE_MODULES')) {
873 $checkRes = $objMod->checkForCompliance();
874 if (!is_numeric($checkRes) && $checkRes !=
'') {
875 $langs->load(
"errors");
876 setEventMessages($objMod->getName().
' : '.$langs->trans($checkRes),
null,
'errors');
882 if ($objMod->isCoreOrExternalModule() ==
'external') {
883 $imginfo =
"info_black";
886 $codeenabledisable =
'';
890 if (in_array($modulenameshort, $disabled_modules)) {
891 $objMod->disabled =
true;
898 if (!empty($arrayofwarnings[$modName])) {
899 $codeenabledisable .=
'<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
902 if (!empty($objMod->disabled)) {
903 $codeenabledisable .= $langs->trans(
"Disabled");
904 } elseif (!empty($objMod->always_enabled) || ((isModEnabled(
'multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
905 if (method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
906 $codeenabledisable .= $langs->trans(
"Used");
908 $codeenabledisable .=
img_picto($langs->trans(
"Required"),
'switch_on',
'',
false, 0, 0,
'',
'opacitymedium valignmiddle');
911 if (isModEnabled(
'multicompany') && $user->entity) {
915 if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
916 $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.
'">';
917 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
918 $codeenabledisable .=
'</a>';
920 $codeenabledisable .=
' ';
921 $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.
'">';
922 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
923 $codeenabledisable .=
'</a>';
926 $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.
'">';
927 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
928 $codeenabledisable .=
'</a>';
930 $codeenabledisable .=
' ';
931 $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.
'">';
932 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
933 $codeenabledisable .=
'</a>';
939 if (!empty($objMod->config_page_url) && !$disableSetup) {
940 $backtourlparam =
'';
941 if ($search_keyword !=
'') {
942 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_keyword='.urlencode($search_keyword);
944 if ($search_nature > -1) {
945 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_nature='.urlencode($search_nature);
947 if ($search_version > -1) {
948 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_version='.urlencode($search_version);
950 if ($search_status > -1) {
951 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_status='.urlencode($search_status);
953 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
956 if (is_array($objMod->config_page_url)) {
958 foreach ($objMod->config_page_url as $page) {
961 $codetoconfig .=
'<a href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
964 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
965 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
966 $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>';
968 $urltouse = $urlpage;
969 $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>';
973 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', (
string) $objMod->config_page_url, $regs)) {
974 $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>';
976 $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>';
979 $codetoconfig .=
img_picto($langs->trans(
"NothingToSetup"),
"setup",
'class="opacitytransp" style="padding-right: 6px"',
false, 0, 0,
'',
'fa-15');
983 if (!empty($objMod->always_enabled)) {
985 $codeenabledisable .=
'<!-- Message to show: an always_enabled module has been disabled -->'.
"\n";
986 $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.
'"';
987 $codeenabledisable .=
'>';
988 $codeenabledisable .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
989 $codeenabledisable .=
"</a>\n";
990 } elseif (!empty($objMod->disabled)) {
991 $codeenabledisable .= $langs->trans(
"Disabled");
994 $warningmessage =
'';
995 if (!empty($arrayofwarnings[$modName])) {
996 $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";
997 foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
998 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
999 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
1003 if ($objMod->isCoreOrExternalModule() ==
'external' && !empty($arrayofwarningsext)) {
1004 $codeenabledisable .=
'<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
1005 foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
1006 $keymodulelowercase = strtolower(preg_replace(
'/^mod/',
'', $keymodule));
1007 if (in_array($keymodulelowercase, $conf->modules)) {
1008 foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
1009 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
1010 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
1011 $warningmessage .= ($warningmessage ?
"\n" :
"").($warningmessage ?
"\n" :
"").$langs->trans(
"Module").
' : '.$objMod->getName();
1012 if (!empty($objMod->editor_name)) {
1013 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"Publisher").
' : '.$objMod->editor_name;
1015 if (!empty($objMod->editor_name)) {
1016 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"ModuleTriggeringThisWarning").
' : '.$modules[$keymodule]->getName();
1023 $codeenabledisable .=
'<!-- Message to show: '.$warningmessage.
' -->'.
"\n";
1024 $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.
'"';
1025 if ($warningmessage) {
1026 $codeenabledisable .=
' onclick="return confirm(\''.dol_escape_js($warningmessage).
'\');
"';
1028 $codeenabledisable .= '>';
1029 $codeenabledisable .= img_picto($langs->trans("Disabled
"), 'switch_off');
1030 $codeenabledisable .= "</a>\n
";
1033 // Set $codetoconfig
1034 $codetoconfig .= img_picto($langs->trans("NothingToSetup
"), "setup
", 'class="opacitytransp
" style="padding-right: 6px
"');
1037 if ($mode == 'commonkanban') {
1039 print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
1041 print '<tr class="oddeven
'.($warningstring ? ' info-box-content-warning
' : '').'">'."\n
";
1042 if (getDolGlobalString('MAIN_MODULES_SHOW_LINENUMBERS')) {
1043 print '<td class="width50
">'.$linenum.'</td>';
1046 // Picto + Name of module
1047 print ' <td class="tdoverflowmax200 minwidth200imp
" title="'.dol_escape_htmltag($objMod->getName()).'">';
1049 //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
1050 //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
1051 if (!empty($objMod->picto)) {
1052 if (preg_match('/^\//i', $objMod->picto)) {
1053 print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"', 1);
1055 print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"');
1058 print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly
"');
1060 print ' <span class="valignmiddle
">'.$objMod->getName().'</span>';
1064 print '<td class="valignmiddle tdoverflowmax300 minwidth200imp
">';
1065 print nl2br($objMod->getDesc());
1069 print '<td class="center nowrap
" style="width: 82px;
">';
1070 //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
1071 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>';
1075 print '<td class="center nowrap width150
" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
1076 if ($objMod->needUpdate) {
1077 $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
1078 print '<span class="badge badge-warning classfortooltip
" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
1080 print $versiontrans;
1084 // Link enable/disable
1085 print '<td class="center valignmiddle left nowraponall
" width="60px
">';
1086 print $codeenabledisable;
1090 print '<td class="tdsetuppicto right valignmiddle
" width="60px
">';
1091 print $codetoconfig;
1096 if ($objMod->needUpdate) {
1097 $foundoneexternalmodulewithupdate++;
1101 if ($action == 'checklastversion') {
1102 if ($foundoneexternalmodulewithupdate) {
1103 setEventMessages($langs->trans("ModuleUpdateAvailable
"), null, 'mesgs');
1105 setEventMessages($langs->trans("NoExternalModuleWithUpdate
"), null, 'mesgs');
1110 if ($mode == 'commonkanban') {
1118 if (!$atleastonequalified) {
1119 print '<br><span class="opacitymedium
">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria
").'</span><br><br>';
1122 print dol_get_fiche_end();
1126 // Show warning about external users
1127 print info_admin(showModulesExludedForExternal($modules))."\n
";
1132if ($mode == 'marketplace') {
1133 print dol_get_fiche_head($head, $mode, '', -1);
1140 print '<div class="div-table-responsive-no-min
">';
1141 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1142 print '<tr class="liste_titre
">'."\n
";
1143 print '<td class="hideonsmartphone
">'.$form->textwithpicto($langs->trans("Provider
"), $langs->trans("WebSiteDesc
")).'</td>';
1145 print '<td>'.$langs->trans("URL
").'</td>';
1148 print '<tr class="oddeven
">'."\n
";
1149 $url = 'https://www.dolistore.com';
1150 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>';
1151 print '<td><span class="opacitymedium
">'.$langs->trans("DoliStoreDesc
").'</span></td>';
1152 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">'.$url.'</a></td>';
1158 print dol_get_fiche_end();
1162 if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) {
1163 // $options is array with filter criterias
1164 //var_dump($options);
1165 $dolistore->getRemoteCategories();
1166 $dolistore->getRemoteProducts($options);
1168 print '<span class="opacitymedium
">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
1170 $previouslink = $dolistore->get_previous_link();
1171 $nextlink = $dolistore->get_next_link();
1173 print '<div class="liste_titre liste_titre_bydiv centpercent
"><div class="divsearchfield
">';
1175 print '<form method="POST
" class="centpercent
" id="searchFormList
" action="'.$dolistore->url.'">'; ?>
1176 <input type="hidden
" name="token
" value="<?php echo newToken(); ?>
">
1177 <input type="hidden
" name="mode
" value="marketplace
">
1178 <div class="divsearchfield
">
1179 <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>
1181 <div class="divsearchfield
">
1182 <input class="button buttongen
" value="<?php echo $langs->trans(
'Rechercher') ?>
" type="submit
">
1183 <a class="buttonreset
" href="<?php echo urlencode($dolistore->url) ?>
"><?php echo $langs->trans('Reset') ?></a>
1188 print $previouslink;
1193 print '</div></div>';
1194 print '<div class="clearboth
"></div>'; ?>
1196 <div id="category-tree-left
">
1199 echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content?>
1202 <div id="listing-content
">
1203 <table summary="list_of_modules
" id="list_of_modules
" class="productlist centpercent
">
1204 <tbody id="listOfModules
">
1205 <?php echo $dolistore->get_products(); ?>
1214// Install external module
1216if ($mode == 'deploy') {
1217 print dol_get_fiche_head($head, $mode, '', -1);
1219 $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank
" rel="noopener noreferrer
">'.$urldolibarrmodules.'</a>';
1221 if ($allowonlineinstall) {
1222 if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
1223 $message = info_admin($langs->trans("ConfFileMustContainCustom
", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
1227 if (!is_writable(dol_osencode($dirins))) {
1228 $langs->load("errors
");
1229 $message = info_admin($langs->trans("ErrorFailedToWriteInDir
", $dirins), 0, 0, '1', 'warning');
1233 $message = info_admin($langs->trans("NotExistsDirect
", $dirins).$langs->trans("InfDirAlt
").$langs->trans("InfDirExample
"));
1238 if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
1239 // Show clean message
1240 if (!is_numeric(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))) {
1241 $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')));
1243 $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));
1246 // Show technical message
1247 $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile
", $dolibarrdataroot.'/installmodules.lock'));
1254 if ($allowfromweb < 1) {
1255 print $langs->trans("SomethingMakeInstallFromWebNotPossible
");
1257 //print $langs->trans("SomethingMakeInstallFromWebNotPossible2
");
1263 // $allowfromweb = -1 if installation or setup not correct, 0 if not allowed, 1 if allowed
1264 if ($allowfromweb >= 0) {
1265 if ($allowfromweb == 1) {
1266 //print $langs->trans("ThisIsProcessToFollow
").'<br>';
1268 print $langs->trans("ThisIsAlternativeProcessToFollow
").'<br>';
1269 print '<b>'.$langs->trans("StepNb
", 1).'</b>: ';
1270 print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite
", '{s1}')).'<br>';
1271 print '<b>'.$langs->trans("StepNb
", 2).'</b>: ';
1272 print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite
", '{s1}')).'<br>';
1273 print '<b>'.$langs->trans("StepNb
", 3).'</b>: ';
1276 if ($allowfromweb == 1) {
1277 print '<form enctype="multipart/form-data
" method="POST
" class="noborder
" action="'.$_SERVER["PHP_SELF"].'" name="forminstall
">';
1278 print '<input type="hidden
" name="token
" value="'.newToken().'">';
1279 print '<input type="hidden
" name="action
" value="install
">';
1280 print '<input type="hidden
" name="mode
" value="deploy
">';
1282 print $langs->trans("YouCanSubmitFile
").'<br><br>';
1284 $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
1285 $maxphp = @ini_get('upload_max_filesize'); // In unknown
1286 if (preg_match('/k$/i', $maxphp)) {
1287 $maxphp = preg_replace('/k$/i', '', $maxphp);
1288 $maxphp = $maxphp * 1;
1290 if (preg_match('/m$/i', $maxphp)) {
1291 $maxphp = preg_replace('/m$/i', '', $maxphp);
1292 $maxphp = $maxphp * 1024;
1294 if (preg_match('/g$/i', $maxphp)) {
1295 $maxphp = preg_replace('/g$/i', '', $maxphp);
1296 $maxphp = $maxphp * 1024 * 1024;
1298 if (preg_match('/t$/i', $maxphp)) {
1299 $maxphp = preg_replace('/t$/i', '', $maxphp);
1300 $maxphp = $maxphp * 1024 * 1024 * 1024;
1302 $maxphp2 = @ini_get('post_max_size'); // In unknown
1303 if (preg_match('/k$/i', $maxphp2)) {
1304 $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
1305 $maxphp2 = $maxphp2 * 1;
1307 if (preg_match('/m$/i', $maxphp2)) {
1308 $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
1309 $maxphp2 = $maxphp2 * 1024;
1311 if (preg_match('/g$/i', $maxphp2)) {
1312 $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
1313 $maxphp2 = $maxphp2 * 1024 * 1024;
1315 if (preg_match('/t$/i', $maxphp2)) {
1316 $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
1317 $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
1319 // Now $max and $maxphp and $maxphp2 are in Kb
1321 $maxphptoshow = $maxphptoshowparam = '';
1323 $maxmin = min($max, $maxphp);
1324 $maxphptoshow = $maxphp;
1325 $maxphptoshowparam = 'upload_max_filesize';
1328 $maxmin = min($max, $maxphp2);
1329 if ($maxphp2 < $maxphp) {
1330 $maxphptoshow = $maxphp2;
1331 $maxphptoshowparam = 'post_max_size';
1336 print '<script type="text/javascript
">
1337 $(document).ready(function() {
1338 jQuery("#fileinstall
").on("change
", function() {
1339 if(this.files[0].size > '.($maxmin * 1024).') {
1340 alert("'.dol_escape_js($langs->transnoentitiesnoconv("ErrorFileSizeTooLarge")).'");
1346 // MAX_FILE_SIZE doit précéder le champ input de type file
1347 print '<input type="hidden
" name="MAX_FILE_SIZE
" value="'.($maxmin * 1024).'">';
1350 print '<input class="flat minwidth400
" type="file
" name="fileinstall
" id="fileinstall
"> ';
1352 print '<input type="submit
" name="send
" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button">';
1354 if (getDolGlobalString('MAIN_UPLOAD_DOC')) {
1356 $langs->load('other');
1358 print info_admin($langs->trans("ThisLimitIsDefinedInSetup
", $max, $maxphptoshow, $maxphptoshowparam), 1);
1361 print ' ('.$langs->trans("UploadDisabled
").')';
1369 print '<div class="center
"><div class="logo_setup
"></div></div>';
1371 print $langs->trans("UnpackPackageInModulesRoot
", $dirins).'<br>';
1372 print '<b>'.$langs->trans("StepNb
", 4).'</b>: ';
1373 print $langs->trans("SetupIsReadyForUse
").'<br>';
1377 if (!empty($result['return'])) {
1380 foreach ($result['return'] as $value) {
1385 print dol_get_fiche_end();
1388if ($mode == 'develop') {
1389 print dol_get_fiche_head($head, $mode, '', -1);
1396 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1397 print '<tr class="liste_titre
">'."\n
";
1398 //print '<td>'.$langs->trans("Logo
").'</td>';
1399 print '<td colspan="2
">'.$langs->trans("DevelopYourModuleDesc
").'</td>';
1400 print '<td>'.$langs->trans("URL
").'</td>';
1403 print '<tr class="oddeven
" height="80
">'."\n
";
1404 print '<td class="center
">';
1405 print '<div class="imgmaxheight50 logo_setup
"></div>';
1407 print '<td>'.$langs->trans("TryToUseTheModuleBuilder
", $langs->transnoentitiesnoconv("ModuleBuilder
")).'</td>';
1408 print '<td class="maxwidth300
">';
1409 if (isModEnabled('modulebuilder')) {
1410 print $langs->trans("SeeTopRightMenu
");
1412 print '<span class="opacitymedium
">'.$langs->trans("ModuleMustBeEnabledFirst
", $langs->transnoentitiesnoconv("ModuleBuilder
")).'</span>';
1417 print '<tr class="oddeven
" height="80
">'."\n
";
1418 $url = 'https://partners.dolibarr.org';
1419 print '<td class="center
">';
1420 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>';
1422 print '<td>'.$langs->trans("DoliPartnersDesc
").'</td>';
1423 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">';
1424 print img_picto('', 'url', 'class="pictofixedwidth
"');
1425 print $url.'</a></td>';
1430 print dol_get_fiche_end();
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='')
Make control on an uploaded file from an GUI page and move it to final destination.
dol_uncompress($inputfile, $outputdir)
Uncompress a file.
dol_is_file($pathoffile)
Return if path is a file.
dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement=null, $excludesubdir=0, $excludefileext=null)
Copy a dir to another dir.
dol_is_dir($folder)
Test if filename is a directory.
dolGetModulesDirs($subdir='')
Return list of modules directories.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
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.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_set_focus($selector)
Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
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.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
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...
document_preview(file, type, title)
Function show document preview.
ui dialog ui datepicker calendar ui widget content ui state ui datepicker calendar ui widget header ui state ui datepicker calendar ui button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
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.