dolibarr  9.0.0
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 <http://www.gnu.org/licenses/>.
17 * or see http://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 // $trigger_name 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  */
36 if (GETPOST('addfile','alpha'))
37 {
38  $trackid = GETPOST('trackid','aZ09');
39 
40  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
41 
42  // Set tmp user directory
43  $vardir=$conf->user->dir_output."/".$user->id;
44  $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
45 
46  dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, $trackid, 0);
47  $action='presend';
48 }
49 
50 /*
51  * Remove file in email form
52  */
53 if (! empty($_POST['removedfile']) && empty($_POST['removAll']))
54 {
55  $trackid = GETPOST('trackid','aZ09');
56 
57  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
58 
59  // Set tmp user directory
60  $vardir=$conf->user->dir_output."/".$user->id;
61  $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
62 
63  // 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"
64  // GETPOST('removedfile','alpha') is position of file into $_SESSION["listofpaths"...] array.
65  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
66  $action='presend';
67 }
68 
69 /*
70  * Remove all files in email form
71  */
72 if (GETPOST('removAll','alpha'))
73 {
74  $trackid = GETPOST('trackid','aZ09');
75 
76  $listofpaths=array();
77  $listofnames=array();
78  $listofmimes=array();
79  $keytoavoidconflict = empty($trackid)?'':'-'.$trackid;
80  if (! empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths=explode(';',$_SESSION["listofpaths".$keytoavoidconflict]);
81  if (! empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames=explode(';',$_SESSION["listofnames".$keytoavoidconflict]);
82  if (! empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes=explode(';',$_SESSION["listofmimes".$keytoavoidconflict]);
83 
84  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
85  $formmail = new FormMail($db);
86  $formmail->trackid = $trackid;
87 
88  foreach($listofpaths as $key => $value)
89  {
90  $pathtodelete = $value;
91  $filetodelete = $listofnames[$key];
92  $result = dol_delete_file($pathtodelete,1); // Delete uploded Files
93 
94  $langs->load("other");
95  setEventMessages($langs->trans("FileWasRemoved",$filetodelete), null, 'mesgs');
96 
97  $formmail->remove_attached_files($key); // Update Session
98  }
99 }
100 
101 /*
102  * Send mail
103  */
104 if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_POST['removAll'] && ! $_POST['removedfile'] && ! $_POST['cancel'] && !$_POST['modelselected'])
105 {
106  if (empty($trackid)) $trackid = GETPOST('trackid','aZ09');
107 
108  $subject='';$actionmsg='';$actionmsg2='';
109 
110  $langs->load('mails');
111 
112  if (is_object($object))
113  {
114  $result=$object->fetch($id);
115 
116  $sendtosocid=0; // Thirdparty on object
117  if (method_exists($object,"fetch_thirdparty") && ! in_array($object->element, array('societe','member','user','expensereport')))
118  {
119  $result=$object->fetch_thirdparty();
120  if ($object->element == 'user' && $result == 0) $result=1; // Even if not found, we consider ok
121  $thirdparty=$object->thirdparty;
122  $sendtosocid=$thirdparty->id;
123  }
124  else if ($object->element == 'member' || $object->element == 'user')
125  {
126  $thirdparty=$object;
127  if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
128  }
129  else if ($object->element == 'societe')
130  {
131  $thirdparty=$object;
132  if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id;
133  }
134  else dol_print_error('','Use actions_sendmails.in.php for an element/object that is not supported');
135 
136  if (is_object($hookmanager))
137  {
138  $parameters=array();
139  $reshook=$hookmanager->executeHooks('initSendToSocid',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
140  }
141  }
142  else $thirdparty = $mysoc;
143 
144  if ($result > 0)
145  {
146  $sendto='';
147  $sendtocc='';
148  $sendtobcc='';
149  $sendtoid = array();
150  $sendtouserid=array();
151  $sendtoccuserid=array();
152 
153  // Define $sendto
154  $receiver=$_POST['receiver'];
155  if (! is_array($receiver))
156  {
157  if ($receiver == '-1') $receiver=array();
158  else $receiver=array($receiver);
159  }
160  $tmparray=array();
161  if (trim($_POST['sendto']))
162  {
163  // Recipients are provided into free text
164  $tmparray[] = trim($_POST['sendto']);
165  }
166  if (count($receiver)>0)
167  {
168  foreach($receiver as $key=>$val)
169  {
170  // Recipient was provided from combo list
171  if ($val == 'thirdparty') // Id of third party
172  {
173  $tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
174  }
175  elseif ($val) // Id du contact
176  {
177  $tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
178  $sendtoid[] = $val;
179  }
180  }
181  }
182  if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT))
183  {
184  $receiveruser=$_POST['receiveruser'];
185  if (is_array($receiveruser) && count($receiveruser)>0)
186  {
187  $fuserdest = new User($db);
188  foreach($receiveruser as $key=>$val)
189  {
190  $tmparray[] = $fuserdest->user_get_property($val,'email');
191  $sendtouserid[] = $val;
192  }
193  }
194  }
195 
196  $sendto=implode(',',$tmparray);
197 
198  // Define $sendtocc
199  $receivercc=$_POST['receivercc'];
200  if (! is_array($receivercc))
201  {
202  if ($receivercc == '-1') $receivercc=array();
203  else $receivercc=array($receivercc);
204  }
205  $tmparray=array();
206  if (trim($_POST['sendtocc']))
207  {
208  $tmparray[] = trim($_POST['sendtocc']);
209  }
210  if (count($receivercc) > 0)
211  {
212  foreach($receivercc as $key=>$val)
213  {
214  // Recipient was provided from combo list
215  if ($val == 'thirdparty') // Id of third party
216  {
217  $tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
218  }
219  elseif ($val) // Id du contact
220  {
221  $tmparray[] = $thirdparty->contact_get_property((int) $val,'email');
222  //$sendtoid[] = $val; TODO Add also id of contact in CC ?
223  }
224  }
225  }
226  if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
227  $receiverccuser=$_POST['receiverccuser'];
228 
229  if (is_array($receiverccuser) && count($receiverccuser)>0)
230  {
231  $fuserdest = new User($db);
232  foreach($receiverccuser as $key=>$val)
233  {
234  $tmparray[] = $fuserdest->user_get_property($val,'email');
235  $sendtoccuserid[] = $val;
236  }
237  }
238  }
239  $sendtocc=implode(',',$tmparray);
240 
241  if (dol_strlen($sendto))
242  {
243  // Define $urlwithroot
244  $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
245  $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
246  //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
247 
248  require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
249 
250  $langs->load("commercial");
251 
252  $fromtype = GETPOST('fromtype','alpha');
253  if ($fromtype === 'robot') {
254  $from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")) .' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>';
255  }
256  elseif ($fromtype === 'user') {
257  $from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")) .' <'.$user->email.'>';
258  }
259  elseif ($fromtype === 'company') {
260  $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")) .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
261  }
262  elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
263  $tmp=explode(',', $user->email_aliases);
264  $from = trim($tmp[($reg[1] - 1)]);
265  }
266  elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) {
267  $tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
268  $from = trim($tmp[($reg[1] - 1)]);
269  }
270  elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
271  $sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE rowid = '.(int) $reg[1];
272  $resql = $db->query($sql);
273  $obj = $db->fetch_object($resql);
274  if ($obj)
275  {
276  $from = dol_string_nospecial($obj->label, ' ', array(",")).' <'.$obj->email.'>';
277  }
278  }
279  else {
280  $from = dol_string_nospecial($_POST['fromname'], ' ', array(",")) . ' <' . $_POST['frommail'] .'>';
281  }
282 
283  $replyto = dol_string_nospecial($_POST['replytoname'], ' ', array(",")). ' <' . $_POST['replytomail'].'>';
284  $message = GETPOST('message','none');
285  $subject = GETPOST('subject','none');
286 
287  // Make a change into HTML code to allow to include images from medias directory with an external reabable URL.
288  // <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
289  // become
290  // <img alt="" src="'.$urlwithroot.'viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
291  $message=preg_replace('/(<img.*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $message);
292 
293  $sendtobcc= GETPOST('sendtoccc');
294  // Autocomplete the $sendtobcc
295  // $autocopy can be MAIN_MAIL_AUTOCOPY_PROPOSAL_TO, MAIN_MAIL_AUTOCOPY_ORDER_TO, MAIN_MAIL_AUTOCOPY_INVOICE_TO, MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO...
296  if (! empty($autocopy))
297  {
298  $sendtobcc .= (empty($conf->global->$autocopy) ? '' : (($sendtobcc?", ":"").$conf->global->$autocopy));
299  }
300 
301  $deliveryreceipt = $_POST['deliveryreceipt'];
302 
303  if ($action == 'send' || $action == 'relance')
304  {
305  $actionmsg2=$langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from,4,0,1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto,4,0,1);
306  if ($message)
307  {
308  $actionmsg=$langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
309  $actionmsg=dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
310  if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . dol_escape_htmltag($sendtocc));
311  $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject);
312  $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":");
313  $actionmsg = dol_concatdesc($actionmsg, $message);
314  }
315  }
316 
317  // Create form object
318  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
319  $formmail = new FormMail($db);
320  $formmail->trackid = $trackid; // $trackid must be defined
321 
322  $attachedfiles=$formmail->get_attached_files();
323  $filepath = $attachedfiles['paths'];
324  $filename = $attachedfiles['names'];
325  $mimetype = $attachedfiles['mimes'];
326 
327  // Feature to push mail sent into Sent folder
328  /* This code must be now included into the hook mail, method sendMailAfter
329  if (! empty($conf->dolimail->enabled))
330  {
331  $mailfromid = explode("#", $_POST['frommail'],3); // $_POST['frommail'] = 'aaa#Sent# <aaa@aaa.com>' // TODO Use a better way to define Sent dir.
332  if (count($mailfromid)==0) $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>';
333  else
334  {
335  $mbid = $mailfromid[1];
336 
337  // IMAP Postbox
338  $mailboxconfig = new IMAP($db);
339  $mailboxconfig->fetch($mbid);
340  if ($mailboxconfig->mailbox_imap_host) $ref=$mailboxconfig->get_ref();
341 
342  $mailboxconfig->folder_id=$mailboxconfig->mailbox_imap_outbox;
343  $mailboxconfig->userfolder_fetch();
344 
345  if ($mailboxconfig->mailbox_save_sent_mails == 1)
346  {
347 
348  $folder=str_replace($ref, '', $mailboxconfig->folder_cache_key);
349  if (!$folder) $folder = "Sent"; // Default Sent folder
350 
351  $mailboxconfig->mbox = imap_open($mailboxconfig->get_connector_url().$folder, $mailboxconfig->mailbox_imap_login, $mailboxconfig->mailbox_imap_password);
352  if (false === $mailboxconfig->mbox)
353  {
354  $info = false;
355  $err = $langs->trans('Error3_Imap_Connection_Error');
356  setEventMessages($err,$mailboxconfig->element, null, 'errors');
357  }
358  else
359  {
360  $mailboxconfig->mailboxid=$_POST['frommail'];
361  $mailboxconfig->foldername=$folder;
362  $from = $mailfromid[0] . $mailfromid[2];
363  $imap=1;
364  }
365 
366  }
367  }
368  }
369  */
370 
371  // Make substitution in email content
372  $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $object);
373  $substitutionarray['__EMAIL__'] = $sendto;
374  $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty))?'<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.$object->thirdparty->tag.'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>':'';
375 
376  $parameters=array('mode'=>'formemail');
377  complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
378 
379  $subject=make_substitutions($subject, $substitutionarray);
380  $message=make_substitutions($message, $substitutionarray);
381 
382  if (method_exists($object, 'makeSubstitution'))
383  {
384  $subject = $object->makeSubstitution($subject);
385  $message = $object->makeSubstitution($message);
386  }
387 
388  // Send mail (substitutionarray must be done just before this)
389  if (empty($sendcontext)) $sendcontext = 'standard';
390  $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid,'', $sendcontext);
391 
392  if ($mailfile->error)
393  {
394  setEventMessages($mailfile->error, $mailfile->errors, 'errors');
395  $action='presend';
396  }
397  else
398  {
399  $result=$mailfile->sendfile();
400  if ($result)
401  {
402  // Two hooks are available into method $mailfile->sendfile, so dedicated code is no more required
403  /*
404  if (! empty($conf->dolimail->enabled))
405  {
406  $mid = (GETPOST('mid','int') ? GETPOST('mid','int') : 0); // Original mail id is set ?
407  if ($mid)
408  {
409  // set imap flag answered if it is an answered mail
410  $dolimail=new DoliMail($db);
411  $dolimail->id = $mid;
412  $res=$dolimail->set_prop($user, 'answered',1);
413  }
414  if ($imap==1)
415  {
416  // write mail to IMAP Server
417  $movemail = $mailboxconfig->putMail($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$folder,$deliveryreceipt,$mailfile);
418  if ($movemail) setEventMessages($langs->trans("MailMovedToImapFolder",$folder), null, 'mesgs');
419  else setEventMessages($langs->trans("MailMovedToImapFolder_Warning",$folder), null, 'warnings');
420  }
421  }*/
422 
423  // Initialisation of datas of object to call trigger
424  if (is_object($object))
425  {
426  if (empty($actiontypecode)) $actiontypecode='AC_OTH_AUTO'; // Event insert into agenda automatically
427 
428  $object->socid = $sendtosocid; // To link to a company
429  $object->sendtoid = $sendtoid; // To link to contact addresses. This is an array.
430  $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
431  $object->actionmsg = $actionmsg; // Long text (@TODO Replace this with $message, we already have details of email in dedicated properties)
432  $object->actionmsg2 = $actionmsg2; // Short text ($langs->transnoentities('MailSentBy')...);
433 
434  $object->trackid = $trackid;
435  $object->fk_element = $object->id;
436  $object->elementtype = $object->element;
437  if (is_array($attachedfiles) && count($attachedfiles)>0) {
438  $object->attachedfiles = $attachedfiles;
439  }
440  if (is_array($sendtouserid) && count($sendtouserid)>0 && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
441  $object->sendtouserid = $sendtouserid;
442  }
443 
444  $object->email_msgid = $mailfile->msgid; // @TODO Set msgid into $mailfile after sending
445  $object->email_from = $from;
446  $object->email_subject = $subject;
447  $object->email_to = $sendto;
448  $object->email_tocc = $sendtocc;
449  $object->email_tobcc = $sendtobcc;
450  $object->email_subject = $subject;
451  $object->email_msgid = $mailfile->msgid;
452 
453  // Call of triggers
454  if (! empty($trigger_name))
455  {
456  include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
457  $interface=new Interfaces($db);
458  $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf);
459  if ($result < 0) {
460  setEventMessages($interface->error, $interface->errors, 'errors');
461  }
462  }
463  }
464 
465  // Redirect here
466  // This avoid sending mail twice if going out and then back to page
467  $mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2));
468  setEventMessages($mesg, null, 'mesgs');
469 
470  $moreparam='';
471  if (isset($paramname2) || isset($paramval2)) $moreparam.= '&'.($paramname2?$paramname2:'mid').'='.$paramval2;
472  header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname?$paramname:'id').'='.(is_object($object)?$object->id:'').$moreparam);
473  exit;
474  }
475  else
476  {
477  $langs->load("other");
478  $mesg='<div class="error">';
479  if ($mailfile->error)
480  {
481  $mesg.=$langs->trans('ErrorFailedToSendMail',$from,$sendto);
482  $mesg.='<br>'.$mailfile->error;
483  }
484  else
485  {
486  $mesg.='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
487  }
488  $mesg.='</div>';
489 
490  setEventMessages($mesg, null, 'warnings');
491  $action = 'presend';
492  }
493  }
494  }
495  else
496  {
497  $langs->load("errors");
498  setEventMessages($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("MailTo")), null, 'warnings');
499  dol_syslog('Try to send email with no recipient defined', LOG_WARNING);
500  $action = 'presend';
501  }
502  }
503  else
504  {
505  $langs->load("other");
506  setEventMessages($langs->trans('ErrorFailedToReadObject',$object->element), null, 'errors');
507  dol_syslog('Failed to read data of object id='.$object->id.' element='.$object->element);
508  $action = 'presend';
509  }
510 }
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Classe permettant la generation du formulaire html d&#39;envoi de mail unitaire Usage: $formail = new For...
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
if(! empty($conf->facture->enabled) && $user->rights->facture->lire) if(! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture->lire) if(! empty($conf->don->enabled) && $user->rights->societe->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) && $user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1053
Class to manage Dolibarr users.
Definition: user.class.php:41
dol_remove_file_process($filenb, $donotupdatesession=0, $donotdeletefile=1, $trackid='')
Remove an uploaded file (for example after submitting a new file a mail form).
Definition: files.lib.php:1663
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
dol_concatdesc($text1, $text2, $forxml=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='')
Write log message into outputs.
static getValidAddress($address, $format, $encode=0, $maxnumberofemail=0)
Return a formatted address string for SMTP protocol.
dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='', $link=null, $trackid='', $generatethumbs=1)
Get and save an upload file (for example after submitting a new file a mail form).
Definition: files.lib.php:1519
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to,$css,$trackid,$moreinheader,$sendcontext); $mailfile->sendfile();.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1)
Remove a file or several files with a mask.
Definition: files.lib.php:1139
make_substitutions($text, $substitutionarray, $outputlangs=null)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
dol_string_nospecial($str, $newstr='_', $badcharstoreplace='')
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.
Class to manage triggers.
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...