예제 #1
0
파일: Main.php 프로젝트: kokkez/shineisp
 /**
  * Transfer a domain name
  * 
  * Executes the 'Purchase' command on the service's servers to transfer the domain.
  * Note in order to not fail this command, it must meet the following requirements:
  * - Your account credentials must have enough credits to cover the order amount.
  * - To transfer EPP names, the query must include the authorization key from the Registrar.
  * - Name Servers must be valid and registered.
  * 
  * @param      integer     $domainID     Must be a valid domain id, that is currently available
  * @param      integer     $customerID   Customer Identify Code.
  * @param      array       $nameServers    If not set, Service's Default name servers will be used instead.
  * @param      bool        $regLock        A flag that specifies if the domain should be locked or not. Default is true.
  * @return     mixed       True, or throw an Exception if failed.
  * @access     public
  * @see        renewDomain
  * @see        registerDomain
  */
 public function transferDomain($domainID, $nameServers = null, $regLock = true)
 {
     // Connection to the SOAP system
     $soap = $this->Connect();
     if (empty($this->session)) {
         throw new Exception('SOAP connection system error');
     }
     // Get the registrar information
     $registrar = Registrars::getActiveRegistrarbyClass(__CLASS__);
     if (empty($registrar)) {
         throw new Exception("Registrar __CLASS__ not found in database.");
     }
     // Get the domain information
     $domain = Domains::find($domainID);
     if (!empty($domain[0])) {
         $customerID = $domain[0]['customer_id'];
         // Get the customer information
         $customer = Customers::getAllInfo($domain[0]['customer_id']);
         if (empty($customer)) {
             throw new Exception("Customer has been not found.");
         }
         // Create the Ascio nic-Handle
         $nicHandle = $this->createNicHandle($customerID);
         // Check if the nichandle has been created
         if (!empty($nicHandle)) {
             $params = array();
             // Save the nic-Handle in the database
             CustomersDomainsRegistrars::addNicHandle($domainID, $nicHandle);
             $domain_name = $domain[0]['domain'] . "." . $domain[0]['DomainsTlds']['WhoisServers']['tld'];
             // Get the main DNS servers set in the configuration
             $dns = $this->getDnsServers();
             $locale = Shineisp_Registry::get('Zend_Locale');
             $birthdate = new Zend_Date($customer['birthdate'], "yyyy-MM-dd HH:mm:ss", $locale);
             // Ascio handle two kind of registration for the domains it and the others
             if ($domain[0]['DomainsTlds']['WhoisServers']['tld'] == "it") {
                 $params[] = $this->session['id'];
                 // the session id
                 $params[] = $domain_name;
                 // the domain name
                 $params[] = $domain[0]['authinfocode'];
                 // authinfo code, mandatory for domains managed by -REG
                 $params[] = 'none';
                 // the hosting type (none|start1m|perso|pro|business|premium)
                 $params[] = 'gold';
                 // the domain offer (gold|platinum|diamond)
                 $params[] = 'agent';
                 // the reseller profile (none | whiteLabel | agent)
                 $params[] = 'yes';
                 // activate OwO for .com, .net, .org, .info and .biz (yes | no)
                 $params[] = $nicHandle;
                 // the owner nichandle
                 $params[] = $registrar['ascio_username'];
                 // the admin nichandle
                 $params[] = $registrar['ascio_username'];
                 // the tech nichandle
                 $params[] = $registrar['ascio_username'];
                 // the billing nichandle
                 $params[] = !empty($dns[0]) ? $dns[0] : null;
                 // the primary dns hostname (if hosting, default Ascio dns will be installed)
                 $params[] = !empty($dns[1]) ? $dns[1] : null;
                 // the secondary dns hostname
                 $params[] = !empty($dns[2]) ? $dns[2] : null;
                 // the third dns hostname
                 $params[] = !empty($dns[3]) ? $dns[3] : null;
                 // the fourth dns hostname
                 $params[] = !empty($dns[4]) ? $dns[4] : null;
                 // the fifth dns hostname
                 $params[] = $customer['firstname'];
                 // the legal representant firstname
                 $params[] = $customer['lastname'];
                 // the legal representant lastname
                 $params[] = $customer['taxpayernumber'];
                 // the regCode : Codice Fiscale
                 $params[] = $customer['vat'];
                 // the VAT number
                 $params[] = $birthdate->get('dd/MM/yyyy');
                 // owner or legal representant birth date
                 $params[] = $customer['birthplace'];
                 // owner or legal representant birth city
                 $params[] = $customer['birthdistrict'];
                 // owner or legal representant birth departement
                 $params[] = $customer['birthcountry'];
                 // owner or legal representant birth country
                 $params[] = "IT";
                 // owner or legal representant nationality (2 letter country code)
                 $params[] = $registrar['ascio_testmode'] ? true : false;
                 // enable the TEST MODE when enabled (true), will not debit your account
                 // Call the soap service and send the parameters
                 call_user_func_array(array($soap, 'resellerDomainTransfer'), $params);
             } else {
                 $params[] = $this->session['id'];
                 // the session id
                 $params[] = $domain_name;
                 // the domain name
                 $params[] = $domain[0]['authinfocode'];
                 // authinfo code, mandatory for domains managed by -REG
                 $params[] = 'none';
                 // the hosting type (none|start1m|perso|pro|business|premium)
                 $params[] = 'gold';
                 // the domain offer (gold|platinum|diamond)
                 $params[] = 'agent';
                 // the reseller profile (none | whiteLabel | agent)
                 $params[] = 'yes';
                 // activate OwO for .com, .net, .org, .info and .biz (yes | no)
                 $params[] = $nicHandle;
                 // the owner nichandle
                 $params[] = $registrar['ascio_username'];
                 // the admin nichandle
                 $params[] = $registrar['ascio_username'];
                 // the tech nichandle
                 $params[] = $registrar['ascio_username'];
                 // the billing nichandle
                 $params[] = !empty($dns[0]) ? $dns[0] : null;
                 // the primary dns hostname (if hosting, default Ascio dns will be installed)
                 $params[] = !empty($dns[1]) ? $dns[1] : null;
                 // the secondary dns hostname
                 $params[] = !empty($dns[2]) ? $dns[2] : null;
                 // the third dns hostname
                 $params[] = !empty($dns[3]) ? $dns[3] : null;
                 // the fourth dns hostname
                 $params[] = !empty($dns[4]) ? $dns[4] : null;
                 // the fifth dns hostname
                 $params[] = null;
                 // the legal representant firstname
                 $params[] = null;
                 // the legal representant lastname
                 $params[] = null;
                 // the regCode : Codice Fiscale
                 $params[] = null;
                 // the VAT number
                 $params[] = null;
                 // owner or legal representant birth date
                 $params[] = null;
                 // owner or legal representant birth city
                 $params[] = null;
                 // owner or legal representant birth departement
                 $params[] = null;
                 // owner or legal representant birth country
                 $params[] = null;
                 // owner or legal representant nationality (2 letter country code)
                 $params[] = $registrar['ascio_testmode'] ? true : false;
                 // enable the TEST MODE when enabled (true), will not debit your account
                 // Call the soap service and send the parameters
                 call_user_func_array(array($soap, 'resellerDomainTransfer'), $params);
             }
             return true;
         }
     }
     return false;
 }
예제 #2
0
파일: Main.php 프로젝트: moay/shineisp
 /**
  * 
  * @param integer $domainId
  * @param string $type
  */
 private function createNic($domainId, $type = 'owner')
 {
     $soap = $this->Connect();
     if (!empty($this->session)) {
         $tld = Domains::getDomainTld($domainId);
         // get the domain profile
         $profile = DomainsProfiles::getProfileByDomainId($domainId, $type);
         if ($profile) {
             // Set generic variables for parameters
             $profile['countrycode'] = strtolower(Countries::getCodebyId($profile['country_id']));
             $profile['birthdate'] = Shineisp_Commons_Utilities::formatDateOut($profile['birthdate']);
             $profile['password'] = Shineisp_Commons_Utilities::GenerateRandomString();
             $profile['fullname'] = $profile['firstname'] . " " . $profile['lastname'];
             $profile['legalform'] = strtolower($profile['Legalforms']['name']);
             $profile['corporationtype'] = strtolower($profile['CompanyTypes']['name']);
             $profile['legalnumber'] = null;
             $profile['language'] = "en";
             $profile['isowner'] = $type == "owner" ? true : false;
             if ($tld == "it") {
                 // Create a nicHandle for the Italian domain tld
                 $params[] = $this->session['id'];
                 // Session
                 $params[] = $profile['lastname'];
                 // Lastname
                 $params[] = $profile['firstname'];
                 // Firstname
                 $params[] = $profile['gender'];
                 // Gender
                 $params[] = $profile['password'];
                 // Password
                 $params[] = $profile['email'];
                 // Email
                 $params[] = $profile['phone'];
                 // Phone
                 $params[] = $profile['fax'];
                 // Fax
                 $params[] = $profile['address'];
                 // Address
                 $params[] = $profile['city'];
                 // City
                 $params[] = $profile['area'];
                 // Area
                 $params[] = $profile['zip'];
                 // Zip
                 $params[] = $profile['countrycode'];
                 // Country Code
                 $params[] = $profile['language'];
                 // Language
                 $params[] = $profile['isowner'];
                 // isOwner
                 $params[] = $profile['legalform'];
                 // Legalform
                 $params[] = $profile['company'];
                 // Organisation
                 $params[] = $profile['fullname'];
                 // Legal name
                 $params[] = $profile['legalnumber'];
                 // Legal Number
                 $params[] = $profile['vat'];
                 // VAT or IVA
                 $params[] = $profile['birthdate'];
                 // Birthday
                 $params[] = $profile['birthplace'];
                 // Birthcity
                 $params[] = $profile['taxpayernumber'];
                 // Contact fiscal code or company vat
                 $params[] = $profile['vat'];
                 // Company National Identification Number
                 $params[] = $profile['corporationtype'];
                 $nicHandle = call_user_func_array(array($soap, 'nicCreateIT'), $params);
                 Shineisp_Commons_Utilities::log('Calling profile nicCreateIT with these params: ' . json_encode($params), "registrar.ovh.log");
             } else {
                 $params[] = $this->session['id'];
                 // Session
                 $params[] = $profile['lastname'];
                 // Lastname
                 $params[] = $profile['firstname'];
                 // Firstname
                 $params[] = $profile['password'];
                 // Password
                 $params[] = $profile['email'];
                 // Email
                 $params[] = $profile['phone'];
                 // Phone
                 $params[] = $profile['fax'];
                 // Fax
                 $params[] = $profile['address'];
                 // Address
                 $params[] = $profile['city'];
                 // City
                 $params[] = $profile['area'];
                 // Area
                 $params[] = $profile['zip'];
                 // Zip
                 $params[] = $profile['countrycode'];
                 // Country Code
                 $params[] = $profile['language'];
                 // Language
                 $params[] = $profile['isowner'];
                 // isOwner
                 $params[] = $profile['legalform'];
                 // Legalform
                 $params[] = $profile['company'];
                 // Organisation
                 $params[] = $profile['fullname'];
                 // Legal name
                 $params[] = $profile['legalnumber'];
                 // Legal Number
                 $params[] = $profile['vat'];
                 // VAT or IVA
                 $nicHandle = call_user_func_array(array($soap, 'nicCreate'), $params);
                 Shineisp_Commons_Utilities::log('Calling profile nicCreate with these params: ' . json_encode($params), "registrar.ovh.log");
             }
             if (!empty($nicHandle)) {
                 CustomersDomainsRegistrars::addNicHandle($domainId, $nicHandle, $type, $profile['profile_id']);
                 // Save the nic-Handle in the database
             }
         } else {
             // If the client has not create any profile, the main client information will be set in all domain tld field [admin, tech, owner, billing]
             // Get the domain information
             $domain = Domains::find($domainId);
             // Create the OVH nic-Handle
             $nicHandle = $this->createNicHandlebyCustomer($domain[0]['customer_id'], $domainId);
             // Save the nic-Handle in the database
             CustomersDomainsRegistrars::addNicHandle($domainId, $nicHandle);
         }
         return $nicHandle;
     }
     return false;
 }