32 if (!defined(
'CSRFCHECK_WITH_TOKEN') && (empty($_GET[
'action']) || $_GET[
'action'] !=
'reset')) {
33 define(
'CSRFCHECK_WITH_TOKEN',
'1');
37 require
'../main.inc.php';
38 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
39 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
40 require_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
41 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
42 require_once DOL_DOCUMENT_ROOT.
'/admin/dolistore/class/dolistore.class.php';
45 $langs->loadLangs(array(
"errors",
"admin",
"modulebuilder"));
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'] = ((
GETPOST(
'categorie',
'int') ?
GETPOST(
'categorie',
'int') : 0) + 0);
69 $options[
'start'] = ((
GETPOST(
'start',
'int') ?
GETPOST(
'start',
'int') : 0) + 0);
70 $options[
'end'] = ((
GETPOST(
'end',
'int') ?
GETPOST(
'end',
'int') : 0) + 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")),
95 if (!
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'));
123 $parameters = array();
124 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
129 if (
GETPOST(
'buttonreset',
'alpha')) {
130 $search_keyword =
'';
133 $search_version =
'';
136 if ($action ==
'install') {
140 $original_file = basename($_FILES[
"fileinstall"][
"name"]);
141 $original_file = preg_replace(
'/\s*\(\d+\)\.zip$/i',
'.zip', $original_file);
142 $newfile = $conf->admin->dir_temp.
'/'.$original_file.
'/'.$original_file;
144 if (!$original_file) {
145 $langs->load(
"Error");
146 setEventMessages($langs->trans(
"ErrorModuleFileRequired"),
null,
'warnings');
149 if (!$error && !preg_match(
'/\.zip$/i', $original_file)) {
150 $langs->load(
"errors");
151 setEventMessages($langs->trans(
"ErrorFileMustBeADolibarrPackage", $original_file),
null,
'errors');
154 if (!$error && !preg_match(
'/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file)) {
155 $langs->load(
"errors");
156 setEventMessages($langs->trans(
"ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file,
'module_*-x.y*.zip'),
null,
'errors');
159 if (empty($_FILES[
'fileinstall'][
'tmp_name'])) {
160 $langs->load(
"errors");
167 if ($original_file) {
169 dol_mkdir($conf->admin->dir_temp.
'/'.$original_file);
172 $tmpdir = preg_replace(
'/\.zip$/i',
'', $original_file).
'.dir';
175 dol_mkdir($conf->admin->dir_temp.
'/'.$tmpdir);
178 $result =
dol_move_uploaded_file($_FILES[
'fileinstall'][
'tmp_name'], $newfile, 1, 0, $_FILES[
'fileinstall'][
'error']);
180 $result =
dol_uncompress($newfile, $conf->admin->dir_temp.
'/'.$tmpdir);
182 if (!empty($result[
'error'])) {
183 $langs->load(
"errors");
184 setEventMessages($langs->trans($result[
'error'], $original_file),
null,
'errors');
188 $modulename = preg_replace(
'/module_/',
'', $original_file);
189 $modulename = preg_replace(
'/\-([0-9][0-9\.]*)\.zip$/i',
'', $modulename);
191 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulename;
194 $modulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulename;
197 setEventMessages($langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat").
'<br>'.$langs->trans(
"ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename,
'htdocs/'.$modulename),
null,
'errors');
206 dol_syslog(
"Uncompress of module file is a success.");
209 $modulenamearrays = array();
210 if (
dol_is_file($modulenamedir.
'/metapackage.conf')) {
212 $metafile = file_get_contents($modulenamedir.
'/metapackage.conf');
213 $modulenamearrays = explode(
"\n", $metafile);
215 $modulenamearrays[$modulename] = $modulename;
219 foreach ($modulenamearrays as $modulenameval) {
220 if (strpos($modulenameval,
'#') === 0) {
223 if (strpos($modulenameval,
'//') === 0) {
226 if (!trim($modulenameval)) {
233 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/'.$modulenameval;
235 $submodulenamedir = $conf->admin->dir_temp.
'/'.$tmpdir.
'/htdocs/'.$modulenameval;
237 dol_syslog(
"We copy now directory ".$submodulenamedir.
" into target dir ".$dirins.
'/'.$modulenameval);
238 $result =
dolCopyDir($submodulenamedir, $dirins.
'/'.$modulenameval,
'0444', 1);
240 dol_syslog(
'Failed to call dolCopyDir result='.$result.
" with param ".$submodulenamedir.
" and ".$dirins.
'/'.$modulenameval, LOG_WARNING);
241 $langs->load(
"errors");
242 setEventMessages($langs->trans(
"ErrorFailToCopyDir", $submodulenamedir, $dirins.
'/'.$modulenameval),
null,
'errors');
249 setEventMessages($langs->trans(
"ErrorFailToRenameFile", $_FILES[
'fileinstall'][
'tmp_name'], $newfile),
null,
'errors');
255 setEventMessages($langs->trans(
"SetupIsReadyForUse", DOL_URL_ROOT.
'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv(
"Home").
' - '.$langs->transnoentitiesnoconv(
"Setup").
' - '.$langs->transnoentitiesnoconv(
"Modules")),
null,
'warnings');
259 if ($action ==
'set' && $user->admin) {
262 if (!empty($resarray[
'errors'])) {
266 if ($resarray[
'nbperms'] > 0) {
267 $tmpsql =
"SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX.
"user WHERE admin <> 1";
268 $resqltmp = $db->query($tmpsql);
270 $obj = $db->fetch_object($resqltmp);
272 if ($obj && $obj->nb > 1) {
273 $msg = $langs->trans(
'ModuleEnabledAdminMustCheckRights');
281 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
283 } elseif ($action ==
'reset' && $user->admin &&
GETPOST(
'confirm') ==
'yes') {
289 header(
"Location: ".$_SERVER[
"PHP_SELF"].
"?mode=".$mode.$param.($page_y ?
'&page_y='.$page_y :
''));
302 $morecss = array(
"/admin/dolistore/css/dolistore.css");
310 $help_url =
'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
311 llxHeader(
'', $langs->trans(
"Setup"),
$help_url,
'',
'',
'', $morejs, $morecss, 0, 0);
317 $arrayofnatures = array(
'core'=>$langs->transnoentitiesnoconv(
"NativeModules"),
'external'=>$langs->transnoentitiesnoconv(
"External").
' - ['.$langs->trans(
"AllPublishers").
']');
318 $arrayofwarnings = array();
319 $arrayofwarningsext = array();
327 $modNameLoaded = array();
329 foreach ($modulesdir as $dir) {
332 dol_syslog(
"Scan directory ".$dir.
" for module descriptor files (modXXX.class.php)");
333 $handle = @opendir($dir);
334 if (is_resource($handle)) {
335 while (($file = readdir($handle)) !==
false) {
337 if (is_readable($dir.$file) && substr($file, 0, 3) ==
'mod' && substr($file,
dol_strlen($file) - 10) ==
'.class.php') {
338 $modName = substr($file, 0,
dol_strlen($file) - 10);
341 if (!empty($modNameLoaded[$modName])) {
342 $mesg =
"Error: Module ".$modName.
" was found twice: Into ".$modNameLoaded[$modName].
" and ".$dir.
". You probably have an old file on your disk.<br>";
349 $res = include_once $dir.$file;
350 if (class_exists($modName)) {
352 $objMod =
new $modName($db);
353 $modNameLoaded[$modName] = $dir;
354 if (!$objMod->numero > 0 && $modName !=
'modUser') {
355 dol_syslog(
'The module descriptor '.$modName.
' must have a numero property', LOG_ERR);
357 $j = $objMod->numero;
359 $modulequalified = 1;
362 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
363 if ($objMod->version ==
'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) {
364 $modulequalified = 0;
366 if ($objMod->version ==
'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) {
367 $modulequalified = 0;
369 if (preg_match(
'/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) {
370 $modulequalified = 0;
374 if (!empty($objMod->hidden)) {
375 $modulequalified = 0;
378 if ($modulequalified > 0) {
380 $external = ($objMod->isCoreOrExternalModule() ==
'external');
383 $arrayofnatures[
'external_'.$publisher] = $langs->trans(
"External").
' - '.$publisher;
385 $arrayofnatures[
'external_'] = $langs->trans(
"External").
' - '.$langs->trans(
"UnknownPublishers");
388 ksort($arrayofnatures);
391 $filename[$i] = $modName;
392 $modules[$modName] = $objMod;
395 if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
396 $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
397 $familykey = key($objMod->familyinfo);
399 $familykey = $objMod->family;
402 $moduleposition = ($objMod->module_position ? $objMod->module_position :
'50');
403 if ($objMod->isCoreOrExternalModule() ==
'external' && $moduleposition < 100000) {
405 $moduleposition =
'80';
409 if (!empty($objMod->warnings_activation)) {
410 $arrayofwarnings[$modName] = $objMod->warnings_activation;
412 if (!empty($objMod->warnings_activation_ext)) {
413 $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
416 $familyposition = (empty($familyinfo[$familykey][
'position']) ? 0 : $familyinfo[$familykey][
'position']);
417 $listOfOfficialModuleGroups = array(
'hr',
'technic',
'interface',
'technic',
'portal',
'financial',
'crm',
'base',
'products',
'srm',
'ecm',
'projects',
'other');
418 if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
420 if (is_numeric($familyposition)) {
421 $familyposition = sprintf(
"%03d", (
int) $familyposition + 100);
425 $orders[$i] = $familyposition.
"_".$familykey.
"_".$moduleposition.
"_".$j;
428 $specialstring =
'unknown';
429 if ($objMod->version ==
'development' || $objMod->version ==
'experimental') {
430 $specialstring =
'expdev';
432 if (isset($categ[$specialstring])) {
433 $categ[$specialstring]++;
435 $categ[$specialstring] = 1;
440 dol_syslog(
"Module ".get_class($objMod).
" not qualified");
443 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
446 print
"admin/modules.php Warning bad descriptor file : ".$dir.$file.
" (Class ".$modName.
" not found into file)<br>";
449 dol_syslog(
"Failed to load ".$dir.$file.
" ".$e->getMessage(), LOG_ERR);
456 dol_syslog(
"htdocs/admin/modules.php: Failed to open directory ".$dir.
". See permission and open_basedir option.", LOG_WARNING);
460 if ($action ==
'reset_confirm' && $user->admin) {
461 if (!empty($modules[$value])) {
462 $objMod = $modules[$value];
464 if (!empty($objMod->langfiles)) {
465 $langs->loadLangs($objMod->langfiles);
469 $formconfirm =
$form->formconfirm($_SERVER[
"PHP_SELF"].
'?value='.$value.
'&mode='.$mode.$param, $langs->trans(
'ConfirmUnactivation'), $langs->trans(
GETPOST(
'confirm_message_code')),
'reset',
'',
'no', 1);
480 $nbofactivatedmodules = count($conf->modules);
493 if ($mode ==
'common' || $mode ==
'commonkanban') {
494 $desc = $langs->trans(
"ModulesDesc",
'{picto}');
495 $desc .=
' '.$langs->trans(
"ModulesDesc2",
'{picto2}');
496 $desc = str_replace(
'{picto}',
img_picto(
'',
'switch_off',
'class="size15x"'), $desc);
497 $desc = str_replace(
'{picto2}',
img_picto(
'',
'setup',
'class="size15x"'), $desc);
498 if (count($conf->modules) <=
getDolGlobalInt(
'MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) {
499 $deschelp .=
'<div class="info hideonsmartphone">'.$desc.
"<br></div>\n";
501 if (!empty($conf->global->MAIN_SETUP_MODULES_INFO)) {
502 $deschelp .=
'<div class="info">'.$langs->trans($conf->global->MAIN_SETUP_MODULES_INFO).
"<br></div>\n";
508 if ($mode ==
'marketplace') {
511 if ($mode ==
'deploy') {
512 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDeployDesc", $langs->transnoentitiesnoconv(
"AvailableModules")).
"<br></div><br>\n";
514 if ($mode ==
'develop') {
515 $deschelp =
'<div class="info hideonsmartphone">'.$langs->trans(
"ModulesDevelopDesc").
"<br></div><br>\n";
521 if ($mode ==
'common' || $mode ==
'commonkanban') {
524 print
'<form method="POST" id="searchFormList" action="'.$_SERVER[
"PHP_SELF"].
'">';
525 print
'<input type="hidden" name="token" value="'.newToken().
'">';
526 if (isset($optioncss) && $optioncss !=
'') {
527 print
'<input type="hidden" name="optioncss" value="'.$optioncss.
'">';
529 if (isset($sortfield) && $sortfield !=
'') {
530 print
'<input type="hidden" name="sortfield" value="'.$sortfield.
'">';
532 if (isset($sortorder) && $sortorder !=
'') {
533 print
'<input type="hidden" name="sortorder" value="'.$sortorder.
'">';
535 if (isset($page) && $page !=
'') {
536 print
'<input type="hidden" name="page" value="'.$page.
'">';
538 print
'<input type="hidden" name="mode" value="'.$mode.
'">';
544 $moreforfilter =
'<div class="valignmiddle">';
546 $moreforfilter .=
'<div class="floatright right pagination paddingtop --module-list"><ul><li>';
547 $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'));
549 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewList'),
'',
'fa fa-bars imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=common'.$param,
'', ($mode ==
'common' ? 2 : 1), array(
'morecss'=>
'reposition'));
550 $moreforfilter .=
dolGetButtonTitle($langs->trans(
'ViewKanban'),
'',
'fa fa-th-list imgforviewmode', $_SERVER[
"PHP_SELF"].
'?mode=commonkanban'.$param,
'', ($mode ==
'commonkanban' ? 2 : 1), array(
'morecss'=>
'reposition'));
551 $moreforfilter .=
'</li></ul></div>';
555 $moreforfilter .=
'<div class="divfilteralone colorbacktimesheet float valignmiddle">';
556 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
557 $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')).
'">';
558 $moreforfilter .=
'</div>';
559 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
560 $moreforfilter .=
$form->selectarray(
'search_nature', $arrayofnatures,
dol_escape_htmltag($search_nature), $langs->trans(
'Origin'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth250', 1);
561 $moreforfilter .=
'</div>';
563 $array_version = array(
'stable'=>$langs->transnoentitiesnoconv(
"Stable"));
564 if ($conf->global->MAIN_FEATURES_LEVEL < 0) {
565 $array_version[
'deprecated'] = $langs->trans(
"Deprecated");
567 if ($conf->global->MAIN_FEATURES_LEVEL > 0) {
568 $array_version[
'experimental'] = $langs->trans(
"Experimental");
570 if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
571 $array_version[
'development'] = $langs->trans(
"Development");
573 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
574 $moreforfilter .=
$form->selectarray(
'search_version', $array_version, $search_version, $langs->trans(
'Version'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
575 $moreforfilter .=
'</div>';
577 $moreforfilter .=
'<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
578 $moreforfilter .=
$form->selectarray(
'search_status', array(
'active'=>$langs->transnoentitiesnoconv(
"Enabled"),
'disabled'=>$langs->transnoentitiesnoconv(
"Disabled")), $search_status, $langs->trans(
'Status'), 0, 0,
'', 0, 0, 0,
'',
'maxwidth150', 1);
579 $moreforfilter .=
'</div>';
580 $moreforfilter .=
' ';
581 $moreforfilter .=
'<div class="divsearchfield valignmiddle inline-block">';
582 $moreforfilter .=
'<input type="submit" name="buttonsubmit" class="button small" value="'.dol_escape_htmltag($langs->trans(
"Refresh")).
'">';
583 if ($search_keyword || ($search_nature && $search_nature !=
'-1') || ($search_version && $search_version !=
'-1') || ($search_status && $search_status !=
'-1')) {
584 $moreforfilter .=
' ';
585 $moreforfilter .=
'<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans(
"Reset")).
'">';
587 $moreforfilter .=
'</div>';
588 $moreforfilter .=
'</div>';
590 $moreforfilter .=
'</div>';
592 if (!empty($moreforfilter)) {
593 print $moreforfilter;
594 $parameters = array();
595 $reshook = $hookmanager->executeHooks(
'printFieldPreListTitle', $parameters);
596 print $hookmanager->resPrint;
601 print
'<div class="clearboth"></div><br>';
603 $object =
new stdClass();
604 $parameters = array();
605 $reshook = $hookmanager->executeHooks(
'insertExtraHeader', $parameters, $object, $action);
610 $disabled_modules = array();
611 if (!empty($_SESSION[
"disablemodules"])) {
612 $disabled_modules = explode(
',', $_SESSION[
"disablemodules"]);
617 $foundoneexternalmodulewithupdate = 0;
619 $atleastonequalified = 0;
620 $atleastoneforfamily = 0;
622 foreach ($orders as $key => $value) {
624 $tab = explode(
'_', $value);
625 $familykey = $tab[1];
626 $module_position = $tab[2];
628 $modName = $filename[$key];
631 $objMod = $modules[$modName];
634 if ($mode ==
'expdev' && $objMod->version !=
'development' && $objMod->version !=
'experimental') {
638 if (!$objMod->getName()) {
639 dol_syslog(
"Error for module ".$key.
" - Property name of module looks empty", LOG_WARNING);
643 $modulenameshort = strtolower(preg_replace(
'/^mod/i',
'', get_class($objMod)));
644 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
647 $modulename = $objMod->getName();
648 $moduletechnicalname = $objMod->name;
649 $moduledesc = $objMod->getDesc();
650 $moduledesclong = $objMod->getDescLong();
651 $moduleauthor = $objMod->getPublisher();
654 if ($search_keyword) {
656 if (preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $modulename)
657 || preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduletechnicalname)
658 || ($moduledesc && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesc))
659 || ($moduledesclong && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduledesclong))
660 || ($moduleauthor && preg_match(
'/'.preg_quote($search_keyword,
'/').
'/i', $moduleauthor))
668 if ($search_status) {
669 if ($search_status ==
'active' && empty($conf->global->$const_name)) {
672 if ($search_status ==
'disabled' && !empty($conf->global->$const_name)) {
676 if ($search_nature) {
677 if (preg_match(
'/^external/', $search_nature) && $objMod->isCoreOrExternalModule() !=
'external') {
681 if (preg_match(
'/^external_(.*)$/', $search_nature, $reg)) {
687 if (!$reg[1] && !empty($publisher)) {
691 if ($search_nature ==
'core' && $objMod->isCoreOrExternalModule() ==
'external') {
695 if ($search_version) {
696 if (($objMod->version ==
'development' || $objMod->version ==
'experimental' || preg_match(
'/deprecated/', $objMod->version)) && $search_version ==
'stable') {
699 if ($objMod->version !=
'development' && ($search_version ==
'development')) {
702 if ($objMod->version !=
'experimental' && ($search_version ==
'experimental')) {
705 if (!preg_match(
'/deprecated/', $objMod->version) && ($search_version ==
'deprecated')) {
710 $atleastonequalified++;
713 if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
714 foreach ($objMod->langfiles as $domain) {
715 $langs->load($domain);
720 if ($familykey != $oldfamily) {
722 print
'</table></div><br>';
725 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
729 if ($mode ==
'commonkanban') {
730 print
'<div class="box-flex-container">';
732 print
'<div class="div-table-responsive">';
733 print
'<table class="tagtable liste" summary="list_of_modules">'.
"\n";
736 $atleastoneforfamily = 0;
739 $atleastoneforfamily++;
741 if ($familykey != $oldfamily) {
742 $familytext = empty($familyinfo[$familykey][
'label']) ? $familykey : $familyinfo[$familykey][
'label'];
743 $oldfamily = $familykey;
747 $version = $objMod->getVersion(0);
749 if (preg_match(
'/development/i', $version)) {
750 $versiontrans .=
img_warning($langs->trans(
"Development"),
'',
'floatleft paddingright');
752 if (preg_match(
'/experimental/i', $version)) {
753 $versiontrans .=
img_warning($langs->trans(
"Experimental"),
'',
'floatleft paddingright');
755 if (preg_match(
'/deprecated/i', $version)) {
756 $versiontrans .=
img_warning($langs->trans(
"Deprecated"),
'',
'floatleft paddingright');
758 if ($objMod->isCoreOrExternalModule() ==
'external' || preg_match(
'/development|experimental|deprecated/i', $version)) {
759 $versiontrans .= $objMod->getVersion(1);
762 if ($objMod->isCoreOrExternalModule() ==
'external'
764 $action ==
'checklastversion'
767 || !empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)
770 $checkRes = $objMod->checkForUpdate();
772 setEventMessage($objMod->getName().
' : '.$versiontrans.
' -> '.$objMod->lastVersion);
773 } elseif ($checkRes < 0) {
774 setEventMessage($objMod->getName().
' '.$langs->trans(
'CheckVersionFail'),
'warnings');
780 if ($objMod->isCoreOrExternalModule() ==
'external') {
781 $imginfo =
"info_black";
784 $codeenabledisable =
'';
788 if (in_array($modulenameshort, $disabled_modules)) {
789 $objMod->disabled =
true;
793 if (!empty($conf->global->$const_name)) {
796 if (!empty($arrayofwarnings[$modName])) {
797 $codeenabledisable .=
'<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
800 if (!empty($objMod->disabled)) {
801 $codeenabledisable .= $langs->trans(
"Disabled");
802 } elseif (!empty($objMod->always_enabled) || ((
isModEnabled(
'multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
803 if (method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
804 $codeenabledisable .= $langs->trans(
"Used");
806 $codeenabledisable .=
img_picto($langs->trans(
"Required"),
'switch_on',
'',
false, 0, 0,
'',
'opacitymedium valignmiddle');
813 if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod,
'alreadyUsed') && $objMod->alreadyUsed()) {
814 $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.
'">';
815 $codeenabledisable .=
img_picto($langs->trans(
"Activated"),
'switch_on');
816 $codeenabledisable .=
'</a>';
818 $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.
'">';
819 $codeenabledisable .=
img_picto($langs->trans(
"Activated"),
'switch_on');
820 $codeenabledisable .=
'</a>';
825 if (!empty($objMod->config_page_url) && !$disableSetup) {
826 $backtourlparam =
'';
827 if ($search_keyword !=
'') {
828 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_keyword='.urlencode($search_keyword);
830 if ($search_nature > -1) {
831 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_nature='.urlencode($search_nature);
833 if ($search_version > -1) {
834 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_version='.urlencode($search_version);
836 if ($search_status > -1) {
837 $backtourlparam .= ($backtourlparam ?
'&' :
'?').
'search_status='.urlencode($search_status);
839 $backtourl = $_SERVER[
"PHP_SELF"].$backtourlparam;
842 if (is_array($objMod->config_page_url)) {
844 foreach ($objMod->config_page_url as $page) {
847 $codetoconfig .=
'<a href="'.$urlpage.
'" title="'.$langs->trans($page).
'">'.
img_picto(ucfirst($page),
"setup").
'</a>';
850 if (preg_match(
'/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
851 $urltouse =
dol_buildpath(
'/'.$regs[2].
'/admin/'.$regs[1], 1);
852 $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>';
854 $urltouse = $urlpage;
855 $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>';
859 } elseif (preg_match(
'/^([^@]+)@([^@]+)$/i', (
string) $objMod->config_page_url, $regs)) {
860 $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>';
862 $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>';
865 $codetoconfig .=
img_picto($langs->trans(
"NothingToSetup"),
"setup",
'class="opacitytransp" style="padding-right: 6px"',
false, 0, 0,
'',
'fa-15');
869 if (!empty($objMod->always_enabled)) {
871 } elseif (!empty($objMod->disabled)) {
872 $codeenabledisable .= $langs->trans(
"Disabled");
875 $warningmessage =
'';
876 if (!empty($arrayofwarnings[$modName])) {
877 $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";
878 foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
879 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
880 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
884 if ($objMod->isCoreOrExternalModule() ==
'external' && !empty($arrayofwarningsext)) {
885 $codeenabledisable .=
'<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.
') -->'.
"\n";
886 foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
887 $keymodulelowercase = strtolower(preg_replace(
'/^mod/',
'', $keymodule));
888 if (in_array($keymodulelowercase, $conf->modules)) {
889 foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
890 if (preg_match(
'/^always/', $keycountry) || ($mysoc->country_code && preg_match(
'/^'.$mysoc->country_code.
'/', $keycountry))) {
891 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
892 $warningmessage .= ($warningmessage ?
"\n" :
"").($warningmessage ?
"\n" :
"").$langs->trans(
"Module").
' : '.$objMod->getName();
893 if (!empty($objMod->editor_name)) {
894 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"Publisher").
' : '.$objMod->editor_name;
896 if (!empty($objMod->editor_name)) {
897 $warningmessage .= ($warningmessage ?
"\n" :
"").$langs->trans(
"ModuleTriggeringThisWarning").
' : '.$modules[$keymodule]->getName();
904 $codeenabledisable .=
'<!-- Message to show: '.$warningmessage.
' -->'.
"\n";
905 $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.
'"';
906 if ($warningmessage) {
907 $codeenabledisable .=
' onclick="return confirm(\''.dol_escape_js($warningmessage).
'\');
"';
909 $codeenabledisable .= '>';
910 $codeenabledisable .= img_picto($langs->trans("Disabled
"), 'switch_off');
911 $codeenabledisable .= "</a>\n
";
915 $codetoconfig .= img_picto($langs->trans("NothingToSetup
"), "setup
", 'class="opacitytransp
" style="padding-right: 6px
"');
918 if ($mode == 'commonkanban') {
920 print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
922 print '<tr class="oddeven
">'."\n
";
923 if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) {
924 print '<td class="width50
">'.$linenum.'</td>';
927 // Picto + Name of module
928 print ' <td class="tdoverflowmax300
" title="'.dol_escape_htmltag($objMod->getName()).'">';
930 //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
931 //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
932 if (!empty($objMod->picto)) {
933 if (preg_match('/^\//i', $objMod->picto)) {
934 print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"', 1);
936 print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly
"');
939 print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly
"');
941 print ' <span class="valignmiddle
">'.$objMod->getName().'</span>';
945 print '<td class="valignmiddle tdoverflowmax300
">';
946 print nl2br($objMod->getDesc());
950 print '<td class="center nowrap
" style="width: 82px;
">';
951 //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
952 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>';
956 print '<td class="center nowrap
" width="120px
">';
957 if ($objMod->needUpdate) {
958 $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
959 print '<span class="badge badge-warning classfortooltip
" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
965 // Link enable/disable
966 print '<td class="center valignmiddle
" width="60px
">';
967 print $codeenabledisable;
971 print '<td class="tdsetuppicto right valignmiddle
" width="60px
">';
977 if ($objMod->needUpdate) {
978 $foundoneexternalmodulewithupdate++;
982 if ($action == 'checklastversion') {
983 if ($foundoneexternalmodulewithupdate) {
984 setEventMessages($langs->trans("ModuleUpdateAvailable
"), null, 'mesgs');
986 setEventMessages($langs->trans("NoExternalModuleWithUpdate
"), null, 'mesgs');
991 if ($mode == 'commonkanban') {
999 if (!$atleastonequalified) {
1000 print '<br><span class="opacitymedium
">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria
").'</span><br><br>';
1003 print dol_get_fiche_end();
1007 // Show warning about external users
1008 print info_admin(showModulesExludedForExternal($modules))."\n
";
1013 if ($mode == 'marketplace') {
1014 print dol_get_fiche_head($head, $mode, '', -1);
1021 print '<div class="div-table-responsive-no-min
">';
1022 print '<table summary="list_of_modules
" class="noborder centpercent
">'."\n
";
1023 print '<tr class="liste_titre
">'."\n
";
1024 print '<td class="hideonsmartphone
">'.$form->textwithpicto($langs->trans("Provider
"), $langs->trans("WebSiteDesc
")).'</td>';
1026 print '<td>'.$langs->trans("URL
").'</td>';
1029 print '<tr class="oddeven
">'."\n
";
1030 $url = 'https://www.dolistore.com';
1031 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>';
1032 print '<td><span class="opacitymedium
">'.$langs->trans("DoliStoreDesc
").'</span></td>';
1033 print '<td><a href="'.$url.'" target="_blank
" rel="noopener noreferrer external
">'.$url.'</a></td>';
1039 print dol_get_fiche_end();
1043 if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1) {
1044 // $options is array with filter criterias
1045 //var_dump($options);
1046 $dolistore->getRemoteCategories();
1047 $dolistore->getRemoteProducts($options);
1049 print '<span class="opacitymedium
">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
1051 $previouslink = $dolistore->get_previous_link();
1052 $nextlink = $dolistore->get_next_link();
1054 print '<div class="liste_titre liste_titre_bydiv centpercent
"><div class="divsearchfield
">';
1056 print '<form method="POST
" class="centpercent
" id="searchFormList
" action="'.$dolistore->url.'">';
1058 <input type="hidden
" name="token
" value="<?php echo
newToken(); ?>
">
1059 <input type="hidden
" name="mode
" value="marketplace
">
1060 <div class="divsearchfield
">
1061 <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>
1063 <div class="divsearchfield
">
1064 <input class="button buttongen
" value="<?php echo $langs->trans(
'Rechercher') ?>
" type="submit
">
1065 <a class="buttonreset
" href="<?php echo urlencode($dolistore->url) ?>
"><?php echo $langs->trans('Reset') ?></a>
1070 print $previouslink;
1075 print '</div></div>';
1076 print '<div class="clearboth
"></div>';
1080 <div id="category-tree-left
">
1083 echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content
1087 <div id="listing-content
">
1088 <table summary="list_of_modules
" id="list_of_modules
" class="productlist centpercent
">
1089 <tbody id="listOfModules
">
1090 <?php echo $dolistore->get_products(); ?>
1100 // Install external module
1102 if ($mode == 'deploy') {
1103 print dol_get_fiche_head($head, $mode, '', -1);
1107 $dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
1108 $allowonlineinstall = true;
1110 if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) {
1111 $allowonlineinstall = false;
1114 $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank
" rel="noopener noreferrer
">'.$urldolibarrmodules.'</a>';
1116 if ($allowonlineinstall) {
1117 if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
1118 $message = info_admin($langs->trans("ConfFileMustContainCustom
", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
1122 if (!is_writable(dol_osencode($dirins))) {
1123 $langs->load("errors
");
1124 $message = info_admin($langs->trans("ErrorFailedToWriteInDir
", $dirins), 0, 0, '1', 'warning');
1128 $message = info_admin($langs->trans("NotExistsDirect
", $dirins).$langs->trans("InfDirAlt
").$langs->trans("InfDirExample
"));
1133 if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
1134 // Show clean message
1135 if (!is_numeric(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US'))) {
1136 $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')));
1138 $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));
1141 // Show technical message
1142 $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile
", $dolibarrdataroot.'/installmodules.lock'));
1147 if ($allowfromweb < 1) {
1148 print $langs->trans("SomethingMakeInstallFromWebNotPossible
");
1150 //print $langs->trans("SomethingMakeInstallFromWebNotPossible2
");
1156 if ($allowfromweb >= 0) {
1157 if ($allowfromweb == 1) {
1158 //print $langs->trans("ThisIsProcessToFollow
").'<br>';
1160 print $langs->trans("ThisIsAlternativeProcessToFollow
").'<br>';
1161 print '<b>'.$langs->trans("StepNb
", 1).'</b>: ';
1162 print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite
", '{s1}')).'<br>';
1163 print '<b>'.$langs->trans("StepNb
", 2).'</b>: ';
1164 print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite
", '{s1}')).'<br>';
1165 print '<b>'.$langs->trans("StepNb
", 3).'</b>: ';
1168 if ($allowfromweb == 1) {
1169 print '<span class="opacitymedium
">'.$langs->trans("UnpackPackageInModulesRoot
", $dirins).'</span><br>';
1173 print '<form enctype="multipart/form-data
" method="POST
" class="noborder
" action="'.$_SERVER["PHP_SELF"].'" name="forminstall
">';
1174 print '<input type="hidden
" name="token
" value="'.newToken().'">';
1175 print '<input type="hidden
" name="action
" value="install
">';
1176 print '<input type="hidden
" name="mode
" value="deploy
">';
1178 print $langs->trans("YouCanSubmitFile
");
1180 $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
1181 $maxphp = @ini_get('upload_max_filesize'); // In unknown
1182 if (preg_match('/k$/i', $maxphp)) {
1183 $maxphp = preg_replace('/k$/i', '', $maxphp);
1184 $maxphp = $maxphp * 1;
1186 if (preg_match('/m$/i', $maxphp)) {
1187 $maxphp = preg_replace('/m$/i', '', $maxphp);
1188 $maxphp = $maxphp * 1024;
1190 if (preg_match('/g$/i', $maxphp)) {
1191 $maxphp = preg_replace('/g$/i', '', $maxphp);
1192 $maxphp = $maxphp * 1024 * 1024;
1194 if (preg_match('/t$/i', $maxphp)) {
1195 $maxphp = preg_replace('/t$/i', '', $maxphp);
1196 $maxphp = $maxphp * 1024 * 1024 * 1024;
1198 $maxphp2 = @ini_get('post_max_size'); // In unknown
1199 if (preg_match('/k$/i', $maxphp2)) {
1200 $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
1201 $maxphp2 = $maxphp2 * 1;
1203 if (preg_match('/m$/i', $maxphp2)) {
1204 $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
1205 $maxphp2 = $maxphp2 * 1024;
1207 if (preg_match('/g$/i', $maxphp2)) {
1208 $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
1209 $maxphp2 = $maxphp2 * 1024 * 1024;
1211 if (preg_match('/t$/i', $maxphp2)) {
1212 $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
1213 $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
1215 // Now $max and $maxphp and $maxphp2 are in Kb
1217 $maxphptoshow = $maxphptoshowparam = '';
1219 $maxmin = min($max, $maxphp);
1220 $maxphptoshow = $maxphp;
1221 $maxphptoshowparam = 'upload_max_filesize';
1224 $maxmin = min($max, $maxphp2);
1225 if ($maxphp2 < $maxphp) {
1226 $maxphptoshow = $maxphp2;
1227 $maxphptoshowparam = 'post_max_size';
1232 print '<script type="text/javascript
">
1233 $(document).ready(function() {
1234 jQuery("#fileinstall
").on("change
", function() {
1235 if(this.files[0].size > '.($maxmin * 1024).'){
1236 alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'");
1242 // MAX_FILE_SIZE doit précéder le champ input de type file
1243 print '<input type="hidden
" name="MAX_FILE_SIZE
" value="'.($maxmin * 1024).'">';
1246 print '<input class="flat minwidth400
" type="file
" name="fileinstall
" id="fileinstall
"> ';
1248 print '<input type="submit
" name="send
" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button">';
1250 if (!empty($conf->global->MAIN_UPLOAD_DOC)) {
1252 $langs->load('other');
1254 print info_admin($langs->trans("ThisLimitIsDefinedInSetup
", $max, $maxphptoshow, $maxphptoshowparam), 1);
1257 print ' ('.$langs->trans("UploadDisabled
").')';
1265 print '<div class="center
"><div class="logo_setup
"></div></div>';
1267 print $langs->trans("UnpackPackageInModulesRoot
", $dirins).'<br>';
1268 print '<b>'.$langs->trans("StepNb
", 4).'</b>: ';
1269 print $langs->trans("SetupIsReadyForUse
").'<br>';
1273 if (!empty($result['return'])) {
1276 foreach ($result['return'] as $value) {
1281 print dol_get_fiche_end();
1284 if ($mode == 'develop') {
1285 print dol_get_fiche_head($head, $mode, '', -1);
1292 print "<table summary=\
"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
1293 print
"<tr class=\"liste_titre\">\n";
1295 print
'<td colspan="2">'.$langs->trans(
"DevelopYourModuleDesc").
'</td>';
1296 print
'<td>'.$langs->trans(
"URL").
'</td>';
1299 print
'<tr class="oddeven" height="80">'.
"\n";
1300 print
'<td class="left">';
1301 print
'<div class="imgmaxheight50 logo_setup"></div>';
1303 print
'<td>'.$langs->trans(
"TryToUseTheModuleBuilder", $langs->transnoentitiesnoconv(
"ModuleBuilder")).
'</td>';
1304 print
'<td class="maxwidth300">';
1306 print $langs->trans(
"SeeTopRightMenu");
1308 print
'<span class="opacitymedium">'.$langs->trans(
"ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv(
"ModuleBuilder")).
'</span>';
1313 print
'<tr class="oddeven" height="80">'.
"\n";
1314 $url =
'https://partners.dolibarr.org';
1315 print
'<td class="left">';
1316 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>';
1318 print
'<td>'.$langs->trans(
"DoliPartnersDesc").
'</td>';
1319 print
'<td><a href="'.$url.
'" target="_blank" rel="noopener noreferrer external">'.$url.
'</a></td>';
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
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)
Enable a module.
modules_prepare_head($nbofactivatedmodules, $nboftotalmodules)
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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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='')
Show tabs of a record.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages 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)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
dolGetButtonTitleSeparator($moreClass="")
Add space between dolGetButtonTitle.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessage($mesgs, $style='mesgs')
Set event message in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
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)
document_preview(file, type, title)
Function show document preview.
$formconfirm
if ($action == 'delbookkeepingyear') {
table tableforfield button
0 = Do not include form tag and submit button -1 = Do not include form tag but include submit button
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.