diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-02-07 08:58:15 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-02-07 08:58:15 +0000 |
commit | 2371c5526f72d031844cd4cd0c1b9c7610296f88 (patch) | |
tree | cc50c09723031b019aadbd28a8692cce6d0cfc53 /h-source/Application/Controllers/SearchController.php | |
parent | d36a10db4f19a93fa2f666eabe8f585313f0e834 (diff) |
improved SearchController.php
Diffstat (limited to 'h-source/Application/Controllers/SearchController.php')
-rw-r--r-- | h-source/Application/Controllers/SearchController.php | 16 |
1 files changed, 8 insertions, 8 deletions
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('<br />',$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'] = "<div class='alert'>".gtext('the text submitted by you does not seem the lspci -vmmnn output. Please check the text and try again')."</div>\n"; + $flag = false; } } else { $data['notice'] = "<div class='alert'>the lspci output is too long</div>\n"; + $flag = false; } $data['flag'] = $flag; |