예제 #1
0
 function DispatchPollUpdateDomain(PollUpdateDomainResponse $resp)
 {
     if ($resp->IsFailed()) {
         Log::Log(sprintf('DispatchPollUpdateDomain failed. Registry response: %s', $resp->ErrMsg), E_USER_ERROR);
         throw new Exception($resp->ErrMsg, $resp->Code);
     }
     if ($resp->Succeed()) {
         list($name, $extension) = FQDN::Parse($resp->HostName);
         $domain = $this->DBDomain->LoadByName($name, $extension, $this->GetManifest());
         if ($resp->Result) {
             $domain = $this->GetRemoteDomain($domain);
             $this->FireEvent('DomainOperation', $domain, self::OP_UPDATE);
             $this->FireEvent('DomainUpdated', $domain);
             $this->DBDomain->Save($domain);
         } else {
             $this->FireEvent('DomainOperation', $domain, self::OP_UPDATE, true, $resp->FailReason);
         }
         return true;
     }
 }
예제 #2
0
<?php

require_once 'src/prepend.inc.php';
@set_time_limit(999999);
if (Client::Load($_SESSION['userid'])->GetSettingValue('domain_preorder') != 1) {
    CoreUtils::Redirect("index.php");
}
if ($_POST) {
    $Validator = new Validator();
    $lines = explode("\n", $post_domains);
    $post_domainname = FQDN::Sanitize($post_domainname);
    list($domain_name, $extension) = FQDN::Parse($post_domainname);
    $expiredate = trim($post_dt);
    // Validate date. Sucks.
    if (!preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}\$/", $expiredate) || !strtotime($expiredate)) {
        throw new ApplicationException(sprintf(_("Incorrect expiration date.")));
    }
    // Validate domain name
    if (!$Validator->IsDomain($post_domainname)) {
        throw new Exception(sprintf(_("Incorrect domain name: %s"), $post_domainname));
    }
    if (!$Registries[$extension]) {
        try {
            $Registry = RegistryModuleFactory::GetInstance()->GetRegistryByExtension($extension);
        } catch (Exception $e) {
            throw new ApplicationException($e->getMessage());
        }
        $Manifest = $Registry->GetManifest();
        if ($Manifest->GetRegistryOptions()->ability->preregistration != 1) {
            throw new ApplicationException(sprintf(_("Module %s does not support domain pre-registration."), $Registry->GetModuleName()));
        }