dolibarr  17.0.4
mails_emailing.php
1 <?php
2 /* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
4  * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
5  * Copyright (C) 2016 Jonathan TISSEAU <jonathan.tisseau@86dev.fr>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 
26 // Load Dolibarr environment
27 require '../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
29 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
30 
31 // Load translation files required by the page
32 $langs->loadLangs(array('companies', 'products', 'admin', 'mails', 'other', 'errors'));
33 
34 $action = GETPOST('action', 'aZ09');
35 $cancel = GETPOST('cancel', 'aZ09');
36 
37 $usersignature = $user->signature;
38 // For action = test or send, we ensure that content is not html, even for signature, because this we want a test with NO html.
39 if ($action == 'test' || $action == 'send') {
40  $usersignature = dol_string_nohtmltag($usersignature, 2);
41 }
42 
43 $substitutionarrayfortest = array(
44  '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
45  '__ID__' => 'RecipientIdRecord',
46  //'__EMAIL__' => 'RecipientEMail', // Done into actions_sendmails
47  '__CHECK_READ__' => (!empty($object) && 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"/>' : '',
48  '__USER_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
49  '__SENDEREMAIL_SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN)) ? $usersignature : ''), // Done into actions_sendmails
50  '__LOGIN__' => $user->login,
51  '__LASTNAME__' => 'RecipientLastname',
52  '__FIRSTNAME__' => 'RecipientFirstname',
53  '__ADDRESS__'=> 'RecipientAddress',
54  '__ZIP__'=> 'RecipientZip',
55  '__TOWN_'=> 'RecipientTown',
56  '__COUNTRY__'=> 'RecipientCountry'
57 );
58 complete_substitutions_array($substitutionarrayfortest, $langs);
59 
60 // Security check
61 if (!$user->admin) {
63 }
64 
65 
66 /*
67  * Actions
68  */
69 
70 if ($action == 'update' && !$cancel) {
71  // Send mode parameters
72  dolibarr_set_const($db, "MAIN_MAIL_SENDMODE_EMAILING", GETPOST("MAIN_MAIL_SENDMODE_EMAILING"), 'chaine', 0, '', $conf->entity);
73  dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT_EMAILING", GETPOST("MAIN_MAIL_SMTP_PORT_EMAILING"), 'chaine', 0, '', $conf->entity);
74  dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_EMAILING", GETPOST("MAIN_MAIL_SMTP_SERVER_EMAILING"), 'chaine', 0, '', $conf->entity);
75  dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID_EMAILING", GETPOST("MAIN_MAIL_SMTPS_ID_EMAILING"), 'chaine', 0, '', $conf->entity);
76  if (GETPOSTISSET("MAIN_MAIL_SMTPS_PW_EMAILING")) {
77  dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_EMAILING", GETPOST("MAIN_MAIL_SMTPS_PW_EMAILING", 'none'), 'chaine', 0, '', $conf->entity);
78  }
79  if (GETPOSTISSET("MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING")) {
80  dolibarr_set_const($db, "MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING", GETPOST("MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING", 'chaine'), 'chaine', 0, '', $conf->entity);
81  }
82  if (GETPOSTISSET("MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING")) {
83  dolibarr_set_const($db, "MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING", GETPOST("MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING", 'chaine'), 'chaine', 0, '', $conf->entity);
84  }
85  dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS_EMAILING", GETPOST("MAIN_MAIL_EMAIL_TLS_EMAILING"), 'chaine', 0, '', $conf->entity);
86  dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_EMAILING", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_EMAILING"), 'chaine', 0, '', $conf->entity);
87  dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING"), 'chaine', 0, '', $conf->entity);
88 
89  header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
90  exit;
91 }
92 
93 
94 // Actions to send emails
95 $id = 0;
96 $actiontypecode = ''; // Not an event for agenda
97 $triggersendname = ''; // Disable triggers
98 $paramname = 'id';
99 $mode = 'emailfortest';
100 $trackid = (($action == 'testhtml') ? "testhtml" : "test");
101 $sendcontext = 'emailing'; // Force to use dedicated context of setup for emailing
102 include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
103 
104 if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') {
105  $action = 'test';
106 }
107 if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') {
108  $action = 'testhtml';
109 }
110 
111 
112 
113 
114 /*
115  * View
116  */
117 
118 $form = new Form($db);
119 
120 $linuxlike = 1;
121 if (preg_match('/^win/i', PHP_OS)) {
122  $linuxlike = 0;
123 }
124 if (preg_match('/^mac/i', PHP_OS)) {
125  $linuxlike = 0;
126 }
127 
128 if (empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING)) {
129  $conf->global->MAIN_MAIL_SENDMODE_EMAILING = 'default';
130 }
131 $port = !empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : ini_get('smtp_port');
132 if (!$port) {
133  $port = 25;
134 }
135 $server = !empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : ini_get('SMTP');
136 if (!$server) {
137  $server = '127.0.0.1';
138 }
139 
140 
141 $wikihelp = 'EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
142 llxHeader('', $langs->trans("Setup"), $wikihelp);
143 
144 print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup');
145 
146 $head = email_admin_prepare_head();
147 
148 // List of sending methods
149 $listofmethods = array();
150 $listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup');
151 $listofmethods['mail'] = 'PHP mail function';
152 //$listofmethods['simplemail']='Simplemail class';
153 $listofmethods['smtps'] = 'SMTP/SMTPS socket library';
154 if (version_compare(phpversion(), '7.0', '>=')) {
155  $listofmethods['swiftmailer'] = 'Swift Mailer socket library';
156 }
157 
158 // List of oauth services
159 $oauthservices = array();
160 
161 foreach ($conf->global as $key => $val) {
162  if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
163  $key = preg_replace('/^OAUTH_/', '', $key);
164  $key = preg_replace('/_ID$/', '', $key);
165  if (preg_match('/^.*-/', $key)) {
166  $name = preg_replace('/^.*-/', '', $key);
167  } else {
168  $name = $langs->trans("NoName");
169  }
170  $provider = preg_replace('/-.*$/', '', $key);
171  $provider = ucfirst(strtolower($provider));
172 
173  $oauthservices[$key] = $name." (".$provider.")";
174  }
175 }
176 
177 if ($action == 'edit') {
178  if ($conf->use_javascript_ajax) {
179  print "\n".'<script type="text/javascript">';
180  print 'jQuery(document).ready(function () {
181  function initfields()
182  {
183  if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'default\')
184  {
185  jQuery(".hideifdefault").hide();
186  }
187  else
188  {
189  jQuery(".hideifdefault").show();
190  }
191 
192  if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'mail\')
193  {
194  jQuery(".drag").hide();
195  jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val(0);
196  jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").prop("disabled", true);
197  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val(0);
198  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").prop("disabled", true);
199  jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(0);
200  jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").prop("disabled", true);
201  jQuery(".smtp_method").hide();
202  jQuery(".smtp_auth_method").hide();
203  ';
204  if ($linuxlike) {
205  print '
206  jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").hide();
207  jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").hide();
208  jQuery("#smtp_server_mess").show();
209  jQuery("#smtp_port_mess").show();
210  ';
211  } else {
212  print '
213  jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").prop("disabled", true);
214  jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").prop("disabled", true);
215  jQuery("#smtp_server_mess").hide();
216  jQuery("#smtp_port_mess").hide();
217  ';
218  }
219  print '
220  }
221  if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'smtps\')
222  {
223  jQuery(".drag").show();
224  jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING.');
225  jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").removeAttr("disabled");
226  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING.');
227  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").removeAttr("disabled");
228  jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING.');
229  jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").removeAttr("disabled");
230  jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").removeAttr("disabled");
231  jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
232  jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
233  jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").show();
234  jQuery("#smtp_port_mess").hide();
235  jQuery("#smtp_server_mess").hide();
236  jQuery(".smtp_method").show();
237  jQuery(".smtp_auth_method").show();
238  }
239  if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'swiftmailer\')
240  {
241  jQuery(".drag").show();
242  jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING.');
243  jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").removeAttr("disabled");
244  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING.');
245  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").removeAttr("disabled");
246  jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val('.$conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING.');
247  jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").removeAttr("disabled");
248  jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").removeAttr("disabled");
249  jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").removeAttr("disabled");
250  jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").show();
251  jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").show();
252  jQuery("#smtp_server_mess").hide();
253  jQuery("#smtp_port_mess").hide();
254  jQuery(".smtp_method").show();
255  jQuery(".smtp_auth_method").show();
256  }
257  }
258  function change_smtp_auth_method() {
259  console.log(jQuery("#radio_pw").prop("checked"));
260  if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
261  jQuery(".smtp_oauth_service").show();
262  jQuery(".smtp_pw").hide();
263  } else if (jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
264  jQuery(".smtp_oauth_service").show();
265  jQuery(".smtp_pw").hide();
266  } else if(jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'mail\' || jQuery("#MAIN_MAIL_SENDMODE_EMAILING").val()==\'default\'){
267  jQuery(".smtp_oauth_service").hide();
268  jQuery(".smtp_pw").hide();
269  } else {
270  jQuery(".smtp_oauth_service").hide();
271  jQuery(".smtp_pw").show();
272  }
273  }
274  initfields();
275  change_smtp_auth_method();
276  jQuery("#MAIN_MAIL_SENDMODE_EMAILING").change(function() {
277  initfields();
278  change_smtp_auth_method();
279  });
280  jQuery("#radio_pw, #radio_oauth").change(function() {
281  change_smtp_auth_method();
282  });
283  jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").change(function() {
284  if (jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val() == 1)
285  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val(0);
286  else
287  jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(0);
288  });
289  jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").change(function() {
290  if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS_EMAILING").val() == 1)
291  jQuery("#MAIN_MAIL_EMAIL_TLS_EMAILING").val(0);
292  else
293  jQuery("#MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING").val(0);
294  });
295  })';
296  print '</script>'."\n";
297  }
298 
299  print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
300  print '<input type="hidden" name="token" value="'.newToken().'">';
301  print '<input type="hidden" name="action" value="update">';
302 
303  print dol_get_fiche_head($head, 'common_emailing', '', -1);
304 
305  print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
306  print "<br><br>\n";
307 
308 
309  clearstatcache();
310 
311  print '<table class="noborder centpercent">';
312  print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
313 
314  // Method
315 
316  print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
317 
318  // SuperAdministrator access only
319  if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) {
320  print $form->selectarray('MAIN_MAIL_SENDMODE_EMAILING', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_EMAILING);
321  } else {
322  $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE_EMAILING];
323  if (empty($text)) {
324  $text = $langs->trans("Undefined");
325  }
326  $htmltext = $langs->trans("ContactSuperAdminForChange");
327  print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
328  print '<input type="hidden" name="MAIN_MAIL_SENDMODE_EMAILING" value="'.$conf->global->MAIN_MAIL_SENDMODE_EMAILING.'">';
329  }
330  print '</td></tr>';
331 
332  // Host server
333 
334  print '<tr class="oddeven hideifdefault">';
335  if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail') {
336  print '<td>';
337  print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
338  print '</td><td>';
339  print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
340  print '</td>';
341  } else {
342  print '<td>';
343  $mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '');
344  $smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined");
345  if ($linuxlike) {
346  print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
347  } else {
348  print $langs->trans("MAIN_MAIL_SMTP_SERVER", $smtpserver);
349  }
350  print '</td><td>';
351  // SuperAdministrator access only
352  if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
353  print '<input class="flat minwidth300" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" size="18" value="' . $mainserver . '">';
354  print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" name="MAIN_MAIL_SMTP_SERVER_EMAILING_sav" value="' . $mainserver . '">';
355  print '<span id="smtp_server_mess" class="opacitymedium">' . $langs->trans("SeeLocalSendMailSetup") . '</span>';
356  print ' <span class="opacitymedium smtp_method">' . $langs->trans("SeeLinkToOnlineDocumentation") . '</span>';
357  } else {
358  $text = !empty($mainserver) ? $mainserver : $smtpserver;
359  $htmltext = $langs->trans("ContactSuperAdminForChange");
360  print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
361  print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_EMAILING" name="MAIN_MAIL_SMTP_SERVER_EMAILING" value="' . $mainserver . '">';
362  }
363  print '</td>';
364  }
365  print '</tr>';
366 
367  // Port
368 
369  print '<tr class="oddeven hideifdefault"><td>';
370  if (!$conf->use_javascript_ajax && $linuxlike && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail') {
371  print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
372  print '</td><td>';
373  print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
374  } else {
375  $mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '');
376  $smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined");
377  if ($linuxlike) {
378  print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
379  } else {
380  print $langs->trans("MAIN_MAIL_SMTP_PORT", $smtpport);
381  }
382  print '</td><td>';
383  // SuperAdministrator access only
384  if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
385  print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" size="3" value="' . $mainport . '">';
386  print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING_sav" name="MAIN_MAIL_SMTP_PORT_EMAILING_sav" value="' . $mainport . '">';
387  print '<span id="smtp_port_mess" class="opacitymedium">' . $langs->trans("SeeLocalSendMailSetup") . '</span>';
388  } else {
389  $text = (!empty($mainport) ? $mainport : $smtpport);
390  $htmltext = $langs->trans("ContactSuperAdminForChange");
391  print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
392  print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_EMAILING" name="MAIN_MAIL_SMTP_PORT_EMAILING" value="' . $mainport . '">';
393  }
394  }
395  print '</td></tr>';
396 
397  // AUTH method
398  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
399  print '<tr class="oddeven smtp_auth_method hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
400  if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
401  // Note: Default value for MAIN_MAIL_SMTPS_AUTH_TYPE if not defined is 'LOGIN' (but login/pass may be empty and they won't be provided in such a case)
402  print '<input type="radio" id="radio_pw" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="LOGIN"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN') == 'LOGIN' ? ' checked' : '').'> ';
403  print '<label for="radio_pw" >'.$langs->trans("UsePassword").'</label>';
404  print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
405  print '<input type="radio" id="radio_oauth" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="XOAUTH2"'.(getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') == 'XOAUTH2' ? ' checked' : '').'> ';
406  print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
407  } else {
408  $value = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN');
409  $htmltext = $langs->trans("ContactSuperAdminForChange");
410  print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
411  print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING" value="'.$value.'">';
412  }
413  print '</td></tr>';
414  }
415 
416  // ID
417  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
418  $mainstmpid = (!empty($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING) ? $conf->global->MAIN_MAIL_SMTPS_ID_EMAILING : '');
419  print '<tr class="drag drop oddeven hideifdefault"><td>' . $langs->trans("MAIN_MAIL_SMTPS_ID") . '</td><td>';
420  // SuperAdministrator access only
421  if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
422  print '<input class="flat" name="MAIN_MAIL_SMTPS_ID_EMAILING" size="32" value="' . $mainstmpid . '">';
423  } else {
424  $htmltext = $langs->trans("ContactSuperAdminForChange");
425  print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING, $htmltext, 1, 'superadmin');
426  print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID_EMAILING" value="' . $mainstmpid . '">';
427  }
428  print '</td></tr>';
429  }
430 
431  // PW
432  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
433  $mainsmtppw = (!empty($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING) ? $conf->global->MAIN_MAIL_SMTPS_PW_EMAILING : '');
434  print '<tr class="drag drop oddeven smtp_pw hideifdefault"><td>' . $langs->trans("MAIN_MAIL_SMTPS_PW") . '</td><td>';
435  // SuperAdministrator access only
436  if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
437  print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW_EMAILING" size="32" value="' . $mainsmtppw . '">';
438  } else {
439  $htmltext = $langs->trans("ContactSuperAdminForChange");
440  print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING, $htmltext, 1, 'superadmin');
441  print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW_EMAILING" value="' . $mainsmtppw . '">';
442  }
443  print '</td></tr>';
444  }
445 
446  // OAUTH service provider
447  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
448  print '<tr class="oddeven smtp_oauth_service hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
449 
450  // SuperAdministrator access only
451  if ((empty($conf->global->MAIN_MODULE_MULTICOMPANY)) || ($user->admin && !$user->entity)) {
452  print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING);
453  } else {
454  $text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING];
455  if (empty($text)) {
456  $text = $langs->trans("Undefined");
457  }
458  $htmltext = $langs->trans("ContactSuperAdminForChange");
459  print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
460  print '<input type="hidden" name="MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING" value="'.$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING.'">';
461  }
462  print '</td></tr>';
463  }
464 
465 
466  // TLS
467  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
468  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
469  if (function_exists('openssl_open')) {
470  print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_EMAILING', (!empty($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING) ? $conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING : 0), 1);
471  } else {
472  print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
473  }
474  } else {
475  print yn(0).' ('.$langs->trans("NotSupported").')';
476  }
477  print '</td></tr>';
478 
479  // STARTTLS
480  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
481  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
482  if (function_exists('openssl_open')) {
483  print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_EMAILING', (!empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING) ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING : 0), 1);
484  } else {
485  print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
486  }
487  } else {
488  print yn(0).' ('.$langs->trans("NotSupported").')';
489  }
490  print '</td></tr>';
491 
492  // SMTP_ALLOW_SELF_SIGNED_EMAILING
493  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
494  if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')))) {
495  if (function_exists('openssl_open')) {
496  print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING', (!empty($conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING) ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING : 0), 1);
497  } else {
498  print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
499  }
500  } else {
501  print yn(0).' ('.$langs->trans("NotSupported").')';
502  }
503  print '</td></tr>';
504 
505  print '</table>';
506 
507  print dol_get_fiche_end();
508 
509  print $form->buttonsSaveCancel();
510 
511  print '</form>';
512 } else {
513  print dol_get_fiche_head($head, 'common_emailing', '', -1);
514 
515  print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
516  print "<br><br>\n";
517 
518  print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
519  print '<table class="noborder centpercent">';
520  print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameter").'</td><td>'.$langs->trans("Value").'</td></tr>';
521 
522  // Method
523  print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
524  $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING')];
525  if (empty($text)) {
526  $text = $langs->trans("Undefined").img_warning();
527  }
528  if (getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING') == 'default') {
529  print '<span class="opacitymedium">'.$text.'</span>';
530  } else {
531  print $text;
532  }
533  print '</td></tr>';
534 
535  if (!empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') {
536  // Host server
537  if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail')) {
538  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
539  } else {
540  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '').'</td></tr>';
541  }
542 
543  // Port
544  if ($linuxlike && (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail')) {
545  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
546  } else {
547  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).'</td><td>'.(!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '').'</td></tr>';
548  }
549 
550  // AUTH method
551  if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer'))) {
552  $authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING', 'LOGIN');
553  $text = ($authtype === "LOGIN") ? $langs->trans("UsePassword") : ($authtype === "XOAUTH2" ? $langs->trans("UseOauth") : '') ;
554  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
555  }
556 
557  // SMTPS ID
558  if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) {
559  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>'.getDolGlobalString('MAIN_MAIL_SMTPS_ID_EMAILING').'</td></tr>';
560  }
561 
562  // SMTPS PW
563  if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') != "XOAUTH2") {
564  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_EMAILING')).'</td></tr>';
565  }
566 
567  // SMTPS oauth service
568  if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_EMAILING'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_EMAILING') === "XOAUTH2") {
569  $text = $oauthservices[$conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING];
570  if (empty($text)) {
571  $text = $langs->trans("Undefined").img_warning();
572  }
573  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE_EMAILING").'</td><td>'.$text.'</td></tr>';
574  }
575 
576 
577  // TLS
578  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
579  if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) {
580  if (function_exists('openssl_open')) {
581  print yn($conf->global->MAIN_MAIL_EMAIL_TLS_EMAILING);
582  } else {
583  print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
584  }
585  } else {
586  print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
587  }
588  print '</td></tr>';
589 
590  // STARTTLS
591  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
592  if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) {
593  if (function_exists('openssl_open')) {
594  print yn($conf->global->MAIN_MAIL_EMAIL_STARTTLS_EMAILING);
595  } else {
596  print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
597  }
598  } else {
599  print yn(0).' ('.$langs->trans("NotSupported").')';
600  }
601  print '</td></tr>';
602 
603  // SMTP_ALLOW_SELF_SIGNED_EMAILING
604  print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
605  if (isset($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && in_array($conf->global->MAIN_MAIL_SENDMODE_EMAILING, array('smtps', 'swiftmailer'))) {
606  if (function_exists('openssl_open')) {
607  print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_EMAILING'));
608  } else {
609  print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
610  }
611  } else {
612  print yn(0).' ('.$langs->trans("NotSupported").')';
613  }
614  print '</td></tr>';
615  }
616 
617  print '</table>';
618  print '</div>';
619 
620  print dol_get_fiche_end();
621 
622 
623  if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) {
624  print '<br>';
625  /*
626  // Warning 1
627  if ($linuxlike) {
628  $sendmailoption=ini_get('mail.force_extra_parameters');
629  if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption)) {
630  print info_admin($langs->trans("SendmailOptionNotComplete"));
631  }
632  }*/
633  // Warning 2
634  print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
635  }
636 
637 
638  // Buttons for actions
639 
640  print '<div class="tabsAction">';
641 
642  print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
643 
644  if (!empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') {
645  if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'mail' || !$linuxlike) {
646  if (function_exists('fsockopen') && $port && $server) {
647  print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=testconnect">' . $langs->trans("DoTestServerAvailability") . '</a>';
648  }
649  } else {
650  print '<a class="butActionRefused classfortooltip" href="#" title="' . $langs->trans("FeatureNotAvailableOnLinux") . '">' . $langs->trans("DoTestServerAvailability") . '</a>';
651  }
652 
653  print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=test&amp;mode=init">' . $langs->trans("DoTestSend") . '</a>';
654 
655  if (isModEnabled('fckeditor')) {
656  print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=testhtml&amp;mode=init">' . $langs->trans("DoTestSendHTML") . '</a>';
657  }
658  }
659 
660  print '</div>';
661 
662 
663  if ($conf->global->MAIN_MAIL_SENDMODE_EMAILING == 'mail' && !in_array($action, array('testconnect', 'test', 'testhtml'))) {
664  $text = $langs->trans("WarningPHPMail");
665  print info_admin($text);
666  }
667 
668  // Run the test to connect
669  if ($action == 'testconnect') {
670  print '<div id="formmailaftertstconnect" name="formmailaftertstconnect"></div>';
671  print load_fiche_titre($langs->trans("DoTestServerAvailability"));
672 
673  include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
674  $mail = new CMailFile('', '', '', '', array(), array(), array(), '', '', 0, '', '', '', '', $trackid, $sendcontext);
675 
676  $result = $mail->check_server_port($server, $port);
677  if ($result) {
678  print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort", $server, $port).'</div>';
679  } else {
680  $errormsg = $langs->trans("ServerNotAvailableOnIPOrPort", $server, $port);
681 
682  if ($mail->error) {
683  $errormsg .= ' - '.$mail->error;
684  }
685 
686  setEventMessages($errormsg, null, 'errors');
687  }
688  print '<br>';
689  }
690 
691  // Show email send test form
692  if ($action == 'test' || $action == 'testhtml') {
693  print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
694  print load_fiche_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend"));
695 
696  print dol_get_fiche_head('');
697 
698  // Cree l'objet formulaire mail
699  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
700  $formmail = new FormMail($db);
701  $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
702  $formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM);
703  $formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : $conf->global->MAIN_MAIL_EMAIL_FROM);
704  $formmail->fromid = $user->id;
705  $formmail->fromalsorobot = 1;
706  $formmail->withfromreadonly = 0;
707  $formmail->withsubstit = 0;
708  $formmail->withfrom = 1;
709  $formmail->witherrorsto = 1;
710  $formmail->withto = (GETPOSTISSET('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1));
711  $formmail->withtocc = (GETPOSTISSET('sendtocc') ? GETPOST('sendtocc', 'restricthtml') : 1); // ! empty to keep field if empty
712  $formmail->withtoccc = (GETPOSTISSET('sendtoccc') ? GETPOST('sendtoccc', 'restricthtml') : 1); // ! empty to keep field if empty
713  $formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test"));
714  $formmail->withtopicreadonly = 0;
715  $formmail->withfile = 2;
716  $formmail->withbody = (GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest")));
717  $formmail->withbodyreadonly = 0;
718  $formmail->withcancel = 1;
719  $formmail->withdeliveryreceipt = 1;
720  $formmail->withfckeditor = ($action == 'testhtml' ? 1 : 0);
721  $formmail->ckeditortoolbar = 'dolibarr_mailings';
722  // Tableau des substitutions
723  $formmail->substit = $substitutionarrayfortest;
724  // Tableau des parametres complementaires du post
725  $formmail->param["action"] = "send";
726  $formmail->param["models"] = "body";
727  $formmail->param["mailid"] = 0;
728  $formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
729 
730  // Init list of files
731  if (GETPOST("mode", "aZ09") == 'init') {
732  $formmail->clear_attached_files();
733  }
734 
735  print $formmail->get_form('addfile', 'removefile');
736 
737  print dol_get_fiche_end();
738  }
739 }
740 
741 // End of page
742 llxFooter();
743 $db->close();
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:632
email_admin_prepare_head()
Return array head with list of tabs to view object informations.
Definition: admin.lib.php:2016
if(GETPOSTISSET('MAIN_AGENDA_XCAL_EXPORTKEY')) if(GETPOSTISSET('MAIN_AGENDA_EXPORT_PAST_DELAY')) if(GETPOSTISSET('MAIN_AGENDA_EXPORT_CACHE')) if(GETPOSTISSET('AGENDA_EXPORT_FIX_TZ')) if($actionsave) if(!isset($conf->global->MAIN_AGENDA_EXPORT_PAST_DELAY)) $wikihelp
View.
Definition: agenda_xcal.php:90
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
Definition: wrapper.php:56
llxFooter()
Empty footer.
Definition: wrapper.php:70
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to manage generation of HTML components Only common components must be here.
Classe permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new For...
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
Definition: card.php:143
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='')
Show tabs of a record.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='')
Show information for admin users or standard users.
if(!function_exists('utf8_encode')) if(!function_exists('utf8_decode')) getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.