dolibarr 20.0.0
mailing-send.php
Go to the documentation of this file.
1#!/usr/bin/env php
2<?php
3/*
4 * Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
5 * Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
6 * Copyright (C) 2005-2016 Regis Houssin <regis.houssin@inodbox.com>
7 * Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
29if (!defined('NOSESSION')) {
30 define('NOSESSION', '1');
31}
32
33$sapi_type = php_sapi_name();
34$script_file = basename(__FILE__);
35$path = __DIR__.'/';
36
37// Test if batch mode
38if (substr($sapi_type, 0, 3) == 'cgi') {
39 echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
40 exit(1);
41}
42
43if (!isset($argv[1]) || !$argv[1]) {
44 print "Usage: ".$script_file." (ID_MAILING|all) [userloginforsignature] [maxnbofemails]\n";
45 exit(1);
46}
47
48$id = $argv[1];
49
50if (isset($argv[2]) || !empty($argv[2])) {
51 $login = $argv[2];
52} else {
53 $login = '';
54}
55
56$max = -1;
57
58if (isset($argv[3]) || !empty($argv[3])) {
59 $max = $argv[3];
60}
61
62
63require_once $path."../../htdocs/master.inc.php";
64require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php";
65require_once DOL_DOCUMENT_ROOT."/comm/mailing/class/mailing.class.php";
66
67// Global variables
68$version = DOL_VERSION;
69$error = 0;
70
71if (!getDolGlobalString('MAILING_LIMIT_SENDBYCLI')) {
72 $conf->global->MAILING_LIMIT_SENDBYCLI = 0;
73}
74
75$langs->loadLangs(array("main", "mails"));
76
77if (!isModEnabled('mailing')) {
78 print 'Module Emailing not enabled';
79 exit(1);
80}
81
82$hookmanager->initHooks(array('cli'));
83
84
85/*
86 * Main
87 */
88
89@set_time_limit(0);
90print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
91
92if (getDolGlobalInt('MAILING_DELAY')) {
93 print 'A delay of '.((float) getDolGlobalInt('MAILING_DELAY')).' seconds has been set between each email'."\n";
94}
95
96if (getDolGlobalString('MAILING_LIMIT_SENDBYCLI') == '-1') {
97}
98
99if (!empty($dolibarr_main_db_readonly)) {
100 print "Error: instance in read-only mode\n";
101 exit(1);
102}
103
104$user = new User($db);
105// for signature, we use user send as parameter
106if (!empty($login)) {
107 $user->fetch('', $login);
108}
109
110// We get list of emailing id to process
111$sql = "SELECT m.rowid, m.statut as status";
112$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
113$sql .= " WHERE m.statut IN (1,2)";
114if ($id != 'all') {
115 $sql .= " AND m.rowid= ".((int) $id);
116 $sql .= " LIMIT 1";
117}
118
119$resql = $db->query($sql);
120if ($resql) {
121 $num = $db->num_rows($resql);
122 $j = 0;
123
124 if ($num) {
125 for ($j = 0; $j < $num && $max != 0; $j++) {
126 $obj = $db->fetch_object($resql);
127
128 dol_syslog("Process mailing with id ".$obj->rowid);
129 print "Process mailing with id ".$obj->rowid."\n";
130
131 if ($obj->status == 1) {
132 $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut = 2 WHERE rowid = ".((int) $obj->rowid);
133 $result_sql = $db->query($sql);
134 dol_syslog("Started mailing campaign ".$obj->rowid, LOG_DEBUG);
135 }
136
137 $emailing = new Mailing($db);
138 $emailing->fetch($obj->rowid);
139
140 $upload_dir = $conf->mailing->dir_output."/".get_exdir($emailing->id, 2, 0, 1, $emailing, 'mailing');
141
142 $id = $emailing->id;
143 $subject = $emailing->sujet;
144 $message = $emailing->body;
145 $from = $emailing->email_from;
146 $replyto = $emailing->email_replyto;
147 $errorsto = $emailing->email_errorsto;
148 // Le message est-il en html
149 $msgishtml = -1; // Unknown by default
150 if (preg_match('/[\s\t]*<html>/i', $message)) {
151 $msgishtml = 1;
152 }
153
154 $nbok = 0;
155 $nbko = 0;
156
157 // On choisit les mails non deja envoyes pour ce mailing (statut=0)
158 // ou envoyes en erreur (statut=-1)
159 $sql2 = "SELECT mc.rowid, mc.fk_mailing, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
160 $sql2 .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
161 $sql2 .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".((int) $id);
162 if (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && empty($max)) {
163 $sql2 .= " LIMIT " . getDolGlobalInt('MAILING_LIMIT_SENDBYCLI');
164 } elseif (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && $max > 0) {
165 $sql2 .= " LIMIT ".min(getDolGlobalInt('MAILING_LIMIT_SENDBYCLI'), $max);
166 } elseif ($max > 0) {
167 $sql2 .= " LIMIT ".((int) $max);
168 }
169
170 $resql2 = $db->query($sql2);
171 if ($resql2) {
172 $num2 = $db->num_rows($resql2);
173 dol_syslog("Nb of targets = ".$num2, LOG_DEBUG);
174 print "Nb of targets = ".$num2."\n";
175
176 if ($num2) {
177 $now = dol_now();
178
179 // Positionne date debut envoi
180 $sqlstartdate = "UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi='".$db->idate($now)."' WHERE rowid=".((int) $id);
181 $resqlstartdate = $db->query($sqlstartdate);
182 if (!$resqlstartdate) {
183 dol_print_error($db);
184 $error++;
185 }
186
187 $thirdpartystatic = new Societe($db);
188
189 // Look on each email and sent message
190 $i = 0;
191 while ($i < $num2) {
192 // Here code is common with same loop ino card.php
193 $res = 1;
194 $now = dol_now();
195
196 $obj = $db->fetch_object($resql2);
197 $max--;
198
199 // sendto en RFC2822
200 $sendto = str_replace(',', ' ', dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">");
201
202 // Make subtsitutions on topic and body
203 $other = explode(';', $obj->other);
204 $tmpfield = explode('=', $other[0], 2);
205 $other1 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
206 $tmpfield = explode('=', $other[1], 2);
207 $other2 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
208 $tmpfield = explode('=', $other[2], 2);
209 $other3 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
210 $tmpfield = explode('=', $other[3], 2);
211 $other4 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
212 $tmpfield = explode('=', $other[4], 2);
213 $other5 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
214 $signature = ((!empty($user->signature) && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $user->signature : '');
215
216 $object = null; // Not defined with mass emailing
217 $parameters = array('mode' => 'emailing');
218 $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $object); // Note: On mass emailing, this is null because we don't know object
219
220 // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
221 $substitutionarray['__ID__'] = $obj->source_id;
222 if ($obj->source_type == "thirdparty") {
223 $result = $thirdpartystatic->fetch($obj->source_id);
224
225 if ($result > 0) {
226 $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = $thirdpartystatic->code_client;
227 } else {
228 $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = '';
229 }
230 }
231 $substitutionarray['__EMAIL__'] = $obj->email;
232 $substitutionarray['__LASTNAME__'] = $obj->lastname;
233 $substitutionarray['__FIRSTNAME__'] = $obj->firstname;
234 $substitutionarray['__MAILTOEMAIL__'] = '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>';
235 $substitutionarray['__OTHER1__'] = $other1;
236 $substitutionarray['__OTHER2__'] = $other2;
237 $substitutionarray['__OTHER3__'] = $other3;
238 $substitutionarray['__OTHER4__'] = $other4;
239 $substitutionarray['__OTHER5__'] = $other5;
240 $substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
241 $substitutionarray['__SIGNATURE__'] = $signature; // For backward compatibility
242 $substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.urlencode($obj->tag).'&securitykey='.dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY') . "-".$obj->tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
243 $substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY') . "-".$obj->tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>';
244 $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY') . "-".$obj->tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid);
245
246 $onlinepaymentenabled = 0;
247 if (isModEnabled('paypal')) {
248 $onlinepaymentenabled++;
249 }
250 if (isModEnabled('paybox')) {
251 $onlinepaymentenabled++;
252 }
253 if (isModEnabled('stripe')) {
254 $onlinepaymentenabled++;
255 }
256 if ($onlinepaymentenabled && getDolGlobalString('PAYMENT_SECURITY_TOKEN')) {
257 $substitutionarray['__SECUREKEYPAYMENT__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), 2);
258 if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
259 $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), 2);
260 $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), 2);
261 $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), 2);
262 $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), 2);
263 } else {
264 $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'membersubscription'.$obj->source_id, 2);
265 $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'order'.$obj->source_id, 2);
266 $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'invoice'.$obj->source_id, 2);
267 $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'contractline'.$obj->source_id, 2);
268 }
269 }
270 /* For backward compatibility */
271 if (isModEnabled('paypal') && getDolGlobalString('PAYPAL_SECURITY_TOKEN')) {
272 $substitutionarray['__SECUREKEYPAYPAL__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), 2);
273
274 if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
275 $substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), 2);
276 } else {
277 $substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'membersubscription'.$obj->source_id, 2);
278 }
279
280 if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
281 $substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), 2);
282 } else {
283 $substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'order'.$obj->source_id, 2);
284 }
285
286 if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
287 $substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), 2);
288 } else {
289 $substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'invoice'.$obj->source_id, 2);
290 }
291
292 if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
293 $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), 2);
294 } else {
295 $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'contractline'.$obj->source_id, 2);
296 }
297 }
298
299 complete_substitutions_array($substitutionarray, $langs);
300 $newsubject = make_substitutions($subject, $substitutionarray);
301 $newmessage = make_substitutions($message, $substitutionarray);
302
303 $substitutionisok = true;
304
305 $moreinheader = '';
306 if (preg_match('/__UNSUBSCRIBE__/', $message)) {
307 $moreinheader = "List-Unsubscribe: <__UNSUBSCRIBE_URL__>\n";
308 $moreinheader = make_substitutions($moreinheader, $substitutionarray);
309 }
310
311 $arr_file = array();
312 $arr_mime = array();
313 $arr_name = array();
314 $arr_css = array();
315
316 $listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
317
318 if (count($listofpaths)) {
319 foreach ($listofpaths as $key => $val) {
320 $arr_file[] = $listofpaths[$key]['fullname'];
321 $arr_mime[] = dol_mimetype($listofpaths[$key]['name']);
322 $arr_name[] = $listofpaths[$key]['name'];
323 }
324 }
325 // Fabrication du mail
326 $trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid;
327 $upload_dir_tmp = $upload_dir;
328 $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing', '', $upload_dir_tmp);
329
330 if ($mail->error) {
331 $res = 0;
332 }
333 if (!$substitutionisok) {
334 $mail->error = 'Some substitution failed';
335 $res = 0;
336 }
337
338 // Send Email
339 if ($res) {
340 $res = $mail->sendfile();
341 }
342
343 if ($res) {
344 // Mail successful
345 $nbok++;
346
347 dol_syslog("ok for emailing id ".$id." #".$i.($mail->error ? ' - '.$mail->error : ''), LOG_DEBUG);
348
349 // Note: If emailing is 100 000 targets, 100 000 entries are added, so we don't enter events for each target here
350 // We must union table llx_mailing_taget for event tab OR enter 1 event with a special table link (id of email in event)
351 // Run trigger
352 /*
353 * if ($obj->source_type == 'contact')
354 * {
355 * $emailing->sendtoid = $obj->source_id;
356 * }
357 * if ($obj->source_type == 'thirdparty')
358 * {
359 * $emailing->socid = $obj->source_id;
360 * }
361 * // Call trigger
362 * $result=$emailing->call_trigger('EMAILING_SENTBYMAIL',$user);
363 * if ($result < 0) $error++;
364 * // End call triggers
365 */
366
367 $sqlok = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
368 $sqlok .= " SET statut = 1, date_envoi = '".$db->idate($now)."' WHERE rowid = ".((int) $obj->rowid);
369 $resqlok = $db->query($sqlok);
370 if (!$resqlok) {
371 dol_print_error($db);
372 $error++;
373 } else {
374 // if cheack read is use then update prospect contact status
375 if (strpos($message, '__CHECK_READ__') !== false) {
376 // Update status communication of thirdparty prospect
377 $sqlx = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".((int) $obj->rowid).")";
378 dol_syslog("card.php: set prospect thirdparty status", LOG_DEBUG);
379 $resqlx = $db->query($sqlx);
380 if (!$resqlx) {
381 dol_print_error($db);
382 $error++;
383 }
384
385 // Update status communication of contact prospect
386 $sqlx = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".((int) $obj->rowid)." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
387 dol_syslog("card.php: set prospect contact status", LOG_DEBUG);
388
389 $resqlx = $db->query($sqlx);
390 if (!$resqlx) {
391 dol_print_error($db);
392 $error++;
393 }
394 }
395
396 if (getDolGlobalInt('MAILING_DELAY')) {
397 usleep((float) getDolGlobalInt('MAILING_DELAY') * 1000000);
398 }
399 }
400 } else {
401 // Mail failed
402 $nbko++;
403
404 dol_syslog("error for emailing id ".$id." #".$i.($mail->error ? ' - '.$mail->error : ''), LOG_DEBUG);
405
406 $sqlerror = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
407 $sqlerror .= " SET statut=-1, date_envoi='".$db->idate($now)."' WHERE rowid=".$obj->rowid;
408 $resqlerror = $db->query($sqlerror);
409 if (!$resqlerror) {
410 dol_print_error($db);
411 $error++;
412 }
413 }
414
415 $i++;
416 }
417 } else {
418 //$mesg = "Emailing id ".$id." has no recipient to target";
419 print $mesg."\n";
420 dol_syslog($mesg, LOG_ERR);
421
422 // Loop finished, set global statut of mail
423 $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=3 WHERE rowid=".$obj->rowid;
424 $result_sql = $db->query($sql);
425
426 dol_syslog("update global status", LOG_DEBUG);
427 print "Update status of emailing id ".$id." to ".$statut."\n";
428 }
429 } else {
430 dol_print_error($db);
431 $error++;
432 }
433 }
434 } else {
435 $mesg = "No validated emailing id to send found.";
436 print $mesg."\n";
437 dol_syslog($mesg, LOG_ERR);
438 $error++;
439 }
440} else {
441 dol_print_error($db);
442 $error++;
443}
444
445exit($error);
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to manage emailings module.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition files.lib.php:63
dol_getmypid()
Return getmypid() or random PID when function is disabled Some web hosts disable this php function fo...
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_hash($chain, $type='0', $nosalt=0)
Returns a hash (non reversible encryption) of a string.