Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ISPConfig 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Helmo
ISPConfig 3
Commits
efca2797
Commit
efca2797
authored
4 years ago
by
Marius Burkard
Browse files
Options
Downloads
Patches
Plain Diff
- added method onAfterDatalogSave
- move update of spamfilter users to after datalog update
parent
edf105af
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
interface/lib/classes/tform_actions.inc.php
+6
-5
6 additions, 5 deletions
interface/lib/classes/tform_actions.inc.php
interface/web/mail/spamfilter_policy_edit.php
+14
-10
14 additions, 10 deletions
interface/web/mail/spamfilter_policy_edit.php
with
20 additions
and
15 deletions
interface/lib/classes/tform_actions.inc.php
+
6
−
5
View file @
efca2797
...
@@ -141,6 +141,8 @@ class tform_actions {
...
@@ -141,6 +141,8 @@ class tform_actions {
$app
->
tform
->
datalogSave
(
'UPDATE'
,
$this
->
id
,
$this
->
oldDataRecord
,
$new_data_record
);
$app
->
tform
->
datalogSave
(
'UPDATE'
,
$this
->
id
,
$this
->
oldDataRecord
,
$new_data_record
);
unset
(
$new_data_record
);
unset
(
$new_data_record
);
unset
(
$old_data_record
);
unset
(
$old_data_record
);
$this
->
onAfterDatalogSave
();
}
}
if
(
$_REQUEST
[
"next_tab"
]
==
''
)
{
if
(
$_REQUEST
[
"next_tab"
]
==
''
)
{
...
@@ -222,6 +224,7 @@ class tform_actions {
...
@@ -222,6 +224,7 @@ class tform_actions {
$new_data_record
=
$app
->
tform
->
getDataRecord
(
$this
->
id
);
$new_data_record
=
$app
->
tform
->
getDataRecord
(
$this
->
id
);
$app
->
tform
->
datalogSave
(
'INSERT'
,
$this
->
id
,
array
(),
$new_data_record
);
$app
->
tform
->
datalogSave
(
'INSERT'
,
$this
->
id
,
array
(),
$new_data_record
);
unset
(
$new_data_record
);
unset
(
$new_data_record
);
$this
->
onAfterDatalogSave
(
true
);
}
}
...
@@ -264,21 +267,19 @@ class tform_actions {
...
@@ -264,21 +267,19 @@ class tform_actions {
}
}
function
onBeforeUpdate
()
{
function
onBeforeUpdate
()
{
global
$app
,
$conf
;
}
}
function
onBeforeInsert
()
{
function
onBeforeInsert
()
{
global
$app
,
$conf
;
}
}
function
onAfterUpdate
()
{
function
onAfterUpdate
()
{
global
$app
,
$conf
;
}
}
function
onAfterInsert
()
{
function
onAfterInsert
()
{
global
$app
,
$conf
;
}
}
function
onAfterDatalogSave
(
$insert
=
false
)
{
}
/**
/**
* Function called on data insert or update error
* Function called on data insert or update error
...
@@ -297,7 +298,7 @@ class tform_actions {
...
@@ -297,7 +298,7 @@ class tform_actions {
*/
*/
function
onDelete
()
{
function
onDelete
()
{
global
$app
,
$conf
,
$list_def_file
,
$tform_def_file
;
global
$app
,
$conf
,
$list_def_file
,
$tform_def_file
;
// Check CSRF Token
// Check CSRF Token
$app
->
auth
->
csrf_token_check
(
'GET'
);
$app
->
auth
->
csrf_token_check
(
'GET'
);
...
...
This diff is collapsed.
Click to expand it.
interface/web/mail/spamfilter_policy_edit.php
+
14
−
10
View file @
efca2797
...
@@ -49,7 +49,9 @@ $app->uses('tpl,tform,tform_actions');
...
@@ -49,7 +49,9 @@ $app->uses('tpl,tform,tform_actions');
$app
->
load
(
'tform_actions'
);
$app
->
load
(
'tform_actions'
);
class
page_action
extends
tform_actions
{
class
page_action
extends
tform_actions
{
private
$record_has_changed
=
false
;
function
onShowNew
()
{
function
onShowNew
()
{
global
$app
;
global
$app
;
...
@@ -87,30 +89,32 @@ class page_action extends tform_actions {
...
@@ -87,30 +89,32 @@ class page_action extends tform_actions {
parent
::
onSubmit
();
parent
::
onSubmit
();
}
}
function
onAfterUpdate
()
{
function
onAfterUpdate
()
{
global
$app
;
$this
->
record_has_changed
=
false
;
$record_has_changed
=
false
;
foreach
(
$this
->
dataRecord
as
$key
=>
$val
)
{
foreach
(
$this
->
dataRecord
as
$key
=>
$val
)
{
if
(
isset
(
$this
->
oldDataRecord
[
$key
])
&&
@
$this
->
oldDataRecord
[
$key
]
!=
$val
)
{
if
(
isset
(
$this
->
oldDataRecord
[
$key
])
&&
@
$this
->
oldDataRecord
[
$key
]
!=
$val
)
{
// Record has changed
// Record has changed
$record_has_changed
=
true
;
$
this
->
record_has_changed
=
true
;
}
}
}
}
}
if
(
$record_has_changed
){
function
onAfterDatalogSave
(
$insert
=
false
)
{
global
$app
;
if
(
!
$insert
&&
$this
->
record_has_changed
){
$spamfilter_users
=
$app
->
db
->
queryAllRecords
(
"SELECT * FROM spamfilter_users WHERE policy_id = ?"
,
intval
(
$this
->
id
));
$spamfilter_users
=
$app
->
db
->
queryAllRecords
(
"SELECT * FROM spamfilter_users WHERE policy_id = ?"
,
intval
(
$this
->
id
));
if
(
is_array
(
$spamfilter_users
)
&&
!
empty
(
$spamfilter_users
)){
if
(
is_array
(
$spamfilter_users
)
&&
!
empty
(
$spamfilter_users
)){
foreach
(
$spamfilter_users
as
$spamfilter_user
){
foreach
(
$spamfilter_users
as
$spamfilter_user
){
$app
->
db
->
datalogUpdate
(
'spamfilter_users'
,
$spamfilter_user
,
'id'
,
$spamfilter_user
[
"id"
],
true
);
$app
->
db
->
datalogUpdate
(
'spamfilter_users'
,
$spamfilter_user
,
'id'
,
$spamfilter_user
[
"id"
],
true
);
// check if this is an email domain
// check if this is an email domain
if
(
substr
(
$spamfilter_user
[
'email'
],
0
,
1
)
==
'@'
)
{
if
(
substr
(
$spamfilter_user
[
'email'
],
0
,
1
)
==
'@'
)
{
$domain
=
substr
(
$spamfilter_user
[
'email'
],
1
);
$domain
=
substr
(
$spamfilter_user
[
'email'
],
1
);
$forwardings
=
$app
->
db
->
queryAllRecords
(
"SELECT * FROM mail_forwarding WHERE source LIKE ? OR destination LIKE ?"
,
"%@"
.
$domain
,
"%@"
.
$domain
);
$forwardings
=
$app
->
db
->
queryAllRecords
(
"SELECT * FROM mail_forwarding WHERE source LIKE ? OR destination LIKE ?"
,
"%@"
.
$domain
,
"%@"
.
$domain
);
// Force-update aliases and forwards
// Force-update aliases and forwards
if
(
is_array
(
$forwardings
))
{
if
(
is_array
(
$forwardings
))
{
foreach
(
$forwardings
as
$rec
)
{
foreach
(
$forwardings
as
$rec
)
{
...
@@ -118,7 +122,7 @@ class page_action extends tform_actions {
...
@@ -118,7 +122,7 @@ class page_action extends tform_actions {
}
}
}
}
}
}
}
}
}
}
}
}
...
...
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