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
5d0839d4
Commit
5d0839d4
authored
12 years ago
by
mcramer
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix: Limits where processed the wrong way ('n', 'y' checkboxes)
parent
f6dd53c7
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
interface/lib/classes/client_templates.inc.php
+21
-3
21 additions, 3 deletions
interface/lib/classes/client_templates.inc.php
with
21 additions
and
3 deletions
interface/lib/classes/client_templates.inc.php
+
21
−
3
View file @
5d0839d4
...
...
@@ -44,11 +44,14 @@ class client_templates {
if
(
trim
(
$item
)
!=
''
){
$sql
=
"SELECT * FROM client_template WHERE template_id = "
.
$app
->
functions
->
intval
(
$item
);
$addLimits
=
$app
->
db
->
queryOneRecord
(
$sql
);
$app
->
log
(
'Template processing subtemplate '
.
$item
.
' for client '
.
$clientId
,
LOGLEVEL_DEBUG
);
/* maybe the template is deleted in the meantime */
if
(
is_array
(
$addLimits
)){
foreach
(
$addLimits
as
$k
=>
$v
){
/* we can remove this condition, but it is easier to debug with it (don't add ids and other non-limit values) */
if
(
strpos
(
$k
,
'limit'
)
!==
false
){
if
(
strpos
(
$k
,
'limit'
)
!==
false
or
$k
==
'ssh_chroot'
or
$k
==
'web_php_options'
or
$k
==
'force_suexec'
){
$app
->
log
(
'Template processing key '
.
$k
.
' for client '
.
$clientId
,
LOGLEVEL_DEBUG
);
/* process the numerical limits */
if
(
is_numeric
(
$v
)){
/* switch for special cases */
...
...
@@ -84,7 +87,7 @@ class client_templates {
$limits_values
=
explode
(
$form
[
"tabs"
][
"limits"
][
"fields"
][
$k
][
"separator"
],
$limits
[
$k
]);
}
$additional_values
=
explode
(
$form
[
"tabs"
][
"limits"
][
"fields"
][
$k
][
"separator"
],
$v
);
$app
->
log
(
'Template processing key '
.
$k
.
' type CHECKBOXARRAY, lim / add: '
.
implode
(
','
,
$limits_values
)
.
' / '
.
implode
(
','
,
$additional_values
)
.
' for client '
.
$clientId
,
LOGLEVEL_DEBUG
);
/* unification of limits_values (master template) and additional_values (additional template) */
$limits_unified
=
array
();
foreach
(
$form
[
"tabs"
][
"limits"
][
"fields"
][
$k
][
"value"
]
as
$key
=>
$val
){
...
...
@@ -92,7 +95,21 @@ class client_templates {
}
$limits
[
$k
]
=
implode
(
$form
[
"tabs"
][
"limits"
][
"fields"
][
$k
][
"separator"
],
$limits_unified
);
break
;
case
'CHECKBOX'
:
if
(
$k
==
'force_suexec'
)
{
// 'n' is less limited than y
if
(
!
isset
(
$limits
[
$k
])){
$limits
[
$k
]
=
'y'
;
}
if
(
$limits
[
$k
]
==
'n'
||
$v
==
'n'
)
$limits
[
$k
]
=
'n'
;
}
else
{
// 'y' is less limited than n
if
(
!
isset
(
$limits
[
$k
])){
$limits
[
$k
]
=
'n'
;
}
if
(
$limits
[
$k
]
==
'y'
||
$v
==
'y'
)
$limits
[
$k
]
=
'y'
;
}
break
;
case
'SELECT'
:
$limit_values
=
array_keys
(
$form
[
"tabs"
][
"limits"
][
"fields"
][
$k
][
"value"
]);
/* choose the lower index of the two SELECT items */
...
...
@@ -116,6 +133,7 @@ class client_templates {
$update
.
=
'`'
.
$k
.
"`='"
.
$v
.
"'"
;
}
}
$app
->
log
(
'Template processed for client '
.
$clientId
.
', update string: '
.
$update
,
LOGLEVEL_DEBUG
);
if
(
$update
!=
''
)
{
$sql
=
'UPDATE client SET '
.
$update
.
" WHERE client_id = "
.
$app
->
functions
->
intval
(
$clientId
);
$app
->
db
->
query
(
$sql
);
...
...
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