Project

General

Profile

« Previous | Next » 

Revision 3e4f5a33

Added by Jim Pingle almost 15 years ago

Protect against PHP errors if the interface list is empty

View differences:

usr/local/www/services_captiveportal.php
117 117
		do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
118 118

  
119 119
		/* make sure no interfaces are bridged */
120
		foreach ($pconfig['cinterface'] as $cpbrif)
121
			if (link_interface_to_bridge($cpbrif)) 
122
				$input_errors[] = sprintf(gettext("The captive portal cannot be used on interface %s since it is part of a bridge."), $cpbrif);
120
		if (is_array($_POST['cinterface']))
121
			foreach ($pconfig['cinterface'] as $cpbrif)
122
				if (link_interface_to_bridge($cpbrif))
123
					$input_errors[] = sprintf(gettext("The captive portal cannot be used on interface %s since it is part of a bridge."), $cpbrif);
123 124

  
124 125
		if ($_POST['httpslogin_enable']) {
125 126
		 	if (!$_POST['cert'] || !$_POST['key']) {
......
169 170
	}
170 171

  
171 172
	if (!$input_errors) {
172
		$config['captiveportal']['interface'] = implode(",", $_POST['cinterface']);
173
		if (is_array($_POST['cinterface']))
174
			$config['captiveportal']['interface'] = implode(",", $_POST['cinterface']);
173 175
		$config['captiveportal']['maxproc'] = $_POST['maxproc'];
174 176
		$config['captiveportal']['maxprocperip'] = $_POST['maxprocperip'] ? $_POST['maxprocperip'] : false;
175 177
		$config['captiveportal']['timeout'] = $_POST['timeout'];
......
222 224

  
223 225
		$savemsg = get_std_save_message($retval);
224 226
		
225
		$pconfig['cinterface'] = implode(",", $_POST['cinterface']);
227
		if (is_array($_POST['cinterface']))
228
			$pconfig['cinterface'] = implode(",", $_POST['cinterface']);
226 229
	}
227 230
}
228 231
include("head.inc");

Also available in: Unified diff