function LogicBoxes_Domain_Prolong($Settings, $DomainName, $DomainZone, $Years, $CustomerID, $DomainID) { /****************************************************************************/ $__args_types = array('array', 'string', 'string', 'integer', 'string'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ $DomainHash = array(); #----------------------------------------------------------------------------- $Wsdl = System_Element('config/Wsdl/DomOrder.wsdl'); if (Is_Error($Wsdl)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $DomainInfo = new SoapClient($Wsdl, array('exceptions' => 0)); #----------------------------------------------------------------------------- $Domain = SPrintF('%s.%s', $DomainName, $DomainZone); #----------------------------------------------------------------------------- $Params = array('SERVICE_USERNAME' => $Settings['Login'], 'SERVICE_PASSWORD' => $Settings['Password'], 'SERVICE_ROLE' => 'reseller', 'SERVICE_LANGPREF' => 'ru', 'SERVICE_PARENTID' => $Settings['ParentID'], 'domainName' => $Domain, 'option' => array('All')); #----------------------------------------------------------------------------- Debug(Print_R($Params, TRUE)); #----------------------------------------------------------------------------- $Response = $DomainInfo->__SoapCall('getDetailsByDomain', $Params); #----------------------------------------------------------------------------- if (Is_SOAP_Fault($Response)) { #--------------------------------------------------------------------------- Debug($Response->faultstring); #--------------------------------------------------------------------------- return new gException('ANSWER_ERROR', 'Ошибка обращения к регистратору'); } #--------------------------------------------------------------------------- $DomainHash[$Domain] = array('entityid' => $Response['entityid'], 'noofyears' => (string) $Years, 'expirydate' => $Response['endtime']); #----------------------------------------------------------------------------- $Wsdl = System_Element('config/Wsdl/DomOrder.wsdl'); if (Is_Error($Wsdl)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $RenewDomain = new SoapClient($Wsdl, array('exceptions' => 0)); #----------------------------------------------------------------------------- $Response = $RenewDomain->renewDomain($Settings['Login'], $Settings['Password'], 'reseller', 'ru', $Settings['ParentID'], $DomainHash, 'NoInvoice'); #----------------------------------------------------------------------------- if (Is_SOAP_Fault($Response)) { #--------------------------------------------------------------------------- Debug($Response->faultstring); #--------------------------------------------------------------------------- return new gException('ANSWER_ERROR', 'Ошибка обращения к регистратору'); } #----------------------------------------------------------------------------- switch ($Response[$Domain]['status']) { case 'error': #------------------------------------------------------------------------- Debug($Response[$Domain]['error']); #------------------------------------------------------------------------- return new gException('REGISTRATION_ERROR', 'Ошибка регистрации домена'); case 'Success': return array('TicketID' => $Domain); default: return ERROR | @Trigger_Error(101); } }
function ventraip_APICall($command, $request, $params) { $apiurl = "https://api.wholesalesystem.com.au/?wsdl"; $values = array(); $soaprequest = $request; $soaprequest['resellerID'] = $params['resellerID']; $soaprequest['apiKey'] = $params['apiKey']; $client = new SoapClient(null, array("location" => $apiurl, "uri" => "")); try { if ($command == "register") { $params['tld'] = end(explode(".", $params['tld'])); if ($params['tld'] == "au") { $soapresult = get_object_vars($client->domainRegisterAU($soaprequest)); } else { if ($params['tld'] == "uk") { $soapresult = get_object_vars($client->domainRegisterUK($soaprequest)); } else { $soapresult = get_object_vars($client->domainRegister($soaprequest)); } } } else { if ($command == "transfer") { if ($params['tld'] == "uk") { $soapresult = get_object_vars($client->domainTransferUK($soaprequest)); } else { $soapresult = get_object_vars($client->transferDomain($soaprequest)); } } else { if ($command == "renew") { $soapresult = get_object_vars($client->renewDomain($soaprequest)); } else { if ($command == "getns") { $soapresult = get_object_vars($client->domainInfo($soaprequest)); $values['ns1'] = $soapresult['nameServers'][0]; $values['ns2'] = $soapresult['nameServers'][1]; $values['ns3'] = $soapresult['nameServers'][2]; $values['ns4'] = $soapresult['nameServers'][3]; $values['ns5'] = $soapresult['nameServers'][4]; } else { if ($command == "savens") { $soapresult = get_object_vars($client->updateNameServers($soaprequest)); } else { if ($command == "getlockstatus") { $soapresult = get_object_vars($client->domainInfo($soaprequest)); if ($soapresult['domain_status'] == "clientTransferProhibited") { $values['lockstatus'] = "locked"; } else { $values['lockstatus'] = "unlocked"; } } else { if ($command == "getidprotectionstatus") { $soapresult = get_object_vars($client->domainInfo($soaprequest)); if ($soapresult['idProtect'] == "Enabled") { $values['idProtect'] = "Enabled"; } else { $values['idProtect'] = "Disabled"; } } else { if ($command == "geteppcode") { $soapresult = get_object_vars($client->domainInfo($soaprequest)); $values['eppCode'] = $soapresult['domainPassword']; } else { if ($command == "getcontacts") { $soapresult = get_object_vars($client->listContacts($soaprequest)); $values['Registrant']["First Name"] = $soapresult['registrant']->firstname; $values['Registrant']["Last Name"] = $soapresult['registrant']->lastname; $values['Registrant']["Address 1"] = $soapresult['registrant']->address1; $values['Registrant']["Address 2"] = $soapresult['registrant']->address2; $values['Registrant']['City'] = $soapresult['registrant']->suburb; $values['Registrant']['State'] = $soapresult['registrant']->state; $values['Registrant']['Postcode'] = $soapresult['registrant']->postcode; $values['Registrant']['Country'] = $soapresult['registrant']->country; $values['Registrant']['Phone'] = $soapresult['registrant']->phone; $values['Registrant']['Fax'] = $soapresult['registrant']->fax; $values['Registrant']['Email'] = $soapresult['registrant']->email; if (isset($soapresult['admin'])) { $values['Admin']["First Name"] = $soapresult['admin']->firstname; $values['Admin']["Last Name"] = $soapresult['admin']->lastname; $values['Admin']["Address 1"] = $soapresult['admin']->address1; $values['Admin']["Address 2"] = $soapresult['admin']->address2; $values['Admin']['City'] = $soapresult['admin']->suburb; $values['Admin']['State'] = $soapresult['admin']->state; $values['Admin']['Postcode'] = $soapresult['admin']->postcode; $values['Admin']['Country'] = $soapresult['admin']->country; $values['Admin']['Phone'] = $soapresult['admin']->phone; $values['Admin']['Fax'] = $soapresult['admin']->fax; $values['Admin']['Email'] = $soapresult['admin']->email; } if (isset($soapresult['billing'])) { $values['Billing']["First Name"] = $soapresult['billing']->firstname; $values['Billing']["Last Name"] = $soapresult['billing']->lastname; $values['Billing']["Address 1"] = $soapresult['billing']->address1; $values['Billing']["Address 2"] = $soapresult['billing']->address2; $values['Billing']['City'] = $soapresult['billing']->suburb; $values['Billing']['State'] = $soapresult['billing']->state; $values['Billing']['Postcode'] = $soapresult['billing']->postcode; $values['Billing']['Country'] = $soapresult['billing']->country; $values['Billing']['Phone'] = $soapresult['billing']->phone; $values['Billing']['Fax'] = $soapresult['billing']->fax; $values['Billing']['Email'] = $soapresult['billing']->email; } if (isset($soapresult['tech'])) { $values['Tech']["First Name"] = $soapresult['tech']->firstname; $values['Tech']["Last Name"] = $soapresult['tech']->lastname; $values['Tech']["Address 1"] = $soapresult['tech']->address1; $values['Tech']["Address 2"] = $soapresult['tech']->address2; $values['Tech']['City'] = $soapresult['tech']->suburb; $values['Tech']['State'] = $soapresult['tech']->state; $values['Tech']['Postcode'] = $soapresult['tech']->postcode; $values['Tech']['Country'] = $soapresult['tech']->country; $values['Tech']['Phone'] = $soapresult['tech']->phone; $values['Tech']['Fax'] = $soapresult['tech']->fax; $values['Tech']['Email'] = $soapresult['tech']->email; } } else { if ($command == "savecontacts") { $soapresult = get_object_vars($client->updateContact($soaprequest)); } else { if ($command == "addhost") { $soapresult = get_object_vars($client->addHost($soaprequest)); } else { if ($command == "delhost") { $soapresult = get_object_vars($client->deleteHost($soaprequest)); } else { if ($command == "addhostip") { $soapresult = get_object_vars($client->addHostIP($soaprequest)); } else { if ($command == "delhostip") { $soapresult = get_object_vars($client->deleteHostIP($soaprequest)); } else { if ($command == "sync") { $soapresult = get_object_vars($client->domainInfo($soaprequest)); if (in_array($soapresult['domain_status'], array("ok", "clientTransferProhibited"))) { $values['status'] = "Active"; $values['active'] = true; } else { if ($soapresult['domain_status'] == "Transferred Away") { update_query("tbldomains", array("status" => "Cancelled"), array("domain" => $params['sld'] . "." . $params['tld'])); } } $values['expirydate'] = substr($soapresult['domain_expiry'], 0, 10); } else { if ($command == "lockdomain") { $soapresult = get_object_vars($client->lockDomain($soaprequest)); } else { if ($command == "unlockdomain") { $soapresult = get_object_vars($client->unlockDomain($soaprequest)); } else { if ($command == "idprotect") { $soapresult = get_object_vars($client->enableIDProtection($soaprequest)); if ($soapresult['status'] != "OK") { $values = array("error" => $soapresult['errorMessage']); } } else { if ($command == "idunprotect") { $soapresult = get_object_vars($client->disableIDProtection($soaprequest)); if ($soapresult['status'] != "OK") { $values = array("error" => $soapresult['errorMessage']); } } else { if ($command == "releasedomain") { $soapresult = get_object_vars($client->domainReleaseUK($soaprequest)); } else { if ($command == "listMailForwards") { $soapresult = get_object_vars($client->listMailForwards($soaprequest)); if (is_array($soapresult['forwards'])) { foreach ($soapresult['forwards'] as $forward) { $forward = get_object_vars($forward); $values[$forward['id']]['prefix'] = str_replace("@" . $request['domainName'], "", $forward['source']); $values[$forward['id']]['forwardto'] = $forward['destination']; } } } else { if ($command == "addMailForward") { $soapresult = get_object_vars($client->addMailForward($soaprequest)); } else { if ($command == "deleteMailForward") { $soapresult = get_object_vars($client->deleteMailForward($soaprequest)); } else { if ($command == "deleteDNSRecord") { $soapresult = get_object_vars($client->deleteDNSRecord($soaprequest)); } else { if ($command == "addDNSRecord") { $soapresult = get_object_vars($client->addDNSRecord($soaprequest)); } else { if ($command == "listDNSZone") { $soapresult = get_object_vars($client->listDNSZone($soaprequest)); if ($soapresult['status'] == "OK" && is_array($soapresult['records'])) { $values = array(); foreach ($soapresult['records'] as $record) { $record = get_object_vars($record); if ($record['type'] != "SOA") { if ($record['type'] == "MX") { $values[] = array("hostname" => $record['hostName'], "type" => $record['type'], "address" => $record['content'], "priority" => $record['prio'], "recid" => $record['id']); continue; } $values[] = array("hostname" => $record['hostName'], "type" => $record['type'], "address" => $record['content'], "recid" => $record['id']); continue; } } } } } } } } } } } } } } } } } } } } } } } } } } } } } $not_in_status = array("OK", "OK_PENDING_REGO", "OK_TRANSFER_PENDING", "OK_TRANSFER_EMAILPENDING", "OK_TRANSFER_EMAIL", "OK_TRANSFER_UK_PENDING", "OK_TRANSFER_WAITING_AUTH"); if (!in_array($soapresult['status'], $not_in_status)) { $values['error'] = $soapresult['errorMessage'] ? $soapresult['errorMessage'] : serialize($soapresult); } logModuleCall("ventraip", $command, $soaprequest, $soapresult, $soapresult, array($params['resellerID'], $params['apiKey'])); } catch (SoapFault $e) { $values['error'] = $e->errorMessage ? $e->status . " - " . $e->errorMessage : $e; logModuleCall("ventraip", $command, $soaprequest, $soapresult, $e, array($params['resellerID'], $params['apiKey'])); return $values; } }