mailing.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/admin/mailing.php
  20. * \ingroup mailing
  21. * \brief Page to setup emailing module
  22. */
  23. require("../main.inc.php");
  24. require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
  25. $langs->load("admin");
  26. if (!$user->admin)
  27. accessforbidden();
  28. /*
  29. * Actions
  30. */
  31. if ($_POST["action"] == 'setvalue' && $user->admin)
  32. {
  33. $result1=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$_POST["MAILING_EMAIL_FROM"],'chaine',0,'',$conf->entity);
  34. $result2=dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO",$_POST["MAILING_EMAIL_ERRORSTO"],'chaine',0,'',$conf->entity);
  35. if (($result1 + $result2) == 2)
  36. {
  37. $mesg='<div class="ok">'.$langs->trans("Success").'</div>';
  38. }
  39. else
  40. {
  41. dol_print_error($db);
  42. }
  43. }
  44. /*
  45. * View
  46. */
  47. llxHeader();
  48. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  49. print_fiche_titre($langs->trans("MailingSetup"),$linkback,'setup');
  50. if ($mesg) print '<br>'.$mesg;
  51. print '<br>';
  52. print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
  53. print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
  54. print '<input type="hidden" name="action" value="setvalue">';
  55. $var=true;
  56. print '<table class="nobordernopadding" width="100%">';
  57. print '<tr class="liste_titre">';
  58. print '<td>'.$langs->trans("Parameter").'</td>';
  59. print '<td>'.$langs->trans("Value").'</td>';
  60. print "</tr>\n";
  61. $var=!$var;
  62. print '<tr '.$bc[$var].'><td>';
  63. print $langs->trans("MailingEMailFrom").'</td><td>';
  64. print '<input size="32" type="text" name="MAILING_EMAIL_FROM" value="'.$conf->global->MAILING_EMAIL_FROM.'">';
  65. print '</td></tr>';
  66. $var=!$var;
  67. print '<tr '.$bc[$var].'><td>';
  68. print $langs->trans("MailingEMailError").'</td><td>';
  69. print '<input size="32" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf->global->MAILING_EMAIL_ERRORSTO.'">';
  70. print '</td></tr>';
  71. print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
  72. print '</table></form>';
  73. $db->close();
  74. llxFooter();
  75. ?>