dolibarr  9.0.0
events.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
25 require '../main.inc.php';
26 require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
27 require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php';
28 require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
29 
30 
31 if (!$user->admin)
33 
34 // Load translation files required by the page
35 $langs->loadLangs(array("users","admin","other"));
36 
37 $action=GETPOST('action','aZ09');
38 
39 
40 $securityevent=new Events($db);
41 $eventstolog=$securityevent->eventstolog;
42 
43 
44 /*
45  * Actions
46  */
47 if ($action == "save")
48 {
49  $i=0;
50 
51  $db->begin();
52 
53  foreach ($eventstolog as $key => $arr)
54  {
55  $param='MAIN_LOGEVENTS_'.$arr['id'];
56  //print "param=".$param." - ".$_POST[$param];
57  if (! empty($_POST[$param])) dolibarr_set_const($db,$param,$_POST[$param],'chaine',0,'',$conf->entity);
58  else dolibarr_del_const($db,$param,$conf->entity);
59  }
60 
61  $db->commit();
62  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
63 }
64 
65 
66 
67 /*
68  * View
69  */
70 
71 $wikihelp='EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
72 llxHeader('',$langs->trans("Audit"),$wikihelp);
73 
74 //$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
75 print load_fiche_titre($langs->trans("SecuritySetup"),'','title_setup');
76 
77 print $langs->trans("LogEventDesc", $langs->transnoentitiesnoconv("AdminTools"), $langs->transnoentitiesnoconv("Audit"))."<br>\n";
78 print "<br>\n";
79 
80 
81 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
82 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
83 print '<input type="hidden" name="action" value="save">';
84 
85 $head=security_prepare_head();
86 
87 dol_fiche_head($head, 'audit', $langs->trans("Security"), -1);
88 
89 print "<table class=\"noborder\" width=\"100%\">";
90 print "<tr class=\"liste_titre\">";
91 print "<td colspan=\"2\">".$langs->trans("LogEvents")."</td>";
92 print "</tr>\n";
93 // Loop on each event type
94 foreach ($eventstolog as $key => $arr)
95 {
96  if ($arr['id'])
97  {
98  print '<tr class="oddeven">';
99  print '<td>'.$arr['id'].'</td>';
100  print '<td>';
101  $key='MAIN_LOGEVENTS_'.$arr['id'];
102  $value=$conf->global->$key;
103  print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.($value?' checked':'').'>';
104  print '</td></tr>'."\n";
105  }
106 }
107 print '</table>';
108 
109 dol_fiche_end();
110 
111 print '<div class="center">';
112 print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
113 print "</div>";
114 
115 print "</form>\n";
116 
117 // End of page
118 llxFooter();
119 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:56
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
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:510
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
dolibarr_del_const($db, $name, $entity=1)
Effacement d&#39;une constante dans la base de donnees.
Definition: admin.lib.php:435
dol_fiche_end($notab=0)
Show tab footer of a card.
llxHeader()
Empty header.
Definition: wrapper.php:44
security_prepare_head()
Prepare array with list of tabs.
Definition: admin.lib.php:606
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
Show tab header of a card.
Events class.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $wikihelp
View.
Definition: agenda.php:120