Project

General

Profile

« Previous | Next » 

Revision a42bea4a

Added by Renato Botelho about 9 years ago

Simplify mode parameter validation

View differences:

src/usr/local/www/pkg_mgr_install.php
221 221
}
222 222

  
223 223
$pkgmode = '';
224
if (!empty($_POST['mode'])) {
225
	$pkgmode = $_POST['mode'];
226
} elseif (!empty($_GET['mode'])) {
227
	$pkgmode = $_GET['mode'];
228
}
224
if (!empty($_REQUEST['mode'])) {
225
	$valid_modes = array(
226
		'reinstallall',
227
		'reinstallpkg',
228
		'delete',
229
		'installed'
230
	);
231

  
232
	if (!in_array($_REQUEST['mode'], $valid_modes)) {
233
		header("Location: pkg_mgr_installed.php");
234
		return;
235
	}
229 236

  
230
$valid_modes = array(
231
	'',
232
	'reinstallall',
233
	'reinstallpkg',
234
	'delete',
235
	'installed'
236
);
237

  
238
if (!in_array($pkgmode, $valid_modes)) {
239
	header("Location: pkg_mgr_installed.php");
240
	return;
237
	$pkgmode = $_REQUEST['mode'];
241 238
}
242 239

  
243 240
if ($_POST) {

Also available in: Unified diff