dolibarr 19.0.3
setupmail.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
4 * Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
26// Load Dolibarr environment
27require '../../main.inc.php';
28require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
29require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
30require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
31require_once DOL_DOCUMENT_ROOT.'/datapolicy/lib/datapolicy.lib.php';
32
33// Translations
34$langs->loadLangs(array('admin', 'companies', 'members', 'datapolicy'));
35
36
37// Parameters
38$action = GETPOST('action', 'aZ09');
39$backtopage = GETPOST('backtopage', 'alpha');
40
41if (GETPOST('l')) {
42 $l = GETPOST('l');
43} else {
44 $l = $langs->defaultlang;
45}
46
47// Security
48if (!isModEnabled("datapolicy")) {
50}
51if (!$user->admin) {
53}
54
55
56/*
57 * Actions
58 */
59
60include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
61
62if ($action == 'setvalue' && $user->admin) {
63 $db->begin();
64 $sub = "DATAPOLICYSUBJECT_".$l;
65 $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
66 $cont = "DATAPOLICYCONTENT_".$l;
67 $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
68 $cont = "TXTLINKDATAPOLICYACCEPT_".$l;
69 $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
70 $cont = "TXTLINKDATAPOLICYREFUSE_".$l;
71 $result = dolibarr_set_const($db, $cont, GETPOST($cont), 'chaine', 0, '', $conf->entity);
72 $sub = "DATAPOLICYACCEPT_".$l;
73 $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
74 $sub = "DATAPOLICYREFUSE_".$l;
75 $result = dolibarr_set_const($db, $sub, GETPOST($sub), 'chaine', 0, '', $conf->entity);
76 if (!($result > 0)) {
77 $error++;
78 }
79 if (!$error) {
80 $db->commit();
81 setEventMessage($langs->trans("SetupSaved"));
82 } else {
83 $db->rollback();
84 dol_print_error($db);
85 }
86}
87
88
89/*
90 * View
91 */
92
93$formadmin = new FormAdmin($db);
94
95$page_name = "datapolicySetup";
96llxHeader('', $langs->trans($page_name));
97
98// Subheader
99$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
100
101print load_fiche_titre($langs->trans($page_name), $linkback, 'generic');
102
103// Configuration header
105print dol_get_fiche_head($head, 'emailing', '', -1, '');
106
107
108print "<script type='text/javascript'>
109 $(document).ready(function(){
110 $('#default_lang').change(function(){
111 lang=$('#default_lang').val();
112 window.location.replace('" . $_SERVER['PHP_SELF']."?l='+lang);
113 });
114 });
115</script>";
116
117print '<form method="post" action="'.$_SERVER["PHP_SELF"].'?l='.$l.'">';
118print '<input type="hidden" name="token" value="'.newToken().'">';
119print '<input type="hidden" name="action" value="setvalue">';
120print '<table>';
121if (getDolGlobalInt('MAIN_MULTILANGS')) {
122 print '<tr><td>'.$form->editfieldkey('DefaultLang', 'default_lang', '', null, 0).'</td><td colspan="3" class="maxwidthonsmartphone">'."\n";
123 print img_picto('', 'language', 'class="pictofixedwidth"');
124 print $formadmin->select_language((GETPOST('l') ? GETPOST('l') : $langs->defaultlang), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
125 print '</tr>';
126}
127$subject = 'DATAPOLICYSUBJECT_'.$l;
128$linka = 'TXTLINKDATAPOLICYACCEPT_'.$l;
129$linkr = 'TXTLINKDATAPOLICYREFUSE_'.$l;
130$content = 'DATAPOLICYCONTENT_'.$l;
131$acc = 'DATAPOLICYACCEPT_'.$l;
132$ref = 'DATAPOLICYREFUSE_'.$l;
133print '<tr class"oddeven"><td class="fieldrequired">';
134print $langs->trans('DATAPOLICYSUBJECTMAIL').'</td><td>';
135print '<input type="text" name="'.$subject.'" value="' . getDolGlobalString($subject).'" />';
136print '</td><tr>';
137print '<tr class"oddeven"><td class="fieldrequired">';
138print $langs->trans('DATAPOLICYCONTENTMAIL').'</td><td>';
139print '<span class="opacitymedium">';
140print $langs->trans('DATAPOLICYSUBSITUTION');
141print '__LINKACCEPT__,__LINKREFUSED__,__FIRSTNAME__,__NAME__,__CIVILITY__';
142print '</span>';
143$doleditor = new DolEditor($content, $conf->global->$content, '', 250, 'Full', '', false, true, 1, 200, 70);
144$doleditor->Create();
145print '</td><tr>';
146print '<tr class"oddeven"><td class="fieldrequired">';
147print $langs->trans('TXTLINKDATAPOLICYACCEPT').'</td><td>';
148print '<input type="text" name="'.$linka.'" value="' . getDolGlobalString($linka).'" />';
149print '</td><tr>';
150print '<tr class"oddeven"><td class="fieldrequired">';
151print $langs->trans('TXTLINKDATAPOLICYREFUSE').'</td><td>';
152print '<input type="text" name="'.$linkr.'" value="' . getDolGlobalString($linkr).'" />';
153print '</td><tr>';
154print '<tr class"oddeven"><td class="fieldrequired">';
155
156print $langs->trans('DATAPOLICYACCEPT').'</td><td>';
157
158$doleditor = new DolEditor($acc, getDolGlobalString($acc), '', 250, 'Full', '', false, true, 1, 200, 70);
159$doleditor->Create();
160print '</td><tr>';
161print '<tr class"oddeven"><td class="fieldrequired">';
162print $langs->trans('DATAPOLICYREFUSE').'</td><td>';
163
164print $langs->trans('');
165$doleditor = new DolEditor($ref, getDolGlobalString($ref), '', 250, 'Full', '', false, true, 1, 200, 70);
166$doleditor->Create();
167print '</td><tr>';
168print '</table>';
169
170print '<br><center><input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'"></center>';
171
172print '</form>';
173
174print dol_get_fiche_end();
175
176llxFooter();
177$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).
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 manage a WYSIWYG editor.
Class to generate html code for admin pages.
datapolicyAdminPrepareHead()
Prepare admin pages header.
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='', $dragdropfile=0)
Show tabs of a record.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
setEventMessage($mesgs, $style='mesgs', $noduplicate=0)
Set event message in dol_events session object.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.