Project

General

Profile

« Previous | Next » 

Revision 44c42356

Added by Phil Davis over 8 years ago

Report problems applying changes

1) Strictly keep track of the accumulating $retval from calls to various
functions that apply changes.
2) Use new function print_apply_result_box() to print a suitable message
in a suitable severity based on $retval

View differences:

src/usr/local/www/firewall_aliases.php
48 48
		$retval = 0;
49 49

  
50 50
		/* reload all components that use aliases */
51
		$retval = filter_configure();
51
		$retval |= filter_configure();
52 52

  
53
		if (stristr($retval, "error") <> true) {
54
			$savemsg = get_std_save_message($retval);
55
			$class = "success";
56
		} else {
57
			$savemsg = $retval;
58
			$class = "danger";
59
		}
60 53
		if ($retval == 0) {
61 54
			clear_subsystem_dirty('aliases');
62 55
		}
......
99 92
		// Static routes
100 93
		find_alias_reference(array('staticroutes', 'route'), array('network'), $alias_name, $is_alias_referenced, $referenced_by);
101 94
		if ($is_alias_referenced == true) {
102
			$savemsg = sprintf(gettext("Cannot delete alias. Currently in use by %s."), htmlspecialchars($referenced_by));
103
			$class = "danger";
95
			$delete_error = sprintf(gettext("Cannot delete alias. Currently in use by %s."), htmlspecialchars($referenced_by));
104 96
		} else {
105 97
			if (preg_match("/urltable/i", $a_aliases[$_GET['id']]['type'])) {
106 98
				// this is a URL table type alias, delete its file as well
......
173 165

  
174 166
include("head.inc");
175 167

  
176
if ($savemsg) {
177
	print_info_box($savemsg, $class);
168
if ($delete_error) {
169
	print_info_box($delete_error, 'danger');
170
}
171
if ($_POST['apply']) {
172
	print_apply_result_box($retval);
178 173
}
179 174

  
180 175
if (is_subsystem_dirty('aliases')) {
src/usr/local/www/firewall_nat.php
86 86
		$retval = 0;
87 87

  
88 88
		$retval |= filter_configure();
89
		$savemsg = get_std_save_message($retval);
90 89

  
91 90
		pfSense_handle_custom_code("/usr/local/pkg/firewall_nat/apply");
92 91

  
......
186 185
$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Port Forward"));
187 186
include("head.inc");
188 187

  
189
if ($savemsg) {
190
	print_info_box($savemsg, 'success');
188
if ($_POST['apply']) {
189
	print_apply_result_box($retval);
191 190
}
192 191

  
193 192
if (is_subsystem_dirty('natconf')) {
src/usr/local/www/firewall_nat_1to1.php
68 68
	if ($_POST['apply']) {
69 69
		$retval = 0;
70 70
		$retval |= filter_configure();
71
		$savemsg = get_std_save_message($retval);
72 71

  
73 72
		if ($retval == 0) {
74 73
			clear_subsystem_dirty('natconf');
......
122 121
$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("1:1"));
123 122
include("head.inc");
124 123

  
125
if ($savemsg) {
126
	print_info_box($savemsg, 'success');
124
if ($_POST['apply']) {
125
	print_apply_result_box($retval);
127 126
}
128 127

  
129 128
if (is_subsystem_dirty('natconf')) {
src/usr/local/www/firewall_nat_npt.php
69 69
	if ($_POST['apply']) {
70 70
		$retval = 0;
71 71
		$retval |= filter_configure();
72
		$savemsg = get_std_save_message($retval);
73 72

  
74 73
		if ($retval == 0) {
75 74
			clear_subsystem_dirty('natconf');
......
122 121
$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("NPt"));
123 122
include("head.inc");
124 123

  
125
if ($savemsg) {
126
	print_info_box($savemsg, 'success');
124
if ($_POST['apply']) {
125
	print_apply_result_box($retval);
127 126
}
128 127

  
129 128
if (is_subsystem_dirty('natconf')) {
src/usr/local/www/firewall_nat_out.php
82 82
	$retval = 0;
83 83
	$retval |= filter_configure();
84 84

  
85
	if (stristr($retval, "error") <> true) {
86
			$savemsg = get_std_save_message($retval);
87
	} else {
88
		$savemsg = $retval;
89
	}
90

  
91 85
	if ($retval == 0) {
92 86
		clear_subsystem_dirty('natconf');
93 87
		clear_subsystem_dirty('filter');
......
139 133
				}
140 134
			}
141 135
		}
142
		$savemsg = gettext("Default rules for each interface have been created.");
136
		$default_rules_msg = gettext("Default rules for each interface have been created.");
143 137
		unset($FilterIflist, $GatewaysList);
144 138
	}
145 139

  
......
206 200
$pgtitle = array(gettext("Firewall"), gettext("NAT"), gettext("Outbound"));
207 201
include("head.inc");
208 202

  
209
if ($savemsg) {
210
	print_info_box($savemsg, 'success');
203
if ($default_rules_msg) {
204
	print_info_box($default_rules_msg, 'success');
205
}
206

  
207
if ($_POST['apply']) {
208
	print_apply_result_box($retval);
211 209
}
212 210

  
213 211
if (is_subsystem_dirty('natconf')) {
src/usr/local/www/firewall_shaper.php
121 121
			}
122 122

  
123 123
			if (write_config()) {
124
				$changes_applied = true;
124 125
				$retval = 0;
125 126
				$retval |= filter_configure();
126

  
127
				if (stristr($retval, "error") <> true) {
128
					$savemsg = get_std_save_message($retval);
129
					$class = 'success';
130
				} else {
131
					$savemsg = $retval;
132
					$class = 'warning';
133
				}
134 127
			} else {
135
				$savemsg = gettext("Unable to write config.xml (Access Denied?).");
136
				$class = 'warning';
128
				$no_write_config_msg = gettext("Unable to write config.xml (Access Denied?).");
137 129
			}
138 130

  
139 131
			$dfltmsg = true;
......
280 272
		}
281 273
	} else if ($_POST['apply']) {
282 274
		write_config();
283

  
275
		$changes_applied = true;
284 276
		$retval = 0;
285
		$retval = filter_configure();
286

  
287
		if (stristr($retval, "error") <> true) {
288
			$savemsg = get_std_save_message($retval);
289
			$class = 'success';
290
		} else {
291
			$savemsg = $retval;
292
			$class = 'warning';
293
		}
277
		$retval |= filter_configure();
294 278

  
295 279
		/* reset rrd queues */
296 280
		system("rm -f /var/db/rrd/*queuedrops.rrd");
......
369 353
	print_input_errors($input_errors);
370 354
}
371 355

  
372
if ($savemsg) {
373
	print_info_box($savemsg, $class);
356
if ($no_write_config_msg) {
357
	print_info_box($no_write_config_msg, 'danger');
358
}
359

  
360
if ($changes_applied) {
361
	print_apply_result_box($retval);
374 362
}
375 363

  
376 364
if (is_subsystem_dirty('shaper')) {
src/usr/local/www/firewall_shaper_queues.php
167 167

  
168 168
	$retval = 0;
169 169
	/* Setup pf rules since the user may have changed the optimization value */
170
	$retval = filter_configure();
171
	$savemsg = get_std_save_message($retval);
172
	if (stristr($retval, "error") <> true) {
173
		$savemsg = get_std_save_message($retval);
174
		$class = 'alert-success';
175
	} else {
176
		$savemsg = $retval;
177
		$class = 'alert-danger';
178
	}
170
	$retval |= filter_configure();
179 171

  
180 172
	/* reset rrd queues */
181 173
	system("rm -f /var/db/rrd/*queuedrops.rrd");
......
198 190
	print_input_errors($input_errors);
199 191
}
200 192

  
201
if ($savemsg) {
202
	print_info_box($savemsg, $class);
193
if ($_POST['apply']) {
194
	print_apply_result_box($retval);
203 195
}
204 196

  
205 197
if (is_subsystem_dirty('shaper')) {
src/usr/local/www/firewall_shaper_vinterface.php
134 134
				}
135 135
			}
136 136
			if (write_config()) {
137
				$changes_applied = true;
137 138
				$retval = 0;
138
				$retval = filter_configure();
139

  
140
				if (stristr($retval, "error") != true) {
141
					$savemsg = get_std_save_message($retval);
142
					$class = 'success';
143
				} else {
144
					$savemsg = $retval;
145
					$class = 'danger';
146
				}
147

  
139
				$retval |= filter_configure();
148 140
			} else {
149
				$savemsg = gettext("Unable to write config.xml (Access Denied?).");
150
				$class = 'danger';
141
				$no_write_config_msg = gettext("Unable to write config.xml (Access Denied?).");
151 142
			}
152 143

  
153 144
			$dfltmsg = true;
......
271 262
	} else if ($_POST['apply']) {
272 263
		write_config();
273 264

  
265
		$changes_applied = true;
274 266
		$retval = 0;
275
		$retval = filter_configure();
276

  
277
		if (stristr($retval, "error") != true) {
278
			$savemsg = get_std_save_message($retval);
279
			$class = 'success';
280
		} else {
281
			$savemsg = $retval;
282
			$class = 'danger';
283
		}
267
		$retval |= filter_configure();
284 268

  
285 269
		/* XXX: TODO Make dummynet pretty graphs */
286 270
		//	enable_rrd_graphing();
......
369 353
	print_input_errors($input_errors);
370 354
}
371 355

  
372
if ($savemsg) {
373
	print_info_box($savemsg, $class);
356
if ($no_write_config_msg) {
357
	print_info_box($no_write_config_msg, 'danger');
358
}
359

  
360
if ($changes_applied) {
361
	print_apply_result_box($retval);
374 362
}
375 363

  
376 364
if (is_subsystem_dirty('shaper')) {
src/usr/local/www/firewall_shaper_wizards.php
42 42

  
43 43
	$retval = 0;
44 44
	/* Setup pf rules since the user may have changed the optimization value */
45
	$retval = filter_configure();
46
	if (stristr($retval, "error") <> true) {
47
		$savemsg = get_std_save_message($retval);
48
		$class = 'success';
49
	} else {
50
		$savemsg = $retval;
51
		$class = 'warning';
52
	}
45
	$retval |= filter_configure();
53 46

  
54 47
	/* reset rrd queues */
55 48
	unlink_if_exists("/var/db/rrd/*queuedrops.rrd");
......
82 75
$tab_array[] = array(gettext("Wizards"), true, "firewall_shaper_wizards.php");
83 76
display_top_tabs($tab_array);
84 77

  
85
if ($savemsg) {
86
	print_info_box($savemsg, $class);
78
if ($_POST['apply']) {
79
	print_apply_result_box($retval);
87 80
}
88 81

  
89 82
if (is_subsystem_dirty('shaper')) {
src/usr/local/www/firewall_virtual_ip.php
79 79

  
80 80
		$retval = 0;
81 81
		$retval |= filter_configure();
82
		$savemsg = get_std_save_message($retval);
83 82

  
84 83
		clear_subsystem_dirty('vip');
85 84
	}
......
240 239

  
241 240
if ($input_errors) {
242 241
	print_input_errors($input_errors);
243
} else if ($savemsg) {
244
	print_info_box($savemsg, 'success');
242
} else if ($_POST['apply']) {
243
	print_apply_result_box($retval);
245 244
} else if (is_subsystem_dirty('vip')) {
246 245
	print_apply_box(gettext("The VIP configuration has been changed.") . "<br />" . gettext("The changes must be applied for them to take effect."));
247 246
}
src/usr/local/www/guiconfig.inc
323 323
	print_info_box($msg, "warning", "apply", gettext("Apply Changes"), 'fa-check', 'success');
324 324
}
325 325

  
326
// Format and print a box reporting that changes have been applied
327
// $retval = status value from the functions called to apply the changes
328
// 0 is good
329
// non-zero is a problem
330
// $extra_text = optional extra text to display after the standard message
331
function print_apply_result_box($retval, $extra_text="") {
332
	$result_msg = get_std_save_message($retval);
333
	if ($retval === 0) {
334
		// 0 is success
335
		$severity = "success";
336
	} else {
337
		// non-zero means there was some problem
338
		$severity = "warning";
339
	}
340

  
341
	if (strlen($extra_text) > 0) {
342
		$result_msg .= " " . $extra_text;
343
	}
344
	print_info_box($result_msg, $severity);
345
}
346

  
326 347
/*
327 348
 * Print Bootstrap callout
328 349
 *
......
350 371
	echo $callout;
351 372
}
352 373

  
353
function get_std_save_message($ok) {
374
function get_std_save_message($retval) {
354 375
	$filter_related = false;
355 376
	$filter_pages = array("nat", "filter");
356
	$to_return = gettext("The changes have been applied successfully.");
377
	if ($retval === 0) {
378
		// 0 is success
379
		$to_return = gettext("The changes have been applied successfully.");
380
	} else {
381
		// non-zero means there was some problem
382
		$to_return = gettext("There was a problem applying the changes. See the <a href=\"status_logs.php\">System Logs</a>.");
383
	}
357 384
	foreach ($filter_pages as $fp) {
358 385
		if (stristr($_SERVER['SCRIPT_FILENAME'], $fp)) {
359 386
			$filter_related = true;
src/usr/local/www/interfaces.php
407 407

  
408 408
}
409 409

  
410
$changes_applied = false;
411

  
410 412
if ($_POST['apply']) {
411 413
	unset($input_errors);
412 414
	if (!is_subsystem_dirty('interfaces')) {
413 415
		$input_errors[] = gettext("The settings have already been applied!");
414 416
	} else {
417
		$retval = 0;
415 418
		unlink_if_exists("{$g['tmp_path']}/config.cache");
416 419
		clear_subsystem_dirty('interfaces');
417 420

  
......
440 443
			}
441 444
		}
442 445
		/* restart snmp so that it binds to correct address */
443
		services_snmpd_configure();
446
		$retval |= services_snmpd_configure();
444 447

  
445 448
		/* sync filter configuration */
446 449
		setup_gateways_monitor();
447 450

  
448 451
		clear_subsystem_dirty('interfaces');
449 452

  
450
		filter_configure();
453
		$retval |= filter_configure();
451 454

  
452 455
		enable_rrd_graphing();
453 456

  
457
		$changes_applied = true;
458

  
454 459
		if (is_subsystem_dirty('staticroutes') && (system_routing_configure() == 0)) {
455 460
			clear_subsystem_dirty('staticroutes');
456 461
		}
457 462
	}
458 463
	@unlink("{$g['tmp_path']}/.interfaces.apply");
459
	header("Location: interfaces.php?if={$if}");
460
	exit;
461 464
} else if ($_POST) {
462 465

  
463 466
	unset($input_errors);
......
1695 1698
					gettext("Don't forget to adjust the DHCP Server range if needed after applying."));
1696 1699
}
1697 1700

  
1698
if ($savemsg) {
1699
	print_info_box($savemsg, 'success');
1701
if ($changes_applied) {
1702
	print_apply_result_box($retval);
1700 1703
}
1701 1704

  
1702

  
1703 1705
$form = new Form();
1704 1706

  
1705 1707
$section = new Form_Section('General Configuration');
src/usr/local/www/interfaces_assign.php
244 244

  
245 245
		write_config();
246 246

  
247
		$savemsg = gettext("Interface has been added.");
247
		$action_msg = gettext("Interface has been added.");
248 248
		$class = "success";
249 249
	}
250 250

  
......
255 255
	} else {
256 256
		write_config();
257 257

  
258
		$retval = filter_configure();
259

  
260
		if (stristr($retval, "error") <> true) {
261
			$savemsg = get_std_save_message($retval);
262
			$class = "success";
263
		} else {
264
			$savemsg = $retval;
265
			$class = "danger";
266
		}
258
		$changes_applied = true;
259
		$retval = 0;
260
		$retval |= filter_configure();
267 261
	}
268 262

  
269 263
} else if (isset($_POST['Submit'])) {
......
438 432

  
439 433
			link_interface_to_vlans($realid, "update");
440 434

  
441
			$savemsg = gettext("Interface has been deleted.");
435
			$action_msg = gettext("Interface has been deleted.");
442 436
			$class = "success";
443 437
		}
444 438
	}
......
464 458
if (file_exists("/var/run/interface_mismatch_reboot_needed")) {
465 459
	if ($_POST) {
466 460
		if ($rebootingnow) {
467
			$savemsg = gettext("The system is now rebooting. Please wait.");
461
			$action_msg = gettext("The system is now rebooting. Please wait.");
468 462
			$class = "success";
469 463
		} else {
470 464
			$applymsg = gettext("Reboot is needed. Please apply the settings in order to reboot.");
471 465
			$class = "warning";
472 466
		}
473 467
	} else {
474
		$savemsg = gettext("Interface mismatch detected. Please resolve the mismatch, save and then click 'Apply Changes'. The firewall will reboot afterwards.");
468
		$action_msg = gettext("Interface mismatch detected. Please resolve the mismatch, save and then click 'Apply Changes'. The firewall will reboot afterwards.");
475 469
		$class = "warning";
476 470
	}
477 471
}
......
482 476
	echo "<br /></p>\n";
483 477
} elseif ($applymsg) {
484 478
	print_apply_box($applymsg);
485
} elseif ($savemsg) {
486
	print_info_box($savemsg, $class);
479
} elseif ($action_msg) {
480
	print_info_box($action_msg, $class);
481
} elseif ($changes_applied) {
482
	print_apply_result_box($retval);
487 483
}
488 484

  
489 485
pfSense_handle_custom_code("/usr/local/pkg/interfaces_assign/pre_input_errors");
src/usr/local/www/load_balancer_monitor.php
43 43
		$retval |= filter_configure();
44 44
		$retval |= relayd_configure();
45 45

  
46
		$savemsg = get_std_save_message($retval);
47 46
		clear_subsystem_dirty('loadbalancer');
48 47
	}
49 48
}
......
79 78
	print_input_errors($input_errors);
80 79
}
81 80

  
82
if ($savemsg) {
83
	print_info_box($savemsg, 'success');
81
if ($_POST['apply']) {
82
	print_apply_result_box($retval);
84 83
}
85 84

  
86 85
if (is_subsystem_dirty('loadbalancer')) {
src/usr/local/www/load_balancer_pool.php
47 47
		$retval |= filter_configure();
48 48
		$retval |= relayd_configure();
49 49

  
50
		$savemsg = get_std_save_message($retval);
51 50
		clear_subsystem_dirty('loadbalancer');
52 51
	}
53 52
}
......
93 92
	print_input_errors($input_errors);
94 93
}
95 94

  
96
if ($savemsg) {
97
	print_info_box($savemsg, 'success');
95
if ($_POST['apply']) {
96
	print_apply_result_box($retval);
98 97
}
99 98

  
100 99
if (is_subsystem_dirty('loadbalancer')) {
src/usr/local/www/load_balancer_setting.php
46 46
		$retval |= filter_configure();
47 47
		$retval |= relayd_configure();
48 48

  
49
		$savemsg = get_std_save_message($retval);
50 49
		clear_subsystem_dirty('loadbalancer');
51 50
	} else {
52 51
		unset($input_errors);
......
92 91
	print_input_errors($input_errors);
93 92
}
94 93

  
95
if ($savemsg) {
96
	print_info_box($savemsg, 'success');
94
if ($_POST['apply']) {
95
	print_apply_result_box($retval);
97 96
}
98 97

  
99 98
if (is_subsystem_dirty('loadbalancer')) {
src/usr/local/www/load_balancer_virtual_server.php
45 45
		$retval = 0;
46 46
		$retval |= filter_configure();
47 47
		$retval |= relayd_configure();
48
		$savemsg = get_std_save_message($retval);
49 48
		/* Wipe out old relayd anchors no longer in use. */
50 49
		cleanup_lb_marked();
51 50
		clear_subsystem_dirty('loadbalancer');
......
113 112
	print_input_errors($input_errors);
114 113
}
115 114

  
116
if ($savemsg) {
117
	print_info_box($savemsg, 'success');
115
if ($_POST['apply']) {
116
	print_apply_result_box($retval);
118 117
}
119 118

  
120 119
if (is_subsystem_dirty('loadbalancer')) {
src/usr/local/www/services_captiveportal_mac.php
76 76
				mwexec("/sbin/ipfw {$g['tmp_path']}/passthrumac_gui");
77 77
				@unlink("{$g['tmp_path']}/passthrumac_gui");
78 78
			}
79
			$savemsg = get_std_save_message($retval);
80 79
			if ($retval == 0) {
81 80
				clear_subsystem_dirty('passthrumac');
82 81
			}
......
152 151

  
153 152
include("head.inc");
154 153

  
155
if ($savemsg) {
156
	print_info_box($savemsg, 'success');
154
if ($_POST['apply']) {
155
	print_apply_result_box($retval);
157 156
}
158 157

  
159 158
if (is_subsystem_dirty('passthrumac')) {
src/usr/local/www/services_dhcp.php
610 610
}
611 611

  
612 612
if ((isset($_POST['save']) || isset($_POST['apply'])) && (!$input_errors)) {
613
	$changes_applied = true;
613 614
	$retval = 0;
614 615
	$retvaldhcp = 0;
615 616
	$retvaldns = 0;
616 617
	/* dnsmasq_configure calls dhcpd_configure */
617 618
	/* no need to restart dhcpd twice */
618 619
	if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic']))	{
619
		$retvaldns = services_dnsmasq_configure();
620
		$retvaldns |= services_dnsmasq_configure();
620 621
		if ($retvaldns == 0) {
621 622
			clear_subsystem_dirty('hosts');
622 623
			clear_subsystem_dirty('staticmaps');
623 624
		}
624 625
	} else if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
625
		$retvaldns = services_unbound_configure();
626
		$retvaldns |= services_unbound_configure();
626 627
		if ($retvaldns == 0) {
627 628
			clear_subsystem_dirty('unbound');
628 629
			clear_subsystem_dirty('hosts');
629 630
			clear_subsystem_dirty('staticmaps');
630 631
		}
631 632
	} else {
632
		$retvaldhcp = services_dhcpd_configure();
633
		$retvaldhcp |= services_dhcpd_configure();
633 634
		if ($retvaldhcp == 0) {
634 635
			clear_subsystem_dirty('staticmaps');
635 636
		}
636 637
	}
637 638
	if ($dhcpd_enable_changed) {
638
		$retvalfc = filter_configure();
639
		$retvalfc |= filter_configure();
639 640
	}
640 641

  
641 642
	if ($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1) {
642 643
		$retval = 1;
643 644
	}
644

  
645
	$savemsg = get_std_save_message($retval);
646 645
}
647 646

  
648 647
if ($act == "delpool") {
......
733 732
	print_input_errors($input_errors);
734 733
}
735 734

  
736
if ($savemsg) {
737
	print_info_box($savemsg, 'success');
735
if ($changes_applied) {
736
	print_apply_result_box($retval);
738 737
}
739 738

  
740 739
if (is_subsystem_dirty('staticmaps')) {
src/usr/local/www/services_dhcp_relay.php
114 114

  
115 115
		write_config();
116 116

  
117
		$changes_applied = true;
117 118
		$retval = 0;
118
		$retval = services_dhcrelay_configure();
119
		$savemsg = get_std_save_message($retval);
120
		filter_configure();
119
		$retval |= services_dhcrelay_configure();
120
		$retval |= filter_configure();
121 121
	}
122 122
}
123 123

  
......
135 135
	print_input_errors($input_errors);
136 136
}
137 137

  
138
if ($savemsg) {
139
	print_info_box($savemsg, 'success');
138
if ($changes_applied) {
139
	print_apply_result_box($retval);
140 140
}
141 141

  
142 142
$form = new Form;
src/usr/local/www/services_dhcpv6.php
44 44
	/* dnsmasq_configure calls dhcpd_configure */
45 45
	/* no need to restart dhcpd twice */
46 46
	if (isset($config['dnsmasq']['enable']) && isset($config['dnsmasq']['regdhcpstatic']))	{
47
		$retvaldns = services_dnsmasq_configure();
47
		$retvaldns |= services_dnsmasq_configure();
48 48
		if ($retvaldns == 0) {
49 49
			clear_subsystem_dirty('hosts');
50 50
			clear_subsystem_dirty('staticmaps');
51 51
		}
52 52
	} else if (isset($config['unbound']['enable']) && isset($config['unbound']['regdhcpstatic'])) {
53
		$retvaldns = services_unbound_configure();
53
		$retvaldns |= services_unbound_configure();
54 54
		if ($retvaldns == 0) {
55 55
			clear_subsystem_dirty('unbound');
56 56
			clear_subsystem_dirty('staticmaps');
57 57
		}
58 58
	} else {
59
		$retvaldhcp = services_dhcpd_configure();
59
		$retvaldhcp |= services_dhcpd_configure();
60 60
		if ($retvaldhcp == 0) {
61 61
			clear_subsystem_dirty('staticmaps');
62 62
		}
63 63
	}
64 64
	if ($dhcpdv6_enable_changed) {
65
		$retvalfc = filter_configure();
65
		$retvalfc |= filter_configure();
66 66
	}
67 67
	if ($retvaldhcp == 1 || $retvaldns == 1 || $retvalfc == 1) {
68 68
		$retval = 1;
69 69
	}
70
	return get_std_save_message($retval);
70
	return $retval;
71 71
}
72 72

  
73 73
if (!$g['services_dhcp_server_enable']) {
......
184 184
}
185 185

  
186 186
if (isset($_POST['apply'])) {
187
	$savemsg = dhcpv6_apply_changes(false);
187
	$changes_applied = true;
188
	$retval = dhcpv6_apply_changes(false);
188 189
} elseif (isset($_POST['save'])) {
189 190
	unset($input_errors);
190 191

  
......
459 460

  
460 461
		write_config();
461 462

  
462
		$savemsg = dhcpv6_apply_changes($dhcpdv6_enable_changed);
463
		$changes_applied = true;
464
		$retval = dhcpv6_apply_changes($dhcpdv6_enable_changed);
463 465
	}
464 466
}
465 467

  
......
492 494
	print_input_errors($input_errors);
493 495
}
494 496

  
495
if ($savemsg) {
496
	print_info_box($savemsg, 'success');
497
if ($changes_applied) {
498
	print_apply_result_box($retval);
497 499
}
498 500

  
499 501
if (is_subsystem_dirty('staticmaps')) {
src/usr/local/www/services_dhcpv6_relay.php
115 115

  
116 116
		write_config();
117 117

  
118
		$changes_applied = true;
118 119
		$retval = 0;
119
		$retval = services_dhcrelay6_configure();
120
		$savemsg = get_std_save_message($retval);
120
		$retval |= services_dhcrelay6_configure();
121 121
	}
122 122
}
123 123

  
......
135 135
	print_input_errors($input_errors);
136 136
}
137 137

  
138
if ($savemsg) {
139
	print_info_box($savemsg, 'success');
138
if ($changes_applied) {
139
	print_apply_result_box($retval);
140 140
}
141 141

  
142 142
$form = new Form;
src/usr/local/www/services_dnsmasq.php
113 113
if ($_POST) {
114 114
	if ($_POST['apply']) {
115 115
		$retval = 0;
116
		$retval = services_dnsmasq_configure();
117
		$savemsg = get_std_save_message($retval);
116
		$retval |= services_dnsmasq_configure();
118 117

  
119 118
		// Reload filter (we might need to sync to CARP hosts)
120 119
		filter_configure();
......
232 231
	print_input_errors($input_errors);
233 232
}
234 233

  
235
if ($savemsg) {
236
	print_info_box($savemsg, 'success');
234
if ($_POST['apply']) {
235
	print_apply_result_box($retval);
237 236
}
238 237

  
239 238
if (is_subsystem_dirty('hosts')) {
src/usr/local/www/services_igmpproxy.php
42 42
if ($_POST) {
43 43
	$pconfig = $_POST;
44 44

  
45
	$changes_applied = true;
45 46
	$retval = 0;
46 47
	/* reload all components that use igmpproxy */
47
	$retval = services_igmpproxy_configure();
48

  
49
	if (stristr($retval, "error") <> true) {
50
		$savemsg = get_std_save_message($retval);
51
	} else {
52
		$savemsg = $retval;
53
	}
48
	$retval |= services_igmpproxy_configure();
54 49

  
55 50
	clear_subsystem_dirty('igmpproxy');
56 51
}
......
68 63
$pgtitle = array(gettext("Services"), gettext("IGMP Proxy"));
69 64
include("head.inc");
70 65

  
71
if ($savemsg) {
72
	print_info_box($savemsg, 'success');
66
if ($changes_applied) {
67
	print_apply_result_box($retval);
73 68
}
74 69

  
75 70
if (is_subsystem_dirty('igmpproxy')) {
src/usr/local/www/services_ntpd.php
151 151

  
152 152
		write_config("Updated NTP Server Settings");
153 153

  
154
		$changes_applied = true;
154 155
		$retval = 0;
155
		$retval = system_ntp_configure();
156
		$savemsg = get_std_save_message($retval);
156
		$retval |= system_ntp_configure();
157 157
	}
158 158
}
159 159

  
......
192 192
if ($input_errors) {
193 193
	print_input_errors($input_errors);
194 194
}
195
if ($savemsg) {
196
	print_info_box($savemsg, 'success');
195

  
196
if ($changes_applied) {
197
	print_apply_result_box($retval);
197 198
}
198 199

  
199 200
$tab_array = array();
src/usr/local/www/services_ntpd_acls.php
150 150

  
151 151
		write_config("Updated NTP ACL Settings");
152 152

  
153
		$changes_applied = true;
153 154
		$retval = 0;
154
		$retval = system_ntp_configure();
155
		$savemsg = get_std_save_message($retval);
155
		$retval |= system_ntp_configure();
156 156
	}
157 157
}
158 158

  
......
165 165
if ($input_errors) {
166 166
	print_input_errors($input_errors);
167 167
}
168
if ($savemsg) {
169
	print_info_box($savemsg, 'success');
168

  
169
if ($changes_applied) {
170
	print_apply_result_box($retval);
170 171
}
171 172

  
172 173
$tab_array = array();
src/usr/local/www/services_ntpd_gps.php
154 154

  
155 155
	write_config(gettext("Updated NTP GPS Settings"));
156 156

  
157
	$retval = system_ntp_configure();
158
	$savemsg = get_std_save_message($retval);
157
	$changes_applied = true;
158
	$retval = 0;
159
	$retval |= system_ntp_configure();
159 160
} else {
160 161
	/* set defaults if they do not already exist */
161 162
	if (!is_array($config['ntpd']) || !is_array($config['ntpd']['gps']) || empty($config['ntpd']['gps']['type'])) {
......
192 193
$shortcut_section = "ntp";
193 194
include("head.inc");
194 195

  
196
if ($changes_applied) {
197
	print_apply_result_box($retval);
198
}
199

  
195 200
$tab_array = array();
196 201
$tab_array[] = array(gettext("Settings"), false, "services_ntpd.php");
197 202
$tab_array[] = array(gettext("ACLs"), false, "services_ntpd_acls.php");
src/usr/local/www/services_ntpd_pps.php
91 91

  
92 92
		write_config("Updated NTP PPS Settings");
93 93

  
94
		$changes_applied = true;
94 95
		$retval = 0;
95
		$retval = system_ntp_configure();
96
		$savemsg = get_std_save_message($retval);
96
		$retval |= system_ntp_configure();
97 97
	}
98 98
}
99 99

  
......
107 107
    print_input_errors($input_errors);
108 108
}
109 109

  
110
if ($savemsg) {
111
    print_info_box($savemsg, 'success');
110
if ($changes_applied) {
111
	print_apply_result_box($retval);
112 112
}
113 113

  
114 114
$tab_array = array();
src/usr/local/www/services_pppoe.php
59 59
		}
60 60
		$retval = 0;
61 61
		$retval |= filter_configure();
62
		$savemsg = get_std_save_message($retval);
63 62
		clear_subsystem_dirty('vpnpppoe');
64 63
	}
65 64
}
......
83 82
$shortcut_section = "pppoes";
84 83
include("head.inc");
85 84

  
86
if ($savemsg) {
87
	print_info_box($savemsg, 'success');
85
if ($_POST['apply']) {
86
	print_apply_result_box($retval);
88 87
}
89 88

  
90 89
if (is_subsystem_dirty('vpnpppoe')) {
src/usr/local/www/services_router_advertisements.php
54 54
}
55 55

  
56 56
if (!$_GET['if']) {
57
	$savemsg = gettext("The DHCPv6 Server can only be enabled on interfaces configured with static, non unique local IP addresses.") . "<br />" .
57
	$info_msg = gettext("The DHCPv6 Server can only be enabled on interfaces configured with static, non unique local IP addresses.") . "<br />" .
58 58
	    gettext("Only interfaces configured with a static IP will be shown.");
59 59
}
60 60

  
......
243 243
		}
244 244

  
245 245
		write_config();
246
		$retval = services_radvd_configure();
247
		$savemsg = get_std_save_message($retval);
246
		$changes_applied = true;
247
		$retval = 0;
248
		$retval |= services_radvd_configure();
248 249
	}
249 250
}
250 251

  
......
261 262
	print_input_errors($input_errors);
262 263
}
263 264

  
264
if ($savemsg) {
265
	print_info_box($savemsg, 'success');
265
if ($changes_applied) {
266
	print_apply_result_box($retval);
267
}
268

  
269
if ($info_msg) {
270
	print_info_box($info_msg, 'success');
266 271
}
267 272

  
268 273
/* active tabs */
src/usr/local/www/services_snmp.php
161 161

  
162 162
		write_config();
163 163

  
164
		$changes_applied = true;
164 165
		$retval = 0;
165
		$retval = services_snmpd_configure();
166
		$savemsg = get_std_save_message($retval);
166
		$retval |= services_snmpd_configure();
167 167
	}
168 168
}
169 169

  
......
200 200
	print_input_errors($input_errors);
201 201
}
202 202

  
203
if ($savemsg) {
204
	print_info_box($savemsg, 'success');
203
if ($changes_applied) {
204
	print_apply_result_box($retval);
205 205
}
206 206

  
207 207
$form = new Form();
src/usr/local/www/services_unbound.php
88 88

  
89 89
if ($_POST) {
90 90
	if ($_POST['apply']) {
91
		$retval = services_unbound_configure();
92
		$savemsg = get_std_save_message($retval);
91
		$retval = 0;
92
		$retval |= services_unbound_configure();
93 93
		if ($retval == 0) {
94 94
			clear_subsystem_dirty('unbound');
95 95
		}
......
244 244
	print_input_errors($input_errors);
245 245
}
246 246

  
247
if ($savemsg) {
248
	print_info_box($savemsg, 'success');
247
if ($_POST['apply']) {
248
	print_apply_result_box($retval);
249 249
}
250 250

  
251 251
if (is_subsystem_dirty('unbound')) {
src/usr/local/www/services_unbound_acls.php
99 99
	}
100 100

  
101 101
	if ($_POST['apply']) {
102
		$retval = services_unbound_configure();
103
		$savemsg = get_std_save_message($retval);
102
		$retval = 0;
103
		$retval |= services_unbound_configure();
104 104
		if ($retval == 0) {
105 105
			clear_subsystem_dirty('unbound');
106 106
		}
......
185 185
	print_input_errors($input_errors);
186 186
}
187 187

  
188
if ($savemsg) {
189
	print_info_box($savemsg, 'success');
188
if ($_POST['apply']) {
189
	print_apply_result_box($retval);
190 190
}
191 191

  
192 192
if (is_subsystem_dirty('unbound')) {
src/usr/local/www/services_unbound_advanced.php
77 77

  
78 78
if ($_POST) {
79 79
	if ($_POST['apply']) {
80
		$retval = services_unbound_configure();
81
		$savemsg = get_std_save_message($retval);
80
		$retval = 0;
81
		$retval |= services_unbound_configure();
82 82
		if ($retval == 0) {
83 83
			clear_subsystem_dirty('unbound');
84 84
		}
......
192 192
	print_input_errors($input_errors);
193 193
}
194 194

  
195
if ($savemsg) {
196
	print_info_box($savemsg, 'success');
195
if ($_POST['apply']) {
196
	print_apply_result_box($retval);
197 197
}
198 198

  
199 199
if (is_subsystem_dirty('unbound')) {
src/usr/local/www/status_lb_pool.php
68 68
		$retval = 0;
69 69
		$retval |= filter_configure();
70 70
		$retval |= relayd_configure();
71
		$savemsg = get_std_save_message($retval);
72 71
		clear_subsystem_dirty('loadbalancer');
73 72
	} else {
74 73
		/* Keep a list of servers we find in POST variables */
......
110 109
	print_apply_box(gettext("The load balancer configuration has been changed.") . "<br />" . gettext("The changes must be applied for them to take effect."));
111 110
}
112 111

  
112
if ($_POST['apply']) {
113
	print_apply_result_box($retval);
114
}
115

  
113 116
/* active tabs */
114 117
$tab_array = array();
115 118
$tab_array[] = array(gettext("Pools"), true, "status_lb_pool.php");
src/usr/local/www/status_logs.php
99 99
}
100 100
include("head.inc");
101 101

  
102
if (!$input_errors && $savemsg) {
103
	print_info_box($savemsg, 'success');
102
if ($changes_applied) {
103
	print_apply_result_box($retval, $extra_save_msg);
104 104
	$manage_log_active = false;
105 105
}
106 106

  
src/usr/local/www/status_logs_common.inc
584 584
		return;
585 585
	}
586 586

  
587
	global $logfile, $specific_log, $config, $pconfig, $save_settings, $input_errors, $savemsg;
587
	global $logfile, $specific_log, $config, $pconfig, $save_settings, $input_errors, $extra_save_msg, $retval, $changes_applied;
588 588

  
589
	$changes_applied = false;
590
	$extra_save_msg = "";
589 591
	$specific_log = basename($logfile) . '_settings';
590 592

  
591 593
	// Common to All Logs
......
711 713
				}
712 714
			}
713 715

  
716
			$retval = 0;
714 717

  
715 718
		// If any of the logging settings were changed then backup and sync (standard write_config).  Otherwise only write config (don't backup, don't sync).
716
		if ($logging_changed) {
717
			write_config($desc = gettext("Log Display Settings Saved: ") . gettext($allowed_logs[$logfile]["name"]), $backup = true, $write_config_only = false);
718
			$retval = 0;
719
			$retval = system_syslogd_start();
720
			$savemsg = gettext("The changes have been applied successfully.");
721
		} else {
722
			write_config($desc = gettext("Log Display Settings Saved (no backup, no sync): ") . gettext($allowed_logs[$logfile]["name"]), $backup = false, $write_config_only = true);
723
			$savemsg = '';
724
		}
719
			if ($logging_changed) {
720
				write_config($desc = gettext("Log Display Settings Saved: ") . gettext($allowed_logs[$logfile]["name"]), $backup = true, $write_config_only = false);
721
				$changes_applied = true;
722
				$retval |= system_syslogd_start();
723
			} else {
724
				write_config($desc = gettext("Log Display Settings Saved (no backup, no sync): ") . gettext($allowed_logs[$logfile]["name"]), $backup = false, $write_config_only = true);
725
			}
725 726

  
726 727
		// Specific to System General (main) Log
727
		if ($logfile == 'system') {
728
			if ($nginx_logging_changed) {
729
				ob_flush();
730
				flush();
731
				log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
732
				send_event("service restart webgui");
733
				$savemsg .= "<br />" . gettext("WebGUI process is restarting.");
728
			if ($logfile == 'system') {
729
				if ($nginx_logging_changed) {
730
					ob_flush();
731
					flush();
732
					log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
733
					send_event("service restart webgui");
734
					$extra_save_msg = gettext("WebGUI process is restarting.");
735
				}
734 736
			}
735
		}
736 737

  
737 738
		// Specific to Firewall Log
738 739
			if ($logfile == 'filter') {
739 740
				if ($firewall_logging_changed) {
740 741
					require_once("filter.inc");
742
					$changes_applied = true;
741 743
					$retval |= filter_configure();
742 744
					filter_pflog_start(true);
743

  
744
					$savemsg = get_std_save_message($retval);
745 745
				}
746 746
			}
747 747
		}
src/usr/local/www/status_logs_filter.php
102 102
$pgtitle = array(gettext("Status"), gettext("System Logs"), gettext($allowed_logs[$logfile]["name"]), $view_title);
103 103
include("head.inc");
104 104

  
105
if (!$input_errors && $savemsg) {
106
	print_info_box($savemsg, 'success');
105
if ($changes_applied) {
106
	print_apply_result_box($retval, $extra_save_msg);
107 107
	$manage_log_active = false;
108 108
}
109 109

  
110

  
111 110
// Tab Array
112 111
tab_array_logs_common();
113 112

  
src/usr/local/www/status_logs_filter_dynamic.php
82 82
$pgtitle = array(gettext("Status"), gettext("System Logs"), gettext($allowed_logs[$logfile]["name"]), $view_title);
83 83
include("head.inc");
84 84

  
85
if (!$input_errors && $savemsg) {
86
	print_info_box($savemsg, 'success');
85
if ($changes_applied) {
86
	print_apply_result_box($retval, $extra_save_msg);
87 87
	$manage_log_active = false;
88 88
}
89 89

  
90

  
91 90
// Tab Array
92 91
tab_array_logs_common();
93 92

  
src/usr/local/www/status_logs_filter_summary.php
67 67
$pgtitle = array(gettext("Status"), gettext("System Logs"), gettext($allowed_logs[$logfile]["name"]), $view_title);
68 68
include("head.inc");
69 69

  
70
if (!$input_errors && $savemsg) {
71
	print_info_box($savemsg, 'success');
70
if ($changes_applied) {
71
	print_apply_result_box($retval, $extra_save_msg);
72 72
	$manage_log_active = false;
73 73
}
74 74

  
75

  
76 75
// Tab Array
77 76
tab_array_logs_common();
78 77

  
src/usr/local/www/status_logs_settings.php
80 80

  
81 81
if ($_POST['resetlogs'] == gettext("Reset Log Files")) {
82 82
	clear_all_log_files(true);
83
	$savemsg .= gettext("The log files have been reset.");
83
	$reset_msg = gettext("The log files have been reset.");
84 84
} elseif ($_POST) {
85 85
	unset($input_errors);
86 86
	$pconfig = $_POST;
......
162 162

  
163 163
		write_config();
164 164

  
165
		$changes_applied = true;
165 166
		$retval = 0;
166
		$retval = system_syslogd_start();
167
		$retval |= system_syslogd_start();
167 168
		if (($oldnologdefaultblock !== isset($config['syslog']['nologdefaultblock'])) ||
168 169
		    ($oldnologdefaultpass !== isset($config['syslog']['nologdefaultpass'])) ||
169 170
		    ($oldnologbogons !== isset($config['syslog']['nologbogons'])) ||
......
171 172
			$retval |= filter_configure();
172 173
		}
173 174

  
174
		$savemsg = get_std_save_message($retval);
175

  
176 175
		if ($oldnolognginx !== isset($config['syslog']['nolognginx'])) {
177 176
			ob_flush();
178 177
			flush();
179 178
			log_error(gettext("webConfigurator configuration has changed. Restarting webConfigurator."));
180 179
			send_event("service restart webgui");
181
			$savemsg .= "<br />" . gettext("WebGUI process is restarting.");
180
			$extra_save_msg = gettext("WebGUI process is restarting.");
182 181
		}
183 182

  
184 183
		filter_pflog_start(true);
......
204 203
	print_input_errors($input_errors);
205 204
}
206 205

  
207
if ($savemsg) {
208
	print_info_box($savemsg, 'success');
206
if ($reset_msg) {
207
	print_info_box($reset_msg, 'success');
208
}
209

  
210
if ($changes_applied) {
211
	print_apply_result_box($retval, $extra_save_msg);
209 212
}
210 213

  
211 214
$tab_array = array();
src/usr/local/www/system.php
314 314
			write_config($changedesc);
315 315
		}
316 316

  
317
		$changes_applied = true;
317 318
		$retval = 0;
318
		$retval = system_hostname_configure();
319
		$retval |= system_hostname_configure();
319 320
		$retval |= system_hosts_generate();
320 321
		$retval |= system_resolvconf_generate();
321 322
		if (isset($config['dnsmasq']['enable'])) {
......
332 333

  
333 334
		// Reload the filter - plugins might need to be run.
334 335
		$retval |= filter_configure();
335

  
336
		$savemsg = get_std_save_message($retval);
337 336
	}
338 337

  
339 338
	unset($ignore_posted_dnsgw);
......
346 345
	print_input_errors($input_errors);
347 346
}
348 347

  
349
if ($savemsg) {
350
	print_info_box($savemsg, 'success');
348
if ($changes_applied) {
349
	print_apply_result_box($retval);
351 350
}
352 351
?>
353 352
<div id="container">
src/usr/local/www/system_advanced_admin.php
263 263

  
264 264
		write_config();
265 265

  
266
		$retval = filter_configure();
267
		$savemsg = get_std_save_message($retval);
266
		$changes_applied = true;
267
		$retval = 0;
268
		$retval |= filter_configure();
268 269

  
269 270
		if ($restart_webgui) {
270
			$savemsg .= sprintf("<br />" . gettext("One moment...redirecting to %s in 20 seconds."), $url);
271
			$extra_save_msg = sprintf("<br />" . gettext("One moment...redirecting to %s in 20 seconds."), $url);
271 272
		}
272 273

  
273 274
		setup_serial_port();
......
287 288
	print_input_errors($input_errors);
288 289
}
289 290

  
290
if ($savemsg) {
291
	print_info_box($savemsg, 'success');
291
if ($changes_applied) {
292
	print_apply_result_box($retval, $extra_save_msg);
292 293
}
293 294

  
294 295
$tab_array = array();
src/usr/local/www/system_advanced_firewall.php
356 356
			killbypid("{$g['varrun_path']}/filterdns.pid");
357 357
		}
358 358

  
359
		$changes_applied = true;
359 360
		$retval = 0;
360
		$retval = filter_configure();
361
		if (stristr($retval, "error") <> true) {
362
			$savemsg = get_std_save_message($retval);
363
			$class = 'success';
364
		} else {
365
			$savemsg = $retval;
366
			$class = 'warning';
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff