本文整理汇总了PHP中Domain::GetContact方法的典型用法代码示例。如果您正苦于以下问题:PHP Domain::GetContact方法的具体用法?PHP Domain::GetContact怎么用?PHP Domain::GetContact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain::GetContact方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ChangeDomainOwner
public function ChangeDomainOwner(Domain $domain, $period = null, $extra = array())
{
$params = array("name" => $this->MakeNameIDNCompatible($domain->GetHostName()), "c_registrant" => $domain->GetContact(CONTACT_TYPE::REGISTRANT)->CLID, "c_onsite" => $domain->GetContact(CONTACT_TYPE::TECH)->CLID, "c_billing" => $this->Config->GetFieldByName('BillingContactCLID')->Value, "ns" => '<' . $this->ExtPrefix . ':ns>' . $this->GetNSXML($domain->GetNameserverList()) . '</' . $this->ExtPrefix . ':ns>');
$response = $this->Request("domain-trade-request", $params);
$status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::PENDING : REGISTRY_RESPONSE_STATUS::FAILED;
return new ChangeDomainOwnerResponse($status, $response->ErrMsg, $response->Code);
}
示例2: Run
/**
* Executor
*
* @throws UpdateDomainContactTask_Exception
*/
public function Run($userid = null)
{
try {
$Factory = RegistryModuleFactory::GetInstance();
$Registry = $Factory->GetRegistryByExtension($this->Domain->Extension);
$Manifest = $Registry->GetManifest();
if ($userid && $this->Domain->UserID != $userid) {
throw new UpdateDomainContactAction_Exception(_("You don't have permissions for manage this domain"), UpdateDomainContactAction_Exception::DOMAIN_NOT_BELONGS_TO_USER);
}
$OldContact = $this->Domain->GetContact($this->contact_type);
if ($this->NewContact && $this->NewContact->UserID != $this->Domain->UserID) {
throw new UpdateDomainContactAction_Exception(_("You don't have permissions for using this contact"), UpdateDomainContactAction_Exception::CONTACT_NOT_BELONGS_TO_USER);
}
$trade = $Manifest->GetRegistryOptions()->ability->trade == '1';
if ($this->contact_type != CONTACT_TYPE::REGISTRANT || !$trade) {
try {
$Registry->UpdateDomainContact($this->Domain, $this->contact_type, $OldContact, $this->NewContact);
return $this->Domain->HasPendingOperation(Registry::OP_UPDATE) ? UpdateDomainContactAction_Result::PENDING : UpdateDomainContactAction_Result::OK;
} catch (Exception $e) {
throw new UpdateDomainContactAction_Exception(sprintf(_("Cannot change contact. Reason: %s"), $e->getMessage()));
}
} else {
// Execute trade when:
// - Trade invoice is paid
// - Previous trade failed
if ($this->Domain->IncompleteOrderOperation == INCOMPLETE_OPERATION::DOMAIN_TRADE || $this->Invoice && $this->Invoice->Status == INVOICE_STATUS::PAID) {
$this->Domain->SetContact($this->NewContact, CONTACT_TYPE::REGISTRANT);
$this->Domain->IncompleteOrderOperation = null;
$extra["requesttype"] = "ownerChange";
try {
$trade = $Registry->ChangeDomainOwner($this->Domain, 1, $extra);
return $this->Domain->HasPendingOperation(Registry::OP_TRADE) ? UpdateDomainContactAction_Result::PENDING : UpdateDomainContactAction_Result::OK;
} catch (Exception $e) {
$this->Domain->IncompleteOrderOperation = INCOMPLETE_OPERATION::DOMAIN_TRADE;
if ($this->Invoice) {
$this->Invoice->ActionStatus = INVOICE_ACTION_STATUS::FAILED;
$this->Invoice->ActionFailReason = $e->getMessage();
}
throw new UpdateDomainContactAction_Exception(sprintf(_("Cannot change contact. Reason: %s"), $e->getMessage()));
}
} else {
// Issue an invoice for trade operation
$invoiceid = $this->Db->GetOne("SELECT * FROM invoices WHERE status=? AND itemid=? AND purpose=?", array(INVOICE_STATUS::PENDING, $this->Domain->ID, INVOICE_PURPOSE::DOMAIN_TRADE));
if (!$invoiceid) {
$this->Domain->SetExtraField("NewRegistrantCLID", $this->NewContact->CLID);
DBDomain::GetInstance()->Save($this->Domain);
$Invoice = new Invoice(INVOICE_PURPOSE::DOMAIN_TRADE, $this->Domain->ID, $userid);
$Invoice->Description = sprintf(_("%s domain name trade"), $this->Domain->GetHostName());
$Invoice->Save();
$this->Invoice = $Invoice;
return UpdateDomainContactAction_Result::INVOICE_GENERATED;
} else {
throw new UpdateDomainContactAction_Exception(_("Another domain trade is already initiated"));
}
}
}
} catch (Exception $e) {
throw new UpdateDomainContactAction_Exception($e->getMessage());
}
}
示例3: ValidateDomain
private function ValidateDomain(Domain $domain)
{
if (!($Registrant = $domain->GetContact(CONTACT_TYPE::REGISTRANT))) {
throw new Exception(_('Domain registrant contact is undefined'));
}
if (!($Admin = $domain->GetContact(CONTACT_TYPE::ADMIN))) {
throw new Exception(_('Domain admin contact is undefined'));
}
if (!($Tech = $domain->GetContact(CONTACT_TYPE::TECH))) {
throw new Exception(_('Domain tech contact is undefined'));
}
}
示例4: UpdateDomainContact
public function UpdateDomainContact(Domain $domain, $contactType, Contact $oldContact, Contact $newContact)
{
if (!$newContact && !$oldContact)
throw new Exception("At leat one contact (\$newContact or \$oldContact) must be passed into UpdateDomainContact");
if ($contactType == CONTACT_TYPE::TECH &&
preg_match('/^\d+/', $domain->GetContact(CONTACT_TYPE::REGISTRANT)->CLID))
{
throw new Exception("Domain transfer from SWITCH was buggy. You must update registrant contact first");
}
$params = array(
"name" => $this->MakeNameIDNCompatible($domain->GetHostName()),
"change" => "",
"add" => "",
"rem" => ""
);
if ($contactType == CONTACT_TYPE::REGISTRANT)
$params["change"] = "<domain:chg><domain:registrant>{$newContact->CLID}</domain:registrant></domain:chg>";
else
{
if ($newContact)
$params['add'] = '<domain:add><domain:contact type="'.$contactType.'">'.$newContact->CLID.'</domain:contact></domain:add>';
if ($oldContact && !preg_match('/^\d+/', $oldContact->CLID))
$params['rem'] = '<domain:rem><domain:contact type="'.$contactType.'">'.$oldContact->CLID.'</domain:contact></domain:rem>';
}
$response = $this->Request("domain-update-contact", $params);
$status = ($response->Succeed) ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED;
// Hack for bad transferred from SWITCH
if ($response->Succeed && preg_match('/^\d+/', $oldContact->CLID) && $contactType == CONTACT_TYPE::REGISTRANT)
{
$domain->SetContact(null, CONTACT_TYPE::TECH);
}
return new UpdateDomainContactResponse($status, $response->ErrMsg, $response->Code);
}
示例5: OnDomainCreated
/**
* Enter description here...
*
* @param Domain $domain
*/
public function OnDomainCreated(Domain $domain)
{
if ($domain->Extension == "de") {
$admin_contact = $domain->GetContact(CONTACT_TYPE::ADMIN)->CLID;
$resp = $this->GetRemoteDomain($domain);
if ($resp->AdminContact != $admin_contact) {
$contact = $this->RegistryAccessible->NewContactInstance(CONTACT_TYPE::ADMIN);
$contact->CLID = $resp->AdminContact;
$contact->UserID = 0;
$contact->ID = null;
$contact->SetFieldList(array("firstname" => "Preassigned", "lastname" => "RRPProxy contact"), false);
$domain->SetContact($contact, CONTACT_TYPE::ADMIN);
}
}
}
示例6: OnDomainTransferApproved
public function OnDomainTransferApproved (Domain $domain)
{
$registrant = $domain->GetContact(CONTACT_TYPE::REGISTRANT);
$admin = $domain->GetContact(CONTACT_TYPE::ADMIN);
if ($registrant && $admin)
{
$this->AddRegistrantAssociation($admin->CLID, $registrant->CLID);
}
}
示例7: MapDomainToWhois
private function MapDomainToWhois(Domain $domain)
{
$Registrant = $domain->GetContact(CONTACT_TYPE::REGISTRANT);
$Admin = $domain->GetContact(CONTACT_TYPE::ADMIN);
$Tech = $domain->GetContact(CONTACT_TYPE::TECH);
$Billing = $domain->GetContact(CONTACT_TYPE::BILLING);
$data = array('domain' => $domain->GetHostName(), 'registered_date' => date('Y-m-d H:i:s', $domain->CreateDate), 'registerexpire_date' => date('Y-m-d H:i:s', $domain->ExpireDate), 'remarks' => '', 'mntnr_fkey' => $this->GetMaintainerId());
if ($Registrant) {
$data['holder'] = $this->CLIDToPersonId($Registrant->CLID);
}
if ($Admin) {
$data['admin_c'] = $this->CLIDToPersonId($Admin->CLID);
}
if ($Tech) {
$data['tech_c'] = $this->CLIDToPersonId($Tech->CLID);
}
if ($Billing) {
$data['bill_c'] = $this->CLIDToPersonId($Billing->CLID);
}
return $data;
}
示例8: CreateDomain
/**
* This method send create domain request.
* In order to pending domain creation, response must have status REGISTRY_RESPONSE_STATUS::PENDING
*
* @param Domain $domain
* @param int $period Domain registration period
* @param array $extra Extra data
* @return CreateDomainResponse
*/
public function CreateDomain(Domain $domain, $period, $extra = array())
{
$Registrant = $domain->GetContact(CONTACT_TYPE::REGISTRANT);
$Tech = $domain->GetContact(CONTACT_TYPE::TECH);
$Admin = $domain->GetContact(CONTACT_TYPE::ADMIN);
$Billing = $domain->GetContact(CONTACT_TYPE::BILLING);
$nslist = $domain->GetNameserverList();
$params = array('name' => $domain->GetHostName(), 'type' => $this->GetDomainType(), 'registrant' => $Registrant->CLID, 'tech' => $Tech->CLID, 'admin' => $Admin->CLID, 'billing' => $Billing->CLID, 'ns1' => $nslist[0]->HostName, 'ns2' => $nslist[1]->HostName, 'period' => $period, 'pw' => $domain->AuthCode ? $domain->AuthCode : rand(100000, 99999999));
$response = $this->Request('domain-create', $params);
$status = $response->Succeed ? REGISTRY_RESPONSE_STATUS::SUCCESS : REGISTRY_RESPONSE_STATUS::FAILED;
$ret = new CreateDomainResponse($status, $response->ErrMsg, $response->Code);
if ($response->Succeed) {
$ret->CreateDate = time();
$ret->ExpireDate = strtotime("+{$period} year");
$ret->AuthCode = (string) $params['pw'];
}
return $ret;
}