diff options
author | plegall <plg@piwigo.org> | 2014-08-22 09:09:17 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2014-08-22 09:09:17 +0000 |
commit | 9c9f8548fc68038a206f3cf5ca551ec930019405 (patch) | |
tree | 7f07cf0806a43928e2d5564dae6052b8911038b7 | |
parent | 3d362a235f0564dce11c1597e1ea7569db36365b (diff) |
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
-rw-r--r-- | admin/batch_manager.php | 6 |
1 files changed, 3 insertions, 3 deletions
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 ]; } |