/plugins/registrar/MANUAL.php

https://github.com/axxtel/agilebill · PHP · 163 lines · 117 code · 16 blank · 30 comment · 16 complexity · 8ef8dc23cb1f26023d2c5ca2f5f203dc 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. class plg_reg_MANUAL
  20. {
  21. function plg_reg_MANUAL ($obj)
  22. {
  23. $this->registrar = $obj->registrar;
  24. $this->domainrs = $obj->domain;
  25. $this->domain_name = $obj->domain['domain_name'].'.'.$obj->domain['domain_tld'];
  26. $this->domain = $obj->domain['domain_name'];
  27. $this->tld = $obj->domain['domain_tld'];
  28. $this->term = $obj->domain['domain_term'];
  29. if(!empty($obj->server['ns_primary']))
  30. $this->ns1 = @$obj->server['ns_primary'];
  31. else
  32. $this->ns1 = @$obj->registrar['ns1'];
  33. if(!empty($obj->server['ns_secondary']))
  34. $this->ns2 = @$obj->server['ns_secondary'];
  35. else
  36. $this->ns2 = @$obj->registrar['ns2'];
  37. if(!empty($obj->server['ns_ip_primary']))
  38. $this->nsip1 = @$obj->server['ns_ip_primary'];
  39. else
  40. $this->nsip1 = @$obj->registrar['ns1ip'];
  41. if(!empty($obj->server['ns_ip_secondary']))
  42. $this->nsip2 = @$obj->server['ns_ip_secondary'];
  43. else
  44. $this->nsip2 = @$obj->registrar['ns2ip'];
  45. }
  46. ### Register domain
  47. function register()
  48. {
  49. # compose the message:
  50. $msg = $this->emailCompose('REGISTER', $this->domain_name, $this->term, $this->ns1, $this->ns2, $this->nsip1, $this->nsip2);
  51. # get the account id of the staff member to e-mail to:
  52. $db = &DB();
  53. $q = "SELECT account_id FROM ".AGILE_DB_PREFIX."staff WHERE
  54. id = ".$db->qstr( @$this->registrar['manual_add_email'] )." AND
  55. site_id = ".$db->qstr(DEFAULT_SITE);
  56. $rs = $db->Execute($q);
  57. if ($rs->RecordCount() == 0) {
  58. return false;
  59. } else {
  60. $account_id = $rs->fields['account_id'];
  61. include_once(PATH_MODULES.'email_template/email_template.inc.php');
  62. $mail = new email_template;
  63. $mail->send('registrar_manual_admin', $account_id, $this->domainrs['account_id'], '', $msg);
  64. }
  65. return true;
  66. }
  67. ### Transfer domain
  68. function transfer()
  69. {
  70. # compose the message:
  71. $msg = $this->emailCompose('TRANSFER', $this->domain_name, $this->term, $this->ns1, $this->ns2, $this->nsip1, $this->nsip2);
  72. # get the account id of the staff member to e-mail to:
  73. $db = &DB();
  74. $q = "SELECT account_id FROM ".AGILE_DB_PREFIX."staff WHERE
  75. id = ".$db->qstr( @$this->registrar['manual_transfer_email'] )." AND
  76. site_id = ".$db->qstr(DEFAULT_SITE);
  77. $rs = $db->Execute($q);
  78. if ($rs->RecordCount() == 0) {
  79. return false;
  80. } else {
  81. $account_id = $rs->fields['account_id'];
  82. include_once(PATH_MODULES.'email_template/email_template.inc.php');
  83. $mail = new email_template;
  84. $mail->send('registrar_manual_admin', $account_id, $this->domainrs['account_id'], '', $msg);
  85. }
  86. return true;
  87. }
  88. ### Park domain
  89. function park()
  90. {
  91. # compose the message:
  92. $msg = $this->emailCompose('REGISTER', $this->domain_name, $this->term, $this->ns1, $this->ns2, $this->nsip1, $this->nsip2);
  93. # get the account id of the staff member to e-mail to:
  94. $db = &DB();
  95. $q = "SELECT account_id FROM ".AGILE_DB_PREFIX."staff WHERE
  96. id = ".$db->qstr( $this->registrar['manual_park_email'] )." AND
  97. site_id = ".$db->qstr(DEFAULT_SITE);
  98. $rs = $db->Execute($q);
  99. if ($rs->RecordCount() == 0) {
  100. return false;
  101. } else {
  102. $account_id = $rs->fields['account_id'];
  103. include_once(PATH_MODULES.'email_template/email_template.inc.php');
  104. $mail = new email_template;
  105. $mail->send('registrar_manual_admin', $account_id, $this->domainrs['account_id'], '', $msg);
  106. }
  107. return true;
  108. }
  109. ### Renew domain
  110. function renew()
  111. {
  112. # compose the message:
  113. $msg = $this->emailCompose('REGISTER', $this->domain_name, $this->term, $this->ns1, $this->ns2, $this->nsip1, $this->nsip2);
  114. # get the account id of the staff member to e-mail to:
  115. $db = &DB();
  116. $q = "SELECT account_id FROM ".AGILE_DB_PREFIX."staff WHERE
  117. id = ".$db->qstr( $this->registrar['manual_renew_email'] )." AND
  118. site_id = ".$db->qstr(DEFAULT_SITE);
  119. $rs = $db->Execute($q);
  120. if ($rs->RecordCount() == 0) {
  121. return false;
  122. } else {
  123. $account_id = $rs->fields['account_id'];
  124. include_once(PATH_MODULES.'email_template/email_template.inc.php');
  125. $mail = new email_template;
  126. $mail->send('registrar_manual_admin', $account_id, $this->domainrs['account_id'], '', $msg);
  127. }
  128. return true;
  129. }
  130. ### Compose the domain details for e-mail
  131. function emailCompose($type, $domain, $term, $ns1, $ns2, $ns1ip, $ns2ip)
  132. {
  133. $msg = "============================================================\r\n" .
  134. "Type : {$type} \r\n" .
  135. "============================================================\r\n" .
  136. "Domain name : ".strtoupper($domain). "\r\n" .
  137. "Term (years) : {$term} \r\n" .
  138. "============================================================\r\n" .
  139. "Primary nameserver : {$ns1} \r\n" .
  140. "Secondary nameserver : {$ns2} \r\n" .
  141. "Primary nameserver ip : {$ns1ip} \r\n" .
  142. "Secondary nameserver ip : {$ns2ip} \r\n" .
  143. "============================================================";
  144. return $msg;
  145. }
  146. }
  147. ?>