externalsite.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?php
  2. /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2003 Eric Seigne <erics@rycks.com>
  4. * Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
  5. * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
  6. * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
  7. * Copyright (C) 2011-2012 Juanjo Menent <jmenent@2byte.es>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. /**
  23. * \file htdocs/externalsite/admin/externalsite.php
  24. * \ingroup externalsite
  25. * \brief Page de configuration du module externalsite
  26. */
  27. require '../../main.inc.php';
  28. require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
  29. if (!$user->admin)
  30. accessforbidden();
  31. $langs->load("admin");
  32. $langs->load("other");
  33. $langs->load("externalsite");
  34. $def = array();
  35. $action = GETPOST('action','alpha');
  36. // Sauvegardes parametres
  37. if ($action == 'update')
  38. {
  39. $i=0;
  40. $db->begin();
  41. $label = GETPOST('EXTERNALSITE_LABEL','alpha');
  42. $exturl = GETPOST('EXTERNALSITE_URL','alpha');
  43. $i+=dolibarr_set_const($db,'EXTERNALSITE_LABEL',trim($label),'chaine',0,'',$conf->entity);
  44. $i+=dolibarr_set_const($db,'EXTERNALSITE_URL',trim($exturl),'chaine',0,'',$conf->entity);
  45. //$i+=dolibarr_set_const($db,'EXTERNALSITE_LABEL',trim($_POST["EXTERNALSITE_LABEL"]),'chaine',0,'',$conf->entity);
  46. if ($i >= 2)
  47. {
  48. $db->commit();
  49. $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
  50. }
  51. else
  52. {
  53. $db->rollback();
  54. $mesg="<div class=\"error\">".$db->lasterror()."</div>";
  55. }
  56. }
  57. /**
  58. * View
  59. */
  60. llxHeader();
  61. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  62. print_fiche_titre($langs->trans("ExternalSiteSetup"),$linkback,'setup');
  63. print '<br>';
  64. print $langs->trans("Module100Desc")."<br>\n";
  65. print '<br>';
  66. print '<form name="externalsiteconfig" action="'.$_SERVER["PHP_SELF"].'" method="POST">';
  67. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  68. print '<input type="hidden" name="action" value="update">';
  69. print "<table class=\"noborder\" width=\"100%\">";
  70. print "<tr class=\"liste_titre\">";
  71. print "<td width=\"30%\">".$langs->trans("Parameter")."</td>";
  72. print "<td>".$langs->trans("Value")."</td>";
  73. print "<td>".$langs->trans("Examples")."</td>";
  74. print "</tr>";
  75. $var=true;
  76. $var=!$var;
  77. print "<tr ".$bc[$var].">";
  78. print '<td class="fieldrequired">'.$langs->trans("Label")."</td>";
  79. print "<td><input type=\"text\" class=\"flat\" name=\"EXTERNALSITE_LABEL\" value=\"". (GETPOST('EXTERNALSITE_LABEL','alpha')?GETPOST('EXTERNALSITE_LABEL','alpha'):((empty($conf->global->EXTERNALSITE_LABEL) || $conf->global->EXTERNALSITE_LABEL=='ExternalSite')?'':$conf->global->EXTERNALSITE_LABEL)) . "\" size=\"12\"></td>";
  80. print "<td>My menu entry</td>";
  81. print "</tr>";
  82. $var=!$var;
  83. print "<tr ".$bc[$var].">";
  84. print '<td class="fieldrequired">'.$langs->trans("ExternalSiteURL")."</td>";
  85. print "<td><input type=\"text\" class=\"flat\" name=\"EXTERNALSITE_URL\" value=\"". (GETPOST('EXTERNALSITE_URL','alpha')?GETPOST('EXTERNALSITE_URL','alpha'):(empty($conf->global->EXTERNALSITE_URL)?'':$conf->global->EXTERNALSITE_URL)) . "\" size=\"40\"></td>";
  86. print "<td>http://localhost/myurl/";
  87. print "<br>http://wikipedia.org/";
  88. print "</td>";
  89. print "</tr>";
  90. print "</table>";
  91. print '<br><center>';
  92. print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
  93. print "</center>";
  94. print "</form>\n";
  95. dol_htmloutput_mesg($mesg);
  96. llxFooter();
  97. $db->close();
  98. ?>