caches.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. /* Copyright (C) 2014-2022 Regis Houssin <regis.houssin@inodbox.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. /**
  19. * \file /multicompany/admin/options.php
  20. * \ingroup multicompany
  21. * \brief Page to setup options for Multicompany module
  22. */
  23. $res=@include("../../main.inc.php"); // For root directory
  24. if (empty($res) && file_exists($_SERVER['DOCUMENT_ROOT']."/main.inc.php"))
  25. $res=@include($_SERVER['DOCUMENT_ROOT']."/main.inc.php"); // Use on dev env only
  26. if (empty($res)) $res=@include("../../../main.inc.php"); // For "custom" directory
  27. dol_include_once('/multicompany/lib/multicompany.lib.php');
  28. require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
  29. $langs->loadLangs(array('admin', 'multicompany@multicompany'));
  30. // Security check
  31. if (empty($user->admin) || !empty($user->entity)) {
  32. accessforbidden();
  33. }
  34. $action = GETPOST('action','alpha');
  35. /*
  36. * Action
  37. */
  38. if ($action == 'setvalue') {
  39. $result=dolibarr_set_const($db, "MULTICOMPANY_MEMCACHED_SERVER",GETPOST('MULTICOMPANY_MEMCACHED_SERVER', 'alpha'),'chaine',0,'',0);
  40. if ($result >= 0) {
  41. setEventMessage($langs->trans("SetupSaved"));
  42. // Force new value
  43. $conf->global->MULTICOMPANY_MEMCACHED_SERVER=GETPOST('MULTICOMPANY_MEMCACHED_SERVER', 'alpha');
  44. } else {
  45. dol_print_error($db);
  46. }
  47. }
  48. /*
  49. * View
  50. */
  51. $form=new Form($db);
  52. $arrayofjs=array(
  53. '/multicompany/core/js/lib_head.js'
  54. );
  55. $help_url='EN:Module_MultiCompany|FR:Module_MultiSoci&eacute;t&eacute;';
  56. llxHeader('', $langs->trans("MultiCompanySetup"), $help_url, '', '', '', $arrayofjs);
  57. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  58. print load_fiche_titre($langs->trans("MultiCompanySetup"),$linkback,'multicompany@multicompany',0,'multicompany_title');
  59. $head=multicompany_prepare_head();
  60. dol_fiche_head($head, 'caches', $langs->trans("ModuleSetup"), -1);
  61. print '<div>'.info_admin($langs->trans("MulticompanyCacheSystemInfo"), 0, 0, '1', 'clearboth').'</div>';
  62. print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
  63. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  64. print '<input type="hidden" name="action" value="setvalue">';
  65. dol_include_once('/multicompany/admin/tpl/caches.tpl.php');
  66. print '</div>';
  67. // Boutons actions
  68. print '<div class="tabsAction">';
  69. print '<input type="submit" id="save" name="save" class="butAction linkobject" value="'.$langs->trans("Save").'" />';
  70. print '</form>'."\n";
  71. print '</div>';
  72. llxFooter();
  73. $db->close();