/** * Retransforms the content to a soa object if applicable */ public function postUpdate(Records $record, LifecycleEventArgs $event) { if ($record->getType() == 'SOA') { $transformer = new SoaTransformer(); $record->setContent($transformer->transform($record->getContent())); } }
/** * Checks a A record for validity. * * @param Records $record * * @return bool */ public function _validateA(Records $record) { $name = $record->getName(); if (0 != strlen($name)) { // Check the hostname only if necessary if (!$record->getLooseCheck()) { // First check if we're in the domain. if ($name != $record->getDomain()->getName() && strpos($name, '.' . $record->getDomain()->getName()) === false) { $this->context->addViolationAt('name', 'Name: ' . $name . ' is not in domain: ' . $record->getDomain()->getName(), array(), null); } else { if (!$this->_checkHostname($name, false, true)) { $this->context->addViolationAt('name', 'Name: ' . $name . ' is not a valid hostname', array(), null); } } } } if (!filter_var($record->getContent(), FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { $this->context->addViolationAt('content', 'You must provide a valid ip for a an record of type ' . $record->getType(), array(), null); } return true; }