aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'h-source/Application/Controllers')
-rw-r--r--h-source/Application/Controllers/SearchController.php39
1 files changed, 26 insertions, 13 deletions
diff --git a/h-source/Application/Controllers/SearchController.php b/h-source/Application/Controllers/SearchController.php
index b35ee45..21b3a2e 100644
--- a/h-source/Application/Controllers/SearchController.php
+++ b/h-source/Application/Controllers/SearchController.php
@@ -110,13 +110,13 @@ class SearchController extends BaseController
$data['notice'] = null;
$lspci = $this->request->post('lspci','','sanitizeHtml');
+ $lspciResult = array();
+ $flag = false;
+
if (strlen($lspci)<10000)
{
- $flag = false;
-
$lspci = nl2br($lspci);
$lspciArray = explode('<br />',$lspci);
- $lspciResult = array();
reset($lspciArray);
while(current($lspciArray) !== false)
{
@@ -208,25 +208,38 @@ class SearchController extends BaseController
}
next($lspciArray);
}
+ if (count($lspciResult) === 0)
+ {
+ $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";
+ }
}
else
{
$data['notice'] = "<div class='alert'>the lspci output is too long</div>\n";
}
+
+ $data['flag'] = $flag;
+
+ $data['table'] = array();
if ($flag)
{
- echo "<pre>";
- print_r($lspciResult);
- echo "</pre>";
+ $lspciFiltered = array();
+ $vendorIDProductIDArray = array();
+ foreach ($lspciResult as $device)
+ {
+ if (array_key_exists($device['classId'],Hardware::$deviceClasses))
+ {
+ $vendorIDProductIDArray[] = sanitizePciid($device['vendorId'].":".$device['deviceId']);
+ $lspciFiltered[] = $device;
+ }
+ }
+ $whereString = "'".implode("','",$vendorIDProductIDArray)."'";
+ $data['table'] = $this->m['HardwareModel']->select()->where(array('pci_id'=>"in($whereString)"))->send();
}
-// $clean['pciid'] = $this->request->post('lspci','','sanitizePciid');
-// $data['table'] = $this->m['HardwareModel']->clear()->select()->where(array('pci_id'=>$clean['pciid']))->send();
-// $data['recordNumber'] = 0;
-//
-// $this->append($data);
-// $this->cleverLoad('results');
-// $this->right();
+ $this->append($data);
+ $this->cleverLoad('lspci_results');
+ $this->right();
}
}
} \ No newline at end of file