30 if (!defined(
'NOLOGIN')) define(
'NOLOGIN',
'1');
31 if (!defined(
'NOCSRFCHECK')) define(
'NOCSRFCHECK',
'1');
32 if (!defined(
'NOBROWSERNOTIF')) define(
'NOBROWSERNOTIF',
'1');
33 if (!defined(
'NOREQUIREMENU')) define(
'NOREQUIREMENU',
'1');
34 if (!defined(
'NOIPCHECK')) define(
'NOIPCHECK',
'1');
35 if (!defined(
"NOSESSION")) define(
"NOSESSION",
'1');
55 require
'../../main.inc.php';
56 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
58 global $user, $conf, $langs;
60 $langs->loadLangs(array(
"main",
"mails"));
65 $unsuscrib =
GETPOST(
'unsuscrib');
66 $securitykey =
GETPOST(
'securitykey');
73 dol_syslog(
"public/emailing/mailing-read.php : tag=".$tag.
" securitykey=".$securitykey, LOG_DEBUG);
75 if ($securitykey != $conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY)
77 print 'Bad security key value.';
82 if (!empty($tag) && ($unsuscrib ==
'1'))
84 dol_syslog(
"public/emailing/mailing-unsubscribe.php : Launch unsubscribe requests", LOG_DEBUG);
86 $sql =
"SELECT mc.rowid, mc.email, mc.statut, m.entity";
87 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing_cibles as mc, ".MAIN_DB_PREFIX.
"mailing as m";
88 $sql .=
" WHERE mc.fk_mailing = m.rowid AND mc.tag='".$db->escape($tag).
"'";
93 $obj = $db->fetch_object(
$resql);
96 print 'Email target not valid. Operation canceled.';
99 if (empty($obj->email)) {
100 print 'Email target not valid. Operation canceled.';
103 if ($obj->statut == 3) {
104 print 'Email target already set to unsubscribe. Operation canceled.';
118 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"mailing_cibles SET statut=".$statut.
" WHERE tag='".$db->escape($tag).
"'";
120 $resql = $db->query($sql);
138 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"mailing_unsubscribe (date_creat, entity, email, unsubscribegroup, ip) VALUES ('".$db->idate(
dol_now()).
"', ".$db->escape($obj->entity).
", '".$db->escape($obj->email).
"', '', '".$db->escape(
getUserRemoteIP()).
"')";
140 $resql = $db->query($sql);
144 header(
"Content-type: text/html; charset=".$conf->file->character_set_client);
146 print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
150 print '<meta name="robots" content="noindex,nofollow">'.
"\n";
151 print '<meta name="keywords" content="dolibarr,emailing">'.
"\n";
152 print '<meta name="description" content="Dolibarr EMailing unsubcribe page">'.
"\n";
153 print "<title>".$langs->trans(
"MailUnsubcribe").
"</title>\n";
154 print '<link rel="stylesheet" type="text/css" href="'.DOL_URL_ROOT.$conf->css.
'?lang='.$langs->defaultlang.
'">'.
"\n";
155 print '<style type="text/css">';
156 print '.CTableRow1 { margin: 1px; padding: 3px; font: 12px verdana,arial; background: #e6E6eE; color: #000000; -moz-border-radius-topleft:6px; -moz-border-radius-topright:6px; -moz-border-radius-bottomleft:6px; -moz-border-radius-bottomright:6px;}';
157 print '.CTableRow2 { margin: 1px; padding: 3px; font: 12px verdana,arial; background: #FFFFFF; color: #000000; -moz-border-radius-topleft:6px; -moz-border-radius-topright:6px; -moz-border-radius-bottomleft:6px; -moz-border-radius-bottomright:6px;}';
161 print '<body style="margin: 20px;">'.
"\n";
162 print '<table><tr><td style="text_align:center;">';
163 print $langs->trans(
"YourMailUnsubcribeOK", $obj->email).
"<br>\n";
164 print '</td></tr></table>';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getUserRemoteIP()
Return the IP of remote user.
dol_now($mode= 'auto')
Return date for now.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...