30 if (!defined(
'NOLOGIN')) {
31 define(
'NOLOGIN',
'1');
33 if (!defined(
'NOCSRFCHECK')) {
34 define(
'NOCSRFCHECK',
'1');
36 if (!defined(
'NOBROWSERNOTIF')) {
37 define(
'NOBROWSERNOTIF',
'1');
39 if (!defined(
'NOREQUIREMENU')) {
40 define(
'NOREQUIREMENU',
'1');
42 if (!defined(
'NOIPCHECK')) {
43 define(
'NOIPCHECK',
'1');
45 if (!defined(
"NOSESSION")) {
46 define(
"NOSESSION",
'1');
48 if (! defined(
'NOREQUIREHTML')) {
49 define(
'NOREQUIREHTML',
'1');
51 if (! defined(
'NOREQUIREAJAX')) {
52 define(
'NOREQUIREAJAX',
'1');
57 require
'../../main.inc.php';
58 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
60 global $user, $conf, $langs;
62 $langs->loadLangs(array(
"main",
"mails"));
67 $unsuscrib =
GETPOST(
'unsuscrib');
68 $securitykey =
GETPOST(
'securitykey');
75 dol_syslog(
"public/emailing/mailing-unsubscribe.php : tag=".$tag.
" securitykey=".$securitykey, LOG_DEBUG);
78 print
'Bad security key value.';
82 if (empty($tag) || ($unsuscrib !=
'1')) {
83 print
'Bad parameters';
93 $replacemainarea = (empty($conf->dol_hide_leftmenu) ?
'<div>' :
'').
'<div>';
95 llxHeader($head, $langs->trans(
"MailUnsubcribe"),
'',
'', 0, 0,
'',
'',
'',
'onlinepaymentbody', $replacemainarea);
97 dol_syslog(
"public/emailing/mailing-unsubscribe.php : Launch unsubscribe requests", LOG_DEBUG);
99 $sql =
"SELECT mc.rowid, mc.email, mc.statut, m.entity";
100 $sql .=
" FROM ".MAIN_DB_PREFIX.
"mailing_cibles as mc, ".MAIN_DB_PREFIX.
"mailing as m";
101 $sql .=
" WHERE mc.fk_mailing = m.rowid AND mc.tag = '".$db->escape($tag).
"'";
103 $resql = $db->query(
$sql);
108 $obj = $db->fetch_object($resql);
111 print
'Emailing tag '.$tag.
' not found in database. Operation canceled.';
115 if (empty($obj->email)) {
116 print
'Email for this tag is not valid. Operation canceled.';
121 if ($obj->statut == 3) {
122 print
'Email tag already set to unsubscribe. Operation canceled.';
137 $sql =
"UPDATE ".MAIN_DB_PREFIX.
"mailing_cibles SET statut=".((int) $statut).
" WHERE tag = '".$db->escape($tag).
"'";
139 $resql = $db->query(
$sql);
159 $sql =
"INSERT INTO ".MAIN_DB_PREFIX.
"mailing_unsubscribe (date_creat, entity, email, unsubscribegroup, ip) VALUES ('".$db->idate(
dol_now()).
"', ".((int) $obj->entity).
", '".$db->escape($obj->email).
"', '', '".$db->escape(
getUserRemoteIP()).
"')";
161 $resql = $db->query(
$sql);
165 print
'<table><tr><td style="text_align:center;">';
166 print $langs->trans(
"YourMailUnsubcribeOK", $obj->email).
"<br>\n";
167 print
'</td></tr></table>';
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
if(isModEnabled('facture') && $user->hasRight('facture', 'lire')) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') && $user->hasRight('don', 'lire')) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $sql
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...
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
getUserRemoteIP()
Return the IP of remote user.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_hash($chain, $type='0')
Returns a hash (non reversible encryption) of a string.