dolibarr 20.0.0
mails_ticket.php
Go to the documentation of this file.
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
27require '../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
29require_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.
39if ($action == 'test' || $action == 'send') {
40 $usersignature = dol_string_nohtmltag($usersignature, 2);
41}
42
43$substitutionarrayfortest = array(
44 '__ID__' => 'TESTIdRecord',
45 '__USER_LOGIN__' => $user->login,
46 '__USER_EMAIL__' => $user->email,
47 '__USER_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails
48 '__SENDEREMAIL_SIGNATURE__' => (($user->signature && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $usersignature : ''), // Done into actions_sendmails
49 '__LASTNAME__' => 'RecipientLastname',
50 '__FIRSTNAME__' => 'RecipientFirstname',
51 '__ADDRESS__'=> 'RecipientAddress',
52 '__ZIP__'=> 'RecipientZip',
53 '__TOWN_'=> 'RecipientTown',
54 '__COUNTRY__'=> 'RecipientCountry',
55 '__DOL_MAIN_URL_ROOT__'=>DOL_MAIN_URL_ROOT,
56);
57complete_substitutions_array($substitutionarrayfortest, $langs);
58
59// List of sending methods
60$listofmethods = array();
61$listofmethods['default'] = $langs->trans('DefaultOutgoingEmailSetup');
62$listofmethods['mail'] = 'PHP mail function';
63//$listofmethods['simplemail']='Simplemail class';
64$listofmethods['smtps'] = 'SMTP/SMTPS socket library';
65if (version_compare(phpversion(), '7.0', '>=')) {
66 $listofmethods['swiftmailer'] = 'Swift Mailer socket library';
67}
68
69// Security check
70if (!$user->admin) {
72}
73
74
75/*
76 * Actions
77 */
78
79if ($action == 'update' && !$cancel) {
80 // Send mode parameters
81 dolibarr_set_const($db, "MAIN_MAIL_SENDMODE_TICKET", GETPOST("MAIN_MAIL_SENDMODE_TICKET"), 'chaine', 0, '', $conf->entity);
82 dolibarr_set_const($db, "MAIN_MAIL_SMTP_PORT_TICKET", GETPOST("MAIN_MAIL_SMTP_PORT_TICKET"), 'chaine', 0, '', $conf->entity);
83 dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_TICKET", GETPOST("MAIN_MAIL_SMTP_SERVER_TICKET"), 'chaine', 0, '', $conf->entity);
84 dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID_TICKET", GETPOST("MAIN_MAIL_SMTPS_ID_TICKET"), 'chaine', 0, '', $conf->entity);
85 if (GETPOSTISSET("MAIN_MAIL_SMTPS_PW_TICKET")) {
86 dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_TICKET", GETPOST("MAIN_MAIL_SMTPS_PW_TICKET", 'none'), 'chaine', 0, '', $conf->entity);
87 }
88 if (GETPOSTISSET("MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET")) {
89 dolibarr_set_const($db, "MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET", GETPOST("MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
90 }
91 if (GETPOSTISSET("MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET")) {
92 dolibarr_set_const($db, "MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET", GETPOST("MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET", 'alphanohtml'), 'chaine', 0, '', $conf->entity);
93 }
94 dolibarr_set_const($db, "MAIN_MAIL_EMAIL_TLS_TICKET", GETPOST("MAIN_MAIL_EMAIL_TLS_TICKET"), 'chaine', 0, '', $conf->entity);
95 dolibarr_set_const($db, "MAIN_MAIL_EMAIL_STARTTLS_TICKET", GETPOST("MAIN_MAIL_EMAIL_STARTTLS_TICKET"), 'chaine', 0, '', $conf->entity);
96 dolibarr_set_const($db, "MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET", GETPOST("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET"), 'chaine', 0, '', $conf->entity);
97
98 header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup");
99 exit;
100}
101
102
103// Actions to send emails
104$id = 0;
105$actiontypecode = ''; // Not an event for agenda
106$triggersendname = ''; // Disable triggers
107$paramname = 'id';
108$mode = 'emailfortest';
109$trackid = (($action == 'testhtml') ? "testhtml" : "test");
110$sendcontext = 'ticket'; // Force to use dedicated context of setup for ticket
111include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
112
113if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'test') {
114 $action = 'test';
115}
116if ($action == 'presend' && GETPOST('trackid', 'alphanohtml') == 'testhtml') {
117 $action = 'testhtml';
118}
119
120
121
122
123/*
124 * View
125 */
126
127$form = new Form($db);
128
129$linuxlike = 1;
130if (preg_match('/^win/i', PHP_OS)) {
131 $linuxlike = 0;
132}
133if (preg_match('/^mac/i', PHP_OS)) {
134 $linuxlike = 0;
135}
136
137if (!getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')) {
138 $conf->global->MAIN_MAIL_SENDMODE_TICKET = 'default';
139}
140$port = getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET') ? $conf->global->MAIN_MAIL_SMTP_PORT_TICKET : ini_get('smtp_port');
141if (!$port) {
142 $port = 25;
143}
144$server = getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_TICKET : ini_get('SMTP');
145if (!$server) {
146 $server = '127.0.0.1';
147}
148
149
150$wikihelp = 'EN:Setup_EMails|FR:Paramétrage_EMails|ES:Configuración_EMails';
151llxHeader('', $langs->trans("Setup"), $wikihelp, '', 0, 0, '', '', '', 'mod-admin page-mails_ticket');
152
153print load_fiche_titre($langs->trans("EMailsSetup"), '', 'title_setup');
154
156
157// List of oauth services
158$oauthservices = array();
159
160foreach ($conf->global as $key => $val) {
161 if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
162 $key = preg_replace('/^OAUTH_/', '', $key);
163 $key = preg_replace('/_ID$/', '', $key);
164 if (preg_match('/^.*-/', $key)) {
165 $name = preg_replace('/^.*-/', '', $key);
166 } else {
167 $name = $langs->trans("NoName");
168 }
169 $provider = preg_replace('/-.*$/', '', $key);
170 $provider = ucfirst(strtolower($provider));
171
172 $oauthservices[$key] = $name." (".$provider.")";
173 }
174}
175
176
177if ($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_TICKET").val()==\'default\')
184 {
185 jQuery(".hideifdefault").hide();
186 }
187 else
188 {
189 jQuery(".hideifdefault").show();
190 }
191
192 if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'mail\')
193 {
194 console.log("I choose php mail mode");
195 jQuery(".drag").hide();
196 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(0);
197 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").prop("disabled", true);
198 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(0);
199 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").prop("disabled", true);
200 jQuery(".smtp_method").hide();
201 jQuery(".smtp_auth_method").hide();
202 ';
203 if ($linuxlike) {
204 print '
205 jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").hide();
206 jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").hide();
207 jQuery("#smtp_server_mess").show();
208 jQuery("#smtp_port_mess").show();
209 ';
210 } else {
211 print '
212 jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").prop("disabled", true);
213 jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").prop("disabled", true);
214 jQuery("#smtp_server_mess").hide();
215 jQuery("#smtp_port_mess").hide();
216 ';
217 }
218 print '
219 }
220 if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'smtps\')
221 {
222 console.log("I choose smtps mail mode");
223 jQuery(".drag").show();
224 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET').');
225 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").removeAttr("disabled");
226 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET').');
227 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").removeAttr("disabled");
228 jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").removeAttr("disabled");
229 jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").removeAttr("disabled");
230 jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").show();
231 jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").show();
232 jQuery("#smtp_server_mess").hide();
233 jQuery("#smtp_port_mess").hide();
234 jQuery(".smtp_method").show();
235 jQuery(".smtp_auth_method").show();
236 }
237 if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'swiftmailer\')
238 {
239 console.log("I choose swiftmailer mail mode");
240 jQuery(".drag").show();
241 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET').');
242 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").removeAttr("disabled");
243 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(' . getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET').');
244 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").removeAttr("disabled");
245 jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").removeAttr("disabled");
246 jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").removeAttr("disabled");
247 jQuery("#MAIN_MAIL_SMTP_SERVER_TICKET").show();
248 jQuery("#MAIN_MAIL_SMTP_PORT_TICKET").show();
249 jQuery("#smtp_server_mess").hide();
250 jQuery("#smtp_port_mess").hide();
251 jQuery(".smtp_method").show();
252 jQuery(".smtp_auth_method").show();
253 }
254 }
255 function change_smtp_auth_method() {
256 console.log("Call smtp auth method");
257 if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'smtps\' && jQuery("#radio_oauth").prop("checked")) {
258 jQuery(".smtp_pw").hide();
259 jQuery(".smtp_oauth_service").show();
260 } else if (jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'swiftmailer\' && jQuery("#radio_oauth").prop("checked")) {
261 jQuery(".smtp_pw").hide();
262 jQuery(".smtp_oauth_service").show();
263 } else if(jQuery("#MAIN_MAIL_SENDMODE_TICKET").val()==\'mail\'){
264 jQuery(".smtp_pw").hide();
265 jQuery(".smtp_oauth_service").hide();
266 } else {
267 jQuery(".smtp_pw").show();
268 jQuery(".smtp_oauth_service").hide();
269 }
270 }
271
272 initfields();
273 change_smtp_auth_method();
274
275 jQuery("#MAIN_MAIL_SENDMODE_TICKET").change(function() {
276 initfields();
277 change_smtp_auth_method();
278 });
279 jQuery("#radio_pw, #radio_plain, #radio_oauth").change(function() {
280 change_smtp_auth_method();
281 });
282 jQuery("#MAIN_MAIL_EMAIL_TLS").change(function() {
283 if (jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val() == 1)
284 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").val(0);
285 });
286 jQuery("#MAIN_MAIL_EMAIL_STARTTLS_TICKET").change(function() {
287 if (jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val() == 1)
288 jQuery("#MAIN_MAIL_EMAIL_TLS_TICKET").val(0);
289 });
290 })';
291 print '</script>'."\n";
292 }
293
294 print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
295 print '<input type="hidden" name="token" value="'.newToken().'">';
296 print '<input type="hidden" name="action" value="update">';
297
298 print dol_get_fiche_head($head, 'common_ticket', '', -1);
299
300 print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
301 print "<br><br>\n";
302
303
304 clearstatcache();
305
306 print '<table class="noborder centpercent">';
307 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td></td></tr>';
308
309 // Method
310
311 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
312
313 // SuperAdministrator access only
314 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
315 print $form->selectarray('MAIN_MAIL_SENDMODE_TICKET', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_TICKET);
316 } else {
317 $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')];
318 if (empty($text)) {
319 $text = $langs->trans("Undefined");
320 }
321 $htmltext = $langs->trans("ContactSuperAdminForChange");
322 print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
323 print '<input type="hidden" name="MAIN_MAIL_SENDMODE_TICKET" value="' . getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET').'">';
324 }
325 print '</td></tr>';
326
327 // Host server
328
329 print '<tr class="oddeven hideifdefault">';
330 if (!$conf->use_javascript_ajax && $linuxlike && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail') {
331 print '<td>';
332 print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
333 print '</td><td>';
334 print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
335 print '</td>';
336 } else {
337 print '<td>';
338 $mainserver = (getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_TICKET : '');
339 $smtpserver = ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined");
340 if ($linuxlike) {
341 print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike");
342 } else {
343 print $langs->trans("MAIN_MAIL_SMTP_SERVER", $smtpserver);
344 }
345 print '</td><td>';
346 // SuperAdministrator access only
347 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
348 print '<input class="flat minwidth300" id="MAIN_MAIL_SMTP_SERVER_TICKET" name="MAIN_MAIL_SMTP_SERVER_TICKET" size="18" value="'.$mainserver.'">';
349 print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_TICKET_sav" name="MAIN_MAIL_SMTP_SERVER_TICKET_sav" value="'.$mainserver.'">';
350 print '<span id="smtp_server_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
351 print ' <span class="opacitymedium smtp_method">' . $langs->trans("SeeLinkToOnlineDocumentation") . '</span>';
352 } else {
353 $text = !empty($mainserver) ? $mainserver : $smtpserver;
354 $htmltext = $langs->trans("ContactSuperAdminForChange");
355 print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
356 print '<input type="hidden" id="MAIN_MAIL_SMTP_SERVER_TICKET" name="MAIN_MAIL_SMTP_SERVER_TICKET" value="'.$mainserver.'">';
357 }
358 print '</td>';
359 }
360 print '</tr>';
361
362 // Port
363
364 print '<tr class="oddeven hideifdefault hideonmodemail"><td>';
365 if (!$conf->use_javascript_ajax && $linuxlike && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail') {
366 print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
367 print '</td><td>';
368 print '<span class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
369 } else {
370 $mainport = (getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET') ? $conf->global->MAIN_MAIL_SMTP_PORT_TICKET : '');
371 $smtpport = ini_get('smtp_port') ? ini_get('smtp_port') : $langs->transnoentities("Undefined");
372 if ($linuxlike) {
373 print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike");
374 } else {
375 print $langs->trans("MAIN_MAIL_SMTP_PORT", $smtpport);
376 }
377 print '</td><td>';
378 // SuperAdministrator access only
379 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
380 print '<input class="flat" id="MAIN_MAIL_SMTP_PORT_TICKET" name="MAIN_MAIL_SMTP_PORT_TICKET" size="3" value="'.$mainport.'">';
381 print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_TICKET_sav" name="MAIN_MAIL_SMTP_PORT_TICKET_sav" value="'.$mainport.'">';
382 print '<span id="smtp_port_mess" class="opacitymedium">'.$langs->trans("SeeLocalSendMailSetup").'</span>';
383 } else {
384 $text = (!empty($mainport) ? $mainport : $smtpport);
385 $htmltext = $langs->trans("ContactSuperAdminForChange");
386 print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
387 print '<input type="hidden" id="MAIN_MAIL_SMTP_PORT_TICKET" name="MAIN_MAIL_SMTP_PORT_TICKET" value="'.$mainport.'">';
388 }
389 }
390 print '</td></tr>';
391
392 // AUTH method
393 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
394 print '<tr class="oddeven smtp_auth_method hideifdefault hideonmodemail"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>';
395 $vartosmtpstype = 'MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET';
396 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
397 // 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)
398 print '<input type="radio" id="radio_pw" name="'.$vartosmtpstype.'" value="LOGIN"'.(getDolGlobalString($vartosmtpstype, 'LOGIN') == 'LOGIN' ? ' checked' : '').'> ';
399 print '<label for="radio_pw" >'.$langs->trans("UseAUTHLOGIN").'</label>';
400 print '<br>';
401 print '<input type="radio" id="radio_plain" name="'.$vartosmtpstype.'" value="PLAIN"'.(getDolGlobalString($vartosmtpstype, 'PLAIN') == 'PLAIN' ? ' checked' : '').'> ';
402 print '<label for="radio_plain" >'.$langs->trans("UseAUTHPLAIN").'</label>';
403 print '<br>';
404 print '<input type="radio" id="radio_oauth" name="'.$vartosmtpstype.'" value="XOAUTH2"'.(getDolGlobalString($vartosmtpstype) == 'XOAUTH2' ? ' checked' : '').(isModEnabled('oauth') ? '' : ' disabled').'> ';
405 print '<label for="radio_oauth" >'.$form->textwithpicto($langs->trans("UseOauth"), $langs->trans("OauthNotAvailableForAllAndHadToBeCreatedBefore")).'</label>';
406 if (!isModEnabled('oauth')) {
407 print ' &nbsp; <a href="'.DOL_URL_ROOT.'/admin/modules.php?search_keyword=oauth">'.$langs->trans("EnableModuleX", "OAuth").'</a>';
408 } else {
409 print ' &nbsp; <a href="'.DOL_URL_ROOT.'/admin/oauth.php">'.$langs->trans("SetupModuleX", " OAuth").'</a>';
410 }
411 } else {
412 $value = getDolGlobalString($vartosmtpstype, 'LOGIN');
413 $htmltext = $langs->trans("ContactSuperAdminForChange");
414 print $form->textwithpicto($langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE"), $htmltext, 1, 'superadmin');
415 print '<input type="hidden" id="MAIN_MAIL_SMTPS_AUTH_TYPE" name="MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET" value="'.$value.'">';
416 }
417 print '</td></tr>';
418 }
419
420 // ID
421 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
422 $mainstmpid = (getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET') ? $conf->global->MAIN_MAIL_SMTPS_ID_TICKET : '');
423 print '<tr class="drag drop oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>';
424 // SuperAdministrator access only
425 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
426 print '<input class="flat" name="MAIN_MAIL_SMTPS_ID_TICKET" size="32" value="'.$mainstmpid.'">';
427 } else {
428 $htmltext = $langs->trans("ContactSuperAdminForChange");
429 print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_TICKET, $htmltext, 1, 'superadmin');
430 print '<input type="hidden" name="MAIN_MAIL_SMTPS_ID_TICKET" value="'.$mainstmpid.'">';
431 }
432 print '</td></tr>';
433 }
434
435 // PW
436 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
437 $mainsmtppw = (getDolGlobalString('MAIN_MAIL_SMTPS_PW_TICKET') ? $conf->global->MAIN_MAIL_SMTPS_PW_TICKET : '');
438 print '<tr class="drag drop oddeven smtp_pw hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>';
439 // SuperAdministrator access only
440 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
441 print '<input class="flat" type="password" name="MAIN_MAIL_SMTPS_PW_TICKET" size="32" value="'.$mainsmtppw.'">';
442 } else {
443 $htmltext = $langs->trans("ContactSuperAdminForChange");
444 print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW_TICKET, $htmltext, 1, 'superadmin');
445 print '<input type="hidden" name="MAIN_MAIL_SMTPS_PW_TICKET" value="'.$mainsmtppw.'">';
446 }
447 print '</td></tr>';
448 }
449
450 // OAUTH service provider
451 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
452 print '<tr class="oddeven smtp_oauth_service hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE").'</td><td>';
453 // SuperAdministrator access only
454 if (!isModEnabled('multicompany') || ($user->admin && !$user->entity)) {
455 print $form->selectarray('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET', $oauthservices, $conf->global->MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET);
456 } else {
457 $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET')];
458 if (empty($text)) {
459 $text = $langs->trans("Undefined");
460 }
461 $htmltext = $langs->trans("ContactSuperAdminForChange");
462 print $form->textwithpicto($text, $htmltext, 1, 'superadmin');
463 print '<input type="hidden" name="MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET" value="' . getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET').'">';
464 }
465 print '</td></tr>';
466 }
467
468 // TLS
469
470 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
471 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
472 if (function_exists('openssl_open')) {
473 print $form->selectyesno('MAIN_MAIL_EMAIL_TLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_TLS_TICKET : 0), 1);
474 } else {
475 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
476 }
477 } else {
478 print yn(0).' ('.$langs->trans("NotSupported").')';
479 }
480 print '</td></tr>';
481
482 // STARTTLS
483
484 print '<tr class="oddeven hideifdefault hideonmodemail"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
485 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
486 if (function_exists('openssl_open')) {
487 print $form->selectyesno('MAIN_MAIL_EMAIL_STARTTLS_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_STARTTLS_TICKET : 0), 1);
488 } else {
489 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
490 }
491 } else {
492 print yn(0).' ('.$langs->trans("NotSupported").')';
493 }
494 print '</td></tr>';
495
496 // SMTP_ALLOW_SELF_SIGNED_TICKET
497 print '<tr class="oddeven hideifdefault hideonmodemail"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
498 if (!empty($conf->use_javascript_ajax) || (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')))) {
499 if (function_exists('openssl_open')) {
500 print $form->selectyesno('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET', (getDolGlobalString('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET') ? $conf->global->MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET : 0), 1);
501 } else {
502 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
503 }
504 } else {
505 print yn(0).' ('.$langs->trans("NotSupported").')';
506 }
507 print '</td></tr>';
508
509 print '</table>';
510
511 print dol_get_fiche_end();
512
513 print $form->buttonsSaveCancel();
514
515 print '</form>';
516} else {
517 print dol_get_fiche_head($head, 'common_ticket', '', -1);
518
519 print '<span class="opacitymedium">'.$langs->trans("EMailsDesc")."</span><br>\n";
520 print "<br><br>\n";
521
522 print '<div class="div-table-responsive-no-min">'; // You can use div-table-responsive-no-min if you don't need reserved height for your table
523 print '<table class="noborder centpercent">';
524 print '<tr class="liste_titre"><td class="titlefieldmiddle">'.$langs->trans("Parameters").'</td><td></td></tr>';
525
526 // Method
527 print '<tr class="oddeven"><td>'.$langs->trans("MAIN_MAIL_SENDMODE").'</td><td>';
528 $text = $listofmethods[getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET')];
529 if (empty($text)) {
530 $text = $langs->trans("Undefined").img_warning();
531 }
532 if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'default') {
533 print '<span class="opacitymedium">'.$text.'</span>';
534 } else {
535 print $text;
536 }
537 print '</td></tr>';
538
539 if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'default') {
540 // Host server
541 if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) {
542 //print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
543 } else {
544 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ? ini_get('SMTP') : $langs->transnoentities("Undefined")).'</td><td>'.(getDolGlobalString('MAIN_MAIL_SMTP_SERVER_TICKET') ? $conf->global->MAIN_MAIL_SMTP_SERVER_TICKET : '').'</td></tr>';
545 }
546
547 // Port
548 if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail')) {
549 //print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").'</td><td>'.$langs->trans("SeeLocalSendMailSetup").'</td></tr>';
550 } else {
551 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>'.(getDolGlobalString('MAIN_MAIL_SMTP_PORT_TICKET') ? $conf->global->MAIN_MAIL_SMTP_PORT_TICKET : '').'</td></tr>';
552 }
553
554 // AUTH method
555 if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer'))) {
556 $authtype = getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET', 'LOGIN');
557 $text = '';
558 if ($authtype === "LOGIN") {
559 $text = $langs->trans("UseAUTHLOGIN");
560 } elseif ($authtype === "PLAIN") {
561 $text = $langs->trans("UseAUTHPLAIN");
562 } elseif ($authtype === "XOAUTH2") {
563 $text = $langs->trans("UseOauth");
564 }
565 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_AUTH_TYPE").'</td><td>'.$text.'</td></tr>';
566 }
567
568 // SMTPS ID
569 if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
570 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_ID").'</td><td>' . getDolGlobalString('MAIN_MAIL_SMTPS_ID_TICKET').'</td></tr>';
571 }
572
573 // SMTPS PW
574 if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') != "XOAUTH2") {
575 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_PW").'</td><td>'.preg_replace('/./', '*', getDolGlobalString('MAIN_MAIL_SMTPS_PW_TICKET')).'</td></tr>';
576 }
577
578 // SMTPS oauth service
579 if (in_array(getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET'), array('smtps', 'swiftmailer')) && getDolGlobalString('MAIN_MAIL_SMTPS_AUTH_TYPE_TICKET') === "XOAUTH2") {
580 $text = $oauthservices[getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET')];
581 if (empty($text)) {
582 $text = $langs->trans("Undefined").img_warning();
583 }
584 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_SMTPS_OAUTH_SERVICE_TICKET").'</td><td>'.$text.'</td></tr>';
585 }
586
587 // TLS
588 if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
589 // Nothing
590 } else {
591 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_TLS").'</td><td>';
592 if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
593 if (function_exists('openssl_open')) {
594 print yn(getDolGlobalString('MAIN_MAIL_EMAIL_TLS_TICKET'));
595 } else {
596 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
597 }
598 } else {
599 print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
600 }
601 print '</td></tr>';
602 }
603
604 // STARTTLS
605 if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
606 // Nothing
607 } else {
608 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_STARTTLS").'</td><td>';
609 if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
610 if (function_exists('openssl_open')) {
611 print yn(getDolGlobalString('MAIN_MAIL_EMAIL_STARTTLS_TICKET'));
612 } else {
613 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
614 }
615 } else {
616 print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
617 }
618 print '</td></tr>';
619 }
620
621 // SMTP_ALLOW_SELF_SIGNED_EMAILING
622 if ($linuxlike && (getDolGlobalString('MAIN_MAIL_SENDMODE', 'mail') == 'mail')) {
623 // Nothing
624 } else {
625 print '<tr class="oddeven hideifdefault"><td>'.$langs->trans("MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED").'</td><td>';
626 if (isset($conf->global->MAIN_MAIL_SENDMODE_TICKET) && in_array($conf->global->MAIN_MAIL_SENDMODE_TICKET, array('smtps', 'swiftmailer'))) {
627 if (function_exists('openssl_open')) {
628 print yn(getDolGlobalInt('MAIN_MAIL_EMAIL_SMTP_ALLOW_SELF_SIGNED_TICKET'));
629 } else {
630 print yn(0).' ('.$langs->trans("YourPHPDoesNotHaveSSLSupport").')';
631 }
632 } else {
633 print '<span class="opacitymedium">'.yn(0).' ('.$langs->trans("NotSupported").')</span>';
634 }
635 print '</td></tr>';
636 }
637 }
638
639 print '</table>';
640 print '</div>';
641
642 print dol_get_fiche_end();
643
644
645 if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail' && !getDolGlobalString('MAIN_FIX_FOR_BUGGED_MTA')) {
646 print '<br>';
647 /*
648 // Warning 1
649 if ($linuxlike)
650 {
651 $sendmailoption=ini_get('mail.force_extra_parameters');
652 if (empty($sendmailoption) || ! preg_match('/ba/',$sendmailoption))
653 {
654 print info_admin($langs->trans("SendmailOptionNotComplete"));
655 }
656 }*/
657 // Warning 2
658 print info_admin($langs->trans("SendmailOptionMayHurtBuggedMTA"));
659 }
660
661
662 // Buttons for actions
663
664 print '<div class="tabsAction">';
665
666 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
667
668 if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') && getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'default') {
669 if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') != 'mail' || !$linuxlike) {
670 if (function_exists('fsockopen') && $port && $server) {
671 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testconnect">'.$langs->trans("DoTestServerAvailability").'</a>';
672 }
673 } else {
674 print '<a class="butActionRefused classfortooltip" href="#" title="'.$langs->trans("FeatureNotAvailableOnLinux").'">'.$langs->trans("DoTestServerAvailability").'</a>';
675 }
676
677 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=test&amp;mode=init">'.$langs->trans("DoTestSend").'</a>';
678
679 if (isModEnabled('fckeditor')) {
680 print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=testhtml&amp;mode=init">'.$langs->trans("DoTestSendHTML").'</a>';
681 }
682 }
683
684 print '</div>';
685
686
687 if (getDolGlobalString('MAIN_MAIL_SENDMODE_TICKET') == 'mail' && !in_array($action, array('testconnect', 'test', 'testhtml'))) {
688 $text = $langs->trans("WarningPHPMail");
689 print info_admin($text);
690 }
691
692 // Run the test to connect
693 if ($action == 'testconnect') {
694 print '<div id="formmailaftertstconnect" name="formmailaftertstconnect"></div>';
695 print load_fiche_titre($langs->trans("DoTestServerAvailability"));
696
697 include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
698 $mail = new CMailFile('', '', '', '', array(), array(), array(), '', '', 0, '', '', '', '', $trackid, $sendcontext);
699
700 $result = $mail->check_server_port($server, $port);
701 if ($result) {
702 print '<div class="ok">'.$langs->trans("ServerAvailableOnIPOrPort", $server, $port).'</div>';
703 } else {
704 $errormsg = $langs->trans("ServerNotAvailableOnIPOrPort", $server, $port);
705
706 if ($mail->error) {
707 $errormsg .= ' - '.$mail->error;
708 }
709
710 setEventMessages($errormsg, null, 'errors');
711 }
712 print '<br>';
713 }
714
715 // Show email send test form
716 if ($action == 'test' || $action == 'testhtml') {
717 print '<div id="formmailbeforetitle" name="formmailbeforetitle"></div>';
718 print load_fiche_titre($action == 'testhtml' ? $langs->trans("DoTestSendHTML") : $langs->trans("DoTestSend"));
719
720 print dol_get_fiche_head(array(), '', '', -1);
721
722 // Cree l'objet formulaire mail
723 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
724 $formmail = new FormMail($db);
725 $formmail->fromname = (GETPOSTISSET('fromname') ? GETPOST('fromname', 'restricthtml') : getDolGlobalString('MAIN_MAIL_EMAIL_FROM'));
726 $formmail->frommail = (GETPOSTISSET('frommail') ? GETPOST('frommail', 'restricthtml') : getDolGlobalString('MAIN_MAIL_EMAIL_FROM'));
727 $formmail->trackid = (($action == 'testhtml') ? "testhtml" : "test");
728 $formmail->fromid = $user->id;
729 $formmail->fromalsorobot = 1;
730 $formmail->withfromreadonly = 0;
731 $formmail->withsubstit = 0;
732 $formmail->withfrom = 1;
733 $formmail->witherrorsto = 1;
734 $formmail->withto = (GETPOSTISSET('sendto') ? GETPOST('sendto', 'restricthtml') : ($user->email ? $user->email : 1));
735 $formmail->withtocc = (GETPOSTISSET('sendtocc') ? GETPOST('sendtocc', 'restricthtml') : 1);
736 $formmail->withtoccc = (GETPOSTISSET('sendtoccc') ? GETPOST('sendtoccc', 'restricthtml') : 1);
737 $formmail->withtopic = (GETPOSTISSET('subject') ? GETPOST('subject') : $langs->trans("Test"));
738 $formmail->withtopicreadonly = 0;
739 $formmail->withfile = 2;
740 $formmail->withbody = (GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ($action == 'testhtml' ? $langs->transnoentities("PredefinedMailTestHtml") : $langs->transnoentities("PredefinedMailTest")));
741 $formmail->withbodyreadonly = 0;
742 $formmail->withcancel = 1;
743 $formmail->withdeliveryreceipt = 1;
744 $formmail->withfckeditor = ($action == 'testhtml' ? 1 : 0);
745 $formmail->ckeditortoolbar = 'dolibarr_mailings';
746 // Tableau des substitutions
747 $formmail->substit = $substitutionarrayfortest;
748 // Tableau des parameters complementaires du post
749 $formmail->param["action"] = "send";
750 $formmail->param["models"] = "body";
751 $formmail->param["mailid"] = 0;
752 $formmail->param["returnurl"] = $_SERVER["PHP_SELF"];
753
754 // Init list of files
755 if (GETPOST("mode", "aZ09") == 'init') {
756 $formmail->clear_attached_files();
757 }
758
759 print $formmail->get_form('addfile', 'removefile');
760
761 print dol_get_fiche_end();
762 }
763}
764
765// End of page
766llxFooter();
767$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).
email_admin_prepare_head()
Return array head with list of tabs to view object information.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Definition wrapper.php:55
llxFooter()
Empty footer.
Definition wrapper.php:69
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.
Class permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new Form...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
yn($yesno, $case=1, $color=0)
Return yes or no in current language.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
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.
getDolGlobalInt($key, $default=0)
Return a 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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='')
Show information in HTML for admin users or standard users.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.