dolibarr 19.0.3
actions_sendmails.inc.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
3* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
4*
5* This program is free software; you can redistribute it and/or modify
6* it under the terms of the GNU General Public License as published by
7* the Free Software Foundation; either version 3 of the License, or
8* (at your option) any later version.
9*
10* This program is distributed in the hope that it will be useful,
11* but WITHOUT ANY WARRANTY; without even the implied warranty of
12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13* GNU General Public License for more details.
14*
15* You should have received a copy of the GNU General Public License
16* along with this program. If not, see <https://www.gnu.org/licenses/>.
17* or see https://www.gnu.org/
18*/
19
25// $mysoc must be defined
26// $id must be defined
27// $paramname may be defined
28// $autocopy may be defined (used to know the automatic BCC to add)
29// $triggersendname must be set (can be '')
30// $actiontypecode can be set
31// $object and $uobject may be defined
32
33/*
34 * Add file in email form
35 */
36if (GETPOST('addfile', 'alpha')) {
37 $trackid = GETPOST('trackid', 'aZ09');
38
39 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
40
41 // Set tmp user directory
42 $vardir = $conf->user->dir_output."/".$user->id;
43 $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
44
45 dol_add_file_process($upload_dir_tmp, 1, 0, 'addedfile', '', null, $trackid, 0);
46 $action = 'presend';
47}
48
49/*
50 * Remove file in email form
51 */
52if (GETPOST('removedfile') && !GETPOST('removAll')) {
53 $trackid = GETPOST('trackid', 'aZ09');
54
55 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
56
57 // Set tmp user directory
58 $vardir = $conf->user->dir_output."/".$user->id;
59 $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
60
61 // TODO Delete only files that was uploaded from email form. This can be addressed by adding the trackid into the temp path then changing donotdeletefile to 2 instead of 1 to say "delete only if into temp dir"
62 // GETPOST('removedfile','alpha') is position of file into $_SESSION["listofpaths"...] array.
63 dol_remove_file_process(GETPOST('removedfile', 'alpha'), 0, 1, $trackid); // We do not delete because if file is the official PDF of doc, we don't want to remove it physically
64 $action = 'presend';
65}
66
67/*
68 * Remove all files in email form
69 */
70if (GETPOST('removAll', 'alpha')) {
71 $trackid = GETPOST('trackid', 'aZ09');
72
73 $listofpaths = array();
74 $listofnames = array();
75 $listofmimes = array();
76 $keytoavoidconflict = empty($trackid) ? '' : '-'.$trackid;
77 if (!empty($_SESSION["listofpaths".$keytoavoidconflict])) {
78 $listofpaths = explode(';', $_SESSION["listofpaths".$keytoavoidconflict]);
79 }
80 if (!empty($_SESSION["listofnames".$keytoavoidconflict])) {
81 $listofnames = explode(';', $_SESSION["listofnames".$keytoavoidconflict]);
82 }
83 if (!empty($_SESSION["listofmimes".$keytoavoidconflict])) {
84 $listofmimes = explode(';', $_SESSION["listofmimes".$keytoavoidconflict]);
85 }
86
87 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
88 $formmail = new FormMail($db);
89 $formmail->trackid = $trackid;
90
91 foreach ($listofpaths as $key => $value) {
92 $pathtodelete = $value;
93 $filetodelete = $listofnames[$key];
94 $result = dol_delete_file($pathtodelete, 1); // Delete uploded Files
95
96 $langs->load("other");
97 setEventMessages($langs->trans("FileWasRemoved", $filetodelete), null, 'mesgs');
98
99 $formmail->remove_attached_files($key); // Update Session
100 }
101}
102
103/*
104 * Send mail
105 */
106if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPOST('removAll') && !GETPOST('removedfile') && !GETPOST('cancel') && !GETPOST('modelselected')) {
107 if (empty($trackid)) {
108 $trackid = GETPOST('trackid', 'aZ09');
109 }
110
111 // Set tmp user directory (used to convert images embedded as img src=data:image)
112 $vardir = $conf->user->dir_output."/".$user->id;
113 $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
114
115 $subject = '';
116 //$actionmsg = '';
117 $actionmsg2 = '';
118
119 $langs->load('mails');
120
121 if (is_object($object)) {
122 $result = $object->fetch($id);
123
124 $sendtosocid = 0; // Id of related thirdparty
125 if (method_exists($object, "fetch_thirdparty") && !in_array($object->element, array('member', 'user', 'expensereport', 'societe', 'contact'))) {
126 $resultthirdparty = $object->fetch_thirdparty();
127 $thirdparty = $object->thirdparty;
128 if (is_object($thirdparty)) {
129 $sendtosocid = $thirdparty->id;
130 }
131 } elseif ($object->element == 'member' || $object->element == 'user') {
132 $thirdparty = $object;
133 if ($object->socid > 0) {
134 $sendtosocid = $object->socid;
135 }
136 } elseif ($object->element == 'expensereport') {
137 $tmpuser = new User($db);
138 $tmpuser->fetch($object->fk_user_author);
139 $thirdparty = $tmpuser;
140 if ($object->socid > 0) {
141 $sendtosocid = $object->socid;
142 }
143 } elseif ($object->element == 'societe') {
144 $thirdparty = $object;
145 if (is_object($thirdparty) && $thirdparty->id > 0) {
146 $sendtosocid = $thirdparty->id;
147 }
148 } elseif ($object->element == 'contact') {
149 $contact = $object;
150 if ($contact->id > 0) {
151 $contact->fetch_thirdparty();
152 $thirdparty = $contact->thirdparty;
153 if (is_object($thirdparty) && $thirdparty->id > 0) {
154 $sendtosocid = $thirdparty->id;
155 }
156 }
157 } else {
158 dol_print_error('', "Use actions_sendmails.in.php for an element/object '".$object->element."' that is not supported");
159 }
160
161 if (is_object($hookmanager)) {
162 $parameters = array();
163 $reshook = $hookmanager->executeHooks('initSendToSocid', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
164 }
165 } else {
166 $thirdparty = $mysoc;
167 }
168
169 if ($result > 0) {
170 $sendto = '';
171 $sendtocc = '';
172 $sendtobcc = '';
173 $sendtoid = array();
174 $sendtouserid = array();
175 $sendtoccuserid = array();
176
177 // Define $sendto
178 $receiver = GETPOST('receiver', 'alphawithlgt');
179 if (!is_array($receiver)) {
180 if ($receiver == '-1') {
181 $receiver = array();
182 } else {
183 $receiver = array($receiver);
184 }
185 }
186
187 $tmparray = array();
188 if (trim($_POST['sendto'])) {
189 // Recipients are provided into free text field
190 $tmparray[] = trim(GETPOST('sendto', 'alphawithlgt'));
191 }
192
193 if (isset($_POST['tomail']) && trim($_POST['tomail'])) {
194 // Recipients are provided into free hidden text field
195 $tmparray[] = trim(GETPOST('tomail', 'alphawithlgt'));
196 }
197
198 if (count($receiver) > 0) {
199 // Recipient was provided from combo list
200 foreach ($receiver as $key => $val) {
201 if ($val == 'thirdparty') { // Key selected means current third party ('thirdparty' may be used for current member or current user too)
202 $tmparray[] = dol_string_nospecial($thirdparty->getFullName($langs), ' ', array(",")).' <'.$thirdparty->email.'>';
203 } elseif ($val == 'contact') { // Key selected means current contact
204 $tmparray[] = dol_string_nospecial($contact->getFullName($langs), ' ', array(",")).' <'.$contact->email.'>';
205 $sendtoid[] = $contact->id;
206 } elseif ($val) { // $val is the Id of a contact
207 $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email');
208 $sendtoid[] = ((int) $val);
209 }
210 }
211 }
212
213 if (getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) {
214 $receiveruser = GETPOST('receiveruser', 'alphawithlgt');
215 if (is_array($receiveruser) && count($receiveruser) > 0) {
216 $fuserdest = new User($db);
217 foreach ($receiveruser as $key => $val) {
218 $tmparray[] = $fuserdest->user_get_property($val, 'email');
219 $sendtouserid[] = $val;
220 }
221 }
222 }
223
224 $sendto = implode(',', $tmparray);
225
226 // Define $sendtocc
227 $receivercc = GETPOST('receivercc', 'alphawithlgt');
228 if (!is_array($receivercc)) {
229 if ($receivercc == '-1') {
230 $receivercc = array();
231 } else {
232 $receivercc = array($receivercc);
233 }
234 }
235 $tmparray = array();
236 if (trim($_POST['sendtocc'])) {
237 $tmparray[] = trim(GETPOST('sendtocc', 'alphawithlgt'));
238 }
239 if (count($receivercc) > 0) {
240 foreach ($receivercc as $key => $val) {
241 if ($val == 'thirdparty') { // Key selected means current thirdparty (may be usd for current member or current user too)
242 // Recipient was provided from combo list
243 $tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
244 } elseif ($val == 'contact') { // Key selected means current contact
245 // Recipient was provided from combo list
246 $tmparray[] = dol_string_nospecial($contact->name, ' ', array(",")).' <'.$contact->email.'>';
247 //$sendtoid[] = $contact->id; TODO Add also id of contact in CC ?
248 } elseif ($val) { // $val is the Id of a contact
249 $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email');
250 //$sendtoid[] = ((int) $val); TODO Add also id of contact in CC ?
251 }
252 }
253 }
254 if (getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) {
255 $receiverccuser = GETPOST('receiverccuser', 'alphawithlgt');
256
257 if (is_array($receiverccuser) && count($receiverccuser) > 0) {
258 $fuserdest = new User($db);
259 foreach ($receiverccuser as $key => $val) {
260 $tmparray[] = $fuserdest->user_get_property($val, 'email');
261 $sendtoccuserid[] = $val;
262 }
263 }
264 }
265 $sendtocc = implode(',', $tmparray);
266
267 if (dol_strlen($sendto)) {
268 // Define $urlwithroot
269 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
270 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
271 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
272
273 require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
274
275 $langs->load("commercial");
276
277 $reg = array();
278 $fromtype = GETPOST('fromtype', 'alpha');
279 if ($fromtype === 'robot') {
280 $from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <' . getDolGlobalString('MAIN_MAIL_EMAIL_FROM').'>';
281 } elseif ($fromtype === 'user') {
282 $from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")).' <'.$user->email.'>';
283 } elseif ($fromtype === 'company') {
284 $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
285 } elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
286 $tmp = explode(',', $user->email_aliases);
287 $from = trim($tmp[($reg[1] - 1)]);
288 } elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) {
289 $tmp = explode(',', getDolGlobalString('MAIN_INFO_SOCIETE_MAIL_ALIASES'));
290 $from = trim($tmp[($reg[1] - 1)]);
291 } elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
292 $sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
293 $sql .= ' WHERE rowid = '.(int) $reg[1];
294 $resql = $db->query($sql);
295 $obj = $db->fetch_object($resql);
296 if ($obj) {
297 $from = dol_string_nospecial($obj->label, ' ', array(",")).' <'.$obj->email.'>';
298 }
299 } elseif (preg_match('/from_template_(\d+)/', $fromtype, $reg)) {
300 $sql = 'SELECT rowid, email_from FROM '.MAIN_DB_PREFIX.'c_email_templates';
301 $sql .= ' WHERE rowid = '.(int) $reg[1];
302 $resql = $db->query($sql);
303 $obj = $db->fetch_object($resql);
304 if ($obj) {
305 $from = $obj->email_from;
306 }
307 } else {
308 $from = dol_string_nospecial(GETPOST('fromname'), ' ', array(",")).' <'.GETPOST('frommail').'>';
309 }
310
311 $replyto = dol_string_nospecial(GETPOST('replytoname'), ' ', array(",")).' <'.GETPOST('replytomail').'>';
312 $message = GETPOST('message', 'restricthtml');
313 $subject = GETPOST('subject', 'restricthtml');
314
315 // Make a change into HTML code to allow to include images from medias directory with an external reabable URL.
316 // <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
317 // become
318 // <img alt="" src="'.$urlwithroot.'viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
319 $message = preg_replace('/(<img.*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $message);
320
321 $sendtobcc = GETPOST('sendtoccc');
322 // Autocomplete the $sendtobcc
323 // $autocopy can be MAIN_MAIL_AUTOCOPY_PROPOSAL_TO, MAIN_MAIL_AUTOCOPY_ORDER_TO, MAIN_MAIL_AUTOCOPY_INVOICE_TO, MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO...
324 if (!empty($autocopy)) {
325 $sendtobcc .= (empty($conf->global->$autocopy) ? '' : (($sendtobcc ? ", " : "") . getDolGlobalString($autocopy)));
326 }
327
328 $deliveryreceipt = GETPOST('deliveryreceipt');
329
330 if ($action == 'send' || $action == 'relance') {
331 $actionmsg2 = $langs->transnoentities('MailSentByTo', CMailFile::getValidAddress($from, 4, 0, 1), CMailFile::getValidAddress($sendto, 4, 0, 1));
332 /*if ($message) {
333 $actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
334 $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
335 if ($sendtocc) {
336 $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".dol_escape_htmltag($sendtocc));
337 }
338 $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
339 $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
340 $actionmsg = dol_concatdesc($actionmsg, $message);
341 }*/
342 }
343
344 // Create form object
345 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
346 $formmail = new FormMail($db);
347 $formmail->trackid = $trackid; // $trackid must be defined
348
349 $attachedfiles = $formmail->get_attached_files();
350 $filepath = $attachedfiles['paths'];
351 $filename = $attachedfiles['names'];
352 $mimetype = $attachedfiles['mimes'];
353
354 // Make substitution in email content
355 $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object);
356 $substitutionarray['__EMAIL__'] = $sendto;
357 $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag=undefined&securitykey='.dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY')."-undefined", 'md5').'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '';
358
359 $parameters = array('mode'=>'formemail');
360 complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
361
362 $subject = make_substitutions($subject, $substitutionarray);
363 $message = make_substitutions($message, $substitutionarray);
364
365 if (is_object($object) && method_exists($object, 'makeSubstitution')) {
366 $subject = $object->makeSubstitution($subject);
367 $message = $object->makeSubstitution($message);
368 }
369
370 // Send mail (substitutionarray must be done just before this)
371 if (empty($sendcontext)) {
372 $sendcontext = 'standard';
373 }
374 $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext, '', $upload_dir_tmp);
375
376 if (!empty($mailfile->error) || !empty($mailfile->errors)) {
377 setEventMessages($mailfile->error, $mailfile->errors, 'errors');
378 $action = 'presend';
379 } else {
380 $result = $mailfile->sendfile();
381 if ($result) {
382 // Initialisation of datas of object to call trigger
383 if (is_object($object)) {
384 if (empty($actiontypecode)) {
385 $actiontypecode = 'AC_OTH_AUTO'; // Event insert into agenda automatically
386 }
387
388 $object->socid = $sendtosocid; // To link to a company
389 $object->sendtoid = $sendtoid; // To link to contact-addresses. This is an array.
390 $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
391 $object->actionmsg = $message; // Long text
392 $object->actionmsg2 = $actionmsg2; // Short text ($langs->transnoentities('MailSentBy')...);
393 if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) {
394 $object->actionmsg2 = $subject; // Short text
395 }
396
397 $object->trackid = $trackid;
398 $object->fk_element = $object->id;
399 $object->elementtype = $object->element;
400 if (is_array($attachedfiles) && count($attachedfiles) > 0) {
401 $object->attachedfiles = $attachedfiles;
402 }
403 if (is_array($sendtouserid) && count($sendtouserid) > 0 && getDolGlobalString('MAIN_MAIL_ENABLED_USER_DEST_SELECT')) {
404 $object->sendtouserid = $sendtouserid;
405 }
406
407 $object->email_msgid = $mailfile->msgid; // @todo Set msgid into $mailfile after sending
408 $object->email_from = $from;
409 $object->email_subject = $subject;
410 $object->email_to = $sendto;
411 $object->email_tocc = $sendtocc;
412 $object->email_tobcc = $sendtobcc;
413 $object->email_subject = $subject;
414
415 // Call of triggers (you should have set $triggersendname to execute trigger. $trigger_name is deprecated)
416 if (!empty($triggersendname) || !empty($trigger_name)) {
417 // Call trigger
418 $result = $object->call_trigger(empty($triggersendname) ? $trigger_name : $triggersendname, $user);
419 if ($result < 0) {
420 $error++;
421 }
422 // End call triggers
423 if ($error) {
424 setEventMessages($object->error, $object->errors, 'errors');
425 }
426 }
427 // End call of triggers
428 }
429
430 // Redirect here
431 // This avoid sending mail twice if going out and then back to page
432 $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
433 setEventMessages($mesg, null, 'mesgs');
434
435 $moreparam = '';
436 if (isset($paramname2) || isset($paramval2)) {
437 $moreparam .= '&'.($paramname2 ? $paramname2 : 'mid').'='.$paramval2;
438 }
439 header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname ? $paramname : 'id').'='.(is_object($object) ? $object->id : '').$moreparam);
440 exit;
441 } else {
442 $langs->load("other");
443 $mesg = '<div class="error">';
444 if (!empty($mailfile->error) || !empty($mailfile->errors)) {
445 $mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto));
446 if (!empty($mailfile->error)) {
447 $mesg .= '<br>'.$mailfile->error;
448 }
449 if (!empty($mailfile->errors) && is_array($mailfile->errors)) {
450 $mesg .= '<br>'.implode('<br>', $mailfile->errors);
451 }
452 } else {
453 $mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto));
454 if (getDolGlobalString('MAIN_DISABLE_ALL_MAILS')) {
455 $mesg .= '<br>Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
456 } else {
457 $mesg .= '<br>Unkown Error, please refers to your administrator';
458 }
459 }
460 $mesg .= '</div>';
461
462 setEventMessages($mesg, null, 'warnings');
463 $action = 'presend';
464 }
465 }
466 } else {
467 $langs->load("errors");
468 setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("MailTo")), null, 'warnings');
469 dol_syslog('Try to send email with no recipient defined', LOG_WARNING);
470 $action = 'presend';
471 }
472 } else {
473 $langs->load("errors");
474 setEventMessages($langs->trans('ErrorFailedToReadObject', $object->element), null, 'errors');
475 dol_syslog('Failed to read data of object id='.$object->id.' element='.$object->element);
476 $action = 'presend';
477 }
478}
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
static getValidAddress($address, $format, $encode=0, $maxnumberofemail=0)
Return a formatted address string for SMTP protocol.
Classe permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new For...
Class to manage Dolibarr users.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
dol_remove_file_process($filenb, $donotupdatesession=0, $donotdeletefile=1, $trackid='')
Remove an uploaded file (for example after submitting a new file a mail form).
dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='', $link=null, $trackid='', $generatethumbs=1, $object=null)
Get and save an upload file (for example after submitting a new file a mail form).
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='', $keepspaces=0)
Clean a string from all punctuation characters to use it as a ref or login.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
dol_hash($chain, $type='0', $nosalt=0)
Returns a hash (non reversible encryption) of a string.