PageRenderTime 63ms CodeModel.GetById 14ms RepoModel.GetById 2ms app.codeStats 0ms

/htdocs/admin/mailing.php

https://github.com/asterix14/dolibarr
PHP | 111 lines | 59 code | 24 blank | 28 comment | 11 complexity | dd779f52289446c46a8f3bea1c0a50f8 MD5 | raw file
Possible License(s): LGPL-2.0
  1. <?php
  2. /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.org>
  4. * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/admin/mailing.php
  21. * \ingroup mailing
  22. * \brief Page to setup emailing module
  23. */
  24. require("../main.inc.php");
  25. require_once(DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php");
  26. $langs->load("admin");
  27. $langs->load("mails");
  28. if (!$user->admin)
  29. accessforbidden();
  30. $action = GETPOST("action");
  31. /*
  32. * Actions
  33. */
  34. if ($action == 'setvalue' && $user->admin)
  35. {
  36. $db->begin();
  37. $mailfrom = GETPOST("MAILING_EMAIL_FROM");
  38. $mailerror = GETPOST("MAILING_EMAIL_ERRORSTO");
  39. $res=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$mailfrom,'chaine',0,'',$conf->entity);
  40. if (! $res > 0) $error++;
  41. $res=dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO",$mailerror,'chaine',0,'',$conf->entity);
  42. if (! $res > 0) $error++;
  43. if (! $error)
  44. {
  45. $db->commit();
  46. $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
  47. }
  48. else
  49. {
  50. $db->rollback();
  51. $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
  52. }
  53. }
  54. /*
  55. * View
  56. */
  57. llxHeader('',$langs->trans("MailingSetup"));
  58. $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
  59. print_fiche_titre($langs->trans("MailingSetup"),$linkback,'setup');
  60. dol_htmloutput_mesg($mesg);
  61. print '<br>';
  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. $var=true;
  66. print '<table class="nobordernopadding" width="100%">';
  67. print '<tr class="liste_titre">';
  68. print '<td>'.$langs->trans("Parameter").'</td>';
  69. print '<td>'.$langs->trans("Value").'</td>';
  70. print "</tr>\n";
  71. $var=!$var;
  72. print '<tr '.$bc[$var].'><td>';
  73. print $langs->trans("MailingEMailFrom").'</td><td>';
  74. print '<input size="32" type="text" name="MAILING_EMAIL_FROM" value="'.$conf->global->MAILING_EMAIL_FROM.'">';
  75. if (!empty($conf->global->MAILING_EMAIL_FROM) && ! isValidEmail($conf->global->MAILING_EMAIL_FROM)) print ' '.img_warning($langs->trans("BadEMail"));
  76. print '</td></tr>';
  77. $var=!$var;
  78. print '<tr '.$bc[$var].'><td>';
  79. print $langs->trans("MailingEMailError").'</td><td>';
  80. print '<input size="32" type="text" name="MAILING_EMAIL_ERRORSTO" value="'.$conf->global->MAILING_EMAIL_ERRORSTO.'">';
  81. if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && ! isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) print ' '.img_warning($langs->trans("BadEMail"));
  82. print '</td></tr>';
  83. print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
  84. print '</table></form>';
  85. $db->close();
  86. llxFooter();
  87. ?>