dolibarr  7.0.0-beta
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 $langs->load("users");
35 $langs->load("admin");
36 $langs->load("other");
37 
38 $action=GETPOST('action','aZ09');
39 
40 
41 $securityevent=new Events($db);
42 $eventstolog=$securityevent->eventstolog;
43 
44 
45 
46 /*
47  * Actions
48  */
49 if ($action == "save")
50 {
51  $i=0;
52 
53  $db->begin();
54 
55  foreach ($eventstolog as $key => $arr)
56  {
57  $param='MAIN_LOGEVENTS_'.$arr['id'];
58  //print "param=".$param." - ".$_POST[$param];
59  if (! empty($_POST[$param])) dolibarr_set_const($db,$param,$_POST[$param],'chaine',0,'',$conf->entity);
60  else dolibarr_del_const($db,$param,$conf->entity);
61  }
62 
63  $db->commit();
64  setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
65 }
66 
67 
68 
69 /*
70  * View
71  */
72 
73 $wikihelp='EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad';
74 llxHeader('',$langs->trans("Audit"),$wikihelp);
75 
76 //$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
77 print load_fiche_titre($langs->trans("SecuritySetup"),'','title_setup');
78 
79 print $langs->trans("LogEventDesc")."<br>\n";
80 print "<br>\n";
81 
82 
83 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
84 print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
85 print '<input type="hidden" name="action" value="save">';
86 
87 $head=security_prepare_head();
88 
89 dol_fiche_head($head, 'audit', $langs->trans("Security"), -1);
90 
91 
92 $var=true;
93 print "<table class=\"noborder\" width=\"100%\">";
94 print "<tr class=\"liste_titre\">";
95 print "<td colspan=\"2\">".$langs->trans("LogEvents")."</td>";
96 print "</tr>\n";
97 // Loop on each event type
98 foreach ($eventstolog as $key => $arr)
99 {
100  if ($arr['id'])
101  {
102 
103  print '<tr class="oddeven">';
104  print '<td>'.$arr['id'].'</td>';
105  print '<td>';
106  $key='MAIN_LOGEVENTS_'.$arr['id'];
107  $value=$conf->global->$key;
108  print '<input class="oddeven" type="checkbox" name="'.$key.'" value="1"'.($value?' checked':'').'>';
109  print '</td></tr>'."\n";
110  }
111 }
112 print '</table>';
113 
114 dol_fiche_end();
115 
116 print '<div class="center">';
117 print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">";
118 print "</div>";
119 
120 print "</form>\n";
121 
122 
123 llxFooter();
124 $db->close();
llxFooter()
Empty footer.
Definition: wrapper.php:58
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='')
Show tab header of a card.
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:485
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
if(GETPOST('button_removefilter_x','alpha')||GETPOST('button_removefilter.x','alpha')||GETPOST('button_removefilter','alpha')) if($action=="save"&&empty($cancel)) if(preg_match('/set_(.*)/', $action, $reg)) if(preg_match('/del_(.*)/', $action, $reg) $wikihelp)
View.
Definition: agenda.php:143
dolibarr_del_const($db, $name, $entity=1)
Effacement d'une constante dans la base de donnees.
Definition: admin.lib.php:410
dol_fiche_end($notab=0)
Show tab footer of a card.
load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', $pictoisfullpath=0, $id=0, $morecssontable='', $morehtmlcenter='')
Load a title with picto.
llxHeader()
Empty header.
Definition: wrapper.php:46
security_prepare_head()
Prepare array with list of tabs.
Definition: admin.lib.php:581
print
Draft customers invoices.
Definition: index.php:91
Events class.