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');
271 setEventMessages($langs->trans(
"SetupIsReadyForUse", DOL_URL_ROOT.
'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv(
"Home").
' - '.$langs->transnoentitiesnoconv(
"Setup").
' - '.$langs->transnoentitiesnoconv(
"Modules")),
null,
'warnings');
273} elseif ($action ==
'install' && !$allowonlineinstall) {
274 httponly_accessforbidden(
"You try to bypass the protection to disallow deployment of an external module. Hack attempt ?");
277if ($action ==
'set' && $user->admin) {
281 if ($checkOldValue !=
getDolGlobalInt(
'CHECKLASTVERSION_EXTERNALMODULE')) {
282 setEventMessage($langs->trans(
'WarningModuleHasChangedLastVersionCheckParameter', $value),
'warnings');
284 if ($csrfCheckOldValue !=
getDolGlobalInt(
'MAIN_SECURITY_CSRF_WITH_TOKEN')) {
285 setEventMessage($langs->trans(
'WarningModuleHasChangedSecurityCsrfParameter', $value),
'warnings');
288 if (!empty($resarray[
'errors'])) {
292 if ($resarray[
'nbperms'] > 0) {
293 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
294 $resqltmp = $db->query($tmpsql);
296 $obj = $db->fetch_object($resqltmp);
298 if ($obj && $obj->nb > 1) {
299 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
307 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
309} elseif ($action ==
'reset' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
315 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
317} elseif (
getDolGlobalInt(
"MAIN_FEATURES_LEVEL") > 1 && $action ==
'reload' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
319 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
322 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
325 dolibarr_set_const($db,
"MAIN_IHM_PARAMS_REV", (
int) $conf->global->MAIN_IHM_PARAMS_REV + 1,
'chaine', 0,
'', $conf->entity);
326 if (!empty($resarray[
'errors'])) {
329 if ($resarray[
'nbperms'] > 0) {
330 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
331 $resqltmp = $db->query($tmpsql);
333 $obj = $db->fetch_object($resqltmp);
334 if ($obj && $obj->nb > 1) {
335 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
343 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
354$form =
new Form($db);
357$morecss = array(
"/admin/dolistore/css/dolistore.css");
365$help_url =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
366llxHeader(
'', $langs->trans(
"Setup"), $help_url,
'',
'',
'', $morejs, $morecss, 0, 0);
372$arrayofnatures = array(
'core'=>$langs->transnoentitiesnoconv(
"NativeModules"),
'external'=>$langs->transnoentitiesnoconv(
"External").
' - ['.$langs->trans(
"AllPublishers").
']');
373$arrayofwarnings = array();
374$arrayofwarningsext = array();
382$modNameLoaded = array();
384foreach ($modulesdir as $dir) {
387 dol_syslog(
"Scan directory ".$dir.
" for module descriptor files (modXXX.class.php)");
388 $handle = @opendir($dir);
389 if (is_resource($handle)) {
390 while (($file = readdir($handle)) !==
false) {
392 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
393 $modName = substr($file, 0,
dol_strlen($file) - 10);
396 if (!empty($modNameLoaded[$modName])) {
397 $mesg =
"Error: Module ".$modName.
" was found twice: Into ".$modNameLoaded[$modName].
" and ".$dir.
". You probably have an old file on your disk.<br>";
404 $res = include_once $dir.$file;
405 if (class_exists($modName)) {
406 $objMod =
new $modName($db);
407 $modNameLoaded[$modName] = $dir;
408 if (!$objMod->numero > 0 && $modName !=
'modUser') {
409 dol_syslog(
'The module descriptor '.$modName.
' must have a numero property', LOG_ERR);
411 $j = $objMod->numero;
413 $modulequalified = 1;
416 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
418 $modulequalified = 0;
421 $modulequalified = 0;
424 $modulequalified = 0;
428 if (!empty($objMod->hidden)) {
429 $modulequalified = 0;
432 if ($modulequalified > 0) {
434 $external = ($objMod->isCoreOrExternalModule() ==
'external');
437 $arrayofnatures[
'external_'.$publisher] = $langs->trans(
"External").
' - '.$publisher;
439 $arrayofnatures[
'external_'] = $langs->trans(
"External").
' - '.$langs->trans(
"UnknownPublishers");
442 ksort($arrayofnatures);
445 $filename[$i] = $modName;
446 $modules[$modName] = $objMod;
449 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
450 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
451 $familykey = key($objMod->familyinfo);
453 $familykey = $objMod->family;
456 $moduleposition = ($objMod->module_position ? $objMod->module_position :
'50');
457 if ($objMod->isCoreOrExternalModule() ==
'external' && $moduleposition < 100000) {
459 $moduleposition =
'80';
463 if (!empty($objMod->warnings_activation)) {
464 $arrayofwarnings[$modName] = $objMod->warnings_activation;
466 if (!empty($objMod->warnings_activation_ext)) {
467 $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
470 $familyposition = (empty($familyinfo[$familykey][
'position']) ? 0 : $familyinfo[$familykey][
'position']);
471 $listOfOfficialModuleGroups = array(
'hr',
'technic',
'interface',
'technic',
'portal',
'financial',
'crm',
'base',
'products',
'srm',
'ecm',
'projects',
'other');
472 if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
474 if (is_numeric($familyposition)) {
475 $familyposition = sprintf(
"%03d", (
int) $familyposition + 100);
479 $orders[$i] = $familyposition.
"_".$familykey.
"_".$moduleposition.
"_".$j;
482 $specialstring =
'unknown';
483 if ($objMod->version ==
'development' || $objMod->version ==
'experimental') {
484 $specialstring =
'expdev';
486 if (isset($categ[$specialstring])) {
487 $categ[$specialstring]++;
489 $categ[$specialstring] = 1;
494 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
497 print
"admin/modules.php Warning bad descriptor file : ".$dir.$file.
" (Class ".$modName.
" not found into file)<br>";
500 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
507 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
511if ($action ==
'reset_confirm' && $user->admin) {
512 if (!empty($modules[$value])) {
513 $objMod = $modules[$value];
515 if (!empty($objMod->langfiles)) {
516 $langs->loadLangs($objMod->langfiles);
519 $form =
new Form($db);
520 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmUnactivation'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reset',
'',
'no', 1);
524if ($action ==
'reload_confirm' && $user->admin) {
525 if (!empty($modules[$value])) {
526 $objMod = $modules[$value];
528 if (!empty($objMod->langfiles)) {
529 $langs->loadLangs($objMod->langfiles);
532 $form =
new Form($db);
533 $formconfirm = $form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmReload'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reload',
'',
'no', 1);
544$nbofactivatedmodules = count($conf->modules);
546$nbmodulesnotautoenabled = count($conf->modules);
547if (in_array(
'fckeditor', $conf->modules)) {
548 $nbmodulesnotautoenabled--;
550if (in_array(
'export', $conf->modules)) {
551 $nbmodulesnotautoenabled--;
553if (in_array(
'import', $conf->modules)) {
554 $nbmodulesnotautoenabled--;
561if ($mode ==
'common' || $mode ==
'commonkanban') {
562 $desc = $langs->trans(
"ModulesDesc",
'{picto}');
563 $desc .=
' '.$langs->trans(
"ModulesDesc2",
'{picto2}');
564 $desc = str_replace(
'{picto}',
img_picto(
'',
'switch_off',
'class="size15x"'), $desc);
565 $desc = str_replace(
'{picto2}',
img_picto(
'',
'setup',
'class="size15x"'), $desc);
566 if ($nbmodulesnotautoenabled <=
getDolGlobalInt(
'MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) {
567 $deschelp .=
'<div class="info hideonsmartphone">'.$desc.
"<br></div>\n";
570 $deschelp .=
'<div class="info">'.$langs->trans($conf->global->MAIN_SETUP_MODULES_INFO).
"<br></div>\n";
576if ($mode ==
'marketplace') {
579if ($mode ==
'deploy') {
580 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDeployDesc", $langs->transnoentitiesnoconv(
"AvailableModules")).
"<br></div><br>\n";
582if ($mode ==
'develop') {
583 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDevelopDesc").
"<br></div><br>\n";
589if ($mode ==
'common' || $mode ==
'commonkanban') {
592 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
593 print
'<input type="hidden" name="token" value="'.newToken().
'">';
594 if (isset($optioncss) && $optioncss !=
'') {
595 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
597 if (isset($sortfield) && $sortfield !=
'') {
598 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
600 if (isset($sortorder) && $sortorder !=
'') {
601 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
603 if (isset($page) && $page !=
'') {
604 print
'<input type="hidden" name="page" value="'.$page.
'">';
606 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
612 $moreforfilter =
'<div class="valignmiddle">';
614 $moreforfilter .=
'<div class="floatright right pagination paddingtop --module-list"><ul><li>';
615 $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'));
617 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.$param,
'', ($mode ==
'common' ? 2 : 1), array(
'morecss'=>
'reposition'));
618 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=commonkanban'.$param,
'', ($mode ==
'commonkanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
619 $moreforfilter .=
'</li></ul></div>';
621 $moreforfilter .=
'<div class="divfilteralone colorbacktimesheet float valignmiddle">';
622 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
623 $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')).
'">';
624 $moreforfilter .=
'</div>';
625 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
626 $moreforfilter .= $form->selectarray(
'search_nature', $arrayofnatures,
dol_escape_htmltag($search_nature), $langs->trans(
'Origin'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth250', 1);
627 $moreforfilter .=
'</div>';
630 $array_version = array(
'stable'=>$langs->transnoentitiesnoconv(
"Stable"));
632 $array_version[
'deprecated'] = $langs->trans(
"Deprecated");
635 $array_version[
'experimental'] = $langs->trans(
"Experimental");
638 $array_version[
'development'] = $langs->trans(
"Development");
640 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
641 $moreforfilter .= $form->selectarray(
'search_version', $array_version, $search_version, $langs->transnoentitiesnoconv(
'Version'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
642 $moreforfilter .=
'</div>';
644 $array_status = array(
'active'=>$langs->transnoentitiesnoconv(
"Enabled"),
'disabled'=>$langs->transnoentitiesnoconv(
"Disabled"));
645 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
646 $moreforfilter .= $form->selectarray(
'search_status', $array_status, $search_status, $langs->transnoentitiesnoconv(
'Status'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
647 $moreforfilter .=
'</div>';
648 $moreforfilter .=
' ';
649 $moreforfilter .=
'<div class="divsearchfield valignmiddle inline-block">';
650 $moreforfilter .=
'<input type="submit" name="buttonsubmit" class="button small" value="'.dol_escape_htmltag($langs->trans(
"Refresh")).
'">';
651 if ($search_keyword || ($search_nature && $search_nature !=
'-1') || ($search_version && $search_version !=
'-1') || ($search_status && $search_status !=
'-1')) {
652 $moreforfilter .=
' ';
653 $moreforfilter .=
'<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans(
"Reset")).
'">';
655 $moreforfilter .=
'</div>';
656 $moreforfilter .=
'</div>';
658 $moreforfilter .=
'</div>';
660 if (!empty($moreforfilter)) {
661 print $moreforfilter;
662 $parameters = array();
663 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
664 print $hookmanager->resPrint;
669 print
'<div class="clearboth"></div><br>';
672 $parameters = array();
673 $reshook = $hookmanager->executeHooks(
'insertExtraHeader', $parameters, $object, $action);
678 $disabled_modules = array();
679 if (!empty($_SESSION[
"disablemodules"])) {
680 $disabled_modules = explode(
',', $_SESSION[
"disablemodules"]);
685 $foundoneexternalmodulewithupdate = 0;
687 $atleastonequalified = 0;
688 $atleastoneforfamily = 0;
690 foreach ($orders as $key => $value) {
692 $tab = explode(
'_', $value);
693 $familykey = $tab[1];
694 $module_position = $tab[2];
696 $modName = $filename[$key];
699 $objMod = $modules[$modName];
702 if ($mode ==
'expdev' && $objMod->version !=
'development' && $objMod->version !=
'experimental') {
706 if (!$objMod->getName()) {
707 dol_syslog(
"Error for module ".$key.
" - Property name of module looks empty", LOG_WARNING);
711 $modulenameshort = strtolower(preg_replace(
'/^mod/i',
'', get_class($objMod)));
712 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
715 $modulename = $objMod->getName();
716 $moduletechnicalname = $objMod->name;
717 $moduledesc = $objMod->getDesc();
718 $moduledesclong = $objMod->getDescLong();
719 $moduleauthor = $objMod->getPublisher();
722 if ($search_keyword) {
724 if (preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $modulename)
725 || preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduletechnicalname)
726 || ($moduledesc && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesc))
727 || ($moduledesclong && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesclong))
728 || ($moduleauthor && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduleauthor))
736 if ($search_status) {
744 if ($search_nature) {
745 if (preg_match(
'/^external/', $search_nature) && $objMod->isCoreOrExternalModule() !=
'external') {
749 if (preg_match(
'/^external_(.*)$/', $search_nature, $reg)) {
755 if (!$reg[1] && !empty($publisher)) {
759 if ($search_nature ==
'core' && $objMod->isCoreOrExternalModule() ==
'external') {
763 if ($search_version) {
764 if (($objMod->version ==
'development' || $objMod->version ==
'experimental' || preg_match(
'/deprecated/', $objMod->version)) && $search_version ==
'stable') {
767 if ($objMod->version !=
'development' && ($search_version ==
'development')) {
770 if ($objMod->version !=
'experimental' && ($search_version ==
'experimental')) {
773 if (!preg_match(
'/deprecated/', $objMod->version) && ($search_version ==
'deprecated')) {
778 $atleastonequalified++;
781 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
782 foreach ($objMod->langfiles as $domain) {
783 $langs->load($domain);
788 if ($familykey != $oldfamily) {
790 print
'</table></div><br>';
793 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
797 if ($mode ==
'commonkanban') {
798 print
'<div class="box-flex-container kanban">';
800 print
'<div class="div-table-responsive">';
801 print
'<table class="tagtable liste" summary="list_of_modules">'.
"\n";
804 $atleastoneforfamily = 0;
807 $atleastoneforfamily++;
809 if ($familykey != $oldfamily) {
810 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
811 $oldfamily = $familykey;
815 $version = $objMod->getVersion(0);
818 if (preg_match(
'/development/i', $version)) {
819 $warningstring = $langs->trans(
"Development");
821 if (preg_match(
'/experimental/i', $version)) {
822 $warningstring = $langs->trans(
"Experimental");
824 if (preg_match(
'/deprecated/i', $version)) {
825 $warningstring = $langs->trans(
"Deprecated");
828 if ($objMod->isCoreOrExternalModule() ==
'external' || preg_match(
'/development|experimental|deprecated/i', $version)) {
829 $versiontrans .= $objMod->getVersion(1);
832 if ($objMod->isCoreOrExternalModule() ==
'external'
834 $action ==
'checklastversion'
840 $checkRes = $objMod->checkForUpdate();
842 setEventMessage($objMod->getName().
' : '.$versiontrans.
' -> '.$objMod->lastVersion);
843 } elseif ($checkRes < 0) {
844 setEventMessage($objMod->getName().
' '.$langs->trans(
'CheckVersionFail'),
'warnings');
850 if ($objMod->isCoreOrExternalModule() ==
'external') {
851 $imginfo =
"info_black";
854 $codeenabledisable =
'';
858 if (in_array($modulenameshort, $disabled_modules)) {
859 $objMod->disabled =
true;
866 if (!empty($arrayofwarnings[$modName])) {
867 $codeenabledisable .=
'<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
870 if (!empty($objMod->disabled)) {
871 $codeenabledisable .= $langs->trans(
"Disabled");
872 } elseif (!empty($objMod->always_enabled) || ((isModEnabled(
'multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
873 if (method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
874 $codeenabledisable .= $langs->trans(
"Used");
876 $codeenabledisable .=
img_picto($langs->trans(
"Required"),
'switch_on',
'',
false, 0, 0,
'',
'opacitymedium valignmiddle');
879 if (isModEnabled(
'multicompany') && $user->entity) {
883 if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
884 $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.
'">';
885 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
886 $codeenabledisable .=
'</a>';
888 $codeenabledisable .=
' ';
889 $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.
'">';
890 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
891 $codeenabledisable .=
'</a>';
894 $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.
'">';
895 $codeenabledisable .=
img_picto($langs->trans(
"Activated").($warningstring ?
' '.$warningstring :
''),
'switch_on');
896 $codeenabledisable .=
'</a>';
898 $codeenabledisable .=
' ';
899 $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.
'">';
900 $codeenabledisable .=
img_picto($langs->trans(
"Reload"),
'refresh',
'class="opacitymedium"');
901 $codeenabledisable .=
'</a>';
907 if (!empty($objMod->config_page_url) && !$disableSetup) {
908 $backtourlparam =
'';
909 if ($search_keyword !=
'') {
910 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_keyword='.urlencode($search_keyword);
912 if ($search_nature > -1) {
913 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_nature='.urlencode($search_nature);
915 if ($search_version > -1) {
916 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_version='.urlencode($search_version);
918 if ($search_status > -1) {
919 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_status='.urlencode($search_status);
921 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
924 if (is_array($objMod->config_page_url)) {
926 foreach ($objMod->config_page_url as $page) {
929 $codetoconfig .=
'<a href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
932 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
933 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
934 $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>';
936 $urltouse = $urlpage;
937 $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>';
941 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', (
string) $objMod->config_page_url, $regs)) {
942 $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>';
944 $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>';
947 $codetoconfig .=
img_picto($langs->trans(
"NothingToSetup"),
"setup",
'class="opacitytransp" style="padding-right: 6px"',
false, 0, 0,
'',
'fa-15');
951 if (!empty($objMod->always_enabled)) {
953 $codeenabledisable .=
'<!-- Message to show: an always_enabled module has been disabled -->'.
"\n";
954 $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.
'"';
955 $codeenabledisable .=
'>';
956 $codeenabledisable .=
img_picto($langs->trans(
"Disabled"),
'switch_off');
957 $codeenabledisable .=
"</a>\n";
958 } elseif (!empty($objMod->disabled)) {
959 $codeenabledisable .= $langs->trans(
"Disabled");
962 $warningmessage =
'';
963 if (!empty($arrayofwarnings[$modName])) {
964 $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";
965 foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
966 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
967 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
971 if ($objMod->isCoreOrExternalModule() ==
'external' && !empty($arrayofwarningsext)) {
972 $codeenabledisable .=
'<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
973 foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
974 $keymodulelowercase = strtolower(preg_replace(
'/^mod/',
'', $keymodule));
975 if (in_array($keymodulelowercase, $conf->modules)) {
976 foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
977 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
978 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
979 $warningmessage .= ($warningmessage ?
"\n" :
"").($warningmessage ?
"\n" :
"").$langs->trans(
"Module").
' : '.$objMod->getName();
980 if (!empty($objMod->editor_name)) {
981 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"Publisher").
' : '.$objMod->editor_name;
983 if (!empty($objMod->editor_name)) {
984 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"ModuleTriggeringThisWarning").
' : '.$modules[$keymodule]->getName();
991 $codeenabledisable .=
'<!-- Message to show: '.$warningmessage.
' -->'.
"\n";
992 $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.
'"';
993 if ($warningmessage) {
994 $codeenabledisable .=
' onclick="return confirm(\''.dol_escape_js($warningmessage).
'\');
"';
996 $codeenabledisable .= '>';
997 $codeenabledisable .= img_picto($langs->trans("Disabled
"), 'switch_off');
998 $codeenabledisable .= "</a>\n
";
1001 // Set $codetoconfig
1002 $codetoconfig .= img_picto($langs->trans("NothingToSetup
"), "setup
", 'class="opacitytransp
" style="padding-right: 6px
"');
1005 if ($mode == 'commonkanban') {
1007 print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
1009 print '<tr class="oddeven
'.($warningstring ? ' info-box-content-warning
' : '').'">'."\n
";
1010 if (getDolGlobalString('MAIN_MODULES_SHOW_LINENUMBERS')) {
1011 print '<td class="width50
">'.$linenum.'</td>';
1014 // Picto + Name of module
1015 print ' <td class="tdoverflowmax200 minwidth200imp
" title="'.dol_escape_htmltag($objMod->getName()).'">';
1017 //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
1018 //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
1019 if (!empty($objMod->picto)) {
1020 if (preg_match('/^\//i', $objMod->picto)) {
1021 print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"', 1);
1023 print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"');
1026 print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly
"');
1028 print ' <span class="valignmiddle
">'.$objMod->getName().'</span>';
1032 print '<td class="valignmiddle tdoverflowmax300 minwidth200imp
">';
1033 print nl2br($objMod->getDesc());
1037 print '<td class="center nowrap
" style="width: 82px;
">';
1038 //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
1039 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>';
1043 print '<td class="center nowrap width150
" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
1044 if ($objMod->needUpdate) {
1045 $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
1046 print '<span class="badge badge-warning classfortooltip
" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
1048 print $versiontrans;
1052 // Link enable/disable
1053 print '<td class="center valignmiddle left nowraponall
" width="60px
">';
1054 print $codeenabledisable;
1058 print '<td class="tdsetuppicto right valignmiddle
" width="60px
">';
1059 print $codetoconfig;
1064 if ($objMod->needUpdate) {
1065 $foundoneexternalmodulewithupdate++;
1069 if ($action == 'checklastversion') {
1070 if ($foundoneexternalmodulewithupdate) {
1071 setEventMessages($langs->trans("ModuleUpdateAvailable
"), null, 'mesgs');
1073 setEventMessages($langs->trans("NoExternalModuleWithUpdate
"), null, 'mesgs');
1078 if ($mode == 'commonkanban') {
1086 if (!$atleastonequalified) {
1087 print '<br><span class="opacitymedium
">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria
").'</span><br><br>';
1090 print dol_get_fiche_end();
1094 // Show warning about external users
1095 print info_admin(showModulesExludedForExternal($modules))."\n
";
1100if ($mode == 'marketplace') {
1101 print dol_get_fiche_head($head, $mode, '', -1);
1108 print '<div class="div-table-responsive-no-min
">';
1109 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1110 print '<tr class="liste_titre
">'."\n
";
1111 print '<td class="hideonsmartphone
">'.$form->textwithpicto($langs->trans("Provider
"), $langs->trans("WebSiteDesc
")).'</td>';
1113 print '<td>'.$langs->trans("URL
").'</td>';
1116 print '<tr class="oddeven
">'."\n
";
1117 $url = 'https://www.dolistore.com';
1118 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>';
1119 print '<td><span class="opacitymedium
">'.$langs->trans("DoliStoreDesc
").'</span></td>';
1120 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">'.$url.'</a></td>';
1126 print dol_get_fiche_end();
1130 if (!getDolGlobalString('MAIN_DISABLE_DOLISTORE_SEARCH') && getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 1) {
1131 // $options is array with filter criterias
1132 //var_dump($options);
1133 $dolistore->getRemoteCategories();
1134 $dolistore->getRemoteProducts($options);
1136 print '<span class="opacitymedium
">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
1138 $previouslink = $dolistore->get_previous_link();
1139 $nextlink = $dolistore->get_next_link();
1141 print '<div class="liste_titre liste_titre_bydiv centpercent
"><div class="divsearchfield
">';
1143 print '<form method="POST
" class="centpercent
" id="searchFormList
" action="'.$dolistore->url.'">'; ?>
1144 <input type="hidden
" name="token
" value="<?php echo newToken(); ?>
">
1145 <input type="hidden
" name="mode
" value="marketplace
">
1146 <div class="divsearchfield
">
1147 <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>
1149 <div class="divsearchfield
">
1150 <input class="button buttongen
" value="<?php echo $langs->trans(
'Rechercher') ?>
" type="submit
">
1151 <a class="buttonreset
" href="<?php echo urlencode($dolistore->url) ?>
"><?php echo $langs->trans('Reset') ?></a>
1156 print $previouslink;
1161 print '</div></div>';
1162 print '<div class="clearboth
"></div>'; ?>
1164 <div id="category-tree-left
">
1167 echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content?>
1170 <div id="listing-content
">
1171 <table summary="list_of_modules
" id="list_of_modules
" class="productlist centpercent
">
1172 <tbody id="listOfModules
">
1173 <?php echo $dolistore->get_products(); ?>
1182// Install external module
1184if ($mode == 'deploy') {
1185 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'));
1222 if ($allowfromweb < 1) {
1223 print $langs->trans("SomethingMakeInstallFromWebNotPossible
");
1225 //print $langs->trans("SomethingMakeInstallFromWebNotPossible2
");
1231 // $allowfromweb = -1 if installation or setup not correct, 0 if not allowed, 1 if allowed
1232 if ($allowfromweb >= 0) {
1233 if ($allowfromweb == 1) {
1234 //print $langs->trans("ThisIsProcessToFollow
").'<br>';
1236 print $langs->trans("ThisIsAlternativeProcessToFollow
").'<br>';
1237 print '<b>'.$langs->trans("StepNb
", 1).'</b>: ';
1238 print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite
", '{s1}')).'<br>';
1239 print '<b>'.$langs->trans("StepNb
", 2).'</b>: ';
1240 print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite
", '{s1}')).'<br>';
1241 print '<b>'.$langs->trans("StepNb
", 3).'</b>: ';
1244 if ($allowfromweb == 1) {
1245 print '<form enctype="multipart/form-data
" method="POST
" class="noborder
" action="'.$_SERVER["PHP_SELF"].'" name="forminstall
">';
1246 print '<input type="hidden
" name="token
" value="'.newToken().'">';
1247 print '<input type="hidden
" name="action
" value="install
">';
1248 print '<input type="hidden
" name="mode
" value="deploy
">';
1250 print $langs->trans("YouCanSubmitFile
").'<br><br>';
1252 $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
1253 $maxphp = @ini_get('upload_max_filesize'); // In unknown
1254 if (preg_match('/k$/i', $maxphp)) {
1255 $maxphp = preg_replace('/k$/i', '', $maxphp);
1256 $maxphp = $maxphp * 1;
1258 if (preg_match('/m$/i', $maxphp)) {
1259 $maxphp = preg_replace('/m$/i', '', $maxphp);
1260 $maxphp = $maxphp * 1024;
1262 if (preg_match('/g$/i', $maxphp)) {
1263 $maxphp = preg_replace('/g$/i', '', $maxphp);
1264 $maxphp = $maxphp * 1024 * 1024;
1266 if (preg_match('/t$/i', $maxphp)) {
1267 $maxphp = preg_replace('/t$/i', '', $maxphp);
1268 $maxphp = $maxphp * 1024 * 1024 * 1024;
1270 $maxphp2 = @ini_get('post_max_size'); // In unknown
1271 if (preg_match('/k$/i', $maxphp2)) {
1272 $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
1273 $maxphp2 = $maxphp2 * 1;
1275 if (preg_match('/m$/i', $maxphp2)) {
1276 $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
1277 $maxphp2 = $maxphp2 * 1024;
1279 if (preg_match('/g$/i', $maxphp2)) {
1280 $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
1281 $maxphp2 = $maxphp2 * 1024 * 1024;
1283 if (preg_match('/t$/i', $maxphp2)) {
1284 $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
1285 $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
1287 // Now $max and $maxphp and $maxphp2 are in Kb
1289 $maxphptoshow = $maxphptoshowparam = '';
1291 $maxmin = min($max, $maxphp);
1292 $maxphptoshow = $maxphp;
1293 $maxphptoshowparam = 'upload_max_filesize';
1296 $maxmin = min($max, $maxphp2);
1297 if ($maxphp2 < $maxphp) {
1298 $maxphptoshow = $maxphp2;
1299 $maxphptoshowparam = 'post_max_size';
1304 print '<script type="text/javascript
">
1305 $(document).ready(function() {
1306 jQuery("#fileinstall
").on("change
", function() {
1307 if(this.files[0].size > '.($maxmin * 1024).') {
1308 alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'");
1314 // MAX_FILE_SIZE doit précéder le champ input de type file
1315 print '<input type="hidden
" name="MAX_FILE_SIZE
" value="'.($maxmin * 1024).'">';
1318 print '<input class="flat minwidth400
" type="file
" name="fileinstall
" id="fileinstall
"> ';
1320 print '<input type="submit
" name="send
" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button">';
1322 if (getDolGlobalString('MAIN_UPLOAD_DOC')) {
1324 $langs->load('other');
1326 print info_admin($langs->trans("ThisLimitIsDefinedInSetup
", $max, $maxphptoshow, $maxphptoshowparam), 1);
1329 print ' ('.$langs->trans("UploadDisabled
").')';
1337 print '<div class="center
"><div class="logo_setup
"></div></div>';
1339 print $langs->trans("UnpackPackageInModulesRoot
", $dirins).'<br>';
1340 print '<b>'.$langs->trans("StepNb
", 4).'</b>: ';
1341 print $langs->trans("SetupIsReadyForUse
").'<br>';
1345 if (!empty($result['return'])) {
1348 foreach ($result['return'] as $value) {
1353 print dol_get_fiche_end();
1356if ($mode == 'develop') {
1357 print dol_get_fiche_head($head, $mode, '', -1);
1364 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1365 print '<tr class="liste_titre
">'."\n
";
1366 //print '<td>'.$langs->trans("Logo
").'</td>';
1367 print '<td colspan="2
">'.$langs->trans("DevelopYourModuleDesc
").'</td>';
1368 print '<td>'.$langs->trans("URL
").'</td>';
1371 print '<tr class="oddeven
" height="80
">'."\n
";
1372 print '<td class="center
">';
1373 print '<div class="imgmaxheight50 logo_setup
"></div>';
1375 print '<td>'.$langs->trans("TryToUseTheModuleBuilder
", $langs->transnoentitiesnoconv("ModuleBuilder
")).'</td>';
1376 print '<td class="maxwidth300
">';
1377 if (isModEnabled('modulebuilder')) {
1378 print $langs->trans("SeeTopRightMenu
");
1380 print '<span class="opacitymedium
">'.$langs->trans("ModuleMustBeEnabledFirst
", $langs->transnoentitiesnoconv("ModuleBuilder
")).'</span>';
1385 print '<tr class="oddeven
" height="80
">'."\n
";
1386 $url = 'https://partners.dolibarr.org';
1387 print '<td class="center
">';
1388 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>';
1390 print '<td>'.$langs->trans("DoliPartnersDesc
").'</td>';
1391 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">';
1392 print img_picto('', 'url', 'class="pictofixedwidth
"');
1393 print $url.'</a></td>';
1398 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.