Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
dfd8b5e2
Commit
dfd8b5e2
authored
10 years ago
by
Marcos García de La Fuente
Browse files
Options
Downloads
Patches
Plain Diff
Converted some global variables to local ones in InterfaceLogevents
parent
c1143117
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/core/triggers/interface_20_all_Logevents.class.php
+45
-55
45 additions, 55 deletions
htdocs/core/triggers/interface_20_all_Logevents.class.php
with
45 additions
and
55 deletions
htdocs/core/triggers/interface_20_all_Logevents.class.php
+
45
−
55
View file @
dfd8b5e2
...
...
@@ -34,12 +34,6 @@ class InterfaceLogevents extends DolibarrTriggers
public
$description
=
"Triggers of this module allows to add security event records inside Dolibarr."
;
public
$version
=
self
::
VERSION_DOLIBARR
;
var
$date
;
var
$duree
;
var
$texte
;
var
$desc
;
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
...
...
@@ -61,8 +55,7 @@ class InterfaceLogevents extends DolibarrTriggers
if
(
empty
(
$conf
->
entity
))
$conf
->
entity
=
$entity
;
// forcing of the entity if it's not defined (ex: in login form)
$this
->
date
=
dol_now
();
$this
->
duree
=
0
;
$date
=
dol_now
();
// Actions
if
(
$action
==
'USER_LOGIN'
)
...
...
@@ -70,24 +63,24 @@ class InterfaceLogevents extends DolibarrTriggers
dol_syslog
(
"Trigger '"
.
$this
->
name
.
"' for action '
$action
' launched by "
.
__FILE__
.
". id="
.
$object
->
id
);
// Initialisation donnees (date,duree,texte,desc)
$
this
->
text
e
=
"(UserLogged,"
.
$object
->
login
.
")"
;
$
this
->
desc
=
"(UserLogged,"
.
$object
->
login
.
")"
;
$text
=
"(UserLogged,"
.
$object
->
login
.
")"
;
$desc
=
"(UserLogged,"
.
$object
->
login
.
")"
;
}
if
(
$action
==
'USER_LOGIN_FAILED'
)
{
dol_syslog
(
"Trigger '"
.
$this
->
name
.
"' for action '
$action
' launched by "
.
__FILE__
.
". id="
.
$object
->
id
);
// Initialisation donnees (date,duree,texte,desc)
$
this
->
text
e
=
$object
->
trigger_mesg
;
// Message direct
$
this
->
desc
=
$object
->
trigger_mesg
;
// Message direct
$text
=
$object
->
trigger_mesg
;
// Message direct
$desc
=
$object
->
trigger_mesg
;
// Message direct
}
if
(
$action
==
'USER_LOGOUT'
)
{
dol_syslog
(
"Trigger '"
.
$this
->
name
.
"' for action '
$action
' launched by "
.
__FILE__
.
". id="
.
$object
->
id
);
// Initialisation donnees (date,duree,texte,desc)
$
this
->
text
e
=
"(UserLogoff,"
.
$object
->
login
.
")"
;
$
this
->
desc
=
"(UserLogoff,"
.
$object
->
login
.
")"
;
$text
=
"(UserLogoff,"
.
$object
->
login
.
")"
;
$desc
=
"(UserLogoff,"
.
$object
->
login
.
")"
;
}
if
(
$action
==
'USER_CREATE'
)
{
...
...
@@ -95,8 +88,8 @@ class InterfaceLogevents extends DolibarrTriggers
$langs
->
load
(
"users"
);
// Initialisation donnees (date,duree,texte,desc)
$
this
->
text
e
=
$langs
->
transnoentities
(
"NewUserCreated"
,
$object
->
login
);
$
this
->
desc
=
$langs
->
transnoentities
(
"NewUserCreated"
,
$object
->
login
);
$text
=
$langs
->
transnoentities
(
"NewUserCreated"
,
$object
->
login
);
$desc
=
$langs
->
transnoentities
(
"NewUserCreated"
,
$object
->
login
);
}
elseif
(
$action
==
'USER_MODIFY'
)
{
...
...
@@ -104,8 +97,8 @@ class InterfaceLogevents extends DolibarrTriggers
$langs
->
load
(
"users"
);
// Initialisation donnees (date,duree,texte,desc)
$
this
->
text
e
=
$langs
->
transnoentities
(
"EventUserModified"
,
$object
->
login
);
$
this
->
desc
=
$langs
->
transnoentities
(
"EventUserModified"
,
$object
->
login
);
$text
=
$langs
->
transnoentities
(
"EventUserModified"
,
$object
->
login
);
$desc
=
$langs
->
transnoentities
(
"EventUserModified"
,
$object
->
login
);
}
elseif
(
$action
==
'USER_NEW_PASSWORD'
)
{
...
...
@@ -113,8 +106,8 @@ class InterfaceLogevents extends DolibarrTriggers
$langs
->
load
(
"users"
);
// Initialisation donnees (date,duree,texte,desc)
$
this
->
text
e
=
$langs
->
transnoentities
(
"NewUserPassword"
,
$object
->
login
);
$
this
->
desc
=
$langs
->
transnoentities
(
"NewUserPassword"
,
$object
->
login
);
$text
=
$langs
->
transnoentities
(
"NewUserPassword"
,
$object
->
login
);
$desc
=
$langs
->
transnoentities
(
"NewUserPassword"
,
$object
->
login
);
}
elseif
(
$action
==
'USER_ENABLEDISABLE'
)
{
...
...
@@ -123,13 +116,13 @@ class InterfaceLogevents extends DolibarrTriggers
// Initialisation donnees (date,duree,texte,desc)
if
(
$object
->
statut
==
0
)
{
$
this
->
text
e
=
$langs
->
transnoentities
(
"UserEnabled"
,
$object
->
login
);
$
this
->
desc
=
$langs
->
transnoentities
(
"UserEnabled"
,
$object
->
login
);
$text
=
$langs
->
transnoentities
(
"UserEnabled"
,
$object
->
login
);
$desc
=
$langs
->
transnoentities
(
"UserEnabled"
,
$object
->
login
);
}
if
(
$object
->
statut
==
1
)
{
$
this
->
text
e
=
$langs
->
transnoentities
(
"UserDisabled"
,
$object
->
login
);
$
this
->
desc
=
$langs
->
transnoentities
(
"UserDisabled"
,
$object
->
login
);
$text
=
$langs
->
transnoentities
(
"UserDisabled"
,
$object
->
login
);
$desc
=
$langs
->
transnoentities
(
"UserDisabled"
,
$object
->
login
);
}
}
elseif
(
$action
==
'USER_DELETE'
)
...
...
@@ -137,8 +130,8 @@ class InterfaceLogevents extends DolibarrTriggers
dol_syslog
(
"Trigger '"
.
$this
->
name
.
"' for action '
$action
' launched by "
.
__FILE__
.
". id="
.
$object
->
id
);
$langs
->
load
(
"users"
);
// Initialisation donnees (date,duree,texte,desc)
$
this
->
text
e
=
$langs
->
transnoentities
(
"UserDeleted"
,
$object
->
login
);
$
this
->
desc
=
$langs
->
transnoentities
(
"UserDeleted"
,
$object
->
login
);
$text
=
$langs
->
transnoentities
(
"UserDeleted"
,
$object
->
login
);
$desc
=
$langs
->
transnoentities
(
"UserDeleted"
,
$object
->
login
);
}
// Groupes
...
...
@@ -147,24 +140,24 @@ class InterfaceLogevents extends DolibarrTriggers
dol_syslog
(
"Trigger '"
.
$this
->
name
.
"' for action '
$action
' launched by "
.
__FILE__
.
". id="
.
$object
->
id
);
$langs
->
load
(
"users"
);
// Initialisation donnees (date,duree,texte,desc)
$
this
->
text
e
=
$langs
->
transnoentities
(
"NewGroupCreated"
,
$object
->
nom
);
$
this
->
desc
=
$langs
->
transnoentities
(
"NewGroupCreated"
,
$object
->
nom
);
$text
=
$langs
->
transnoentities
(
"NewGroupCreated"
,
$object
->
nom
);
$desc
=
$langs
->
transnoentities
(
"NewGroupCreated"
,
$object
->
nom
);
}
elseif
(
$action
==
'GROUP_MODIFY'
)
{
dol_syslog
(
"Trigger '"
.
$this
->
name
.
"' for action '
$action
' launched by "
.
__FILE__
.
". id="
.
$object
->
id
);
$langs
->
load
(
"users"
);
// Initialisation donnees (date,duree,texte,desc)
$
this
->
text
e
=
$langs
->
transnoentities
(
"GroupModified"
,
$object
->
nom
);
$
this
->
desc
=
$langs
->
transnoentities
(
"GroupModified"
,
$object
->
nom
);
$text
=
$langs
->
transnoentities
(
"GroupModified"
,
$object
->
nom
);
$desc
=
$langs
->
transnoentities
(
"GroupModified"
,
$object
->
nom
);
}
elseif
(
$action
==
'GROUP_DELETE'
)
{
dol_syslog
(
"Trigger '"
.
$this
->
name
.
"' for action '
$action
' launched by "
.
__FILE__
.
". id="
.
$object
->
id
);
$langs
->
load
(
"users"
);
// Initialisation donnees (date,duree,texte,desc)
$
this
->
text
e
=
$langs
->
transnoentities
(
"GroupDeleted"
,
$object
->
nom
);
$
this
->
desc
=
$langs
->
transnoentities
(
"GroupDeleted"
,
$object
->
nom
);
$text
=
$langs
->
transnoentities
(
"GroupDeleted"
,
$object
->
nom
);
$desc
=
$langs
->
transnoentities
(
"GroupDeleted"
,
$object
->
nom
);
}
// If not found
...
...
@@ -177,30 +170,27 @@ class InterfaceLogevents extends DolibarrTriggers
*/
// Add entry in event table
if
(
$this
->
date
)
include_once
DOL_DOCUMENT_ROOT
.
'/core/class/events.class.php'
;
$event
=
new
Events
(
$this
->
db
);
$event
->
type
=
$action
;
$event
->
dateevent
=
$date
;
$event
->
label
=
$text
;
$event
->
description
=
$desc
;
$event
->
user_agent
=
$_SERVER
[
"HTTP_USER_AGENT"
];
$result
=
$event
->
create
(
$user
);
if
(
$result
>
0
)
{
include_once
DOL_DOCUMENT_ROOT
.
'/core/class/events.class.php'
;
$event
=
new
Events
(
$this
->
db
);
$event
->
type
=
$action
;
$event
->
dateevent
=
$this
->
date
;
$event
->
label
=
$this
->
texte
;
$event
->
description
=
$this
->
desc
;
$event
->
user_agent
=
$_SERVER
[
"HTTP_USER_AGENT"
];
$result
=
$event
->
create
(
$user
);
if
(
$result
>
0
)
{
return
1
;
}
else
{
$error
=
"Failed to insert security event: "
.
$event
->
error
;
$this
->
error
=
$error
;
dol_syslog
(
get_class
(
$this
)
.
": "
.
$this
->
error
,
LOG_ERR
);
return
-
1
;
}
return
1
;
}
else
{
$error
=
"Failed to insert security event: "
.
$event
->
error
;
$this
->
error
=
$error
;
dol_syslog
(
get_class
(
$this
)
.
": "
.
$this
->
error
,
LOG_ERR
);
return
-
1
;
}
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment