Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
8e5f1724
Commit
8e5f1724
authored
Jan 21, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(legacy) zap update_if_changed
parent
b0a36982
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
47 deletions
+25
-47
guiconfig.inc
src/www/guiconfig.inc
+0
-23
load_balancer_monitor_edit.php
src/www/load_balancer_monitor_edit.php
+9
-8
load_balancer_pool_edit.php
src/www/load_balancer_pool_edit.php
+8
-8
load_balancer_virtual_server_edit.php
src/www/load_balancer_virtual_server_edit.php
+8
-8
No files found.
src/www/guiconfig.inc
View file @
8e5f1724
...
@@ -464,29 +464,6 @@ function dump_log($logfile, $tail, $grepfor = '')
...
@@ -464,29 +464,6 @@ function dump_log($logfile, $tail, $grepfor = '')
print_dump
(
$logarr
);
print_dump
(
$logarr
);
}
}
/* Check if variable has changed, update and log if it has
* returns true if var changed
* varname = variable name in plain text
* orig = original value
* new = new value
*/
function
update_if_changed
(
$varname
,
&
$orig
,
$new
)
{
if
(
is_array
(
$orig
)
&&
is_array
(
$new
))
{
$a_diff
=
array_diff
(
$orig
,
$new
);
$a_diff
=
array_diff
(
$new
,
$orig
);
$orig
=
$new
;
return
true
;
}
if
(
$orig
!=
$new
)
{
$orig
=
$new
;
return
true
;
}
return
false
;
}
function
address_to_pconfig
(
$adr
,
&
$padr
,
&
$pmask
,
&
$pnot
,
&
$pbeginport
,
&
$pendport
)
{
function
address_to_pconfig
(
$adr
,
&
$padr
,
&
$pmask
,
&
$pnot
,
&
$pbeginport
,
&
$pendport
)
{
if
(
isset
(
$adr
[
'any'
]))
if
(
isset
(
$adr
[
'any'
]))
$padr
=
"any"
;
$padr
=
"any"
;
...
...
src/www/load_balancer_monitor_edit.php
View file @
8e5f1724
...
@@ -203,14 +203,14 @@ if ($_POST) {
...
@@ -203,14 +203,14 @@ if ($_POST) {
$monent
=
$a_monitor
[
$id
];
$monent
=
$a_monitor
[
$id
];
}
}
update_if_changed
(
"name"
,
$monent
[
'name'
],
$pconfig
[
'name'
])
;
$monent
[
'name'
]
=
$pconfig
[
'name'
]
;
update_if_changed
(
"type"
,
$monent
[
'type'
],
$pconfig
[
'type'
])
;
$monent
[
'type'
]
=
$pconfig
[
'type'
]
;
update_if_changed
(
"description"
,
$monent
[
'descr'
],
$pconfig
[
'descr'
])
;
$monent
[
'descr'
]
=
$pconfig
[
'descr'
]
;
if
(
$pconfig
[
'type'
]
==
"http"
||
$pconfig
[
'type'
]
==
"https"
)
{
if
(
$pconfig
[
'type'
]
==
"http"
||
$pconfig
[
'type'
]
==
"https"
)
{
/* log updates, then clear array and reassign - dumb, but easiest way to have a clear array */
/* log updates, then clear array and reassign - dumb, but easiest way to have a clear array */
update_if_changed
(
"path"
,
$monent
[
'options'
][
'path'
],
$pconfig
[
'options'
][
'path'
])
;
$monent
[
'options'
][
'path'
]
=
$pconfig
[
'options'
][
'path'
]
;
update_if_changed
(
"host"
,
$monent
[
'options'
][
'host'
],
$pconfig
[
'options'
][
'host'
])
;
$monent
[
'options'
][
'host'
]
=
$pconfig
[
'options'
][
'host'
]
;
update_if_changed
(
"code"
,
$monent
[
'options'
][
'code'
],
$pconfig
[
'options'
][
'code'
])
;
$monent
[
'options'
][
'code'
]
=
$pconfig
[
'options'
][
'code'
]
;
$monent
[
'options'
]
=
array
();
$monent
[
'options'
]
=
array
();
$monent
[
'options'
][
'path'
]
=
$pconfig
[
'options'
][
'path'
];
$monent
[
'options'
][
'path'
]
=
$pconfig
[
'options'
][
'path'
];
$monent
[
'options'
][
'host'
]
=
$pconfig
[
'options'
][
'host'
];
$monent
[
'options'
][
'host'
]
=
$pconfig
[
'options'
][
'host'
];
...
@@ -218,8 +218,9 @@ if ($_POST) {
...
@@ -218,8 +218,9 @@ if ($_POST) {
}
}
if
(
$pconfig
[
'type'
]
==
"send"
)
{
if
(
$pconfig
[
'type'
]
==
"send"
)
{
/* log updates, then clear array and reassign - dumb, but easiest way to have a clear array */
/* log updates, then clear array and reassign - dumb, but easiest way to have a clear array */
update_if_changed
(
"send"
,
$monent
[
'options'
][
'send'
],
$pconfig
[
'options'
][
'send'
]);
$monent
[
'options'
][
'send'
]
=
$pconfig
[
'options'
][
'send'
];
update_if_changed
(
"expect"
,
$monent
[
'options'
][
'expect'
],
$pconfig
[
'options'
][
'expect'
]);
$monent
[
'options'
][
'expect'
]
=
$pconfig
[
'options'
][
'expect'
];
$monent
[
'options'
]
=
array
();
$monent
[
'options'
]
=
array
();
$monent
[
'options'
][
'send'
]
=
$pconfig
[
'options'
][
'send'
];
$monent
[
'options'
][
'send'
]
=
$pconfig
[
'options'
][
'send'
];
$monent
[
'options'
][
'expect'
]
=
$pconfig
[
'options'
][
'expect'
];
$monent
[
'options'
][
'expect'
]
=
$pconfig
[
'options'
][
'expect'
];
...
...
src/www/load_balancer_pool_edit.php
View file @
8e5f1724
...
@@ -119,14 +119,14 @@ if ($_POST) {
...
@@ -119,14 +119,14 @@ if ($_POST) {
$poolent
=
$a_pool
[
$id
];
$poolent
=
$a_pool
[
$id
];
}
}
update_if_changed
(
"name"
,
$poolent
[
'name'
],
$_POST
[
'name'
])
;
$poolent
[
'name'
]
=
$_POST
[
'name'
]
;
update_if_changed
(
"mode"
,
$poolent
[
'mode'
],
$_POST
[
'mode'
])
;
$poolent
[
'mode'
]
=
$_POST
[
'mode'
]
;
update_if_changed
(
"description"
,
$poolent
[
'descr'
],
$_POST
[
'descr'
])
;
$poolent
[
'descr'
]
=
$_POST
[
'descr'
]
;
update_if_changed
(
"port"
,
$poolent
[
'port'
],
$_POST
[
'port'
])
;
$poolent
[
'port'
]
=
$_POST
[
'port'
]
;
update_if_changed
(
"retry"
,
$poolent
[
'retry'
],
$_POST
[
'retry'
])
;
$poolent
[
'retry'
]
=
$_POST
[
'retry'
]
;
update_if_changed
(
"servers"
,
$poolent
[
'servers'
],
$_POST
[
'servers'
])
;
$poolent
[
'servers'
]
=
$_POST
[
'servers'
]
;
update_if_changed
(
"serversdisabled"
,
$poolent
[
'serversdisabled'
],
$_POST
[
'serversdisabled'
])
;
$poolent
[
'serversdisabled'
]
=
$_POST
[
'serversdisabled'
]
;
update_if_changed
(
"monitor"
,
$poolent
[
'monitor'
],
$_POST
[
'monitor'
])
;
$poolent
[
'monitor'
]
=
$_POST
[
'monitor'
]
;
if
(
isset
(
$id
)
&&
$a_pool
[
$id
])
{
if
(
isset
(
$id
)
&&
$a_pool
[
$id
])
{
/* modify all virtual servers with this name */
/* modify all virtual servers with this name */
...
...
src/www/load_balancer_virtual_server_edit.php
View file @
8e5f1724
...
@@ -97,14 +97,14 @@ if ($_POST) {
...
@@ -97,14 +97,14 @@ if ($_POST) {
$vsent
=
$a_vs
[
$id
];
$vsent
=
$a_vs
[
$id
];
}
}
update_if_changed
(
"name"
,
$vsent
[
'name'
],
$_POST
[
'name'
])
;
$vsent
[
'name'
]
=
$_POST
[
'name'
]
;
update_if_changed
(
"descr"
,
$vsent
[
'descr'
],
$_POST
[
'descr'
])
;
$vsent
[
'descr'
]
=
$_POST
[
'descr'
]
;
update_if_changed
(
"poolname"
,
$vsent
[
'poolname'
],
$_POST
[
'poolname'
])
;
$vsent
[
'poolname'
]
=
$_POST
[
'poolname'
]
;
update_if_changed
(
"port"
,
$vsent
[
'port'
],
$_POST
[
'port'
])
;
$vsent
[
'port'
]
=
$_POST
[
'port'
]
;
update_if_changed
(
"sitedown"
,
$vsent
[
'sitedown'
],
$_POST
[
'sitedown'
])
;
$vsent
[
'sitedown'
]
=
$_POST
[
'sitedown'
]
;
update_if_changed
(
"ipaddr"
,
$vsent
[
'ipaddr'
],
$_POST
[
'ipaddr'
])
;
$vsent
[
'ipaddr'
]
=
$_POST
[
'ipaddr'
]
;
update_if_changed
(
"mode"
,
$vsent
[
'mode'
],
$_POST
[
'mode'
])
;
$vsent
[
'mode'
]
=
$_POST
[
'mode'
]
;
update_if_changed
(
"relay protocol"
,
$vsent
[
'relay_protocol'
],
$_POST
[
'relay_protocol'
])
;
$vsent
[
'relay_protocol'
]
=
$_POST
[
'relay_protocol'
]
;
if
(
$_POST
[
'sitedown'
]
==
""
)
if
(
$_POST
[
'sitedown'
]
==
""
)
unset
(
$vsent
[
'sitedown'
]);
unset
(
$vsent
[
'sitedown'
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment