modules.php 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378
  1. <?php
  2. /* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
  4. * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
  5. * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
  6. * Copyright (C) 2005-2017 Regis Houssin <regis.houssin@inodbox.com>
  7. * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
  8. * Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
  9. * Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
  10. * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
  11. * Copyright (C) 2021-2023 Frédéric France <frederic.france@netlogic.fr>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 3 of the License, or
  16. * (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  25. */
  26. /**
  27. * \file htdocs/admin/modules.php
  28. * \brief Page to activate/disable all modules
  29. */
  30. if (!defined('CSRFCHECK_WITH_TOKEN') && (empty($_GET['action']) || $_GET['action'] != 'reset')) { // We force security except to disable modules so we can do it if problem of a module
  31. define('CSRFCHECK_WITH_TOKEN', '1'); // Force use of CSRF protection with tokens even for GET
  32. }
  33. // Load Dolibarr environment
  34. require '../main.inc.php';
  35. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  36. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  37. require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
  38. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  39. require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
  40. // Load translation files required by the page
  41. $langs->loadLangs(array("errors", "admin", "modulebuilder"));
  42. // if we set another view list mode, we keep it (till we change one more time)
  43. if (GETPOSTISSET('mode')) {
  44. $mode = GETPOST('mode', 'alpha');
  45. if ($mode =='common' || $mode =='commonkanban')
  46. dolibarr_set_const($db, "MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT", $mode, 'chaine', 0, '', $conf->entity);
  47. } else {
  48. $mode = (empty($conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT) ? 'commonkanban' : $conf->global->MAIN_MODULE_SETUP_ON_LIST_BY_DEFAULT);
  49. }
  50. $action = GETPOST('action', 'aZ09');
  51. $value = GETPOST('value', 'alpha');
  52. $page_y = GETPOST('page_y', 'int');
  53. $search_keyword = GETPOST('search_keyword', 'alpha');
  54. $search_status = GETPOST('search_status', 'alpha');
  55. $search_nature = GETPOST('search_nature', 'alpha');
  56. $search_version = GETPOST('search_version', 'alpha');
  57. // For dolistore search
  58. $options = array();
  59. $options['per_page'] = 20;
  60. $options['categorie'] = ((int) (GETPOST('categorie', 'int') ? GETPOST('categorie', 'int') : 0));
  61. $options['start'] = ((int) (GETPOST('start', 'int') ?GETPOST('start', 'int') : 0));
  62. $options['end'] = ((int) (GETPOST('end', 'int') ?GETPOST('end', 'int') : 0));
  63. $options['search'] = GETPOST('search_keyword', 'alpha');
  64. $dolistore = new Dolistore(false);
  65. if (!$user->admin) {
  66. accessforbidden();
  67. }
  68. $familyinfo = array(
  69. 'hr'=>array('position'=>'001', 'label'=>$langs->trans("ModuleFamilyHr")),
  70. 'crm'=>array('position'=>'006', 'label'=>$langs->trans("ModuleFamilyCrm")),
  71. 'srm'=>array('position'=>'007', 'label'=>$langs->trans("ModuleFamilySrm")),
  72. 'financial'=>array('position'=>'009', 'label'=>$langs->trans("ModuleFamilyFinancial")),
  73. 'products'=>array('position'=>'012', 'label'=>$langs->trans("ModuleFamilyProducts")),
  74. 'projects'=>array('position'=>'015', 'label'=>$langs->trans("ModuleFamilyProjects")),
  75. 'ecm'=>array('position'=>'018', 'label'=>$langs->trans("ModuleFamilyECM")),
  76. 'technic'=>array('position'=>'021', 'label'=>$langs->trans("ModuleFamilyTechnic")),
  77. 'portal'=>array('position'=>'040', 'label'=>$langs->trans("ModuleFamilyPortal")),
  78. 'interface'=>array('position'=>'050', 'label'=>$langs->trans("ModuleFamilyInterface")),
  79. 'base'=>array('position'=>'060', 'label'=>$langs->trans("ModuleFamilyBase")),
  80. 'other'=>array('position'=>'100', 'label'=>$langs->trans("ModuleFamilyOther")),
  81. );
  82. $param = '';
  83. if (!GETPOST('buttonreset', 'alpha')) {
  84. if ($search_keyword) {
  85. $param .= '&search_keyword='.urlencode($search_keyword);
  86. }
  87. if ($search_status && $search_status != '-1') {
  88. $param .= '&search_status='.urlencode($search_status);
  89. }
  90. if ($search_nature && $search_nature != '-1') {
  91. $param .= '&search_nature='.urlencode($search_nature);
  92. }
  93. if ($search_version && $search_version != '-1') {
  94. $param .= '&search_version='.urlencode($search_version);
  95. }
  96. }
  97. $dirins = DOL_DOCUMENT_ROOT.'/custom';
  98. $urldolibarrmodules = 'https://www.dolistore.com/';
  99. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  100. $hookmanager->initHooks(array('adminmodules', 'globaladmin'));
  101. /*
  102. * Actions
  103. */
  104. $formconfirm = '';
  105. $parameters = array();
  106. $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  107. if ($reshook < 0) {
  108. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  109. }
  110. if (GETPOST('buttonreset', 'alpha')) {
  111. $search_keyword = '';
  112. $search_status = '';
  113. $search_nature = '';
  114. $search_version = '';
  115. }
  116. if ($action == 'install') {
  117. $error = 0;
  118. // $original_file should match format module_modulename-x.y[.z].zip
  119. $original_file = basename($_FILES["fileinstall"]["name"]);
  120. $original_file = preg_replace('/\s*\(\d+\)\.zip$/i', '.zip', $original_file);
  121. $newfile = $conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
  122. if (!$original_file) {
  123. $langs->load("Error");
  124. setEventMessages($langs->trans("ErrorModuleFileRequired"), null, 'warnings');
  125. $error++;
  126. } else {
  127. if (!$error && !preg_match('/\.zip$/i', $original_file)) {
  128. $langs->load("errors");
  129. setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage", $original_file), null, 'errors');
  130. $error++;
  131. }
  132. if (!$error && !preg_match('/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file)) {
  133. $langs->load("errors");
  134. setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file, 'module_*-x.y*.zip'), null, 'errors');
  135. $error++;
  136. }
  137. if (empty($_FILES['fileinstall']['tmp_name'])) {
  138. $langs->load("errors");
  139. setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
  140. $error++;
  141. }
  142. }
  143. if (!$error) {
  144. if ($original_file) {
  145. @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
  146. dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
  147. }
  148. $tmpdir = preg_replace('/\.zip$/i', '', $original_file).'.dir';
  149. if ($tmpdir) {
  150. @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir);
  151. dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir);
  152. }
  153. $result = dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'], $newfile, 1, 0, $_FILES['fileinstall']['error']);
  154. if ($result > 0) {
  155. $result = dol_uncompress($newfile, $conf->admin->dir_temp.'/'.$tmpdir);
  156. if (!empty($result['error'])) {
  157. $langs->load("errors");
  158. setEventMessages($langs->trans($result['error'], $original_file), null, 'errors');
  159. $error++;
  160. } else {
  161. // Now we move the dir of the module
  162. $modulename = preg_replace('/module_/', '', $original_file);
  163. $modulename = preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename);
  164. // Search dir $modulename
  165. $modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename; // Example ./mymodule
  166. if (!dol_is_dir($modulenamedir)) {
  167. $modulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename; // Example ./htdocs/mymodule
  168. //var_dump($modulenamedir);
  169. if (!dol_is_dir($modulenamedir)) {
  170. setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'<br>'.$langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat2", $modulename, 'htdocs/'.$modulename), null, 'errors');
  171. $error++;
  172. }
  173. }
  174. if (!$error) {
  175. // TODO Make more test
  176. }
  177. dol_syslog("Uncompress of module file is a success.");
  178. // We check if this is a metapackage
  179. $modulenamearrays = array();
  180. if (dol_is_file($modulenamedir.'/metapackage.conf')) {
  181. // This is a meta package
  182. $metafile = file_get_contents($modulenamedir.'/metapackage.conf');
  183. $modulenamearrays = explode("\n", $metafile);
  184. }
  185. $modulenamearrays[$modulename] = $modulename;
  186. //var_dump($modulenamearrays);exit;
  187. // Lop on each packacge of the metapackage
  188. foreach ($modulenamearrays as $modulenameval) {
  189. if (strpos($modulenameval, '#') === 0) {
  190. continue; // Discard comments
  191. }
  192. if (strpos($modulenameval, '//') === 0) {
  193. continue; // Discard comments
  194. }
  195. if (!trim($modulenameval)) {
  196. continue;
  197. }
  198. // Now we install the module
  199. if (!$error) {
  200. @dol_delete_dir_recursive($dirins.'/'.$modulenameval); // delete the target directory
  201. $submodulenamedir = $conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulenameval;
  202. dol_syslog("We copy now directory ".$submodulenamedir." into target dir ".$dirins.'/'.$modulenameval);
  203. $result = dolCopyDir($submodulenamedir, $dirins.'/'.$modulenameval, '0444', 1);
  204. if ($result <= 0) {
  205. dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$submodulenamedir." and ".$dirins.'/'.$modulenameval, LOG_WARNING);
  206. $langs->load("errors");
  207. setEventMessages($langs->trans("ErrorFailToCopyDir", $submodulenamedir, $dirins.'/'.$modulenameval), null, 'errors');
  208. $error++;
  209. }
  210. }
  211. }
  212. }
  213. } else {
  214. setEventMessages($langs->trans("ErrorFailToRenameFile", $_FILES['fileinstall']['tmp_name'], $newfile), null, 'errors');
  215. $error++;
  216. }
  217. }
  218. if (!$error) {
  219. setEventMessages($langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")), null, 'warnings');
  220. }
  221. }
  222. if ($action == 'set' && $user->admin) {
  223. $checkOldValue = getDolGlobalInt('CHECKLASTVERSION_EXTERNALMODULE');
  224. $csrfCheckOldValue = getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN');
  225. $resarray = activateModule($value);
  226. if ($checkOldValue != getDolGlobalInt('CHECKLASTVERSION_EXTERNALMODULE')) {
  227. setEventMessage($langs->trans('WarningModuleHasChangedLastVersionCheckParameter', $value), 'warnings');
  228. }
  229. if ($csrfCheckOldValue != getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN')) {
  230. setEventMessage($langs->trans('WarningModuleHasChangedSecurityCsrfParameter', $value), 'warnings');
  231. }
  232. dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
  233. if (!empty($resarray['errors'])) {
  234. setEventMessages('', $resarray['errors'], 'errors');
  235. } else {
  236. //var_dump($resarray);exit;
  237. if ($resarray['nbperms'] > 0) {
  238. $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
  239. $resqltmp = $db->query($tmpsql);
  240. if ($resqltmp) {
  241. $obj = $db->fetch_object($resqltmp);
  242. //var_dump($obj->nb);exit;
  243. if ($obj && $obj->nb > 1) {
  244. $msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
  245. setEventMessages($msg, null, 'warnings');
  246. }
  247. } else {
  248. dol_print_error($db);
  249. }
  250. }
  251. }
  252. header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
  253. exit;
  254. } elseif ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes') {
  255. $result = unActivateModule($value);
  256. dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
  257. if ($result) {
  258. setEventMessages($result, null, 'errors');
  259. }
  260. header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
  261. exit;
  262. } elseif (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1 && $action == 'reload' && $user->admin && GETPOST('confirm') == 'yes') {
  263. $result = unActivateModule($value, 0);
  264. dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
  265. if ($result) {
  266. setEventMessages($result, null, 'errors');
  267. header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
  268. }
  269. $resarray = activateModule($value, 0, 1);
  270. dolibarr_set_const($db, "MAIN_IHM_PARAMS_REV", (int) $conf->global->MAIN_IHM_PARAMS_REV + 1, 'chaine', 0, '', $conf->entity);
  271. if (!empty($resarray['errors'])) {
  272. setEventMessages('', $resarray['errors'], 'errors');
  273. } else {
  274. if ($resarray['nbperms'] > 0) {
  275. $tmpsql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
  276. $resqltmp = $db->query($tmpsql);
  277. if ($resqltmp) {
  278. $obj = $db->fetch_object($resqltmp);
  279. if ($obj && $obj->nb > 1) {
  280. $msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
  281. setEventMessages($msg, null, 'warnings');
  282. }
  283. } else {
  284. dol_print_error($db);
  285. }
  286. }
  287. }
  288. header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y ? '&page_y='.$page_y : ''));
  289. exit;
  290. }
  291. /*
  292. * View
  293. */
  294. $form = new Form($db);
  295. $morejs = array();
  296. $morecss = array("/admin/dolistore/css/dolistore.css");
  297. // Set dir where external modules are installed
  298. if (!dol_is_dir($dirins)) {
  299. dol_mkdir($dirins);
  300. }
  301. $dirins_ok = (dol_is_dir($dirins));
  302. $help_url = 'EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
  303. llxHeader('', $langs->trans("Setup"), $help_url, '', '', '', $morejs, $morecss, 0, 0);
  304. // Search modules dirs
  305. $modulesdir = dolGetModulesDirs();
  306. $arrayofnatures = array('core'=>$langs->transnoentitiesnoconv("NativeModules"), 'external'=>$langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']');
  307. $arrayofwarnings = array(); // Array of warning each module want to show when activated
  308. $arrayofwarningsext = array(); // Array of warning each module want to show when we activate an external module
  309. $filename = array();
  310. $modules = array();
  311. $orders = array();
  312. $categ = array();
  313. $i = 0; // is a sequencer of modules found
  314. $j = 0; // j is module number. Automatically affected if module number not defined.
  315. $modNameLoaded = array();
  316. foreach ($modulesdir as $dir) {
  317. // Load modules attributes in arrays (name, numero, orders) from dir directory
  318. //print $dir."\n<br>";
  319. dol_syslog("Scan directory ".$dir." for module descriptor files (modXXX.class.php)");
  320. $handle = @opendir($dir);
  321. if (is_resource($handle)) {
  322. while (($file = readdir($handle)) !== false) {
  323. //print "$i ".$file."\n<br>";
  324. if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
  325. $modName = substr($file, 0, dol_strlen($file) - 10);
  326. if ($modName) {
  327. if (!empty($modNameLoaded[$modName])) { // In cache of already loaded modules ?
  328. $mesg = "Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>";
  329. setEventMessages($mesg, null, 'warnings');
  330. dol_syslog($mesg, LOG_ERR);
  331. continue;
  332. }
  333. try {
  334. $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error.
  335. if (class_exists($modName)) {
  336. $objMod = new $modName($db);
  337. $modNameLoaded[$modName] = $dir;
  338. if (!$objMod->numero > 0 && $modName != 'modUser') {
  339. dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
  340. }
  341. $j = $objMod->numero;
  342. $modulequalified = 1;
  343. // We discard modules according to features level (PS: if module is activated we always show it)
  344. $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
  345. if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) {
  346. $modulequalified = 0;
  347. }
  348. if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) {
  349. $modulequalified = 0;
  350. }
  351. if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) {
  352. $modulequalified = 0;
  353. }
  354. // We discard modules according to property ->hidden
  355. if (!empty($objMod->hidden)) {
  356. $modulequalified = 0;
  357. }
  358. if ($modulequalified > 0) {
  359. $publisher = dol_escape_htmltag($objMod->getPublisher());
  360. $external = ($objMod->isCoreOrExternalModule() == 'external');
  361. if ($external) {
  362. if ($publisher) {
  363. $arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher;
  364. } else {
  365. $arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers");
  366. }
  367. }
  368. ksort($arrayofnatures);
  369. // Define array $categ with categ with at least one qualified module
  370. $filename[$i] = $modName;
  371. $modules[$modName] = $objMod;
  372. // Gives the possibility to the module, to provide his own family info and position of this family
  373. if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
  374. $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
  375. $familykey = key($objMod->familyinfo);
  376. } else {
  377. $familykey = $objMod->family;
  378. }
  379. $moduleposition = ($objMod->module_position ? $objMod->module_position : '50');
  380. if ($objMod->isCoreOrExternalModule() == 'external' && $moduleposition < 100000) {
  381. // an external module should never return a value lower than '80'.
  382. $moduleposition = '80'; // External modules at end by default
  383. }
  384. // Add list of warnings to show into arrayofwarnings and arrayofwarningsext
  385. if (!empty($objMod->warnings_activation)) {
  386. $arrayofwarnings[$modName] = $objMod->warnings_activation;
  387. }
  388. if (!empty($objMod->warnings_activation_ext)) {
  389. $arrayofwarningsext[$modName] = $objMod->warnings_activation_ext;
  390. }
  391. $familyposition = (empty($familyinfo[$familykey]['position']) ? 0 : $familyinfo[$familykey]['position']);
  392. $listOfOfficialModuleGroups = array('hr', 'technic', 'interface', 'technic', 'portal', 'financial', 'crm', 'base', 'products', 'srm', 'ecm', 'projects', 'other');
  393. if ($external && !in_array($familykey, $listOfOfficialModuleGroups)) {
  394. // If module is extern and into a custom group (not into an official predefined one), it must appear at end (custom groups should not be before official groups).
  395. if (is_numeric($familyposition)) {
  396. $familyposition = sprintf("%03d", (int) $familyposition + 100);
  397. }
  398. }
  399. $orders[$i] = $familyposition."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
  400. // Set categ[$i]
  401. $specialstring = 'unknown';
  402. if ($objMod->version == 'development' || $objMod->version == 'experimental') {
  403. $specialstring = 'expdev';
  404. }
  405. if (isset($categ[$specialstring])) {
  406. $categ[$specialstring]++; // Array of all different modules categories
  407. } else {
  408. $categ[$specialstring] = 1;
  409. }
  410. $j++;
  411. $i++;
  412. } else {
  413. dol_syslog("Module ".get_class($objMod)." not qualified");
  414. }
  415. } else {
  416. print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
  417. }
  418. } catch (Exception $e) {
  419. dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
  420. }
  421. }
  422. }
  423. }
  424. closedir($handle);
  425. } else {
  426. dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
  427. }
  428. }
  429. if ($action == 'reset_confirm' && $user->admin) {
  430. if (!empty($modules[$value])) {
  431. $objMod = $modules[$value];
  432. if (!empty($objMod->langfiles)) {
  433. $langs->loadLangs($objMod->langfiles);
  434. }
  435. $form = new Form($db);
  436. $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmUnactivation'), $langs->trans(GETPOST('confirm_message_code')), 'reset', '', 'no', 1);
  437. }
  438. }
  439. if ($action == 'reload_confirm' && $user->admin) {
  440. if (!empty($modules[$value])) {
  441. $objMod = $modules[$value];
  442. if (!empty($objMod->langfiles)) {
  443. $langs->loadLangs($objMod->langfiles);
  444. }
  445. $form = new Form($db);
  446. $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmReload'), $langs->trans(GETPOST('confirm_message_code')), 'reload', '', 'no', 1);
  447. }
  448. }
  449. print $formconfirm;
  450. asort($orders);
  451. //var_dump($orders);
  452. //var_dump($categ);
  453. //var_dump($modules);
  454. $nbofactivatedmodules = count($conf->modules);
  455. $nbmodulesnotautoenabled = count($conf->modules);
  456. if (in_array('fckeditor', $conf->modules)) $nbmodulesnotautoenabled--;
  457. if (in_array('export', $conf->modules)) $nbmodulesnotautoenabled--;
  458. if (in_array('import', $conf->modules)) $nbmodulesnotautoenabled--;
  459. print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup');
  460. // Start to show page
  461. $deschelp = '';
  462. if ($mode == 'common' || $mode == 'commonkanban') {
  463. $desc = $langs->trans("ModulesDesc", '{picto}');
  464. $desc .= ' '.$langs->trans("ModulesDesc2", '{picto2}');
  465. $desc = str_replace('{picto}', img_picto('', 'switch_off', 'class="size15x"'), $desc);
  466. $desc = str_replace('{picto2}', img_picto('', 'setup', 'class="size15x"'), $desc);
  467. if ($nbmodulesnotautoenabled <= getDolGlobalInt('MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING', 1)) { // If only minimal initial modules enabled
  468. $deschelp = '<div class="info hideonsmartphone">'.$desc."<br></div><br>\n";
  469. }
  470. }
  471. if ($mode == 'marketplace') {
  472. //$deschelp = '<div class="info hideonsmartphone">'.$langs->trans("ModulesMarketPlaceDesc")."<br></div><br>\n";
  473. }
  474. if ($mode == 'deploy') {
  475. $deschelp = '<div class="info hideonsmartphone">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."<br></div><br>\n";
  476. }
  477. if ($mode == 'develop') {
  478. $deschelp = '<div class="info hideonsmartphone">'.$langs->trans("ModulesDevelopDesc")."<br></div><br>\n";
  479. }
  480. $head = modules_prepare_head($nbofactivatedmodules, count($modules), $nbmodulesnotautoenabled);
  481. if ($mode == 'common' || $mode == 'commonkanban') {
  482. dol_set_focus('#search_keyword');
  483. print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
  484. print '<input type="hidden" name="token" value="'.newToken().'">';
  485. if (isset($optioncss) && $optioncss != '') {
  486. print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  487. }
  488. if (isset($sortfield) && $sortfield != '') {
  489. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  490. }
  491. if (isset($sortorder) && $sortorder != '') {
  492. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  493. }
  494. if (isset($page) && $page != '') {
  495. print '<input type="hidden" name="page" value="'.$page.'">';
  496. }
  497. print '<input type="hidden" name="mode" value="'.$mode.'">';
  498. print dol_get_fiche_head($head, 'modules', '', -1);
  499. print $deschelp;
  500. $moreforfilter = '<div class="valignmiddle">';
  501. $moreforfilter .= '<div class="floatright right pagination paddingtop --module-list"><ul><li>';
  502. $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'));
  503. $moreforfilter .= dolGetButtonTitleSeparator();
  504. $moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', ($mode == 'common' ? 2 : 1), array('morecss'=>'reposition'));
  505. $moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', ($mode == 'commonkanban' ? 2 : 1), array('morecss'=>'reposition'));
  506. $moreforfilter .= '</li></ul></div>';
  507. $moreforfilter .= '<div class="divfilteralone colorbacktimesheet float valignmiddle">';
  508. $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
  509. $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')).'">';
  510. $moreforfilter .= '</div>';
  511. $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
  512. $moreforfilter .= $form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), $langs->trans('Origin'), 0, 0, '', 0, 0, 0, '', 'maxwidth250', 1);
  513. $moreforfilter .= '</div>';
  514. if (getDolGlobalInt('MAIN_FEATURES_LEVEL')) {
  515. $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
  516. if ($conf->global->MAIN_FEATURES_LEVEL < 0) {
  517. $array_version['deprecated'] = $langs->trans("Deprecated");
  518. }
  519. if ($conf->global->MAIN_FEATURES_LEVEL > 0) {
  520. $array_version['experimental'] = $langs->trans("Experimental");
  521. }
  522. if ($conf->global->MAIN_FEATURES_LEVEL > 1) {
  523. $array_version['development'] = $langs->trans("Development");
  524. }
  525. $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
  526. $moreforfilter .= $form->selectarray('search_version', $array_version, $search_version, $langs->transnoentitiesnoconv('Version'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
  527. $moreforfilter .= '</div>';
  528. }
  529. $array_status = array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled"));
  530. $moreforfilter .= '<div class="divsearchfield paddingtop paddingbottom valignmiddle inline-block">';
  531. $moreforfilter .= $form->selectarray('search_status', $array_status, $search_status, $langs->transnoentitiesnoconv('Status'), 0, 0, '', 0, 0, 0, '', 'maxwidth150', 1);
  532. $moreforfilter .= '</div>';
  533. $moreforfilter .= ' ';
  534. $moreforfilter .= '<div class="divsearchfield valignmiddle inline-block">';
  535. $moreforfilter .= '<input type="submit" name="buttonsubmit" class="button small" value="'.dol_escape_htmltag($langs->trans("Refresh")).'">';
  536. if ($search_keyword || ($search_nature && $search_nature != '-1') || ($search_version && $search_version != '-1') || ($search_status && $search_status != '-1')) {
  537. $moreforfilter .= ' ';
  538. $moreforfilter .= '<input type="submit" name="buttonreset" class="buttonreset noborderbottom" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
  539. }
  540. $moreforfilter .= '</div>';
  541. $moreforfilter .= '</div>';
  542. $moreforfilter .= '</div>';
  543. if (!empty($moreforfilter)) {
  544. print $moreforfilter;
  545. $parameters = array();
  546. $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook
  547. print $hookmanager->resPrint;
  548. }
  549. $moreforfilter = '';
  550. print '<div class="clearboth"></div><br>';
  551. $object = new stdClass();
  552. $parameters = array();
  553. $reshook = $hookmanager->executeHooks('insertExtraHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
  554. if ($reshook < 0) {
  555. setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  556. }
  557. $disabled_modules = array();
  558. if (!empty($_SESSION["disablemodules"])) {
  559. $disabled_modules = explode(',', $_SESSION["disablemodules"]);
  560. }
  561. // Show list of modules
  562. $oldfamily = '';
  563. $foundoneexternalmodulewithupdate = 0;
  564. $linenum = 0;
  565. $atleastonequalified = 0;
  566. $atleastoneforfamily = 0;
  567. foreach ($orders as $key => $value) {
  568. $linenum++;
  569. $tab = explode('_', $value);
  570. $familykey = $tab[1];
  571. $module_position = $tab[2];
  572. $modName = $filename[$key];
  573. /** @var DolibarrModules $objMod */
  574. $objMod = $modules[$modName];
  575. //print $objMod->name." - ".$key." - ".$objMod->version."<br>";
  576. if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') {
  577. continue; // Discard if not for current tab
  578. }
  579. if (!$objMod->getName()) {
  580. dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
  581. continue;
  582. }
  583. $modulenameshort = strtolower(preg_replace('/^mod/i', '', get_class($objMod)));
  584. $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i', '', get_class($objMod)));
  585. // Check filters
  586. $modulename = $objMod->getName();
  587. $moduletechnicalname = $objMod->name;
  588. $moduledesc = $objMod->getDesc();
  589. $moduledesclong = $objMod->getDescLong();
  590. $moduleauthor = $objMod->getPublisher();
  591. // We discard showing according to filters
  592. if ($search_keyword) {
  593. $qualified = 0;
  594. if (preg_match('/'.preg_quote($search_keyword, '/').'/i', $modulename)
  595. || preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduletechnicalname)
  596. || ($moduledesc && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduledesc))
  597. || ($moduledesclong && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduledesclong))
  598. || ($moduleauthor && preg_match('/'.preg_quote($search_keyword, '/').'/i', $moduleauthor))
  599. ) {
  600. $qualified = 1;
  601. }
  602. if (!$qualified) {
  603. continue;
  604. }
  605. }
  606. if ($search_status) {
  607. if ($search_status == 'active' && empty($conf->global->$const_name)) {
  608. continue;
  609. }
  610. if ($search_status == 'disabled' && !empty($conf->global->$const_name)) {
  611. continue;
  612. }
  613. }
  614. if ($search_nature) {
  615. if (preg_match('/^external/', $search_nature) && $objMod->isCoreOrExternalModule() != 'external') {
  616. continue;
  617. }
  618. $reg = array();
  619. if (preg_match('/^external_(.*)$/', $search_nature, $reg)) {
  620. //print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher());
  621. $publisher = dol_escape_htmltag($objMod->getPublisher());
  622. if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) {
  623. continue;
  624. }
  625. if (!$reg[1] && !empty($publisher)) {
  626. continue;
  627. }
  628. }
  629. if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') {
  630. continue;
  631. }
  632. }
  633. if ($search_version) {
  634. if (($objMod->version == 'development' || $objMod->version == 'experimental' || preg_match('/deprecated/', $objMod->version)) && $search_version == 'stable') {
  635. continue;
  636. }
  637. if ($objMod->version != 'development' && ($search_version == 'development')) {
  638. continue;
  639. }
  640. if ($objMod->version != 'experimental' && ($search_version == 'experimental')) {
  641. continue;
  642. }
  643. if (!preg_match('/deprecated/', $objMod->version) && ($search_version == 'deprecated')) {
  644. continue;
  645. }
  646. }
  647. $atleastonequalified++;
  648. // Load all language files of the qualified module
  649. if (isset($objMod->langfiles) && is_array($objMod->langfiles)) {
  650. foreach ($objMod->langfiles as $domain) {
  651. $langs->load($domain);
  652. }
  653. }
  654. // Print a separator if we change family
  655. if ($familykey != $oldfamily) {
  656. if ($oldfamily) {
  657. print '</table></div><br>';
  658. }
  659. $familytext = empty($familyinfo[$familykey]['label']) ? $familykey : $familyinfo[$familykey]['label'];
  660. print load_fiche_titre($familytext, '', '', 0, '', 'modulefamilygroup');
  661. if ($mode == 'commonkanban') {
  662. print '<div class="box-flex-container kanban">';
  663. } else {
  664. print '<div class="div-table-responsive">';
  665. print '<table class="tagtable liste" summary="list_of_modules">'."\n";
  666. }
  667. $atleastoneforfamily = 0;
  668. }
  669. $atleastoneforfamily++;
  670. if ($familykey != $oldfamily) {
  671. $familytext = empty($familyinfo[$familykey]['label']) ? $familykey : $familyinfo[$familykey]['label'];
  672. $oldfamily = $familykey;
  673. }
  674. // Version (with picto warning or not)
  675. $version = $objMod->getVersion(0);
  676. $versiontrans = '';
  677. $warningstring = '';
  678. if (preg_match('/development/i', $version)) {
  679. $warningstring = $langs->trans("Development");
  680. }
  681. if (preg_match('/experimental/i', $version)) {
  682. $warningstring = $langs->trans("Experimental");
  683. }
  684. if (preg_match('/deprecated/i', $version)) {
  685. $warningstring = $langs->trans("Deprecated");
  686. }
  687. if ($objMod->isCoreOrExternalModule() == 'external' || preg_match('/development|experimental|deprecated/i', $version)) {
  688. $versiontrans .= $objMod->getVersion(1);
  689. }
  690. if ($objMod->isCoreOrExternalModule() == 'external'
  691. && (
  692. $action == 'checklastversion'
  693. // This is a bad practice to activate a check on an external access during the building of the admin page. 1 external module can hang the application.
  694. // Adding a cron job could be a good idea: see DolibarrModules::checkForUpdate()
  695. || !empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)
  696. )
  697. ) {
  698. $checkRes = $objMod->checkForUpdate();
  699. if ($checkRes > 0) {
  700. setEventMessage($objMod->getName().' : '.$versiontrans.' -> '.$objMod->lastVersion);
  701. } elseif ($checkRes < 0) {
  702. setEventMessage($objMod->getName().' '.$langs->trans('CheckVersionFail'), 'warnings');
  703. }
  704. }
  705. // Define imginfo
  706. $imginfo = "info";
  707. if ($objMod->isCoreOrExternalModule() == 'external') {
  708. $imginfo = "info_black";
  709. }
  710. $codeenabledisable = '';
  711. $codetoconfig = '';
  712. // Force disable of module disabled into session (for demo for example)
  713. if (in_array($modulenameshort, $disabled_modules)) {
  714. $objMod->disabled = true;
  715. }
  716. // Activate/Disable and Setup (2 columns)
  717. if (!empty($conf->global->$const_name)) { // If module is already activated
  718. // Set $codeenabledisable
  719. $disableSetup = 0;
  720. if (!empty($arrayofwarnings[$modName])) {
  721. $codeenabledisable .= '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
  722. }
  723. if (!empty($objMod->disabled)) {
  724. $codeenabledisable .= $langs->trans("Disabled");
  725. } elseif (!empty($objMod->always_enabled) || ((isModEnabled('multicompany') && $objMod->core_enabled) && ($user->entity || $conf->entity != 1))) {
  726. if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
  727. $codeenabledisable .= $langs->trans("Used");
  728. } else {
  729. $codeenabledisable .= img_picto($langs->trans("Required"), 'switch_on', '', false, 0, 0, '', 'opacitymedium valignmiddle');
  730. //print $langs->trans("Required");
  731. }
  732. if (isModEnabled('multicompany') && $user->entity) {
  733. $disableSetup++;
  734. }
  735. } else {
  736. if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
  737. $codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reset_confirm&amp;confirm_message_code='.urlencode($objMod->warnings_unactivation[$mysoc->country_code]).'&amp;value='.$modName.'&amp;mode='.$mode.$param.'">';
  738. $codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on');
  739. $codeenabledisable .= '</a>';
  740. if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) {
  741. $codeenabledisable .= '&nbsp;';
  742. $codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reload_confirm&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
  743. $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"');
  744. $codeenabledisable .= '</a>';
  745. }
  746. } else {
  747. $codeenabledisable .= '<a class="reposition valignmiddle" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reset&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
  748. $codeenabledisable .= img_picto($langs->trans("Activated").($warningstring ? ' '.$warningstring : ''), 'switch_on');
  749. $codeenabledisable .= '</a>';
  750. if (getDolGlobalInt("MAIN_FEATURES_LEVEL") > 1) {
  751. $codeenabledisable .= '&nbsp;';
  752. $codeenabledisable .= '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;token='.newToken().'&amp;module_position='.$module_position.'&amp;action=reload&amp;value='.$modName.'&amp;mode='.$mode.'&amp;confirm=yes'.$param.'">';
  753. $codeenabledisable .= img_picto($langs->trans("Reload"), 'refresh', 'class="opacitymedium"');
  754. $codeenabledisable .= '</a>';
  755. }
  756. }
  757. }
  758. // Set $codetoconfig
  759. if (!empty($objMod->config_page_url) && !$disableSetup) {
  760. $backtourlparam = '';
  761. if ($search_keyword != '') {
  762. $backtourlparam .= ($backtourlparam ? '&' : '?').'search_keyword='.urlencode($search_keyword); // No urlencode here, done later
  763. }
  764. if ($search_nature > -1) {
  765. $backtourlparam .= ($backtourlparam ? '&' : '?').'search_nature='.urlencode($search_nature); // No urlencode here, done later
  766. }
  767. if ($search_version > -1) {
  768. $backtourlparam .= ($backtourlparam ? '&' : '?').'search_version='.urlencode($search_version); // No urlencode here, done later
  769. }
  770. if ($search_status > -1) {
  771. $backtourlparam .= ($backtourlparam ? '&' : '?').'search_status='.urlencode($search_status); // No urlencode here, done later
  772. }
  773. $backtourl = $_SERVER["PHP_SELF"].$backtourlparam;
  774. $regs = array();
  775. if (is_array($objMod->config_page_url)) {
  776. $i = 0;
  777. foreach ($objMod->config_page_url as $page) {
  778. $urlpage = $page;
  779. if ($i++) {
  780. $codetoconfig .= '<a href="'.$urlpage.'" title="'.$langs->trans($page).'">'.img_picto(ucfirst($page), "setup").'</a>';
  781. // print '<a href="'.$page.'">'.ucfirst($page).'</a>&nbsp;';
  782. } else {
  783. if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) {
  784. $urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1);
  785. $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>';
  786. } else {
  787. $urltouse = $urlpage;
  788. $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>';
  789. }
  790. }
  791. }
  792. } elseif (preg_match('/^([^@]+)@([^@]+)$/i', (string) $objMod->config_page_url, $regs)) {
  793. $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>';
  794. } else {
  795. $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>';
  796. }
  797. } else {
  798. $codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"', false, 0, 0, '', 'fa-15');
  799. }
  800. } else { // Module not yet activated
  801. // Set $codeenabledisable
  802. if (!empty($objMod->always_enabled)) {
  803. // Should never happened
  804. } elseif (!empty($objMod->disabled)) {
  805. $codeenabledisable .= $langs->trans("Disabled");
  806. } else {
  807. // Module qualified for activation
  808. $warningmessage = '';
  809. if (!empty($arrayofwarnings[$modName])) {
  810. $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";
  811. foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage) {
  812. if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) {
  813. $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
  814. }
  815. }
  816. }
  817. if ($objMod->isCoreOrExternalModule() == 'external' && !empty($arrayofwarningsext)) {
  818. $codeenabledisable .= '<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.') -->'."\n";
  819. foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry) {
  820. $keymodulelowercase = strtolower(preg_replace('/^mod/', '', $keymodule));
  821. if (in_array($keymodulelowercase, $conf->modules)) { // If module that request warning is on
  822. foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage) {
  823. if (preg_match('/^always/', $keycountry) || ($mysoc->country_code && preg_match('/^'.$mysoc->country_code.'/', $keycountry))) {
  824. $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
  825. $warningmessage .= ($warningmessage ? "\n" : "").($warningmessage ? "\n" : "").$langs->trans("Module").' : '.$objMod->getName();
  826. if (!empty($objMod->editor_name)) {
  827. $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("Publisher").' : '.$objMod->editor_name;
  828. }
  829. if (!empty($objMod->editor_name)) {
  830. $warningmessage .= ($warningmessage ? "\n" : "").$langs->trans("ModuleTriggeringThisWarning").' : '.$modules[$keymodule]->getName();
  831. }
  832. }
  833. }
  834. }
  835. }
  836. }
  837. $codeenabledisable .= '<!-- Message to show: '.$warningmessage.' -->'."\n";
  838. $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.'"';
  839. if ($warningmessage) {
  840. $codeenabledisable .= ' onclick="return confirm(\''.dol_escape_js($warningmessage).'\');"';
  841. }
  842. $codeenabledisable .= '>';
  843. $codeenabledisable .= img_picto($langs->trans("Disabled"), 'switch_off');
  844. $codeenabledisable .= "</a>\n";
  845. }
  846. // Set $codetoconfig
  847. $codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"');
  848. }
  849. if ($mode == 'commonkanban') {
  850. // Output Kanban
  851. print $objMod->getKanbanView($codeenabledisable, $codetoconfig);
  852. } else {
  853. print '<tr class="oddeven'.($warningstring ? ' info-box-content-warning' : '').'">'."\n";
  854. if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) {
  855. print '<td class="width50">'.$linenum.'</td>';
  856. }
  857. // Picto + Name of module
  858. print ' <td class="tdoverflowmax300 maxwidth300" title="'.dol_escape_htmltag($objMod->getName()).'">';
  859. $alttext = '';
  860. //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
  861. //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
  862. if (!empty($objMod->picto)) {
  863. if (preg_match('/^\//i', $objMod->picto)) {
  864. print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"', 1);
  865. } else {
  866. print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"');
  867. }
  868. } else {
  869. print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly"');
  870. }
  871. print ' <span class="valignmiddle">'.$objMod->getName().'</span>';
  872. print "</td>\n";
  873. // Desc
  874. print '<td class="valignmiddle tdoverflowmax300">';
  875. print nl2br($objMod->getDesc());
  876. print "</td>\n";
  877. // Help
  878. print '<td class="center nowrap" style="width: 82px;">';
  879. //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
  880. 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>';
  881. print '</td>';
  882. // Version
  883. print '<td class="center nowrap" width="150px" title="'.dol_escape_htmltag(dol_string_nohtmltag($versiontrans)).'">';
  884. if ($objMod->needUpdate) {
  885. $versionTitle = $langs->trans('ModuleUpdateAvailable').' : '.$objMod->lastVersion;
  886. print '<span class="badge badge-warning classfortooltip" title="'.dol_escape_htmltag($versionTitle).'">'.$versiontrans.'</span>';
  887. } else {
  888. print $versiontrans;
  889. }
  890. print "</td>\n";
  891. // Link enable/disable
  892. print '<td class="center valignmiddle left" width="60px">';
  893. print $codeenabledisable;
  894. print "</td>\n";
  895. // Link config
  896. print '<td class="tdsetuppicto right valignmiddle" width="60px">';
  897. print $codetoconfig;
  898. print '</td>';
  899. print "</tr>\n";
  900. }
  901. if ($objMod->needUpdate) {
  902. $foundoneexternalmodulewithupdate++;
  903. }
  904. }
  905. if ($action == 'checklastversion') {
  906. if ($foundoneexternalmodulewithupdate) {
  907. setEventMessages($langs->trans("ModuleUpdateAvailable"), null, 'mesgs');
  908. } else {
  909. setEventMessages($langs->trans("NoExternalModuleWithUpdate"), null, 'mesgs');
  910. }
  911. }
  912. if ($oldfamily) {
  913. if ($mode == 'commonkanban') {
  914. print '</div>';
  915. } else {
  916. print "</table>\n";
  917. print '</div>';
  918. }
  919. }
  920. if (!$atleastonequalified) {
  921. print '<br><span class="opacitymedium">'.$langs->trans("NoDeployedModulesFoundWithThisSearchCriteria").'</span><br><br>';
  922. }
  923. print dol_get_fiche_end();
  924. print '<br>';
  925. // Show warning about external users
  926. print info_admin(showModulesExludedForExternal($modules))."\n";
  927. print '</form>';
  928. }
  929. if ($mode == 'marketplace') {
  930. print dol_get_fiche_head($head, $mode, '', -1);
  931. print $deschelp;
  932. print '<br>';
  933. // Marketplace
  934. print '<div class="div-table-responsive-no-min">';
  935. print '<table summary="list_of_modules" class="noborder centpercent">'."\n";
  936. print '<tr class="liste_titre">'."\n";
  937. print '<td class="hideonsmartphone">'.$form->textwithpicto($langs->trans("Provider"), $langs->trans("WebSiteDesc")).'</td>';
  938. print '<td></td>';
  939. print '<td>'.$langs->trans("URL").'</td>';
  940. print '</tr>';
  941. print '<tr class="oddeven">'."\n";
  942. $url = 'https://www.dolistore.com';
  943. 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>';
  944. print '<td><span class="opacitymedium">'.$langs->trans("DoliStoreDesc").'</span></td>';
  945. print '<td><a href="'.$url.'" target="_blank" rel="noopener noreferrer external">'.$url.'</a></td>';
  946. print '</tr>';
  947. print "</table>\n";
  948. print '</div>';
  949. print dol_get_fiche_end();
  950. print '<br>';
  951. if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1) {
  952. // $options is array with filter criterias
  953. //var_dump($options);
  954. $dolistore->getRemoteCategories();
  955. $dolistore->getRemoteProducts($options);
  956. print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
  957. $previouslink = $dolistore->get_previous_link();
  958. $nextlink = $dolistore->get_next_link();
  959. print '<div class="liste_titre liste_titre_bydiv centpercent"><div class="divsearchfield">';
  960. print '<form method="POST" class="centpercent" id="searchFormList" action="'.$dolistore->url.'">';
  961. ?>
  962. <input type="hidden" name="token" value="<?php echo newToken(); ?>">
  963. <input type="hidden" name="mode" value="marketplace">
  964. <div class="divsearchfield">
  965. <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>
  966. </div>
  967. <div class="divsearchfield">
  968. <input class="button buttongen" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
  969. <a class="buttonreset" href="<?php echo urlencode($dolistore->url) ?>"><?php echo $langs->trans('Reset') ?></a>
  970. &nbsp;
  971. </div>
  972. <?php
  973. print $previouslink;
  974. print $nextlink;
  975. print '</form>';
  976. print '</div></div>';
  977. print '<div class="clearboth"></div>';
  978. ?>
  979. <div id="category-tree-left">
  980. <ul class="tree">
  981. <?php
  982. echo $dolistore->get_categories(); // Do not use dol_escape_htmltag here, it is already a structured content
  983. ?>
  984. </ul>
  985. </div>
  986. <div id="listing-content">
  987. <table summary="list_of_modules" id="list_of_modules" class="productlist centpercent">
  988. <tbody id="listOfModules">
  989. <?php echo $dolistore->get_products(); ?>
  990. </tbody>
  991. </table>
  992. </div>
  993. <?php
  994. }
  995. }
  996. // Install external module
  997. if ($mode == 'deploy') {
  998. print dol_get_fiche_head($head, $mode, '', -1);
  999. print $deschelp;
  1000. $dolibarrdataroot = preg_replace('/([\\/]+)$/i', '', DOL_DATA_ROOT);
  1001. $allowonlineinstall = true;
  1002. $allowfromweb = 1;
  1003. if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) {
  1004. $allowonlineinstall = false;
  1005. }
  1006. $fullurl = '<a href="'.$urldolibarrmodules.'" target="_blank" rel="noopener noreferrer">'.$urldolibarrmodules.'</a>';
  1007. $message = '';
  1008. if (!empty($allowonlineinstall)) {
  1009. if (!in_array('/custom', explode(',', $dolibarr_main_url_root_alt))) {
  1010. $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
  1011. $allowfromweb = -1;
  1012. } else {
  1013. if ($dirins_ok) {
  1014. if (!is_writable(dol_osencode($dirins))) {
  1015. $langs->load("errors");
  1016. $message = info_admin($langs->trans("ErrorFailedToWriteInDir", $dirins), 0, 0, '1', 'warning');
  1017. $allowfromweb = 0;
  1018. }
  1019. } else {
  1020. $message = info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
  1021. $allowfromweb = 0;
  1022. }
  1023. }
  1024. } else {
  1025. if (getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
  1026. // Show clean message
  1027. if (!is_numeric('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')) {
  1028. $message = info_admin($langs->trans(getDolGlobalString('MAIN_MESSAGE_INSTALL_MODULES_DISABLED_CONTACT_US')));
  1029. } else {
  1030. $message = info_admin($langs->trans('InstallModuleFromWebHasBeenDisabledContactUs'));
  1031. }
  1032. } else {
  1033. // Show technical message
  1034. $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock'));
  1035. }
  1036. $allowfromweb = 0;
  1037. }
  1038. if ($allowfromweb < 1) {
  1039. print $langs->trans("SomethingMakeInstallFromWebNotPossible");
  1040. print $message;
  1041. //print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
  1042. print '<br>';
  1043. }
  1044. print '<br>';
  1045. if ($allowfromweb >= 0) {
  1046. if ($allowfromweb == 1) {
  1047. //print $langs->trans("ThisIsProcessToFollow").'<br>';
  1048. } else {
  1049. print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
  1050. print '<b>'.$langs->trans("StepNb", 1).'</b>: ';
  1051. print str_replace('{s1}', $fullurl, $langs->trans("FindPackageFromWebSite", '{s1}')).'<br>';
  1052. print '<b>'.$langs->trans("StepNb", 2).'</b>: ';
  1053. print str_replace('{s1}', $fullurl, $langs->trans("DownloadPackageFromWebSite", '{s1}')).'<br>';
  1054. print '<b>'.$langs->trans("StepNb", 3).'</b>: ';
  1055. }
  1056. if ($allowfromweb == 1) {
  1057. print '<span class="opacitymedium">'.$langs->trans("UnpackPackageInModulesRoot", $dirins).'</span><br>';
  1058. print '<br>';
  1059. print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
  1060. print '<input type="hidden" name="token" value="'.newToken().'">';
  1061. print '<input type="hidden" name="action" value="install">';
  1062. print '<input type="hidden" name="mode" value="deploy">';
  1063. print $langs->trans("YouCanSubmitFile");
  1064. $max = $conf->global->MAIN_UPLOAD_DOC; // In Kb
  1065. $maxphp = @ini_get('upload_max_filesize'); // In unknown
  1066. if (preg_match('/k$/i', $maxphp)) {
  1067. $maxphp = preg_replace('/k$/i', '', $maxphp);
  1068. $maxphp = $maxphp * 1;
  1069. }
  1070. if (preg_match('/m$/i', $maxphp)) {
  1071. $maxphp = preg_replace('/m$/i', '', $maxphp);
  1072. $maxphp = $maxphp * 1024;
  1073. }
  1074. if (preg_match('/g$/i', $maxphp)) {
  1075. $maxphp = preg_replace('/g$/i', '', $maxphp);
  1076. $maxphp = $maxphp * 1024 * 1024;
  1077. }
  1078. if (preg_match('/t$/i', $maxphp)) {
  1079. $maxphp = preg_replace('/t$/i', '', $maxphp);
  1080. $maxphp = $maxphp * 1024 * 1024 * 1024;
  1081. }
  1082. $maxphp2 = @ini_get('post_max_size'); // In unknown
  1083. if (preg_match('/k$/i', $maxphp2)) {
  1084. $maxphp2 = preg_replace('/k$/i', '', $maxphp2);
  1085. $maxphp2 = $maxphp2 * 1;
  1086. }
  1087. if (preg_match('/m$/i', $maxphp2)) {
  1088. $maxphp2 = preg_replace('/m$/i', '', $maxphp2);
  1089. $maxphp2 = $maxphp2 * 1024;
  1090. }
  1091. if (preg_match('/g$/i', $maxphp2)) {
  1092. $maxphp2 = preg_replace('/g$/i', '', $maxphp2);
  1093. $maxphp2 = $maxphp2 * 1024 * 1024;
  1094. }
  1095. if (preg_match('/t$/i', $maxphp2)) {
  1096. $maxphp2 = preg_replace('/t$/i', '', $maxphp2);
  1097. $maxphp2 = $maxphp2 * 1024 * 1024 * 1024;
  1098. }
  1099. // Now $max and $maxphp and $maxphp2 are in Kb
  1100. $maxmin = $max;
  1101. $maxphptoshow = $maxphptoshowparam = '';
  1102. if ($maxphp > 0) {
  1103. $maxmin = min($max, $maxphp);
  1104. $maxphptoshow = $maxphp;
  1105. $maxphptoshowparam = 'upload_max_filesize';
  1106. }
  1107. if ($maxphp2 > 0) {
  1108. $maxmin = min($max, $maxphp2);
  1109. if ($maxphp2 < $maxphp) {
  1110. $maxphptoshow = $maxphp2;
  1111. $maxphptoshowparam = 'post_max_size';
  1112. }
  1113. }
  1114. if ($maxmin > 0) {
  1115. print '<script type="text/javascript">
  1116. $(document).ready(function() {
  1117. jQuery("#fileinstall").on("change", function() {
  1118. if(this.files[0].size > '.($maxmin * 1024).') {
  1119. alert("'.dol_escape_js($langs->trans("ErrorFileSizeTooLarge")).'");
  1120. this.value = "";
  1121. }
  1122. });
  1123. });
  1124. </script>'."\n";
  1125. // MAX_FILE_SIZE doit précéder le champ input de type file
  1126. print '<input type="hidden" name="MAX_FILE_SIZE" value="'.($maxmin * 1024).'">';
  1127. }
  1128. print '<input class="flat minwidth400" type="file" name="fileinstall" id="fileinstall"> ';
  1129. print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Upload")).'" class="button">';
  1130. if (!empty($conf->global->MAIN_UPLOAD_DOC)) {
  1131. if ($user->admin) {
  1132. $langs->load('other');
  1133. print ' ';
  1134. print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow, $maxphptoshowparam), 1);
  1135. }
  1136. } else {
  1137. print ' ('.$langs->trans("UploadDisabled").')';
  1138. }
  1139. print '</form>';
  1140. print '<br>';
  1141. print '<br>';
  1142. print '<div class="center"><div class="logo_setup"></div></div>';
  1143. } else {
  1144. print $langs->trans("UnpackPackageInModulesRoot", $dirins).'<br>';
  1145. print '<b>'.$langs->trans("StepNb", 4).'</b>: ';
  1146. print $langs->trans("SetupIsReadyForUse").'<br>';
  1147. }
  1148. }
  1149. if (!empty($result['return'])) {
  1150. print '<br>';
  1151. foreach ($result['return'] as $value) {
  1152. echo $value.'<br>';
  1153. }
  1154. }
  1155. print dol_get_fiche_end();
  1156. }
  1157. if ($mode == 'develop') {
  1158. print dol_get_fiche_head($head, $mode, '', -1);
  1159. print $deschelp;
  1160. print '<br>';
  1161. // Marketplace
  1162. print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
  1163. print "<tr class=\"liste_titre\">\n";
  1164. //print '<td>'.$langs->trans("Logo").'</td>';
  1165. print '<td colspan="2">'.$langs->trans("DevelopYourModuleDesc").'</td>';
  1166. print '<td>'.$langs->trans("URL").'</td>';
  1167. print '</tr>';
  1168. print '<tr class="oddeven" height="80">'."\n";
  1169. print '<td class="left">';
  1170. print '<div class="imgmaxheight50 logo_setup"></div>';
  1171. print '</td>';
  1172. print '<td>'.$langs->trans("TryToUseTheModuleBuilder", $langs->transnoentitiesnoconv("ModuleBuilder")).'</td>';
  1173. print '<td class="maxwidth300">';
  1174. if (isModEnabled('modulebuilder')) {
  1175. print $langs->trans("SeeTopRightMenu");
  1176. } else {
  1177. print '<span class="opacitymedium">'.$langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("ModuleBuilder")).'</span>';
  1178. }
  1179. print '</td>';
  1180. print '</tr>';
  1181. print '<tr class="oddeven" height="80">'."\n";
  1182. $url = 'https://partners.dolibarr.org';
  1183. print '<td class="left">';
  1184. 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>';
  1185. print '</td>';
  1186. print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
  1187. print '<td><a href="'.$url.'" target="_blank" rel="noopener noreferrer external">'.$url.'</a></td>';
  1188. print '</tr>';
  1189. print "</table>\n";
  1190. print dol_get_fiche_end();
  1191. }
  1192. // End of page
  1193. llxFooter();
  1194. $db->close();