From 2371c5526f72d031844cd4cd0c1b9c7610296f88 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Mon, 7 Feb 2011 08:58:15 +0000 Subject: improved SearchController.php --- h-source/Application/Controllers/SearchController.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'h-source') diff --git a/h-source/Application/Controllers/SearchController.php b/h-source/Application/Controllers/SearchController.php index 1b35a09..cb314c5 100644 --- a/h-source/Application/Controllers/SearchController.php +++ b/h-source/Application/Controllers/SearchController.php @@ -111,9 +111,9 @@ class SearchController extends BaseController $lspci = $this->request->post('lspci','','sanitizeHtml'); $lspciResult = array(); - $flag = false; + $flag = true; - if (strlen($lspci)<10000) + if (strlen($lspci)<50000) { $lspci = nl2br($lspci); $lspciArray = explode('
',$lspci); @@ -124,12 +124,11 @@ class SearchController extends BaseController if (stristr($item,'Slot')) { $temp = array(); - // class if (next($lspciArray) !== false) { $item = trim(current($lspciArray)); - if( !preg_match( '/^[a-zA-Z0-9\-\_\.\:\+\s\(\)\/\[\]]+$/i', $item ) ) + if( !preg_match( '/^[a-zA-Z0-9\-\_\.\,\;\:\+\s\(\)\/\[\]]+$/i', $item ) ) { $flag = false; break; @@ -155,7 +154,7 @@ class SearchController extends BaseController if (next($lspciArray) !== false) { $item = trim(current($lspciArray)); - if( !preg_match( '/^[a-zA-Z0-9\-\_\.\:\+\s\(\)\/\[\]]+$/i', $item ) ) + if( !preg_match( '/^[a-zA-Z0-9\-\_\.\,\;\:\+\s\(\)\/\[\]]+$/i', $item ) ) { $flag = false; break; @@ -181,7 +180,7 @@ class SearchController extends BaseController if (next($lspciArray) !== false) { $item = trim(current($lspciArray)); - if( !preg_match( '/^[a-zA-Z0-9\-\_\.\:\+\s\(\)\/\[\]]+$/i', $item ) ) + if( !preg_match( '/^[a-zA-Z0-9\-\_\.\,\;\:\+\s\(\)\/\[\]]+$/i', $item ) ) { $flag = false; break; @@ -204,18 +203,19 @@ class SearchController extends BaseController } $lspciResult[] = $temp; - $flag = true; } next($lspciArray); } - if (count($lspciResult) === 0) + if (count($lspciResult) === 0 or $flag === false) { $data['notice'] = "
".gtext('the text submitted by you does not seem the lspci -vmmnn output. Please check the text and try again')."
\n"; + $flag = false; } } else { $data['notice'] = "
the lspci output is too long
\n"; + $flag = false; } $data['flag'] = $flag; -- cgit v1.2.3