public function validate(\Nethgui\Controller\ValidationReportInterface $report) { $key = $this->parameters['name']; if ($this->getPlatform()->getDatabase('hosts')->getType($key)) { $report->addValidationErrorMessage($this, 'name', 'Host_key_exists_message'); } parent::validate($report); }
public function validate(\Nethgui\Controller\ValidationReportInterface $report) { parent::validate($report); if ($this->getRequest()->isMutation()) { if ($this->getPlatform()->getDatabase('hosts')->getType($this->parameters['name'])) { $report->addValidationErrorMessage($this, 'name', 'IpRange_key_exists_message'); } if (ip2long($this->parameters['Start']) >= ip2long($this->parameters['End'])) { $report->addValidationErrorMessage($this, 'Start', 'valid_iprange_outofbounds'); $report->addValidationErrorMessage($this, 'End', 'valid_iprange_outofbounds'); } } }
public function validate(\Nethgui\Controller\ValidationReportInterface $report) { parent::validate($report); if (empty($this->parameters['groups'])) { return; } if (!is_array($this->parameters['groups'])) { $report->addValidationErrorMessage($this, 'groups', 'Invalid groups'); return; } $allowedGroups = array_keys(iterator_to_array($this->getAdapter(), TRUE)); $check = array_diff(array_keys($this->parameters['groups']), $allowedGroups); foreach ($check as $groupName) { $report->addValidationErrorMessage($this, 'groups', 'Invalid group name: ' . $groupName); } }
public function validate(\Nethgui\Controller\ValidationReportInterface $report) { $key = $this->parameters['name']; if ($this->getPlatform()->getDatabase('fwservices')->getType($key)) { $report->addValidationErrorMessage($this, 'name', 'Service_key_exists_message'); } if ($this->getRequest()->isMutation()) { $ports = explode(',', $this->parameters['Ports']); $v = $this->createValidator(Validate::PORTNUMBER); foreach ($ports as $port) { if (!$v->evaluate($port)) { $report->addValidationErrorMessage($this, 'Ports', 'Ports_validator'); } } } parent::validate($report); }