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