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);
53 $mode = (empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ?
'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT);
56$action =
GETPOST(
'action',
'aZ09');
57$value =
GETPOST(
'value',
'alpha');
58$page_y =
GETPOST(
'page_y',
'int');
59$search_keyword =
GETPOST(
'search_keyword',
'alpha');
60$search_status =
GETPOST(
'search_status',
'alpha');
61$search_nature =
GETPOST(
'search_nature',
'alpha');
62$search_version =
GETPOST(
'search_version',
'alpha');
67$options[
'per_page'] = 20;
68$options[
'categorie'] = ((int) (
GETPOST(
'categorie',
'int') ?
GETPOST(
'categorie',
'int') : 0));
69$options[
'start'] = ((int) (
GETPOST(
'start',
'int') ?
GETPOST(
'start',
'int') : 0));
70$options[
'end'] = ((int) (
GETPOST(
'end',
'int') ?
GETPOST(
'end',
'int') : 0));
71$options[
'search'] =
GETPOST(
'search_keyword',
'alpha');
80 'hr'=>array(
'position'=>
'001',
'label'=>$langs->trans(
"ModuleFamilyHr")),
81 'crm'=>array(
'position'=>
'006',
'label'=>$langs->trans(
"ModuleFamilyCrm")),
82 'srm'=>array(
'position'=>
'007',
'label'=>$langs->trans(
"ModuleFamilySrm")),
83 'financial'=>array(
'position'=>
'009',
'label'=>$langs->trans(
"ModuleFamilyFinancial")),
84 'products'=>array(
'position'=>
'012',
'label'=>$langs->trans(
"ModuleFamilyProducts")),
85 'projects'=>array(
'position'=>
'015',
'label'=>$langs->trans(
"ModuleFamilyProjects")),
86 'ecm'=>array(
'position'=>
'018',
'label'=>$langs->trans(
"ModuleFamilyECM")),
87 'technic'=>array(
'position'=>
'021',
'label'=>$langs->trans(
"ModuleFamilyTechnic")),
88 'portal'=>array(
'position'=>
'040',
'label'=>$langs->trans(
"ModuleFamilyPortal")),
89 'interface'=>array(
'position'=>
'050',
'label'=>$langs->trans(
"ModuleFamilyInterface")),
90 'base'=>array(
'position'=>
'060',
'label'=>$langs->trans(
"ModuleFamilyBase")),
91 'other'=>array(
'position'=>
'100',
'label'=>$langs->trans(
"ModuleFamilyOther")),
95if (!
GETPOST(
'buttonreset',
'alpha')) {
96 if ($search_keyword) {
97 $param .=
'&search_keyword='.urlencode($search_keyword);
99 if ($search_status && $search_status !=
'-1') {
100 $param .=
'&search_status='.urlencode($search_status);
102 if ($search_nature && $search_nature !=
'-1') {
103 $param .=
'&search_nature='.urlencode($search_nature);
105 if ($search_version && $search_version !=
'-1') {
106 $param .=
'&search_version='.urlencode($search_version);
110$dirins = DOL_DOCUMENT_ROOT.
'/custom';
111$urldolibarrmodules =
'https://www.dolistore.com/';
114$hookmanager->initHooks(array(
'adminmodules',
'globaladmin'));
117$max_execution_time_for_deploy = (empty($conf->global->MODULE_UPLOAD_MAX_EXECUTION_TIME) ? 300 : $conf->global->MODULE_UPLOAD_MAX_EXECUTION_TIME);
118$max_time = @ini_get(
"max_execution_time");
119if ($max_time && $max_time < $max_execution_time_for_deploy) {
120 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.");
121 @ini_set(
"max_execution_time", $max_execution_time_for_deploy);
124$dolibarrdataroot = preg_replace(
'/([\\/]+)$/i',
'', DOL_DATA_ROOT);
125$allowonlineinstall =
true;
127if (
dol_is_file($dolibarrdataroot.
'/installmodules.lock')) {
128 $allowonlineinstall =
false;
138$parameters = array();
139$reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
144if (
GETPOST(
'buttonreset',
'alpha')) {
145 $search_keyword =
'';
148 $search_version =
'';
151if ($action ==
'install' && $allowonlineinstall) {
155 $original_file = basename($_FILES[
"fileinstall"][
"name"]);
156 $original_file = preg_replace(
'/\s*\(\d+\)\.zip$/i',
'.zip', $original_file);
157 $newfile = $conf->admin->dir_temp.
'/'.$original_file.
'/'.$original_file;
159 if (!$original_file) {
160 $langs->load(
"Error");
161 setEventMessages($langs->trans(
"ErrorModuleFileRequired"),
null,
'warnings');
164 if (!$error && !preg_match(
'/\.zip$/i', $original_file)) {
165 $langs->load(
"errors");
166 setEventMessages($langs->trans(
"ErrorFileMustBeADolibarrPackage", $original_file),
null,
'errors');
169 if (!$error && !preg_match(
'/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file)) {
170 $langs->load(
"errors");
171 setEventMessages($langs->trans(
"ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file,
'module_*-x.y*.zip'),
null,
'errors');
174 if (empty($_FILES[
'fileinstall'][
'tmp_name'])) {
175 $langs->load(
"errors");
182 if ($original_file) {
184 dol_mkdir($conf->admin->dir_temp.
'/'.$original_file);
187 $tmpdir = preg_replace(
'/\.zip$/i',
'', $original_file).
'.dir';
190 dol_mkdir($conf->admin->dir_temp.
'/'.$tmpdir);
193 $result =
dol_move_uploaded_file($_FILES[
'fileinstall'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'fileinstall'][
'error']);
195 $result =
dol_uncompress($newfile, $conf->admin->dir_temp.
'/'.$tmpdir);
197 if (!empty($result[
'error'])) {
198 $langs->load(
"errors");
199 setEventMessages($langs->trans($result[
'error'], $original_file),
null,
'errors');
203 $modulename = preg_replace(
'/module_/',
'', $original_file);
204 $modulename = preg_replace(
'/\-([0-9][0-9\.]*)\.zip$/i',
'', $modulename);
206 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulename;
209 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulename;
212 setEventMessages($langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat").
'<br>'.$langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename,
'htdocs/'.$modulename),
null,
'errors');
221 dol_syslog(
"Uncompress of module file is a success.");
224 $modulenamearrays = array();
225 if (
dol_is_file($modulenamedir.
'/metapackage.conf')) {
227 $metafile = file_get_contents($modulenamedir.
'/metapackage.conf');
228 $modulenamearrays = explode(
"\n", $metafile);
230 $modulenamearrays[$modulename] = $modulename;
234 foreach ($modulenamearrays as $modulenameval) {
235 if (strpos($modulenameval,
'#') === 0) {
238 if (strpos($modulenameval,
'//') === 0) {
241 if (!trim($modulenameval)) {
248 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulenameval;
250 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulenameval;
252 dol_syslog(
"We copy now directory ".$submodulenamedir.
" into target dir ".$dirins.
'/'.$modulenameval);
253 $result =
dolCopyDir($submodulenamedir, $dirins.
'/'.$modulenameval,
'0444', 1);
255 dol_syslog(
'Failed to call dolCopyDir result='.$result.
" with param ".$submodulenamedir.
" and ".$dirins.
'/'.$modulenameval, LOG_WARNING);
256 $langs->load(
"errors");
257 setEventMessages($langs->trans(
"ErrorFailToCopyDir", $submodulenamedir, $dirins.
'/'.$modulenameval),
null,
'errors');
264 setEventMessages($langs->trans(
"ErrorFailToRenameFile", $_FILES[
'fileinstall'][
'tmp_name'], $newfile),
null,
'errors');
270 setEventMessages($langs->trans(
"SetupIsReadyForUse", DOL_URL_ROOT.
'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv(
"Home").
' - '.$langs->transnoentitiesnoconv(
"Setup").
' - '.$langs->transnoentitiesnoconv(
"Modules")),
null,
'warnings');
272} elseif ($action ==
'install' && !$allowonlineinstall) {
273 httponly_accessforbidden(
"You try to bypass the protection to disallow deployment of an external module. Hack attempt ?");
276if ($action ==
'set' && $user->admin) {
280 if ($checkOldValue !=
getDolGlobalInt(
'CHECKLASTVERSION_EXTERNALMODULE')) {
281 setEventMessage($langs->trans(
'WarningModuleHasChangedLastVersionCheckParameter', $value),
'warnings');
283 if ($csrfCheckOldValue !=
getDolGlobalInt(
'MAIN_SECURITY_CSRF_WITH_TOKEN')) {
284 setEventMessage($langs->trans(
'WarningModuleHasChangedSecurityCsrfParameter', $value),
'warnings');
287 if (!empty($resarray[
'errors'])) {
291 if ($resarray[
'nbperms'] > 0) {
292 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
293 $resqltmp = $db->query($tmpsql);
295 $obj = $db->fetch_object($resqltmp);
297 if ($obj && $obj->nb > 1) {
298 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
306 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
308} elseif ($action ==
'reset' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
314 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
316} elseif (
getDolGlobalInt(
"MAIN_FEATURES_LEVEL") > 1 && $action ==
'reload' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
318 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
321 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
324 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
325 if (!empty($resarray[
'errors'])) {
328 if ($resarray[
'nbperms'] > 0) {
329 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
330 $resqltmp = $db->query($tmpsql);
332 $obj = $db->fetch_object($resqltmp);
333 if ($obj && $obj->nb > 1) {
334 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
342 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
353$form =
new Form($db);
356$morecss = array(
"/admin/dolistore/css/dolistore.css");
364$help_url =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
365llxHeader(
'', $langs->trans(
"Setup"), $help_url,
'',
'',
'', $morejs, $morecss, 0, 0);
371$arrayofnatures = array(
'core'=>$langs->transnoentitiesnoconv(
"NativeModules"),
'external'=>$langs->transnoentitiesnoconv(
"External").
' - ['.$langs->trans(
"AllPublishers").
']');
372$arrayofwarnings = array();
373$arrayofwarningsext = array();
381$modNameLoaded = array();
383foreach ($modulesdir as $dir) {
386 dol_syslog(
"Scan directory ".$dir.
" for module descriptor files (modXXX.class.php)");
387 $handle = @opendir($dir);
388 if (is_resource($handle)) {
389 while (($file = readdir($handle)) !==
false) {
391 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
392 $modName = substr($file, 0,
dol_strlen($file) - 10);
395 if (!empty($modNameLoaded[$modName])) {
396 $mesg =
"Error: Module ".$modName.
" was found twice: Into ".$modNameLoaded[$modName].
" and ".$dir.
". You probably have an old file on your disk.<br>";
403 $res = include_once $dir.$file;
404 if (class_exists($modName)) {
405 $objMod =
new $modName($db);
406 $modNameLoaded[$modName] = $dir;
407 if (!$objMod->numero > 0 && $modName !=
'modUser') {
408 dol_syslog(
'The module descriptor '.$modName.
' must have a numero property', LOG_ERR);
410 $j = $objMod->numero;
412 $modulequalified = 1;
415 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
416 if ($objMod->version ==
'development' && (empty($conf->global->$const_name) && (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 2))) {
417 $modulequalified = 0;
419 if ($objMod->version ==
'experimental' && (empty($conf->global->$const_name) && (
getDolGlobalInt(
'MAIN_FEATURES_LEVEL') < 1))) {
420 $modulequalified = 0;
422 if (preg_match(
'/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) {
423 $modulequalified = 0;
427 if (!empty($objMod->hidden)) {
428 $modulequalified = 0;
431 if ($modulequalified > 0) {
433 $external = ($objMod->isCoreOrExternalModule() ==
'external');
436 $arrayofnatures[
'external_'.$publisher] = $langs->trans(
"External").
' - '.$publisher;
438 $arrayofnatures[
'external_'] = $langs->trans(
"External").
' - '.$langs->trans(
"UnknownPublishers");
441 ksort($arrayofnatures);
444 $filename[$i] = $modName;
445 $modules[$modName] = $objMod;
448 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
449 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
450 $familykey = key($objMod->familyinfo);
452 $familykey = $objMod->family;
455 $moduleposition = ($objMod->module_position ? $objMod->module_position :
'50');
456 if ($objMod->isCoreOrExternalModule() ==
'external' && $moduleposition < 100000) {
458 $moduleposition =
'80';
462 if (!empty($objMod->warnings_activation)) {
463 $arrayofwarnings[$modName] = $objMod->warnings_activation;
465 if (!empty($objMod->warnings_activation_ext)) {
466 $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
469 $familyposition = (empty($familyinfo[$familykey][
'position']) ? 0 : $familyinfo[$familykey][
'position']);
470 $listOfOfficialModuleGroups = array(
'hr',
'technic',
'interface',
'technic',
'portal',
'financial',
'crm',
'base',
'products',
'srm',
'ecm',
'projects',
'other');
471 if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
473 if (is_numeric($familyposition)) {
474 $familyposition = sprintf(
"%03d", (
int) $familyposition + 100);
478 $orders[$i] = $familyposition.
"_".$familykey.
"_".$moduleposition.
"_".$j;
481 $specialstring =
'unknown';
482 if ($objMod->version ==
'development' || $objMod->version ==
'experimental') {
483 $specialstring =
'expdev';
485 if (isset($categ[$specialstring])) {
486 $categ[$specialstring]++;
488 $categ[$specialstring] = 1;
493 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
496 print
"admin/modules.php Warning bad descriptor file : ".$dir.$file.
" (Class ".$modName.
" not found into file)<br>";
499 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
506 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
510if ($action ==
'reset_confirm' && $user->admin) {
511 if (!empty($modules[$value])) {
512 $objMod = $modules[$value];
514 if (!empty($objMod->langfiles)) {
515 $langs->loadLangs($objMod->langfiles);
518 $form =
new Form($db);
519 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmUnactivation'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reset',
'',
'no', 1);
523if ($action ==
'reload_confirm' && $user->admin) {
524 if (!empty($modules[$value])) {
525 $objMod = $modules[$value];
527 if (!empty($objMod->langfiles)) {
528 $langs->loadLangs($objMod->langfiles);
531 $form =
new Form($db);
532 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmReload'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reload',
'',
'no', 1);
543$nbofactivatedmodules = count($conf->modules);
545$nbmodulesnotautoenabled = count($conf->modules);
546if (in_array(
'fckeditor', $conf->modules)) $nbmodulesnotautoenabled--;
547if (in_array(
'export', $conf->modules)) $nbmodulesnotautoenabled--;
548if (in_array(
'import', $conf->modules)) $nbmodulesnotautoenabled--;
554if ($mode ==
'common' || $mode ==
'commonkanban') {
555 $desc = $langs->trans(
"ModulesDesc",
'{picto}');
556 $desc .=
' '.$langs->trans(
"ModulesDesc2",
'{picto2}');
557 $desc = str_replace(
'{picto}',
img_picto(
'',
'switch_off',
'class="size15x"'), $desc);
558 $desc = str_replace(
'{picto2}',
img_picto(
'',
'setup',
'class="size15x"'), $desc);
559 if ($nbmodulesnotautoenabled <=
getDolGlobalInt(
'MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) {
560 $deschelp .=
'<div class="info hideonsmartphone">'.$desc.
"<br></div>\n";
562 if (!empty($conf->global->MAIN_SETUP_MODULES_INFO)) {
563 $deschelp .=
'<div class="info">'.$langs->trans($conf->global->MAIN_SETUP_MODULES_INFO).
"<br></div>\n";
569if ($mode ==
'marketplace') {
572if ($mode ==
'deploy') {
573 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDeployDesc", $langs->transnoentitiesnoconv(
"AvailableModules")).
"<br></div><br>\n";
575if ($mode ==
'develop') {
576 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDevelopDesc").
"<br></div><br>\n";
582if ($mode ==
'common' || $mode ==
'commonkanban') {
585 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
586 print
'<input type="hidden" name="token" value="'.newToken().
'">';
587 if (isset($optioncss) && $optioncss !=
'') {
588 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
590 if (isset($sortfield) && $sortfield !=
'') {
591 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
593 if (isset($sortorder) && $sortorder !=
'') {
594 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
596 if (isset($page) && $page !=
'') {
597 print
'<input type="hidden" name="page" value="'.$page.
'">';
599 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
605 $moreforfilter =
'<div class="valignmiddle">';
607 $moreforfilter .=
'<div class="floatright right pagination paddingtop --module-list"><ul><li>';
608 $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'));
610 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.$param,
'', ($mode ==
'common' ? 2 : 1), array(
'morecss'=>
'reposition'));
611 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=commonkanban'.$param,
'', ($mode ==
'commonkanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
612 $moreforfilter .=
'</li></ul></div>';
614 $moreforfilter .=
'<div class="divfilteralone colorbacktimesheet float valignmiddle">';
615 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
616 $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')).
'">';
617 $moreforfilter .=
'</div>';
618 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
619 $moreforfilter .= $form->selectarray(
'search_nature', $arrayofnatures,
dol_escape_htmltag($search_nature), $langs->trans(
'Origin'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth250', 1);
620 $moreforfilter .=
'</div>';
623 $array_version = array(
'stable'=>$langs->transnoentitiesnoconv(
"Stable"));
625 $array_version[
'deprecated'] = $langs->trans(
"Deprecated");
627 if ($conf->global->MAIN_FEATURES_LEVEL > 0) {
628 $array_version[
'experimental'] = $langs->trans(
"Experimental");
630 if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
631 $array_version[
'development'] = $langs->trans(
"Development");
633 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
634 $moreforfilter .= $form->selectarray(
'search_version', $array_version, $search_version, $langs->transnoentitiesnoconv(
'Version'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
635 $moreforfilter .=
'</div>';
637 $array_status = array(
'active'=>$langs->transnoentitiesnoconv(
"Enabled"),
'disabled'=>$langs->transnoentitiesnoconv(
"Disabled"));
638 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
639 $moreforfilter .= $form->selectarray(
'search_status', $array_status, $search_status, $langs->transnoentitiesnoconv(
'Status'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
640 $moreforfilter .=
'</div>';
641 $moreforfilter .=
' ';
642 $moreforfilter .=
'<div class="divsearchfield valignmiddle inline-block">';
643 $moreforfilter .=
'<input type="submit" name="buttonsubmit" class="button small" value="'.dol_escape_htmltag($langs->trans(
"Refresh")).
'">';
644 if ($search_keyword || ($search_nature && $search_nature !=
'-1') || ($search_version && $search_version !=
'-1') || ($search_status && $search_status !=
'-1')) {
645 $moreforfilter .=
' ';
646 $moreforfilter .=
'<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans(
"Reset")).
'">';
648 $moreforfilter .=
'</div>';
649 $moreforfilter .=
'</div>';
651 $moreforfilter .=
'</div>';
653 if (!empty($moreforfilter)) {
654 print $moreforfilter;
655 $parameters = array();
656 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
657 print $hookmanager->resPrint;
662 print
'<div class="clearboth"></div><br>';
664 $object =
new stdClass();
665 $parameters = array();
666 $reshook = $hookmanager->executeHooks(
'insertExtraHeader', $parameters, $object, $action);
671 $disabled_modules = array();
672 if (!empty($_SESSION[
"disablemodules"])) {
673 $disabled_modules = explode(
',', $_SESSION[
"disablemodules"]);
678 $foundoneexternalmodulewithupdate = 0;
680 $atleastonequalified = 0;
681 $atleastoneforfamily = 0;
683 foreach ($orders as $key => $value) {
685 $tab = explode(
'_', $value);
686 $familykey = $tab[1];
687 $module_position = $tab[2];
689 $modName = $filename[$key];
692 $objMod = $modules[$modName];
695 if ($mode ==
'expdev' && $objMod->version !=
'development' && $objMod->version !=
'experimental') {
699 if (!$objMod->getName()) {
700 dol_syslog(
"Error for module ".$key.
" - Property name of module looks empty", LOG_WARNING);
704 $modulenameshort = strtolower(preg_replace(
'/^mod/i',
'', get_class($objMod)));
705 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
708 $modulename = $objMod->getName();
709 $moduletechnicalname = $objMod->name;
710 $moduledesc = $objMod->getDesc();
711 $moduledesclong = $objMod->getDescLong();
712 $moduleauthor = $objMod->getPublisher();
715 if ($search_keyword) {
717 if (preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $modulename)
718 || preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduletechnicalname)
719 || ($moduledesc && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesc))
720 || ($moduledesclong && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesclong))
721 || ($moduleauthor && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduleauthor))
729 if ($search_status) {
730 if ($search_status ==
'active' && empty($conf->global->$const_name)) {
733 if ($search_status ==
'disabled' && !empty($conf->global->$const_name)) {
737 if ($search_nature) {
738 if (preg_match(
'/^external/', $search_nature) && $objMod->isCoreOrExternalModule() !=
'external') {
742 if (preg_match(
'/^external_(.*)$/', $search_nature, $reg)) {
748 if (!$reg[1] && !empty($publisher)) {
752 if ($search_nature ==
'core' && $objMod->isCoreOrExternalModule() ==
'external') {
756 if ($search_version) {
757 if (($objMod->version ==
'development' || $objMod->version ==
'experimental' || preg_match(
'/deprecated/', $objMod->version)) && $search_version ==
'stable') {
760 if ($objMod->version !=
'development' && ($search_version ==
'development')) {
763 if ($objMod->version !=
'experimental' && ($search_version ==
'experimental')) {
766 if (!preg_match(
'/deprecated/', $objMod->version) && ($search_version ==
'deprecated')) {
771 $atleastonequalified++;
774 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
775 foreach ($objMod->langfiles as $domain) {
776 $langs->load($domain);
781 if ($familykey != $oldfamily) {
783 print
'</table></div><br>';
786 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
790 if ($mode ==
'commonkanban') {
791 print
'<div class="box-flex-container kanban">';
793 print
'<div class="div-table-responsive">';
794 print
'<table class="tagtable liste" summary="list_of_modules">'.
"\n";
797 $atleastoneforfamily = 0;
800 $atleastoneforfamily++;
802 if ($familykey != $oldfamily) {
803 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
804 $oldfamily = $familykey;
808 $version = $objMod->getVersion(0);
811 if (preg_match(
'/development/i', $version)) {
812 $warningstring = $langs->trans(
"Development");
814 if (preg_match(
'/experimental/i', $version)) {
815 $warningstring = $langs->trans(
"Experimental");
817 if (preg_match(
'/deprecated/i', $version)) {
818 $warningstring = $langs->trans(
"Deprecated");
821 if ($objMod->isCoreOrExternalModule() ==
'external' || preg_match(
'/development|experimental|deprecated/i', $version)) {
822 $versiontrans .= $objMod->getVersion(1);
825 if ($objMod->isCoreOrExternalModule() ==
'external'
827 $action ==
'checklastversion'
830 || !empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)
833 $checkRes = $objMod->checkForUpdate();
835 setEventMessage($objMod->getName().
' : '.$versiontrans.
' -> '.$objMod->lastVersion);
836 } elseif ($checkRes < 0) {
837 setEventMessage($objMod->getName().
' '.$langs->trans(
'CheckVersionFail'),
'warnings');
843 if ($objMod->isCoreOrExternalModule() ==
'external') {
844 $imginfo =
"info_black";
847 $codeenabledisable =
'';
851 if (in_array($modulenameshort, $disabled_modules)) {
852 $objMod->disabled =
true;
856 if (!empty($conf->global->$const_name)) {
859 if (!empty($arrayofwarnings[$modName])) {
860 $codeenabledisable .=
'<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
863 if (!empty($objMod->disabled)) {
864 $codeenabledisable .= $langs->trans(
"Disabled");
865 } elseif (!empty($objMod->always_enabled) || ((isModEnabled(
'multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
866 if (method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
867 $codeenabledisable .= $langs->trans(
"Used");
869 $codeenabledisable .=
img_picto($langs->trans(
"Required"),
'switch_on',
'',
false, 0, 0,
'',
'opacitymedium valignmiddle');
872 if (isModEnabled(
'multicompany') && $user->entity) {
876 if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
877 $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.
'">';
878 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
879 $codeenabledisable .=
'</a>';
881 $codeenabledisable .=
' ';
882 $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.
'">';
883 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
884 $codeenabledisable .=
'</a>';
887 $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.
'">';
888 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
889 $codeenabledisable .=
'</a>';
891 $codeenabledisable .=
' ';
892 $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.
'">';
893 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
894 $codeenabledisable .=
'</a>';
900 if (!empty($objMod->config_page_url) && !$disableSetup) {
901 $backtourlparam =
'';
902 if ($search_keyword !=
'') {
903 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_keyword='.urlencode($search_keyword);
905 if ($search_nature > -1) {
906 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_nature='.urlencode($search_nature);
908 if ($search_version > -1) {
909 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_version='.urlencode($search_version);
911 if ($search_status > -1) {
912 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_status='.urlencode($search_status);
914 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
917 if (is_array($objMod->config_page_url)) {
919 foreach ($objMod->config_page_url as $page) {
922 $codetoconfig .=
'<a href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
925 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
926 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
927 $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>';
929 $urltouse = $urlpage;
930 $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>';
934 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', (
string) $objMod->config_page_url, $regs)) {
935 $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>';
937 $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>';
940 $codetoconfig .=
img_picto($langs->trans(
"NothingToSetup"),
"setup",
'class="opacitytransp" style="padding-right: 6px"',
false, 0, 0,
'',
'fa-15');
944 if (!empty($objMod->always_enabled)) {
946 $codeenabledisable .=
'<!-- Message to show: an always_enabled module has been disabled -->'.
"\n";
947 $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.
'"';
948 $codeenabledisable .=
'>';
949 $codeenabledisable .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
950 $codeenabledisable .=
"</a>\n";
951 } elseif (!empty($objMod->disabled)) {
952 $codeenabledisable .= $langs->trans(
"Disabled");
955 $warningmessage =
'';
956 if (!empty($arrayofwarnings[$modName])) {
957 $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";
958 foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
959 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
960 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
964 if ($objMod->isCoreOrExternalModule() ==
'external' && !empty($arrayofwarningsext)) {
965 $codeenabledisable .=
'<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
966 foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
967 $keymodulelowercase = strtolower(preg_replace(
'/^mod/',
'', $keymodule));
968 if (in_array($keymodulelowercase, $conf->modules)) {
969 foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
970 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
971 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
972 $warningmessage .= ($warningmessage ?
"\n" :
"").($warningmessage ?
"\n" :
"").$langs->trans(
"Module").
' : '.$objMod->getName();
973 if (!empty($objMod->editor_name)) {
974 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"Publisher").
' : '.$objMod->editor_name;
976 if (!empty($objMod->editor_name)) {
977 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"ModuleTriggeringThisWarning").
' : '.$modules[$keymodule]->getName();
984 $codeenabledisable .=
'<!-- Message to show: '.$warningmessage.
' -->'.
"\n";
985 $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.
'"';
986 if ($warningmessage) {
987 $codeenabledisable .=
' onclick="return confirm(\''.dol_escape_js($warningmessage).
'\');
"';
989 $codeenabledisable .= '>';
990 $codeenabledisable .= img_picto($langs->trans("Disabled
"), 'switch_off');
991 $codeenabledisable .= "</a>\n
";
995 $codetoconfig .= img_picto($langs->trans("NothingToSetup
"), "setup
", 'class="opacitytransp
" style="padding-right: 6px
"');
998 if ($mode == 'commonkanban') {
1000 print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
1002 print '<tr class="oddeven
'.($warningstring ? ' info-box-content-warning
' : '').'">'."\n
";
1003 if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) {
1004 print '<td class="width50
">'.$linenum.'</td>';
1007 // Picto + Name of module
1008 print ' <td class="tdoverflowmax200 minwidth200imp
" title="'.dol_escape_htmltag($objMod->getName()).'">';
1010 //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
1011 //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
1012 if (!empty($objMod->picto)) {
1013 if (preg_match('/^\//i', $objMod->picto)) {
1014 print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"', 1);
1016 print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"');
1019 print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly
"');
1021 print ' <span class="valignmiddle
">'.$objMod->getName().'</span>';
1025 print '<td class="valignmiddle tdoverflowmax300 minwidth200imp
">';
1026 print nl2br($objMod->getDesc());
1030 print '<td class="center nowrap
" style="width: 82px;
">';
1031 //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
1032 print '<a href="javascript:
document_preview(\
''.DOL_URL_ROOT.
'/admin/modulehelp.php?id='.$objMod->numero.
'\',\
'text/html\',\''.dol_escape_js($langs->trans(
"Module")).
'\')
">'.img_picto(($objMod->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule
").' - ' : '').$langs->trans("ClickToShowDescription
"), $imginfo).'</a>';
1036 print '<td class="center nowrap width150
" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
1037 if ($objMod->needUpdate) {
1038 $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
1039 print '<span class="badge badge-warning classfortooltip
" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
1041 print $versiontrans;
1045 // Link enable/disable
1046 print '<td class="center valignmiddle left nowraponall
" width="60px
">';
1047 print $codeenabledisable;
1051 print '<td class="tdsetuppicto right valignmiddle
" width="60px
">';
1052 print $codetoconfig;
1057 if ($objMod->needUpdate) {
1058 $foundoneexternalmodulewithupdate++;
1062 if ($action == 'checklastversion') {
1063 if ($foundoneexternalmodulewithupdate) {
1064 setEventMessages($langs->trans("ModuleUpdateAvailable
"), null, 'mesgs');
1066 setEventMessages($langs->trans("NoExternalModuleWithUpdate
"), null, 'mesgs');
1071 if ($mode == 'commonkanban') {
1079 if (!$atleastonequalified) {
1080 print '<br><span class="opacitymedium
">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria
").'</span><br><br>';
1083 print dol_get_fiche_end();
1087 // Show warning about external users
1088 print info_admin(showModulesExludedForExternal($modules))."\n
";
1093if ($mode == 'marketplace') {
1094 print dol_get_fiche_head($head, $mode, '', -1);
1101 print '<div class="div-table-responsive-no-min
">';
1102 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1103 print '<tr class="liste_titre
">'."\n
";
1104 print '<td class="hideonsmartphone
">'.$form->textwithpicto($langs->trans("Provider
"), $langs->trans("WebSiteDesc
")).'</td>';
1106 print '<td>'.$langs->trans("URL
").'</td>';
1109 print '<tr class="oddeven
">'."\n
";
1110 $url = 'https://www.dolistore.com';
1111 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>';
1112 print '<td><span class="opacitymedium
">'.$langs->trans("DoliStoreDesc
").'</span></td>';
1113 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">'.$url.'</a></td>';
1119 print dol_get_fiche_end();
1123 if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1) {
1124 // $options is array with filter criterias
1125 //var_dump($options);
1126 $dolistore->getRemoteCategories();
1127 $dolistore->getRemoteProducts($options);
1129 print '<span class="opacitymedium
">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
1131 $previouslink = $dolistore->get_previous_link();
1132 $nextlink = $dolistore->get_next_link();
1134 print '<div class="liste_titre liste_titre_bydiv centpercent
"><div class="divsearchfield
">';
1136 print '<form method="POST
" class="centpercent
" id="searchFormList
" action="'.$dolistore->url.'">';
1138 <input type="hidden
" name="token
" value="<?php echo newToken(); ?>
">
1139 <input type="hidden
" name="mode
" value="marketplace
">
1140 <div class="divsearchfield
">
1141 <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>
1143 <div class="divsearchfield
">
1144 <input class="button buttongen
" value="<?php echo $langs->trans(
'Rechercher') ?>
" type="submit
">
1145 <a class="buttonreset
" href="<?php echo urlencode($dolistore->url) ?>
"><?php echo $langs->trans('Reset') ?></a>
1150 print $previouslink;
1155 print '</div></div>';
1156 print '<div class="clearboth
"></div>';
1160 <div id="category-tree-left
">
1163 echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content
1167 <div id="listing-content
">
1168 <table summary="list_of_modules
" id="list_of_modules
" class="productlist centpercent
">
1169 <tbody id="listOfModules
">
1170 <?php echo $dolistore->get_products(); ?>
1180// Install external module
1182if ($mode == 'deploy') {
1183 print dol_get_fiche_head($head, $mode, '', -1);
1187 $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank
" rel="noopener noreferrer
">'.$urldolibarrmodules.'</a>';
1189 if ($allowonlineinstall) {
1190 if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
1191 $message = info_admin($langs->trans("ConfFileMustContainCustom
", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
1195 if (!is_writable(dol_osencode($dirins))) {
1196 $langs->load("errors
");
1197 $message = info_admin($langs->trans("ErrorFailedToWriteInDir
", $dirins), 0, 0, '1', 'warning');
1201 $message = info_admin($langs->trans("NotExistsDirect
", $dirins).$langs->trans("InfDirAlt
").$langs->trans("InfDirExample
"));
1206 if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
1207 // Show clean message
1208 if (!is_numeric(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))) {
1209 $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')));
1211 $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));
1214 // Show technical message
1215 $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile
", $dolibarrdataroot.'/installmodules.lock'));
1220 if ($allowfromweb < 1) {
1221 print $langs->trans("SomethingMakeInstallFromWebNotPossible
");
1223 //print $langs->trans("SomethingMakeInstallFromWebNotPossible2
");
1229 if ($allowfromweb >= 0) {
1230 if ($allowfromweb == 1) {
1231 //print $langs->trans("ThisIsProcessToFollow
").'<br>';
1233 print $langs->trans("ThisIsAlternativeProcessToFollow
").'<br>';
1234 print '<b>'.$langs->trans("StepNb
", 1).'</b>: ';
1235 print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite
", '{s1}')).'<br>';
1236 print '<b>'.$langs->trans("StepNb
", 2).'</b>: ';
1237 print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite
", '{s1}')).'<br>';
1238 print '<b>'.$langs->trans("StepNb
", 3).'</b>: ';
1241 if ($allowfromweb == 1) {
1242 print '<span class="opacitymedium
">'.$langs->trans("UnpackPackageInModulesRoot
", $dirins).'</span><br>';
1246 print '<form enctype="multipart/form-data
" method="POST
" class="noborder
" action="'.$_SERVER["PHP_SELF"].'" name="forminstall
">';
1247 print '<input type="hidden
" name="token
" value="'.newToken().'">';
1248 print '<input type="hidden
" name="action
" value="install
">';
1249 print '<input type="hidden
" name="mode
" value="deploy
">';
1251 print $langs->trans("YouCanSubmitFile
");
1253 $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
1254 $maxphp = @ini_get('upload_max_filesize'); // In unknown
1255 if (preg_match('/k$/i', $maxphp)) {
1256 $maxphp = preg_replace('/k$/i', '', $maxphp);
1257 $maxphp = $maxphp * 1;
1259 if (preg_match('/m$/i', $maxphp)) {
1260 $maxphp = preg_replace('/m$/i', '', $maxphp);
1261 $maxphp = $maxphp * 1024;
1263 if (preg_match('/g$/i', $maxphp)) {
1264 $maxphp = preg_replace('/g$/i', '', $maxphp);
1265 $maxphp = $maxphp * 1024 * 1024;
1267 if (preg_match('/t$/i', $maxphp)) {
1268 $maxphp = preg_replace('/t$/i', '', $maxphp);
1269 $maxphp = $maxphp * 1024 * 1024 * 1024;
1271 $maxphp2 = @ini_get('post_max_size'); // In unknown
1272 if (preg_match('/k$/i', $maxphp2)) {
1273 $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
1274 $maxphp2 = $maxphp2 * 1;
1276 if (preg_match('/m$/i', $maxphp2)) {
1277 $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
1278 $maxphp2 = $maxphp2 * 1024;
1280 if (preg_match('/g$/i', $maxphp2)) {
1281 $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
1282 $maxphp2 = $maxphp2 * 1024 * 1024;
1284 if (preg_match('/t$/i', $maxphp2)) {
1285 $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
1286 $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
1288 // Now $max and $maxphp and $maxphp2 are in Kb
1290 $maxphptoshow = $maxphptoshowparam = '';
1292 $maxmin = min($max, $maxphp);
1293 $maxphptoshow = $maxphp;
1294 $maxphptoshowparam = 'upload_max_filesize';
1297 $maxmin = min($max, $maxphp2);
1298 if ($maxphp2 < $maxphp) {
1299 $maxphptoshow = $maxphp2;
1300 $maxphptoshowparam = 'post_max_size';
1305 print '<script type="text/javascript
">
1306 $(document).ready(function() {
1307 jQuery("#fileinstall
").on("change
", function() {
1308 if(this.files[0].size > '.($maxmin * 1024).') {
1309 alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'");
1315 // MAX_FILE_SIZE doit précéder le champ input de type file
1316 print '<input type="hidden
" name="MAX_FILE_SIZE
" value="'.($maxmin * 1024).'">';
1319 print '<input class="flat minwidth400
" type="file
" name="fileinstall
" id="fileinstall
"> ';
1321 print '<input type="submit
" name="send
" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button">';
1323 if (!empty($conf->global->MAIN_UPLOAD_DOC)) {
1325 $langs->load('other');
1327 print info_admin($langs->trans("ThisLimitIsDefinedInSetup
", $max, $maxphptoshow, $maxphptoshowparam), 1);
1330 print ' ('.$langs->trans("UploadDisabled
").')';
1338 print '<div class="center
"><div class="logo_setup
"></div></div>';
1340 print $langs->trans("UnpackPackageInModulesRoot
", $dirins).'<br>';
1341 print '<b>'.$langs->trans("StepNb
", 4).'</b>: ';
1342 print $langs->trans("SetupIsReadyForUse
").'<br>';
1346 if (!empty($result['return'])) {
1349 foreach ($result['return'] as $value) {
1354 print dol_get_fiche_end();
1357if ($mode == 'develop') {
1358 print dol_get_fiche_head($head, $mode, '', -1);
1365 print "<table summary=\
"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
1366 print
"<tr class=\"liste_titre\">\n";
1368 print
'<td colspan="2">'.$langs->trans(
"DevelopYourModuleDesc").
'</td>';
1369 print
'<td>'.$langs->trans(
"URL").
'</td>';
1372 print
'<tr class="oddeven" height="80">'.
"\n";
1373 print
'<td class="left">';
1374 print
'<div class="imgmaxheight50 logo_setup"></div>';
1376 print
'<td>'.$langs->trans(
"TryToUseTheModuleBuilder", $langs->transnoentitiesnoconv(
"ModuleBuilder")).
'</td>';
1377 print
'<td class="maxwidth300">';
1378 if (isModEnabled(
'modulebuilder')) {
1379 print $langs->trans(
"SeeTopRightMenu");
1381 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv(
"ModuleBuilder")).
'</span>';
1386 print
'<tr class="oddeven" height="80">'.
"\n";
1387 $url =
'https://partners.dolibarr.org';
1388 print
'<td class="left">';
1389 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>';
1391 print
'<td>'.$langs->trans(
"DoliPartnersDesc").
'</td>';
1392 print
'<td><a href="'.$url.
'" target="_blank" rel="noopener noreferrer external">'.$url.
'</a></td>';
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.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
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 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.
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.