modules.php 56 KB

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