diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-03-02 23:48:56 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-03-02 23:48:56 +0000 |
commit | fdd5ccda63a6c6825035f99c3e6b6df93814cebe (patch) | |
tree | 5ba045ff3cb29d94f8216706130471e8fa6c71a7 /h-source/Application/Controllers | |
parent | 632f611689562bb79dfb18065b6d0851a5c2077e (diff) |
vendor is now automatically obtained from vendorid, except for notebooks
Diffstat (limited to 'h-source/Application/Controllers')
9 files changed, 95 insertions, 61 deletions
diff --git a/h-source/Application/Controllers/BluetoothController.php b/h-source/Application/Controllers/BluetoothController.php index c763aa6..4730081 100644 --- a/h-source/Application/Controllers/BluetoothController.php +++ b/h-source/Application/Controllers/BluetoothController.php @@ -43,7 +43,6 @@ class BluetoothController extends GenericController //hardware conditions $this->m['HardwareModel']->strongConditions['update'] = array( - "checkIsStrings|".Bluetooth::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\@\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", "checkLength|99" => "model", @@ -54,7 +53,6 @@ class BluetoothController extends GenericController ); $this->m['HardwareModel']->strongConditions['insert'] = array( - "checkIsStrings|".Bluetooth::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\@\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", "checkLength|99" => "model", @@ -82,7 +80,7 @@ class BluetoothController extends GenericController "++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]", ); - $this->m['HardwareModel']->setFields('vendor,model,kernel,description,distribution,comm_year,bluetooth_works,pci_id,interface,driver','sanitizeAll'); + $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,bluetooth_works,pci_id,interface,driver','sanitizeAll'); $argKeys = array( 'page:forceNat' => 1, diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php index 884f915..f58fa24 100644 --- a/h-source/Application/Controllers/GenericController.php +++ b/h-source/Application/Controllers/GenericController.php @@ -79,25 +79,31 @@ class GenericController extends BaseController { if ($this->checkDist()) { - $pci_id = $this->request->post('pci_id','','sanitizeAll'); - if (strcmp($pci_id,'') !== 0) + if ($this->checkVendorId()) { - $this->m['HardwareModel']->databaseConditions['insert']['+checkUnique'] = 'pci_id|<i>VendorID:ProductID</i> is already present in the database. This means that the device you are trying to insert is already in the database'; - } - - //insert the new device - $this->m['HardwareModel']->updateTable('insert'); - - if ($this->m['HardwareModel']->queryResult) - { - if (strcmp($this->controller,'notebooks') === 0) + $pci_id = $this->request->post('pci_id','','sanitizeAll'); + + if (strcmp($this->m['HardwareModel']->type,'notebook') !== 0) + { + $this->m['HardwareModel']->values['vendor'] = sanitizeAll(Vendors::getName($pci_id)); + + $this->m['HardwareModel']->databaseConditions['insert']['+checkUnique'] = 'pci_id|<i>VendorID:ProductID</i> is already present in the database. This means that the device you are trying to insert is already in the database'; + } + + //insert the new device + $this->m['HardwareModel']->updateTable('insert'); + + if ($this->m['HardwareModel']->queryResult) { - session_start(); - $_SESSION['notebook_inserted'] = 'yes'; + if (strcmp($this->controller,'notebooks') === 0) + { + session_start(); + $_SESSION['notebook_inserted'] = 'yes'; + } } + + $this->viewRedirect($this->m['HardwareModel']->lastId); } - - $this->viewRedirect($this->m['HardwareModel']->lastId); } } @@ -216,16 +222,22 @@ class GenericController extends BaseController { if ($this->checkDist()) { - $pci_id = $this->request->post('pci_id','','sanitizeAll'); - if (strcmp($pci_id,'') !== 0) + if ($this->checkVendorId()) { - $this->m['HardwareModel']->databaseConditions['update']['+checkUniqueCompl'] = 'pci_id|<i>VendorID:ProductID</i> is already present in the database. This means that the device you are trying to insert is already in the database'; + $pci_id = $this->request->post('pci_id','','sanitizeAll'); + + if (strcmp($this->m['HardwareModel']->type,'notebook') !== 0) + { + $this->m['HardwareModel']->values['vendor'] = sanitizeAll(Vendors::getName($pci_id)); + + $this->m['HardwareModel']->databaseConditions['update']['+checkUniqueCompl'] = 'pci_id|<i>VendorID:ProductID</i> is already present in the database. This means that the device you are trying to insert is already in the database'; + } + + //carry out the update database action + $this->m['HardwareModel']->updateTable('update'); + + $this->viewRedirect($this->m['HardwareModel']->lastId); } - - //carry out the update database action - $this->m['HardwareModel']->updateTable('update'); - - $this->viewRedirect($this->m['HardwareModel']->lastId); } } @@ -260,6 +272,44 @@ class GenericController extends BaseController $this->redirect($this->controller.'/catalogue/'.$this->lang); } } + + protected function checkVendorId() + { + if (strcmp($this->m['HardwareModel']->type,'notebook') === 0) return true; + + if (array_key_exists('pci_id',$_POST)) + { + if (strcmp($_POST['pci_id'],"") !== 0) + { + if (preg_match('/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/',$_POST['pci_id'])) + { + if (Vendors::check($_POST['pci_id'])) + { + return true; + } + else + { + $this->m['HardwareModel']->result = false; + $this->m['HardwareModel']->notice = "<div class='alert'>Vendorid code non present in the list, please open an issue <a href='".$this->baseUrl."/issues/viewall/".Lang::$current."'>here</a> in order to ask the insertion of your vendor</div>\n"; + return false; + } + } + else + { + $this->m['HardwareModel']->result = false; + $this->m['HardwareModel']->notice = "<div class='alert'><i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}</div>"; + } + } + else + { + $this->m['HardwareModel']->result = false; + $this->m['HardwareModel']->notice = "<div class='alert'>Vendorid:Productid code not defined..</div>\n"; + return false; + } + } + $this->m['HardwareModel']->result = false; + return false; + } protected function checkDist() { diff --git a/h-source/Application/Controllers/PrintersController.php b/h-source/Application/Controllers/PrintersController.php index 5ea6bf7..0251808 100644 --- a/h-source/Application/Controllers/PrintersController.php +++ b/h-source/Application/Controllers/PrintersController.php @@ -43,9 +43,9 @@ class PrintersController extends GenericController //hardware conditions $this->m['HardwareModel']->strongConditions['update'] = array( - "checkIsStrings|".Printer::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "+checkIsStrings|".Printer::compatibilityList() => "compatibility", @@ -55,9 +55,9 @@ class PrintersController extends GenericController ); $this->m['HardwareModel']->strongConditions['insert'] = array( - "checkIsStrings|".Printer::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "+checkIsStrings|".Printer::compatibilityList() => "compatibility", @@ -71,7 +71,6 @@ class PrintersController extends GenericController "checkLength|20000" => "description", "+checkLength|49" => "driver", "++checkLength|49" => "kernel", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]", ); @@ -80,11 +79,10 @@ class PrintersController extends GenericController "checkLength|20000" => "description", "+checkLength|49" => "driver", "++checkLength|49" => "kernel", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]", ); - $this->m['HardwareModel']->setFields('vendor,model,kernel,description,compatibility,distribution,comm_year,pci_id,driver,interface,subtype','sanitizeAll'); + $this->m['HardwareModel']->setFields('model,kernel,description,compatibility,distribution,comm_year,pci_id,driver,interface,subtype','sanitizeAll'); $argKeys = array( 'page:forceNat' => 1, diff --git a/h-source/Application/Controllers/ScannersController.php b/h-source/Application/Controllers/ScannersController.php index b6c84e3..1030fb8 100644 --- a/h-source/Application/Controllers/ScannersController.php +++ b/h-source/Application/Controllers/ScannersController.php @@ -43,9 +43,9 @@ class ScannersController extends GenericController //hardware conditions $this->m['HardwareModel']->strongConditions['update'] = array( - "checkIsStrings|".Printer::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "+checkIsStrings|".Printer::compatibilityList() => "compatibility", @@ -54,9 +54,9 @@ class ScannersController extends GenericController ); $this->m['HardwareModel']->strongConditions['insert'] = array( - "checkIsStrings|".Printer::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "+checkIsStrings|".Printer::compatibilityList() => "compatibility", @@ -69,7 +69,6 @@ class ScannersController extends GenericController "checkLength|20000" => "description", "+checkLength|49" => "driver", "++checkLength|49" => "kernel", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]", ); @@ -78,11 +77,10 @@ class ScannersController extends GenericController "checkLength|20000" => "description", "+checkLength|49" => "driver", "++checkLength|49" => "kernel", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]", ); - $this->m['HardwareModel']->setFields('vendor,model,kernel,description,compatibility,distribution,comm_year,pci_id,driver,interface','sanitizeAll'); + $this->m['HardwareModel']->setFields('model,kernel,description,compatibility,distribution,comm_year,pci_id,driver,interface','sanitizeAll'); $argKeys = array( 'page:forceNat' => 1, diff --git a/h-source/Application/Controllers/SoundcardsController.php b/h-source/Application/Controllers/SoundcardsController.php index b1d94ce..d1386e0 100644 --- a/h-source/Application/Controllers/SoundcardsController.php +++ b/h-source/Application/Controllers/SoundcardsController.php @@ -43,9 +43,9 @@ class SoundcardsController extends GenericController //hardware conditions $this->m['HardwareModel']->strongConditions['update'] = array( - "checkIsStrings|".Soundcards::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\@\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "++checkIsStrings|".Wifi::$commYear => "comm_year", @@ -54,9 +54,9 @@ class SoundcardsController extends GenericController ); $this->m['HardwareModel']->strongConditions['insert'] = array( - "checkIsStrings|".Soundcards::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\@\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "++checkIsStrings|".Wifi::$commYear => "comm_year", @@ -69,7 +69,6 @@ class SoundcardsController extends GenericController "checkLength|20000" => "description", "+checkLength|49" => "kernel", "++checkLength|49" => "driver", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]", ); @@ -78,11 +77,10 @@ class SoundcardsController extends GenericController "checkLength|20000" => "description", "+checkLength|49" => "kernel", "++checkLength|49" => "driver", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]", ); - $this->m['HardwareModel']->setFields('vendor,model,kernel,description,distribution,comm_year,sound_card_works,pci_id,interface,driver','sanitizeAll'); + $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,sound_card_works,pci_id,interface,driver','sanitizeAll'); $argKeys = array( 'page:forceNat' => 1, diff --git a/h-source/Application/Controllers/ThreegcardsController.php b/h-source/Application/Controllers/ThreegcardsController.php index e0ee3fe..69484cd 100644 --- a/h-source/Application/Controllers/ThreegcardsController.php +++ b/h-source/Application/Controllers/ThreegcardsController.php @@ -43,9 +43,9 @@ class ThreegcardsController extends GenericController //hardware conditions $this->m['HardwareModel']->strongConditions['update'] = array( - "checkIsStrings|".ThreeGcards::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "++checkIsStrings|".ThreeGcards::$commYear => "comm_year", @@ -54,9 +54,9 @@ class ThreegcardsController extends GenericController ); $this->m['HardwareModel']->strongConditions['insert'] = array( - "checkIsStrings|".ThreeGcards::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "++checkIsStrings|".ThreeGcards::$commYear => "comm_year", @@ -68,17 +68,15 @@ class ThreegcardsController extends GenericController "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s]+$/" => "kernel|characters not allowed in the <i>kernel</i> entry", "checkLength|20000" => "description", "+checkLength|49" => "kernel", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", ); $this->m['HardwareModel']->softConditions['insert'] = array( "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s]+$/" => "kernel|characters not allowed in the <i>kernel</i> entry", "checkLength|20000" => "description", "+checkLength|49" => "kernel", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", ); - $this->m['HardwareModel']->setFields('vendor,model,kernel,description,distribution,comm_year,wifi_works,pci_id,interface','sanitizeAll'); + $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,wifi_works,pci_id,interface','sanitizeAll'); $argKeys = array( 'page:forceNat' => 1, diff --git a/h-source/Application/Controllers/VideocardsController.php b/h-source/Application/Controllers/VideocardsController.php index 8167d27..3e47961 100644 --- a/h-source/Application/Controllers/VideocardsController.php +++ b/h-source/Application/Controllers/VideocardsController.php @@ -43,9 +43,9 @@ class VideocardsController extends GenericController //hardware conditions $this->m['HardwareModel']->strongConditions['update'] = array( - "checkIsStrings|".Videocard::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "++checkIsStrings|".Notebooks::$commYear => "comm_year", @@ -54,9 +54,9 @@ class VideocardsController extends GenericController ); $this->m['HardwareModel']->strongConditions['insert'] = array( - "checkIsStrings|".Videocard::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "++checkIsStrings|".Notebooks::$commYear => "comm_year", @@ -68,17 +68,15 @@ class VideocardsController extends GenericController "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s]+$/" => "kernel|characters not allowed in the <i>kernel</i> entry", "checkLength|20000" => "description", "+checkLength|49" => "kernel", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", ); $this->m['HardwareModel']->softConditions['insert'] = array( "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s]+$/" => "kernel|characters not allowed in the <i>kernel</i> entry", "checkLength|20000" => "description", "+checkLength|49" => "kernel", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", ); - $this->m['HardwareModel']->setFields('vendor,model,kernel,description,distribution,video_card_works,comm_year,pci_id,interface','sanitizeAll'); + $this->m['HardwareModel']->setFields('model,kernel,description,distribution,video_card_works,comm_year,pci_id,interface','sanitizeAll'); $argKeys = array( 'page:forceNat' => 1, diff --git a/h-source/Application/Controllers/WebcamsController.php b/h-source/Application/Controllers/WebcamsController.php index 74425a2..454f2ee 100644 --- a/h-source/Application/Controllers/WebcamsController.php +++ b/h-source/Application/Controllers/WebcamsController.php @@ -43,9 +43,9 @@ class WebcamsController extends GenericController //hardware conditions $this->m['HardwareModel']->strongConditions['update'] = array( - "checkIsStrings|".Webcams::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\@\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "++checkIsStrings|".Webcams::$commYear => "comm_year", @@ -54,9 +54,9 @@ class WebcamsController extends GenericController ); $this->m['HardwareModel']->strongConditions['insert'] = array( - "checkIsStrings|".Webcams::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\@\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "++checkIsStrings|".Webcams::$commYear => "comm_year", @@ -69,7 +69,6 @@ class WebcamsController extends GenericController "checkLength|20000" => "description", "+checkLength|49" => "kernel", "++checkLength|49" => "driver", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]", ); @@ -78,11 +77,10 @@ class WebcamsController extends GenericController "checkLength|20000" => "description", "+checkLength|49" => "kernel", "++checkLength|49" => "driver", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]", ); - $this->m['HardwareModel']->setFields('vendor,model,kernel,description,distribution,comm_year,webcam_works,pci_id,interface,driver','sanitizeAll'); + $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,webcam_works,pci_id,interface,driver','sanitizeAll'); $argKeys = array( 'page:forceNat' => 1, diff --git a/h-source/Application/Controllers/WifiController.php b/h-source/Application/Controllers/WifiController.php index 8cf38e7..3b8f0f0 100644 --- a/h-source/Application/Controllers/WifiController.php +++ b/h-source/Application/Controllers/WifiController.php @@ -43,9 +43,9 @@ class WifiController extends GenericController //hardware conditions $this->m['HardwareModel']->strongConditions['update'] = array( - "checkIsStrings|".Wifi::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "++checkIsStrings|".Wifi::$commYear => "comm_year", @@ -54,9 +54,9 @@ class WifiController extends GenericController ); $this->m['HardwareModel']->strongConditions['insert'] = array( - "checkIsStrings|".Wifi::vendorsList() => "vendor", "checkNotEmpty" => "model|you have to fill the <i>model name</i> entry", "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", "checkLength|99" => "model", "+checkLength|299" => "distribution", "++checkIsStrings|".Wifi::$commYear => "comm_year", @@ -68,17 +68,15 @@ class WifiController extends GenericController "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s]+$/" => "kernel|characters not allowed in the <i>kernel</i> entry", "checkLength|20000" => "description", "+checkLength|49" => "kernel", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", ); $this->m['HardwareModel']->softConditions['insert'] = array( "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s]+$/" => "kernel|characters not allowed in the <i>kernel</i> entry", "checkLength|20000" => "description", "+checkLength|49" => "kernel", - "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}", ); - $this->m['HardwareModel']->setFields('vendor,model,kernel,description,distribution,comm_year,wifi_works,pci_id,interface','sanitizeAll'); + $this->m['HardwareModel']->setFields('model,kernel,description,distribution,comm_year,wifi_works,pci_id,interface','sanitizeAll'); $argKeys = array( 'page:forceNat' => 1, |