From 9c9f8548fc68038a206f3cf5ca551ec930019405 Mon Sep 17 00:00:00 2001 From: plegall Date: Fri, 22 Aug 2014 09:09:17 +0000 Subject: use filter_var for checking int/float values from user input instead of preg_match (PHP 5.2+) git-svn-id: http://piwigo.org/svn/trunk@29245 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/batch_manager.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'admin') diff --git a/admin/batch_manager.php b/admin/batch_manager.php index 28c7fe06d..8259f2bb9 100644 --- a/admin/batch_manager.php +++ b/admin/batch_manager.php @@ -131,14 +131,14 @@ if (isset($_POST['submitFilter'])) { foreach (array('min_width','max_width','min_height','max_height') as $type) { - if ( preg_match('#^[0-9]+$#', $_POST['filter_dimension_'. $type ]) ) + if (filter_var($_POST['filter_dimension_'.$type], FILTER_VALIDATE_INT) !== false) { $_SESSION['bulk_manager_filter']['dimension'][$type] = $_POST['filter_dimension_'. $type ]; } } foreach (array('min_ratio','max_ratio') as $type) { - if ( preg_match('#^[0-9\.]+$#', $_POST['filter_dimension_'. $type ]) ) + if (filter_var($_POST['filter_dimension_'.$type], FILTER_VALIDATE_FLOAT) !== false) { $_SESSION['bulk_manager_filter']['dimension'][$type] = $_POST['filter_dimension_'. $type ]; } @@ -149,7 +149,7 @@ if (isset($_POST['submitFilter'])) { foreach (array('min','max') as $type) { - if ( preg_match('#^[0-9\.]+$#', $_POST['filter_filesize_'. $type ]) ) + if (filter_var($_POST['filter_filesize_'.$type], FILTER_VALIDATE_FLOAT) !== false) { $_SESSION['bulk_manager_filter']['filesize'][$type] = $_POST['filter_filesize_'. $type ]; } -- cgit v1.2.3