PageRenderTime 28ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/plugins/registrar/_NAMES4EVER.php

https://github.com/axxtel/agilebill
PHP | 172 lines | 104 code | 23 blank | 45 comment | 11 complexity | 3543becbc264f54410a9113f99b20f08 MD5 | raw file
  1. <?php
  2. /**
  3. * AgileBill - Open Billing Software
  4. *
  5. * This body of work is free software; you can redistribute it and/or
  6. * modify it under the terms of the Open AgileBill License
  7. * License as published at http://www.agileco.com/agilebill/license1-4.txt
  8. *
  9. * For questions, help, comments, discussion, etc., please join the
  10. * Agileco community forums at http://forum.agileco.com/
  11. *
  12. * @link http://www.agileco.com/
  13. * @copyright 2004-2008 Agileco, LLC.
  14. * @license http://www.agileco.com/agilebill/license1-4.txt
  15. * @author Tony Landis <tony@agileco.com>
  16. * @package AgileBill
  17. * @version 1.4.93
  18. */
  19. /*
  20. ============================================================================
  21. Available Config Variables:
  22. ============================================================================
  23. debug (0/1 test/live)
  24. mode (0/1 test/live)
  25. user
  26. password
  27. plan_id
  28. ============================================================================
  29. */
  30. class plg_reg_NAMES4EVER
  31. {
  32. function plg_reg_NAMES4EVER ($obj)
  33. {
  34. $this->registrar = $obj->registrar;
  35. $this->domainrs = $obj->domain;
  36. $this->domain_name = $obj->domain['domain_name'].'.'.$obj->domain['domain_tld'];
  37. $this->domain = $obj->domain['domain_name'];
  38. $this->tld = $obj->domain['domain_tld'];
  39. $this->term = $obj->domain['domain_term'];
  40. if(!empty($obj->server['ns_primary']))
  41. $this->ns1 = $obj->server['ns_primary'];
  42. else
  43. $this->ns1 = $obj->registrar['ns1'];
  44. if(!empty($obj->server['ns_secondary']))
  45. $this->ns2 = $obj->server['ns_secondary'];
  46. else
  47. $this->ns2 = $obj->registrar['ns2'];
  48. if(!empty($obj->server['ns_ip_primary']))
  49. $this->nsip1 = $obj->server['ns_ip_primary'];
  50. else
  51. $this->nsip1 = $obj->registrar['ns1ip'];
  52. if(!empty($obj->server['ns_ip_secondary']))
  53. $this->nsip2 = $obj->server['ns_ip_secondary'];
  54. else
  55. $this->nsip2 = $obj->registrar['ns2ip'];
  56. # get the account details for the registrant:
  57. $db = &DB();
  58. $q = "SELECT * FROM ".AGILE_DB_PREFIX."account WHERE
  59. id = ".$db->qstr( $this->domainrs['account_id'] )." AND
  60. site_id = ".$db->qstr(DEFAULT_SITE);
  61. $rs = $db->Execute($q);
  62. if ($rs->RecordCount() == 1) {
  63. $this->account = $rs->fields;
  64. }
  65. # get the country code for this account:
  66. $q = "SELECT three_code FROM ".AGILE_DB_PREFIX."country WHERE
  67. id = ".$db->qstr( $this->account['country_id'] )." AND
  68. site_id = ".$db->qstr(DEFAULT_SITE);
  69. $rs = $db->Execute($q);
  70. if ($rs->RecordCount() == 1) {
  71. $this->country = $rs->fields['three_code'];
  72. }
  73. }
  74. ######################
  75. ### Register domain
  76. ######################
  77. function register()
  78. {
  79. global $VAR;
  80. $VAR['test']=1;
  81. # generate the xml string
  82. $xml_request = '?<?xml version="1.0" ?><request version="1.0" id="REQUEST-123456">'.
  83. '<reseller id="'. $this->registrar['user'] .'">'.
  84. '<password>secret'. $this->registrar['password'] .'</password>'.
  85. '<plan-id>'. $this->registrar['plan_id'] .'</plan-id>'.
  86. '</reseller>'.
  87. '<add-domain fqdn="'. $this->domain_name .'">'.
  88. '<password>'. $this->account['password'] .'</password>'.
  89. '<organization>'. $this->account['company'] .'</organization>'.
  90. '<ns priority="1" fqdn="'.$this->ns1 .'">'.
  91. '<ip>'. $this->nsip1 .'</ip>'.
  92. '</ns>'.
  93. '<ns priority="2" fqdn="'.$this->ns2 .'">'.
  94. '<ip>'. $this->nsip2 .'</ip>'.
  95. '</ns>'.
  96. '<contact type="admin">'.
  97. '<first-name>'. $this->account['first_name'] .'e</first-name>'.
  98. '<last-name>'. $this->account['last_name'] .'</last-name>'.
  99. '<organization>'. $this->account['company'] .'</organization>'.
  100. '<address>'.
  101. '<street>'. $this->account['address1'] .'</street>'.
  102. '<city>'. $this->account['city'] .'</city>'.
  103. '<state>'. $this->account['state'] .'</state>'.
  104. '<postalcode>'. $this->account['zip'] .'</postalcode>'.
  105. '<country>'. $this->country .'</country>'.
  106. '</address>'.
  107. '<voice>+1 (888) 555-1212</voice>'.
  108. '<email>'. $this->account['email'] .'</email>'.
  109. '</contact>'.
  110. '<registration-period>'.$this->term .'</registration-period>'.
  111. '</add-domain>'.
  112. '</request>';
  113. # Test mode:
  114. if($this->registrar['mode'] == 1)
  115. $this->url = '/PirinLink/Pirin.exe';
  116. else
  117. $this->url = '/PirinLink/PirinTest.exe';
  118. # Create the SSL connection & get response from the gateway:
  119. include_once (PATH_CORE . 'ssl.inc.php');
  120. $n = new CORE_ssl;
  121. $response = $n->connect('names4ever.com', $this->url, $xml_request, true, 1);
  122. # debug
  123. #if($this->registrar['debug'] == 1)
  124. #echo "<textarea>$response</textarea>";
  125. if(eregi('<status code="0">', $response))
  126. return TRUE;
  127. else
  128. return FALSE;
  129. }
  130. ### Renew domain
  131. function renew()
  132. {
  133. return false;
  134. }
  135. ### Transfer domain
  136. function transfer()
  137. {
  138. return false;
  139. }
  140. ### Park domain
  141. function park()
  142. {
  143. return false;
  144. }
  145. }
  146. ?>