Project

General

Profile

« Previous | Next » 

Revision 209ae186

Added by Jim Pingle almost 7 years ago

Validation for GUI custom settings. Fixes #8726

Add validation for customizable GUI setting fields and test submitted
values before allowing them to be stored.
Also ensure that dashboardcolumns is an integer before using it in the
GUI.

(cherry picked from commit 9ceace2562e718b9b460633847c12050fff96640)
(cherry picked from commit db7f2719b747da77805972f797c23654518d438e)

View differences:

src/usr/local/www/system.php
190 190

  
191 191
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
192 192

  
193
//	if ($_POST['dashboardperiod']) {
194
//		$config['widgets']['period'] = $_POST['dashboardperiod'];
195
//	}
196

  
197
	if ($_POST['webguicss']) {
198
		$config['system']['webgui']['webguicss'] = $_POST['webguicss'];
199
	} else {
200
		unset($config['system']['webgui']['webguicss']);
201
	}
202

  
203

  
204
	if ($_POST['logincss']) {
205
		$config['system']['webgui']['logincss'] = $_POST['logincss'];
206
	} else {
207
		unset($config['system']['webgui']['logincss']);
208
	}
209

  
210
	$config['system']['webgui']['loginshowhost'] = $_POST['loginshowhost'] ? true:false;
211

  
212
	if ($_POST['webguifixedmenu']) {
213
		$config['system']['webgui']['webguifixedmenu'] = $_POST['webguifixedmenu'];
214
	} else {
215
		unset($config['system']['webgui']['webguifixedmenu']);
216
	}
217

  
218
	if ($_POST['webguihostnamemenu']) {
219
		$config['system']['webgui']['webguihostnamemenu'] = $_POST['webguihostnamemenu'];
220
	} else {
221
		unset($config['system']['webgui']['webguihostnamemenu']);
222
	}
223

  
224
	if ($_POST['dashboardcolumns']) {
225
		$config['system']['webgui']['dashboardcolumns'] = $_POST['dashboardcolumns'];
226
	} else {
227
		unset($config['system']['webgui']['dashboardcolumns']);
228
	}
229

  
230
	$config['system']['webgui']['requirestatefilter'] = $_POST['requirestatefilter'] ? true : false;
231

  
232 193
	if ($_POST['hostname']) {
233 194
		if (!is_hostname($_POST['hostname'])) {
234 195
			$input_errors[] = gettext("The hostname can only contain the characters A-Z, 0-9 and '-'. It may not start or end with '-'.");
......
241 202
	if ($_POST['domain'] && !is_domain($_POST['domain'])) {
242 203
		$input_errors[] = gettext("The domain may only contain the characters a-z, 0-9, '-' and '.'.");
243 204
	}
205
	validate_webguicss_field($input_errors, $_POST['webguicss']);
206
	validate_webguifixedmenu_field($input_errors, $_POST['webguifixedmenu']);
207
	validate_webguihostnamemenu_field($input_errors, $_POST['webguihostnamemenu']);
208
	validate_dashboardcolumns_field($input_errors, $_POST['dashboardcolumns']);
244 209

  
245 210
	$dnslist = $ignore_posted_dnsgw = array();
246 211

  
......
335 300
		unset($config['system']['webgui']['statusmonitoringsettingspanel']);
336 301
		$config['system']['webgui']['statusmonitoringsettingspanel'] = $_POST['statusmonitoringsettingspanel'] ? true : false;
337 302

  
303
//		if ($_POST['dashboardperiod']) {
304
//			$config['widgets']['period'] = $_POST['dashboardperiod'];
305
//		}
306

  
307
		if ($_POST['webguicss']) {
308
			$config['system']['webgui']['webguicss'] = $_POST['webguicss'];
309
		} else {
310
			unset($config['system']['webgui']['webguicss']);
311
		}
312

  
313
		$config['system']['webgui']['roworderdragging'] = $_POST['roworderdragging'] ? true:false;
314

  
315
		if ($_POST['logincss']) {
316
			$config['system']['webgui']['logincss'] = $_POST['logincss'];
317
		} else {
318
			unset($config['system']['webgui']['logincss']);
319
		}
320

  
321
		$config['system']['webgui']['loginshowhost'] = $_POST['loginshowhost'] ? true:false;
322

  
323
		if ($_POST['webguifixedmenu']) {
324
			$config['system']['webgui']['webguifixedmenu'] = $_POST['webguifixedmenu'];
325
		} else {
326
			unset($config['system']['webgui']['webguifixedmenu']);
327
		}
328

  
329
		if ($_POST['webguihostnamemenu']) {
330
			$config['system']['webgui']['webguihostnamemenu'] = $_POST['webguihostnamemenu'];
331
		} else {
332
			unset($config['system']['webgui']['webguihostnamemenu']);
333
		}
334

  
335
		if ($_POST['dashboardcolumns']) {
336
			$config['system']['webgui']['dashboardcolumns'] = $_POST['dashboardcolumns'];
337
		} else {
338
			unset($config['system']['webgui']['dashboardcolumns']);
339
		}
340

  
341
		$config['system']['webgui']['requirestatefilter'] = $_POST['requirestatefilter'] ? true : false;
342

  
338 343
		/* XXX - billm: these still need updating after figuring out how to check if they actually changed */
339 344
		$olddnsservers = $config['system']['dnsserver'];
340 345
		unset($config['system']['dnsserver']);

Also available in: Unified diff