modules.php 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087
  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@capnetworks.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. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 3 of the License, or
  15. * (at your option) any later version.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU General Public License
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  24. */
  25. /**
  26. * \file htdocs/admin/modules.php
  27. * \brief Page to activate/disable all modules
  28. */
  29. require '../main.inc.php';
  30. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  31. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  32. require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
  33. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
  34. require_once DOL_DOCUMENT_ROOT.'/admin/dolistore/class/dolistore.class.php';
  35. // Load translation files required by the page
  36. $langs->loadLangs(array("errors","admin","modulebuilder"));
  37. $mode=GETPOST('mode', 'alpha');
  38. if (empty($mode)) $mode='common';
  39. $action=GETPOST('action','alpha');
  40. $value=GETPOST('value', 'alpha');
  41. $page_y=GETPOST('page_y','int');
  42. $search_keyword=GETPOST('search_keyword','alpha');
  43. $search_status=GETPOST('search_status','alpha');
  44. $search_nature=GETPOST('search_nature','alpha');
  45. $search_version=GETPOST('search_version','alpha');
  46. // For dolistore search
  47. $options = array();
  48. $options['per_page'] = 20;
  49. $options['categorie'] = ((GETPOST('categorie', 'int')?GETPOST('categorie', 'int'):0) + 0);
  50. $options['start'] = ((GETPOST('start', 'int')?GETPOST('start', 'int'):0) + 0);
  51. $options['end'] = ((GETPOST('end', 'int')?GETPOST('end', 'int'):0) + 0);
  52. $options['search'] = GETPOST('search_keyword', 'alpha');
  53. $dolistore = new Dolistore(false);
  54. if (! $user->admin)
  55. accessforbidden();
  56. $specialtostring=array(0=>'common', 1=>'interfaces', 2=>'other', 3=>'functional', 4=>'marketplace');
  57. $familyinfo=array(
  58. 'hr'=>array('position'=>'001', 'label'=>$langs->trans("ModuleFamilyHr")),
  59. 'crm'=>array('position'=>'006', 'label'=>$langs->trans("ModuleFamilyCrm")),
  60. 'srm'=>array('position'=>'007', 'label'=>$langs->trans("ModuleFamilySrm")),
  61. 'financial'=>array('position'=>'009', 'label'=>$langs->trans("ModuleFamilyFinancial")),
  62. 'products'=>array('position'=>'012', 'label'=>$langs->trans("ModuleFamilyProducts")),
  63. 'projects'=>array('position'=>'015', 'label'=>$langs->trans("ModuleFamilyProjects")),
  64. 'ecm'=>array('position'=>'018', 'label'=>$langs->trans("ModuleFamilyECM")),
  65. 'technic'=>array('position'=>'021', 'label'=>$langs->trans("ModuleFamilyTechnic")),
  66. 'portal'=>array('position'=>'040', 'label'=>$langs->trans("ModuleFamilyPortal")),
  67. 'interface'=>array('position'=>'050', 'label'=>$langs->trans("ModuleFamilyInterface")),
  68. 'base'=>array('position'=>'060', 'label'=>$langs->trans("ModuleFamilyBase")),
  69. 'other'=>array('position'=>'100', 'label'=>$langs->trans("ModuleFamilyOther")),
  70. );
  71. $param='';
  72. if (! GETPOST('buttonreset','alpha'))
  73. {
  74. if ($search_keyword) $param.='&search_keyword='.urlencode($search_keyword);
  75. if ($search_status && $search_status != '-1') $param.='&search_status='.urlencode($search_status);
  76. if ($search_nature && $search_nature != '-1') $param.='&search_nature='.urlencode($search_nature);
  77. if ($search_version && $search_version != '-1') $param.='&search_version='.urlencode($search_version);
  78. }
  79. $dirins=DOL_DOCUMENT_ROOT.'/custom';
  80. $urldolibarrmodules='https://www.dolistore.com/';
  81. // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
  82. $hookmanager->initHooks(array('adminmodules','globaladmin'));
  83. /*
  84. * Actions
  85. */
  86. $formconfirm = '';
  87. $parameters=array();
  88. $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
  89. if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  90. if (GETPOST('buttonreset','alpha'))
  91. {
  92. $search_keyword='';
  93. $search_status='';
  94. $search_nature='';
  95. $search_version='';
  96. }
  97. if ($action=='install')
  98. {
  99. $error=0;
  100. // $original_file should match format module_modulename-x.y[.z].zip
  101. $original_file=basename($_FILES["fileinstall"]["name"]);
  102. $newfile=$conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
  103. if (! $original_file)
  104. {
  105. $langs->load("Error");
  106. setEventMessages($langs->trans("ErrorModuleFileRequired"), null, 'warnings');
  107. $error++;
  108. }
  109. else
  110. {
  111. if (! preg_match('/\.zip$/i',$original_file))
  112. {
  113. $langs->load("errors");
  114. setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), null, 'errors');
  115. $error++;
  116. }
  117. if (! preg_match('/module_.*\-[\d]+\.[\d]+.*$/i',$original_file))
  118. {
  119. $langs->load("errors");
  120. setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules",$original_file, 'module_*-x.y*.zip'), null, 'errors');
  121. $error++;
  122. }
  123. }
  124. if (! $error)
  125. {
  126. if ($original_file)
  127. {
  128. @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
  129. dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
  130. }
  131. $tmpdir=preg_replace('/\.zip$/','',$original_file).'.dir';
  132. if ($tmpdir)
  133. {
  134. @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir);
  135. dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir);
  136. }
  137. $result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']);
  138. if ($result > 0)
  139. {
  140. $result=dol_uncompress($newfile,$conf->admin->dir_temp.'/'.$tmpdir);
  141. if (! empty($result['error']))
  142. {
  143. $langs->load("errors");
  144. setEventMessages($langs->trans($result['error'],$original_file), null, 'errors');
  145. $error++;
  146. }
  147. else
  148. {
  149. // Now we move the dir of the module
  150. $modulename=preg_replace('/module_/', '', $original_file);
  151. $modulename=preg_replace('/\-[\d]+\.[\d]+.*$/', '', $modulename);
  152. // Search dir $modulename
  153. $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename;
  154. //var_dump($modulenamedir);
  155. if (! dol_is_dir($modulenamedir))
  156. {
  157. $modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename;
  158. //var_dump($modulenamedir);
  159. if (! dol_is_dir($modulenamedir))
  160. {
  161. setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'<br>Dir not found: '.$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename.'<br>'.$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename, null, 'errors');
  162. $error++;
  163. }
  164. }
  165. if (! $error)
  166. {
  167. //var_dump($dirins);
  168. @dol_delete_dir_recursive($dirins.'/'.$modulename);
  169. dol_syslog("Uncompress of module file is a success. We copy it from ".$modulenamedir." into target dir ".$dirins.'/'.$modulename);
  170. $result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1);
  171. if ($result <= 0)
  172. {
  173. dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$modulenamedir." and ".$dirins.'/'.$modulename, LOG_WARNING);
  174. $langs->load("errors");
  175. setEventMessages($langs->trans("ErrorFailToCopyDir", $modulenamedir, $dirins.'/'.$modulename), null, 'errors');
  176. $error++;
  177. }
  178. }
  179. }
  180. }
  181. else
  182. {
  183. $error++;
  184. }
  185. }
  186. if (! $error)
  187. {
  188. setEventMessages($langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")), null, 'warnings');
  189. }
  190. }
  191. if ($action == 'set' && $user->admin)
  192. {
  193. $resarray = activateModule($value);
  194. if (! empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors');
  195. else
  196. {
  197. //var_dump($resarray);exit;
  198. if ($resarray['nbperms'] > 0)
  199. {
  200. $tmpsql="SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."user WHERE admin <> 1";
  201. $resqltmp=$db->query($tmpsql);
  202. if ($resqltmp)
  203. {
  204. $obj=$db->fetch_object($resqltmp);
  205. //var_dump($obj->nb);exit;
  206. if ($obj && $obj->nb > 1)
  207. {
  208. $msg = $langs->trans('ModuleEnabledAdminMustCheckRights');
  209. setEventMessages($msg, null, 'warnings');
  210. }
  211. }
  212. else dol_print_error($db);
  213. }
  214. }
  215. header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
  216. exit;
  217. }
  218. else if ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes')
  219. {
  220. $result=unActivateModule($value);
  221. if ($result) setEventMessages($result, null, 'errors');
  222. header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:''));
  223. exit;
  224. }
  225. /*
  226. * View
  227. */
  228. $form = new Form($db);
  229. //$morejs = array("/admin/dolistore/js/dolistore.js.php");
  230. $morecss = array("/admin/dolistore/css/dolistore.css");
  231. // Set dir where external modules are installed
  232. if (! dol_is_dir($dirins))
  233. {
  234. dol_mkdir($dirins);
  235. }
  236. $dirins_ok=(dol_is_dir($dirins));
  237. $help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
  238. llxHeader('',$langs->trans("Setup"),$help_url, '', '', '', $morejs, $morecss, 0, 0);
  239. $arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
  240. $arrayofwarnings=array(); // Array of warning each module want to show when activated
  241. $arrayofwarningsext=array(); // Array of warning each module want to show when we activate an external module
  242. // Search modules dirs
  243. $modulesdir = dolGetModulesDirs();
  244. $filename = array();
  245. $modules = array();
  246. $orders = array();
  247. $categ = array();
  248. $dirmod = array();
  249. $i = 0; // is a sequencer of modules found
  250. $j = 0; // j is module number. Automatically affected if module number not defined.
  251. $modNameLoaded=array();
  252. foreach ($modulesdir as $dir)
  253. {
  254. // Load modules attributes in arrays (name, numero, orders) from dir directory
  255. //print $dir."\n<br>";
  256. dol_syslog("Scan directory ".$dir." for module descriptor files (modXXX.class.php)");
  257. $handle=@opendir($dir);
  258. if (is_resource($handle))
  259. {
  260. while (($file = readdir($handle))!==false)
  261. {
  262. //print "$i ".$file."\n<br>";
  263. if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
  264. {
  265. $modName = substr($file, 0, dol_strlen($file) - 10);
  266. if ($modName)
  267. {
  268. if (! empty($modNameLoaded[$modName])) // In cache of already loaded modules ?
  269. {
  270. $mesg="Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>";
  271. setEventMessages($mesg, null, 'warnings');
  272. dol_syslog($mesg, LOG_ERR);
  273. continue;
  274. }
  275. try
  276. {
  277. $res=include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error.
  278. if (class_exists($modName))
  279. {
  280. try {
  281. $objMod = new $modName($db);
  282. $modNameLoaded[$modName]=$dir;
  283. if (! $objMod->numero > 0 && $modName != 'modUser')
  284. {
  285. dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
  286. }
  287. $j = $objMod->numero;
  288. $modulequalified=1;
  289. // We discard modules according to features level (PS: if module is activated we always show it)
  290. $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
  291. if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0;
  292. if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0;
  293. if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified=0;
  294. // We discard modules according to property ->hidden
  295. if (! empty($objMod->hidden)) $modulequalified=0;
  296. if ($modulequalified > 0)
  297. {
  298. $publisher=dol_escape_htmltag($objMod->getPublisher());
  299. $external=($objMod->isCoreOrExternalModule() == 'external');
  300. if ($external)
  301. {
  302. if ($publisher)
  303. {
  304. $arrayofnatures['external_'.$publisher]=$langs->trans("External").' - '.$publisher;
  305. }
  306. else
  307. {
  308. $arrayofnatures['external_']=$langs->trans("External").' - '.$langs->trans("UnknownPublishers");
  309. }
  310. }
  311. ksort($arrayofnatures);
  312. }
  313. // Define array $categ with categ with at least one qualified module
  314. if ($modulequalified > 0)
  315. {
  316. $filename[$i]= $modName;
  317. $modules[$modName] = $objMod;
  318. // Gives the possibility to the module, to provide his own family info and position of this family
  319. if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
  320. $familyinfo = array_merge($familyinfo, $objMod->familyinfo);
  321. $familykey = key($objMod->familyinfo);
  322. } else {
  323. $familykey = $objMod->family;
  324. }
  325. $moduleposition = ($objMod->module_position?$objMod->module_position:'500');
  326. if ($moduleposition == 500 && ($objMod->isCoreOrExternalModule() == 'external'))
  327. {
  328. $moduleposition = 800;
  329. }
  330. // Add list of warnings to show into arrayofwarnings and arrayofwarningsext
  331. if (! empty($objMod->warnings_activation))
  332. {
  333. $arrayofwarnings[$modName]=$objMod->warnings_activation;
  334. }
  335. if (! empty($objMod->warnings_activation_ext))
  336. {
  337. $arrayofwarningsext[$modName]=$objMod->warnings_activation_ext;
  338. }
  339. $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
  340. $dirmod[$i] = $dir;
  341. //print $i.'-'.$dirmod[$i].'<br>';
  342. // Set categ[$i]
  343. $specialstring = 'unknown';
  344. if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring='expdev';
  345. if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories
  346. else $categ[$specialstring]=1;
  347. $j++;
  348. $i++;
  349. }
  350. else dol_syslog("Module ".get_class($objMod)." not qualified");
  351. }
  352. catch(Exception $e)
  353. {
  354. dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
  355. }
  356. }
  357. else
  358. {
  359. print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
  360. }
  361. }
  362. catch(Exception $e)
  363. {
  364. dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
  365. }
  366. }
  367. }
  368. }
  369. closedir($handle);
  370. }
  371. else
  372. {
  373. dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
  374. }
  375. }
  376. if ($action == 'reset_confirm' && $user->admin)
  377. {
  378. if(!empty($modules[$value])) {
  379. $objMod = $modules[$value];
  380. if(!empty($objMod->langfiles)) $langs->loadLangs($objMod->langfiles);
  381. $form = new Form($db);
  382. $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?value='.$value.'&mode='.$mode.$param, $langs->trans('ConfirmUnactivation'), $langs->trans(GETPOST('confirm_message_code')), 'reset', '', 'no', 1);
  383. }
  384. }
  385. print $formconfirm;
  386. asort($orders);
  387. //var_dump($orders);
  388. //var_dump($categ);
  389. //var_dump($modules);
  390. $nbofactivatedmodules=count($conf->modules);
  391. $moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1), count($modules));
  392. if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouMustEnableOneModule"));
  393. print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'title_setup');
  394. // Start to show page
  395. if ($mode=='common') print '<span class="opacitymedium">'.$langs->trans("ModulesDesc")."</span><br>\n";
  396. if ($mode=='marketplace') print '<span class="opacitymedium">'.$langs->trans("ModulesMarketPlaceDesc")."</span><br>\n";
  397. if ($mode=='deploy') print '<span class="opacitymedium">'.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."</span><br>\n";
  398. if ($mode=='develop') print '<span class="opacitymedium">'.$langs->trans("ModulesDevelopDesc")."</span><br>\n";
  399. $head = modules_prepare_head();
  400. print "<br>\n";
  401. if ($mode == 'common')
  402. {
  403. dol_set_focus('#search_keyword');
  404. print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
  405. if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
  406. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  407. print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
  408. print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
  409. print '<input type="hidden" name="page" value="'.$page.'">';
  410. dol_fiche_head($head, $mode, '', -1);
  411. $moreforfilter = '';
  412. $moreforfilter.='<div class="divsearchfield">';
  413. $moreforfilter.= $langs->trans('Keyword') . ': <input type="text" id="search_keyword" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
  414. $moreforfilter.= '</div>';
  415. $moreforfilter.='<div class="divsearchfield">';
  416. $moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1);
  417. $moreforfilter.= '</div>';
  418. if (! empty($conf->global->MAIN_FEATURES_LEVEL))
  419. {
  420. $array_version = array('stable'=>$langs->transnoentitiesnoconv("Stable"));
  421. if ($conf->global->MAIN_FEATURES_LEVEL < 0) $array_version['deprecated']=$langs->trans("Deprecated");
  422. if ($conf->global->MAIN_FEATURES_LEVEL > 0) $array_version['experimental']=$langs->trans("Experimental");
  423. if ($conf->global->MAIN_FEATURES_LEVEL > 1) $array_version['development']=$langs->trans("Development");
  424. $moreforfilter.='<div class="divsearchfield">';
  425. $moreforfilter.= $langs->trans('Version') . ': '.$form->selectarray('search_version', $array_version, $search_version, 1);
  426. $moreforfilter.= '</div>';
  427. }
  428. $moreforfilter.='<div class="divsearchfield">';
  429. $moreforfilter.= $langs->trans('Status') . ': '.$form->selectarray('search_status', array('active'=>$langs->transnoentitiesnoconv("Enabled"), 'disabled'=>$langs->transnoentitiesnoconv("Disabled")), $search_status, 1);
  430. $moreforfilter.= '</div>';
  431. $moreforfilter.=' ';
  432. $moreforfilter.='<div class="divsearchfield">';
  433. $moreforfilter.='<input type="submit" name="buttonsubmit" class="button" value="'.dol_escape_htmltag($langs->trans("Refresh")).'">';
  434. $moreforfilter.=' ';
  435. $moreforfilter.='<input type="submit" name="buttonreset" class="button" value="'.dol_escape_htmltag($langs->trans("Reset")).'">';
  436. $moreforfilter.= '</div>';
  437. if (! empty($moreforfilter))
  438. {
  439. print $moreforfilter;
  440. $parameters=array();
  441. $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook
  442. print $hookmanager->resPrint;
  443. }
  444. $moreforfilter='';
  445. print '<div class="clearboth"></div><br>';
  446. $parameters=array();
  447. $reshook=$hookmanager->executeHooks('insertExtraHeader',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
  448. if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
  449. // Show list of modules
  450. $oldfamily='';
  451. foreach ($orders as $key => $value)
  452. {
  453. $tab=explode('_',$value);
  454. $familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3];
  455. $modName = $filename[$key];
  456. $objMod = $modules[$modName];
  457. $dirofmodule = $dirmod[$key];
  458. //print $objMod->name." - ".$key." - ".$objMod->version."<br>";
  459. //if (($mode != (isset($specialtostring[$special])?$specialtostring[$special]:'unknown') && $mode != 'expdev')
  460. if ($mode == 'expdev' && $objMod->version != 'development' && $objMod->version != 'experimental') continue; // Discard if not for current tab
  461. if (! $objMod->getName())
  462. {
  463. dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
  464. continue;
  465. }
  466. $const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
  467. // Check filters
  468. $modulename=$objMod->getName();
  469. $moduletechnicalname=$objMod->name;
  470. $moduledesc=$objMod->getDesc();
  471. $moduledesclong=$objMod->getDescLong();
  472. $moduleauthor=$objMod->getPublisher();
  473. // We discard showing according to filters
  474. if ($search_keyword)
  475. {
  476. $qualified=0;
  477. if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename)
  478. || preg_match('/'.preg_quote($search_keyword).'/i', $moduletechnicalname)
  479. || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc)
  480. || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong)
  481. || preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor)
  482. ) $qualified=1;
  483. if (! $qualified) continue;
  484. }
  485. if ($search_status)
  486. {
  487. if ($search_status == 'active' && empty($conf->global->$const_name)) continue;
  488. if ($search_status == 'disabled' && ! empty($conf->global->$const_name)) continue;
  489. }
  490. if ($search_nature)
  491. {
  492. if (preg_match('/^external/',$search_nature) && $objMod->isCoreOrExternalModule() != 'external') continue;
  493. if (preg_match('/^external_(.*)$/',$search_nature, $reg))
  494. {
  495. //print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher());
  496. $publisher=dol_escape_htmltag($objMod->getPublisher());
  497. if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) continue;
  498. if (! $reg[1] && ! empty($publisher)) continue;
  499. }
  500. if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') continue;
  501. }
  502. if ($search_version)
  503. {
  504. if (($objMod->version == 'development' || $objMod->version == 'experimental' || preg_match('/deprecated/', $objMod->version)) && $search_version == 'stable') continue;
  505. if ($objMod->version != 'development' && ($search_version == 'development')) continue;
  506. if ($objMod->version != 'experimental' && ($search_version == 'experimental')) continue;
  507. if (! preg_match('/deprecated/', $objMod->version) && ($search_version == 'deprecated')) continue;
  508. }
  509. // Load all lang files of module
  510. if (isset($objMod->langfiles) && is_array($objMod->langfiles))
  511. {
  512. foreach($objMod->langfiles as $domain)
  513. {
  514. $langs->load($domain);
  515. }
  516. }
  517. // Print a separator if we change family
  518. if ($familykey!=$oldfamily)
  519. {
  520. if ($oldfamily) print '</table></div><br>';
  521. $familytext=empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label'];
  522. print_fiche_titre($familytext, '', '');
  523. print '<div class="div-table-responsive">';
  524. print '<table class="tagtable liste" summary="list_of_modules">'."\n";
  525. $atleastoneforfamily=0;
  526. }
  527. $atleastoneforfamily++;
  528. if ($familykey!=$oldfamily)
  529. {
  530. $familytext=empty($familyinfo[$familykey]['label'])?$familykey:$familyinfo[$familykey]['label'];
  531. $oldfamily=$familykey;
  532. }
  533. // Version (with picto warning or not)
  534. $version=$objMod->getVersion(0);
  535. $versiontrans='';
  536. if (preg_match('/development/i', $version)) $versiontrans.=img_warning($langs->trans("Development"), 'style="float: left"');
  537. if (preg_match('/experimental/i', $version)) $versiontrans.=img_warning($langs->trans("Experimental"), 'style="float: left"');
  538. if (preg_match('/deprecated/i', $version)) $versiontrans.=img_warning($langs->trans("Deprecated"), 'style="float: left"');
  539. $versiontrans.=$objMod->getVersion(1);
  540. // Define imginfo
  541. $imginfo="info";
  542. if ($objMod->isCoreOrExternalModule() == 'external')
  543. {
  544. $imginfo="info_black";
  545. }
  546. print '<tr class="oddeven">'."\n";
  547. if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) print '<td width="20px">'.++$linenum.'</td>';
  548. // Picto + Name of module
  549. print ' <td width="200px">';
  550. $alttext='';
  551. //if (is_array($objMod->need_dolibarr_version)) $alttext.=($alttext?' - ':'').'Dolibarr >= '.join('.',$objMod->need_dolibarr_version);
  552. //if (is_array($objMod->phpmin)) $alttext.=($alttext?' - ':'').'PHP >= '.join('.',$objMod->phpmin);
  553. if (! empty($objMod->picto))
  554. {
  555. if (preg_match('/^\//i',$objMod->picto)) print img_picto($alttext,$objMod->picto,' width="14px"',1);
  556. else print img_object($alttext, $objMod->picto, 'class="valignmiddle" width="14px"');
  557. }
  558. else
  559. {
  560. print img_object($alttext, 'generic', 'class="valignmiddle"');
  561. }
  562. print ' <span class="valignmiddle">'.$objMod->getName().'</span>';
  563. print "</td>\n";
  564. // Desc
  565. print '<td class="valignmiddle tdoverflowmax300">';
  566. print nl2br($objMod->getDesc());
  567. print "</td>\n";
  568. // Help
  569. print '<td class="center nowrap" style="width: 82px;">';
  570. //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
  571. 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($langs->trans("ClickToShowDescription"), $imginfo).'</a>';
  572. print '</td>';
  573. // Version
  574. print '<td class="center nowrap" width="120px">';
  575. print $versiontrans;
  576. if(!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)){
  577. require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
  578. if (!empty($objMod->url_last_version)) {
  579. $newversion = getURLContent($objMod->url_last_version);
  580. if(isset($newversion['content'])){
  581. if (version_compare($newversion['content'], $versiontrans) > 0) {
  582. print "&nbsp;<span class='butAction' title='" . $langs->trans('LastStableVersion') . "'>".$newversion['content']."</span>";
  583. }
  584. }
  585. }
  586. }
  587. print "</td>\n";
  588. // Activate/Disable and Setup (2 columns)
  589. if (! empty($conf->global->$const_name)) // If module is already activated
  590. {
  591. $disableSetup = 0;
  592. // Link enable/disabme
  593. print '<td class="center valignmiddle" width="60px">';
  594. if (! empty($arrayofwarnings[$modName]))
  595. {
  596. print '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
  597. }
  598. if (! empty($objMod->disabled))
  599. {
  600. print $langs->trans("Disabled");
  601. }
  602. else if (! empty($objMod->always_enabled) || ((! empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity!=1)))
  603. {
  604. if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) print $langs->trans("Used");
  605. else print $langs->trans("Required");
  606. if (! empty($conf->multicompany->enabled) && $user->entity) $disableSetup++;
  607. }
  608. else
  609. {
  610. if(!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) {
  611. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=reset_confirm&amp;confirm_message_code='.$objMod->warnings_unactivation[$mysoc->country_code].'&amp;value=' . $modName . '&amp;mode=' . $mode . $param . '">';
  612. print img_picto($langs->trans("Activated"),'switch_on');
  613. print '</a>';
  614. }
  615. else {
  616. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=reset&amp;value=' . $modName . '&amp;mode=' . $mode .'&amp;confirm=yes' . $param . '">';
  617. print img_picto($langs->trans("Activated"),'switch_on');
  618. print '</a>';
  619. }
  620. }
  621. print '</td>'."\n";
  622. // Link config
  623. if (! empty($objMod->config_page_url) && !$disableSetup)
  624. {
  625. $backtourlparam='';
  626. if ($search_keyword != '') $backtourlparam.=($backtourlparam?'&':'?').'search_keyword='.$search_keyword; // No urlencode here, done later
  627. if ($search_nature > -1) $backtourlparam.=($backtourlparam?'&':'?').'search_nature='.$search_nature;
  628. if ($search_version > -1) $backtourlparam.=($backtourlparam?'&':'?').'search_version='.$search_version;
  629. if ($search_status > -1) $backtourlparam.=($backtourlparam?'&':'?').'search_status='.$search_status;
  630. $backtourl=$_SERVER["PHP_SELF"].$backtourlparam;
  631. if (is_array($objMod->config_page_url))
  632. {
  633. print '<td class="tdsetuppicto right" width="60px">';
  634. $i=0;
  635. foreach ($objMod->config_page_url as $page)
  636. {
  637. $urlpage=$page;
  638. if ($i++)
  639. {
  640. print '<a href="'.$urlpage.'" title="'.$langs->trans($page).'">'.img_picto(ucfirst($page),"setup").'</a>';
  641. // print '<a href="'.$page.'">'.ucfirst($page).'</a>&nbsp;';
  642. }
  643. else
  644. {
  645. if (preg_match('/^([^@]+)@([^@]+)$/i',$urlpage,$regs))
  646. {
  647. $urltouse=dol_buildpath('/'.$regs[2].'/admin/'.$regs[1],1);
  648. print '<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"').'</a>';
  649. }
  650. else
  651. {
  652. $urltouse=$urlpage;
  653. print '<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"').'</a>';
  654. }
  655. }
  656. }
  657. print "</td>\n";
  658. }
  659. else if (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs))
  660. {
  661. print '<td class="tdsetuppicto right valignmiddle" width="60px"><a 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"').'</a></td>';
  662. }
  663. else
  664. {
  665. print '<td class="tdsetuppicto right valignmiddle" width="60px"><a href="'.$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"').'</a></td>';
  666. }
  667. }
  668. else
  669. {
  670. print '<td class="tdsetuppicto right valignmiddle" width="60px">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';
  671. }
  672. }
  673. else // Module not yet activated
  674. {
  675. // Link enable/disable
  676. print '<td class="center valignmiddle" width="60px">';
  677. if (! empty($objMod->always_enabled))
  678. {
  679. // Should never happened
  680. }
  681. else if (! empty($objMod->disabled))
  682. {
  683. print $langs->trans("Disabled");
  684. }
  685. else
  686. {
  687. // Module qualified for activation
  688. $warningmessage='';
  689. if (! empty($arrayofwarnings[$modName]))
  690. {
  691. print '<!-- This module has a warning to show when we activate it (note: your country is '.$mysoc->country_code.') -->'."\n";
  692. foreach ($arrayofwarnings[$modName] as $keycountry => $cursorwarningmessage)
  693. {
  694. $warningmessage .= ($warningmessage?"\n":"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code);
  695. }
  696. }
  697. if ($objMod->isCoreOrExternalModule() == 'external' && ! empty($arrayofwarningsext))
  698. {
  699. print '<!-- This module is an external module and it may have a warning to show (note: your country is '.$mysoc->country_code.') -->'."\n";
  700. foreach ($arrayofwarningsext as $keymodule => $arrayofwarningsextbycountry)
  701. {
  702. $keymodulelowercase=strtolower(preg_replace('/^mod/','',$keymodule));
  703. if (in_array($keymodulelowercase, $conf->modules)) // If module that request warning is on
  704. {
  705. foreach ($arrayofwarningsextbycountry as $keycountry => $cursorwarningmessage)
  706. {
  707. if ($keycountry == 'always' || $keycountry == $mysoc->country_code)
  708. {
  709. $warningmessage .= ($warningmessage?"\n":"").$langs->trans($cursorwarningmessage, $objMod->getName(), $mysoc->country_code, $modules[$keymodule]->getName());
  710. $warningmessage .= ($warningmessage?"\n":"").($warningmessage?"\n":"").$langs->trans("Module").' : '.$objMod->getName();
  711. if (! empty($objMod->editor_name)) $warningmessage .= ($warningmessage?"\n":"").$langs->trans("Publisher").' : '.$objMod->editor_name;
  712. if (! empty($objMod->editor_name)) $warningmessage .= ($warningmessage?"\n":"").$langs->trans("ModuleTriggeringThisWarning").' : '.$modules[$keymodule]->getName();
  713. }
  714. }
  715. }
  716. }
  717. }
  718. print '<!-- Message to show: '.$warningmessage.' -->'."\n";
  719. print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&amp;module_position='.$module_position.'&amp;action=set&amp;value=' . $modName . '&amp;mode=' . $mode . $param . '"';
  720. if ($warningmessage) print ' onclick="return confirm(\''.dol_escape_js($warningmessage).'\');"';
  721. print '>';
  722. print img_picto($langs->trans("Disabled"),'switch_off');
  723. print "</a>\n";
  724. }
  725. print "</td>\n";
  726. // Link config
  727. print '<td class="tdsetuppicto right valignmiddle" width="60px">'.img_picto($langs->trans("NothingToSetup"),"setup",'class="opacitytransp" style="padding-right: 6px"').'</td>';
  728. }
  729. print "</tr>\n";
  730. }
  731. if ($oldfamily)
  732. {
  733. print "</table>\n";
  734. print '</div>';
  735. }
  736. dol_fiche_end();
  737. // Show warning about external users
  738. print info_admin(showModulesExludedForExternal($modules))."\n";
  739. print '</form>';
  740. }
  741. if ($mode == 'marketplace')
  742. {
  743. dol_fiche_head($head, $mode, '', -1);
  744. // Marketplace
  745. print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
  746. print "<tr class=\"liste_titre\">\n";
  747. //print '<td>'.$langs->trans("Logo").'</td>';
  748. print '<td colspan="2">'.$langs->trans("WebSiteDesc").'</td>';
  749. print '<td>'.$langs->trans("URL").'</td>';
  750. print '</tr>';
  751. print "<tr class=\"oddeven\">\n";
  752. $url='https://www.dolistore.com';
  753. print '<td align="left"><a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolistore_logo.png"></a></td>';
  754. print '<td>'.$langs->trans("DoliStoreDesc").'</td>';
  755. print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
  756. print '</tr>';
  757. print "</table>\n";
  758. dol_fiche_end();
  759. print '<br>';
  760. if (empty($conf->global->MAIN_DISABLE_DOLISTORE_SEARCH) && $conf->global->MAIN_FEATURES_LEVEL >= 1)
  761. {
  762. // $options is array with filter criterias
  763. //var_dump($options);
  764. $dolistore->getRemoteData($options);
  765. print '<span class="opacitymedium">'.$langs->trans('DOLISTOREdescriptionLong').'</span><br><br>';
  766. $previouslink = $dolistore->get_previous_link();
  767. $nextlink = $dolistore->get_next_link();
  768. print '<div class="liste_titre liste_titre_bydiv centpercent"><div class="divsearchfield">'
  769. ?>
  770. <form method="POST" class="centpercent" id="searchFormList" action="<?php echo $dolistore->url ?>">
  771. <input type="hidden" name="mode" value="marketplace" />
  772. <div class="divsearchfield"><?php echo $langs->trans('Keyword') ?>:
  773. <input name="search_keyword" placeholder="<?php echo $langs->trans('Chercher un module') ?>" id="search_keyword" type="text" size="50" value="<?php echo $options['search'] ?>"><br>
  774. </div>
  775. <div class="divsearchfield">
  776. <input class="button" value="<?php echo $langs->trans('Rechercher') ?>" type="submit">
  777. <a class="button" href="<?php echo $dolistore->url ?>"><?php echo $langs->trans('Reset') ?></a>
  778. &nbsp;
  779. </div>
  780. <div class="divsearchfield right">
  781. <?php
  782. print $previouslink;
  783. print $nextlink;
  784. ?>
  785. </div>
  786. </form>
  787. <?php
  788. print '</div></div>';
  789. print '<div class="clearboth"></div>';
  790. ?>
  791. <div id="category-tree-left">
  792. <ul class="tree">
  793. <?php echo $dolistore->get_categories(); ?>
  794. </ul>
  795. </div>
  796. <div id="listing-content">
  797. <table summary="list_of_modules" id="list_of_modules" class="productlist centpercent">
  798. <tbody id="listOfModules">
  799. <?php echo $dolistore->get_products($categorie); ?>
  800. </tbody>
  801. </table>
  802. </div>
  803. <?php
  804. }
  805. }
  806. // Install external module
  807. if ($mode == 'deploy')
  808. {
  809. dol_fiche_head($head, $mode, '', -1);
  810. $dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT);
  811. $allowonlineinstall=true;
  812. $allowfromweb=1;
  813. if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false;
  814. $fullurl='<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>';
  815. $message='';
  816. if (! empty($allowonlineinstall))
  817. {
  818. if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt)))
  819. {
  820. $message=info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
  821. $allowfromweb=-1;
  822. }
  823. else
  824. {
  825. if ($dirins_ok)
  826. {
  827. if (! is_writable(dol_osencode($dirins)))
  828. {
  829. $langs->load("errors");
  830. $message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins));
  831. $allowfromweb=0;
  832. }
  833. }
  834. else
  835. {
  836. $message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
  837. $allowfromweb=0;
  838. }
  839. }
  840. }
  841. else
  842. {
  843. $message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock'));
  844. $allowfromweb=0;
  845. }
  846. if ($allowfromweb < 1)
  847. {
  848. print $langs->trans("SomethingMakeInstallFromWebNotPossible");
  849. print $message;
  850. //print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
  851. print '<br>';
  852. }
  853. print '<br>';
  854. if ($allowfromweb >= 0)
  855. {
  856. if ($allowfromweb == 1)
  857. {
  858. //print $langs->trans("ThisIsProcessToFollow").'<br>';
  859. }
  860. else
  861. {
  862. print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
  863. print '<b>'.$langs->trans("StepNb",1).'</b>: ';
  864. print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
  865. print '<b>'.$langs->trans("StepNb",2).'</b>: ';
  866. print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
  867. print '<b>'.$langs->trans("StepNb",3).'</b>: ';
  868. }
  869. if ($allowfromweb == 1)
  870. {
  871. print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
  872. print '<br>';
  873. print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
  874. print '<input type="hidden" name="action" value="install">';
  875. print '<input type="hidden" name="mode" value="deploy">';
  876. print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
  877. print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
  878. print '</form>';
  879. print '<br>';
  880. print '<br>';
  881. print '<div class="center"><div class="logo_setup"></div></div>';
  882. }
  883. else
  884. {
  885. print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
  886. print '<b>'.$langs->trans("StepNb",4).'</b>: ';
  887. print $langs->trans("SetupIsReadyForUse").'<br>';
  888. }
  889. }
  890. if (! empty($result['return']))
  891. {
  892. print '<br>';
  893. foreach($result['return'] as $value)
  894. {
  895. echo $value.'<br>';
  896. }
  897. }
  898. dol_fiche_end();
  899. }
  900. if ($mode == 'develop')
  901. {
  902. dol_fiche_head($head, $mode, '', -1);
  903. // Marketplace
  904. print "<table summary=\"list_of_modules\" class=\"noborder\" width=\"100%\">\n";
  905. print "<tr class=\"liste_titre\">\n";
  906. //print '<td>'.$langs->trans("Logo").'</td>';
  907. print '<td colspan="2">'.$langs->trans("DevelopYourModuleDesc").'</td>';
  908. print '<td>'.$langs->trans("URL").'</td>';
  909. print '</tr>';
  910. print '<tr class="oddeven" height="80">'."\n";
  911. print '<td align="left">';
  912. //span class="fa fa-bug"></span>
  913. //print '<img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png">';
  914. print '<div class="imgmaxheight50 logo_setup"></div>';
  915. print '</td>';
  916. print '<td>'.$langs->trans("TryToUseTheModuleBuilder").'</td>';
  917. print '<td>'.$langs->trans("SeeTopRightMenu").'</td>';
  918. print '</tr>';
  919. print '<tr class="oddeven" height="80">'."\n";
  920. $url='https://partners.dolibarr.org';
  921. print '<td align="left">';
  922. print'<a href="'.$url.'" target="_blank" rel="external"><img border="0" class="imgautosize imgmaxwidth180" src="'.DOL_URL_ROOT.'/theme/dolibarr_preferred_partner_int.png"></a>';
  923. print '</td>';
  924. print '<td>'.$langs->trans("DoliPartnersDesc").'</td>';
  925. print '<td><a href="'.$url.'" target="_blank" rel="external">'.$url.'</a></td>';
  926. print '</tr>';
  927. print "</table>\n";
  928. dol_fiche_end();
  929. }
  930. llxFooter();
  931. $db->close();