mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 11:26:13 +00:00
www: purge $changedesc; closes #394
This one and the former were good ideas, but: o They only affected a very small percentage of the actual code, and o Reviewing changes is best done in the config.xml, not the revision message.
This commit is contained in:
parent
31293e661f
commit
808a260416
@ -338,13 +338,6 @@ function gentitle($title) {
|
||||
return join($navlevelsep, $title);
|
||||
}
|
||||
|
||||
function update_changedesc($update)
|
||||
{
|
||||
global $changedesc;
|
||||
|
||||
$changedesc .= " {$update}";
|
||||
}
|
||||
|
||||
function clear_log($logfile, $restart_syslogd = true)
|
||||
{
|
||||
if ($restart_syslogd) {
|
||||
@ -469,26 +462,20 @@ function dump_log($logfile, $tail, $withorig = true, $grepfor = '', $grepinvert
|
||||
* orig = original value
|
||||
* new = new value
|
||||
*/
|
||||
function update_if_changed($varname, & $orig, $new) {
|
||||
function update_if_changed($varname, &$orig, $new)
|
||||
{
|
||||
if (is_array($orig) && is_array($new)) {
|
||||
$a_diff = array_diff($orig, $new);
|
||||
foreach ($a_diff as $diff) {
|
||||
update_changedesc("removed {$varname}: \"{$diff}\"");
|
||||
}
|
||||
$a_diff = array_diff($new, $orig);
|
||||
foreach ($a_diff as $diff) {
|
||||
update_changedesc("added {$varname}: \"{$diff}\"");
|
||||
}
|
||||
$orig = $new;
|
||||
return true;
|
||||
|
||||
} else {
|
||||
if ($orig != $new) {
|
||||
update_changedesc("{$varname}: \"{$orig}\" -> \"{$new}\"");
|
||||
$orig = $new;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($orig != $new) {
|
||||
$orig = $new;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -127,8 +127,6 @@ if (isset($id) && $a_monitor[$id]) {
|
||||
$pconfig['options']['code'] = 200;
|
||||
}
|
||||
|
||||
$changedesc = gettext("Load Balancer: Monitor:") . " ";
|
||||
|
||||
if ($_POST) {
|
||||
unset($input_errors);
|
||||
$pconfig = $_POST;
|
||||
@ -200,10 +198,10 @@ if ($_POST) {
|
||||
|
||||
if (!$input_errors) {
|
||||
$monent = array();
|
||||
if(isset($id) && $a_monitor[$id])
|
||||
|
||||
if (isset($id) && $a_monitor[$id]) {
|
||||
$monent = $a_monitor[$id];
|
||||
if($monent['name'] != "")
|
||||
$changedesc .= " " . sprintf(gettext("modified '%s' monitor:"), $monent['name']);
|
||||
}
|
||||
|
||||
update_if_changed("name", $monent['name'], $pconfig['name']);
|
||||
update_if_changed("type", $monent['type'], $pconfig['type']);
|
||||
@ -242,7 +240,7 @@ if ($_POST) {
|
||||
}
|
||||
|
||||
mark_subsystem_dirty('loadbalancer');
|
||||
write_config($changedesc);
|
||||
write_config();
|
||||
header("Location: load_balancer_monitor.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -54,8 +54,6 @@ if (isset($id) && $a_pool[$id]) {
|
||||
$pconfig['monitor'] = $a_pool[$id]['monitor'];
|
||||
}
|
||||
|
||||
$changedesc = gettext("Load Balancer: Pool:") . " ";
|
||||
|
||||
if ($_POST) {
|
||||
unset($input_errors);
|
||||
$pconfig = $_POST;
|
||||
@ -116,10 +114,10 @@ if ($_POST) {
|
||||
|
||||
if (!$input_errors) {
|
||||
$poolent = array();
|
||||
if(isset($id) && $a_pool[$id])
|
||||
|
||||
if (isset($id) && $a_pool[$id]) {
|
||||
$poolent = $a_pool[$id];
|
||||
if($poolent['name'] != "")
|
||||
$changedesc .= sprintf(gettext(" modified '%s' pool:"), $poolent['name']);
|
||||
}
|
||||
|
||||
update_if_changed("name", $poolent['name'], $_POST['name']);
|
||||
update_if_changed("mode", $poolent['mode'], $_POST['mode']);
|
||||
@ -142,7 +140,7 @@ if ($_POST) {
|
||||
}
|
||||
|
||||
mark_subsystem_dirty('loadbalancer');
|
||||
write_config($changedesc);
|
||||
write_config();
|
||||
header("Location: load_balancer_pool.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -54,8 +54,6 @@ if (isset($id) && $a_action[$id]) {
|
||||
$pconfig['action'] = 'change';
|
||||
}
|
||||
|
||||
$changedesc = gettext("Load Balancer: Relay Action:") . " ";
|
||||
|
||||
$kv = array('key', 'value');
|
||||
$vk = array('value', 'key');
|
||||
$hr_actions = array();
|
||||
@ -117,10 +115,9 @@ if ($_POST) {
|
||||
|
||||
if (!$input_errors) {
|
||||
$actent = array();
|
||||
if(isset($id) && $a_action[$id])
|
||||
if (isset($id) && $a_action[$id]) {
|
||||
$actent = $a_action[$id];
|
||||
if($actent['name'] != "")
|
||||
$changedesc .= " " . sprintf(gettext("modified '%s' action:"), $actent['name']);
|
||||
}
|
||||
|
||||
update_if_changed("name", $actent['name'], $pconfig['name']);
|
||||
update_if_changed("protocol", $actent['protocol'], $pconfig['protocol']);
|
||||
@ -157,7 +154,7 @@ if ($_POST) {
|
||||
}
|
||||
|
||||
mark_subsystem_dirty('loadbalancer');
|
||||
write_config($changedesc);
|
||||
write_config();
|
||||
header("Location: load_balancer_relay_action.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -53,8 +53,6 @@ if (isset($id) && $a_protocol[$id]) {
|
||||
$pconfig['type'] = 'http';
|
||||
}
|
||||
|
||||
$changedesc = gettext("Load Balancer: Relay Protocol:") . " ";
|
||||
|
||||
if ($_POST) {
|
||||
unset($input_errors);
|
||||
$pconfig = $_POST;
|
||||
@ -85,10 +83,10 @@ if ($_POST) {
|
||||
|
||||
if (!$input_errors) {
|
||||
$protent = array();
|
||||
if(isset($id) && $a_protocol[$id])
|
||||
|
||||
if(isset($id) && $a_protocol[$id]) {
|
||||
$protent = $a_protocol[$id];
|
||||
if($protent['name'] != "")
|
||||
$changedesc .= " " . sprintf(gettext("modified '%s' load balancing protocol:"), $protent['name']);
|
||||
}
|
||||
|
||||
update_if_changed(gettext("name"), $protent['name'], $pconfig['name']);
|
||||
update_if_changed(gettext("type"), $protent['type'], $pconfig['type']);
|
||||
@ -110,7 +108,7 @@ if ($_POST) {
|
||||
}
|
||||
|
||||
mark_subsystem_dirty('loadbalancer');
|
||||
write_config($changedesc);
|
||||
write_config();
|
||||
header("Location: load_balancer_relay_protocol.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -52,8 +52,6 @@ if (isset($id) && $a_vs[$id]) {
|
||||
$pconfig['mode'] = 'redirect';
|
||||
}
|
||||
|
||||
$changedesc = gettext("Load Balancer: Virtual Server:") . " ";
|
||||
|
||||
if ($_POST) {
|
||||
unset($input_errors);
|
||||
$pconfig = $_POST;
|
||||
@ -94,12 +92,10 @@ if ($_POST) {
|
||||
|
||||
if (!$input_errors) {
|
||||
$vsent = array();
|
||||
if(isset($id) && $a_vs[$id])
|
||||
|
||||
if (isset($id) && $a_vs[$id]) {
|
||||
$vsent = $a_vs[$id];
|
||||
if($vsent['name'] != "")
|
||||
$changedesc .= " " . sprintf(gettext("modified '%s' vs:"), $vsent['name']);
|
||||
else
|
||||
$changedesc .= " " . sprintf(gettext("created '%s' vs:"), $_POST['name']);
|
||||
}
|
||||
|
||||
update_if_changed("name", $vsent['name'], $_POST['name']);
|
||||
update_if_changed("descr", $vsent['descr'], $_POST['descr']);
|
||||
@ -124,7 +120,7 @@ if ($_POST) {
|
||||
}
|
||||
|
||||
mark_subsystem_dirty('loadbalancer');
|
||||
write_config($changedesc);
|
||||
write_config();
|
||||
header("Location: load_balancer_virtual_server.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -29,8 +29,8 @@
|
||||
|
||||
require_once("guiconfig.inc");
|
||||
|
||||
function lookup_gateway_monitor_ip_by_name($name) {
|
||||
|
||||
function lookup_gateway_monitor_ip_by_name($name)
|
||||
{
|
||||
$gateways_arr = return_gateways_array(false, true);
|
||||
if (!empty($gateways_arr[$name])) {
|
||||
$gateway = $gateways_arr[$name];
|
||||
@ -53,7 +53,6 @@ if (!is_array($config['gateways']['gateway_group'])) {
|
||||
}
|
||||
|
||||
$a_gateway_groups = &$config['gateways']['gateway_group'];
|
||||
$changedesc = gettext("Gateway Groups") . ": ";
|
||||
|
||||
$gateways_status = return_gateways_status();
|
||||
|
||||
|
||||
@ -78,7 +78,6 @@ if (!is_array($config['gateways']['gateway_group'])) {
|
||||
|
||||
$a_gateway_groups = &$config['gateways']['gateway_group'];
|
||||
$a_gateways = &$config['gateways']['gateway_item'];
|
||||
$changedesc = gettext("Gateway Groups") . ": ";
|
||||
|
||||
if ($_POST) {
|
||||
$pconfig = $_POST;
|
||||
@ -112,14 +111,13 @@ if ($_POST) {
|
||||
|
||||
if ($_GET['act'] == "del") {
|
||||
if ($a_gateway_groups[$_GET['id']]) {
|
||||
$changedesc .= gettext("removed gateway group") . " {$_GET['id']}";
|
||||
foreach ($config['filter']['rule'] as $idx => $rule) {
|
||||
if ($rule['gateway'] == $a_gateway_groups[$_GET['id']]['name']) {
|
||||
unset($config['filter']['rule'][$idx]['gateway']);
|
||||
}
|
||||
}
|
||||
unset($a_gateway_groups[$_GET['id']]);
|
||||
write_config($changedesc);
|
||||
write_config();
|
||||
mark_subsystem_dirty('staticroutes');
|
||||
header("Location: system_gateway_groups.php");
|
||||
exit;
|
||||
|
||||
@ -44,7 +44,6 @@ if (!is_array($config['staticroutes']['route'])) {
|
||||
|
||||
$a_routes = &$config['staticroutes']['route'];
|
||||
$a_gateways = return_gateways_array(true, true, true);
|
||||
$changedesc_prefix = gettext("Static Routes") . ": ";
|
||||
|
||||
if ($_POST) {
|
||||
$pconfig = $_POST;
|
||||
@ -75,7 +74,7 @@ if ($_POST) {
|
||||
|
||||
function delete_static_route($id)
|
||||
{
|
||||
global $config, $a_routes, $changedesc_prefix;
|
||||
global $config, $a_routes;
|
||||
|
||||
if (!isset($a_routes[$id])) {
|
||||
return;
|
||||
@ -108,10 +107,9 @@ function delete_static_route($id)
|
||||
|
||||
if ($_GET['act'] == "del") {
|
||||
if ($a_routes[$_GET['id']]) {
|
||||
$changedesc = $changedesc_prefix . gettext("removed route to") . " " . $a_routes[$_GET['id']]['network'];
|
||||
delete_static_route($_GET['id']);
|
||||
unset($a_routes[$_GET['id']]);
|
||||
write_config($changedesc);
|
||||
write_config();
|
||||
header("Location: system_routes.php");
|
||||
exit;
|
||||
}
|
||||
@ -120,13 +118,11 @@ if ($_GET['act'] == "del") {
|
||||
if (isset($_POST['del_x'])) {
|
||||
/* delete selected routes */
|
||||
if (is_array($_POST['route']) && count($_POST['route'])) {
|
||||
$changedesc = $changedesc_prefix . gettext("removed route to");
|
||||
foreach ($_POST['route'] as $routei) {
|
||||
$changedesc .= " " . $a_routes[$routei]['network'];
|
||||
delete_static_route($routei);
|
||||
unset($a_routes[$routei]);
|
||||
}
|
||||
write_config($changedesc);
|
||||
write_config();
|
||||
header("Location: system_routes.php");
|
||||
exit;
|
||||
}
|
||||
@ -135,16 +131,13 @@ if (isset($_POST['del_x'])) {
|
||||
if ($a_routes[$_GET['id']]) {
|
||||
if (isset($a_routes[$_GET['id']]['disabled'])) {
|
||||
unset($a_routes[$_GET['id']]['disabled']);
|
||||
$changedesc = $changedesc_prefix . gettext("enabled route to") . " " . $a_routes[$id]['network'];
|
||||
} else {
|
||||
delete_static_route($_GET['id']);
|
||||
$a_routes[$_GET['id']]['disabled'] = true;
|
||||
$changedesc = $changedesc_prefix . gettext("disabled route to") . " " . $a_routes[$id]['network'];
|
||||
}
|
||||
|
||||
if (write_config($changedesc)) {
|
||||
mark_subsystem_dirty('staticroutes');
|
||||
}
|
||||
write_config();
|
||||
mark_subsystem_dirty('staticroutes');
|
||||
header("Location: system_routes.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user