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