* Copyright (C) 2005-2013 Laurent Destailleur * Copyright (C) 2011-2013 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/admin/mailing.php * \ingroup mailing * \brief Page to setup emailing module */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $langs->load("admin"); $langs->load("mails"); if (!$user->admin) accessforbidden(); $action = GETPOST('action','alpha'); /* * Actions */ if ($action == 'setvalue') { $db->begin(); $mailfrom = GETPOST('MAILING_EMAIL_FROM','alpha'); $mailerror = GETPOST('MAILING_EMAIL_ERRORSTO','alpha'); $checkread = GETPOST('value','alpha'); $checkread_key = GETPOST('MAILING_EMAIL_UNSUBSCRIBE_KEY','alpha'); $mailingdelay = GETPOST('MAILING_DELAY', 'int'); $res=dolibarr_set_const($db, "MAILING_EMAIL_FROM",$mailfrom,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; $res=dolibarr_set_const($db, "MAILING_EMAIL_ERRORSTO",$mailerror,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; $res=dolibarr_set_const($db, "MAILING_DELAY",$mailingdelay,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; // Create temporary encryption key if nedded $res=dolibarr_set_const($db, "MAILING_EMAIL_UNSUBSCRIBE_KEY",$checkread_key,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; if (! $error) { $db->commit(); setEventMessage($langs->trans("SetupSaved")); } else { $db->rollback(); setEventMessage($langs->trans("Error"),'errors'); } } /* * View */ llxHeader('',$langs->trans("MailingSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("MailingSetup"),$linkback,'title_setup'); if (! empty($conf->use_javascript_ajax)) { print "\n".''; } print '
'; print '
'; print ''; print ''; $var=true; print ''; print ''; print ''; print ''; print "\n"; $var=!$var; print ''; $var=!$var; print ''; $var=!$var; print ''; // Constant to add salt into the unsubscribe and check read tag. // It is also used as a security key parameter. $var=!$var; print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print $langs->trans("MailingEMailFrom").''; print ''; if (!empty($conf->global->MAILING_EMAIL_FROM) && ! isValidEmail($conf->global->MAILING_EMAIL_FROM)) print ' '.img_warning($langs->trans("BadEMail")); print '
'; print $langs->trans("MailingEMailError").''; print ''; if (!empty($conf->global->MAILING_EMAIL_ERRORSTO) && ! isValidEmail($conf->global->MAILING_EMAIL_ERRORSTO)) print ' '.img_warning($langs->trans("BadEMail")); print '
'; print $langs->trans("MailingDelay").''; print ''; print '
'; print $langs->trans("ActivateCheckReadKey").''; print ''; if (! empty($conf->use_javascript_ajax)) print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); print '
'; print '
'; print '
'; print '
'; llxFooter(); $db->close();