/**
  * Validate a Domain Service TLD
  *
  * Verifies that the domain service exists.
  *
  * @param string $data Field data
  * @return DomainServiceDBO Domain Service DBO for this TLD
  * @throws RecordNotFoundException
  */
 public function validate($data)
 {
     $data = parent::validate($data);
     try {
         $domainDBO = load_DomainServiceDBO($data);
     } catch (DBNoRowsFoundException $e) {
         throw new RecordNotFoundException("DomainService");
     }
     if ($this->fieldConfig['publicitemsonly'] && !$domainDBO->isPublic()) {
         throw new RecordNotFoundException("DomainService");
     }
     return $domainDBO;
 }
 /**
  * Set Top Level Domain
  *
  * @param string $tld Top Level Domain that this domain is being registered under
  */
 function setTLD($tld)
 {
     $this->setPurchasable(load_DomainServiceDBO($tld));
 }
 /**
  * Execute Registration
  */
 function executeRegistration()
 {
     // Load the registrar module and verify that it is enabled
     $this->serviceDBO = load_DomainServiceDBO($this->purchaseDBO->getTLD());
     $registry = ModuleRegistry::getModuleRegistry();
     $module = $registry->getModule($this->purchaseDBO->getModuleName());
     // Set the time of purchase
     $this->purchaseDBO->setDate(DBConnection::format_datetime(time()));
     // Prepare contact info
     $contacts['admin'] = new ContactDBO($this->accountDBO->getContactName(), $this->accountDBO->getBusinessName(), $this->accountDBO->getContactEmail(), $this->accountDBO->getAddress1(), $this->accountDBO->getAddress2(), null, $this->accountDBO->getCity(), $this->accountDBO->getState(), $this->accountDBO->getPostalCode(), $this->accountDBO->getCountry(), $this->accountDBO->getPhone(), null, $this->accountDBO->getFax());
     $contacts['tech'] = $contacts['admin'];
     $contacts['billing'] = $contacts['admin'];
     // Execute the registration at the Registrar
     $module->registerNewDomain($this->purchaseDBO->getDomainName(), $this->purchaseDBO->getTLD(), intval($this->purchaseDBO->getTerm() / 12), $contacts, $this->accountDBO);
     // Store the purchase in database
     add_DomainServicePurchaseDBO($this->purchaseDBO);
     // Registration complete
     $this->setMessage(array("type" => "[DOMAIN_REGISTERED]", "args" => array($this->purchaseDBO->getFullDomainName())));
     $this->gotoPage("domains_browse", null, null);
 }
Пример #4
0
 /**
  * Transfer this Domain
  *
  * @param AccountDBO $accountDBO The account registering this domain
  * @return boolean True for success
  */
 function transferDomain($accountDBO)
 {
     global $conf;
     $serviceDBO = load_DomainServiceDBO($this->getTLD());
     $module = $conf['modules'][$serviceDBO->getModuleName()];
     // Verify that the domain is transferable
     if (!$module->isTransferable($this->getFullDomainName())) {
         log_error("OrderDomainDBO::transferDomain()", "Attempted to transfer a domain that is not eligible for transfer: " . $this->getFullDomainName());
         return false;
     }
     // Prepare contact info
     $contacts['admin'] = $this->getAdminContact();
     $contacts['billing'] = $this->getBillingContact();
     $contacts['tech'] = $this->getTechContact();
     // Transfer the domain
     $module->transferDomain($this->getDomainName(), $this->getTLD(), intval($this->getTerm() / 12), $this->getTransferSecret(), $contacts, $accountDBO);
     return true;
 }