switchepp.php 74 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554
  1. <?php
  2. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  3. * SWITCH EPP REGISTRAR WHMCS Module By whmcsglobalservices.com
  4. * Copyright whmcsglobalservices, All Rights Reserved
  5. *
  6. * Release: 21 January, 2015
  7. * Version: 3.1.0
  8. * WHMCS Version: v6,v7,V8
  9. * Update Date: 17 April, 2025
  10. *
  11. * By WHMCSGLOBALSERVICES https://whmcsglobalservices.com
  12. * Contact info@whmcsglobalservices.com
  13. *
  14. * This module is made under license issued by whmcsglobalservices.com
  15. * and used under all terms and conditions of license. Ownership of
  16. * module can not be changed. Title and copy of module is not
  17. * available to any other person.
  18. *
  19. * @owner <whmcsglobalservices.com>
  20. * @author <WHMCSGLOBALSERVICES>
  21. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  22. use Illuminate\Database\Capsule\Manager as Capsule;
  23. use WGSSWITCHEPP\IDNA\idna_convert as idna_convert;
  24. if (!defined("WHMCS"))
  25. die("This file cannot be accessed directly");
  26. if (!class_exists('Net_EPP_Protocol')) {
  27. if (file_exists(__DIR__ . "/Net/EPP/Client.php"))
  28. require_once __DIR__ . "/Net/EPP/Client.php";
  29. }
  30. // require_once(__DIR__ . '/idna_convert.class.php');
  31. #*********************Registrar config options***************************#
  32. function switchepp_getConfigArray()
  33. {
  34. $configarray = array(
  35. "FriendlyName" => array(
  36. "Type" => "System",
  37. "Value" => "Switch Epp"
  38. ),
  39. "registrar_id" => array(
  40. "FriendlyName" => "Registrar Id",
  41. "Type" => "text",
  42. "Size" => "50",
  43. 'Description' => 'Enter production SwitchEPP User ID (Client Identifier clIDs)',
  44. ),
  45. "registrar_password" => array(
  46. "FriendlyName" => "Password",
  47. "Type" => "password",
  48. "Size" => "50",
  49. 'Description' => 'Enter production SwitchEPP EPP Login password',
  50. ),
  51. "eppurl" => array(
  52. "FriendlyName" => "EPP URL",
  53. "Type" => "text",
  54. "Size" => "50",
  55. 'Description' => 'Enter production SwitchEPP URL epp.nic.ch',
  56. ),
  57. "eppport" => array(
  58. "FriendlyName" => "Port Number",
  59. "Type" => "text",
  60. "Size" => "50",
  61. 'Description' => 'Enter SwitchEPP port 700',
  62. ),
  63. 'testMode' => [
  64. 'FriendlyName' => 'Test Mode',
  65. 'Type' => 'yesno',
  66. 'Description' => 'Tick to enable the test mode (OTE)',
  67. ],
  68. "ote_registrar_id" => array(
  69. "FriendlyName" => "OTE Registrar Id",
  70. "Type" => "text",
  71. "Size" => "50",
  72. 'Description' => 'Enter OTE/Test SwitchEPP User ID (Client Identifier clIDs)',
  73. ),
  74. "ote_registrar_password" => array(
  75. "FriendlyName" => "OTE Password",
  76. "Type" => "password",
  77. "Size" => "50",
  78. 'Description' => 'Enter OTE/Test SwitchEPP EPP Login password',
  79. ),
  80. "ote_eppurl" => array(
  81. "FriendlyName" => "OTE EPP URL",
  82. "Type" => "text",
  83. "Size" => "50",
  84. 'Description' => 'Enter OTE SwitchEPP URL epp-test.switch.ch',
  85. ),
  86. "ote_eppport" => array(
  87. "FriendlyName" => "OTE Port Number",
  88. "Type" => "text",
  89. "Size" => "50",
  90. 'Description' => 'Enter OTE port 7001',
  91. ),
  92. "licensenum" => array(
  93. "FriendlyName" => "License Key",
  94. "Type" => "text",
  95. "Size" => "50",
  96. ),
  97. "dnssec" => array(
  98. "FriendlyName" => "DNSSEC",
  99. "Type" => "yesno",
  100. ),
  101. "algorithm" => array(
  102. "FriendlyName" => "Algorithm",
  103. 'Type' => 'dropdown',
  104. 'Options' => "5,7,8,10,13,14,15,16",
  105. 'Default' => '5',
  106. ),
  107. "digest_type" => array(
  108. "FriendlyName" => "Digest Type",
  109. 'Type' => 'dropdown',
  110. 'Options' => "1,2,3,4",
  111. 'Default' => '1',
  112. ),
  113. "passphrase" => array(
  114. "FriendlyName" => "Pass Phrase",
  115. "Type" => "password",
  116. "Size" => "30",
  117. "Description" => "It's optional"
  118. ),
  119. "svcExtension" => array(
  120. "FriendlyName" => "Enable svcExtension",
  121. "Type" => "yesno",
  122. "Description" => "Tick if svcExtension supported."
  123. ),
  124. "switchepp_version" => array(
  125. 'Type' => 'system',
  126. "FriendlyName" => "Version",
  127. "Description" => "3.1.0",
  128. ),
  129. "switchepp_update" => array(
  130. 'Type' => 'system',
  131. "FriendlyName" => "Updated Date",
  132. "Description" => "17 April, 2025",
  133. )
  134. );
  135. return $configarray;
  136. }
  137. #*******************Get Nameserver***********************#
  138. function switchepp_GetNameservers($params)
  139. {
  140. try {
  141. // $check_license = switchepp_license_status($params); #Check License
  142. $client = switchepp_clientloginepp($params); #Epp Connection
  143. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  144. #get domain info
  145. $xml = switchepp_domain_info($params);
  146. $info_domain = switchepp_write_xml($client, $xml, __FUNCTION__ . '(domain info)');
  147. $ns = $info_domain->response->resData->children("domain", true)->infData->ns->hostObj;
  148. $i = 1;
  149. $values = array();
  150. foreach ($ns as $nn) {
  151. $values["ns{$i}"] = $nn;
  152. $i++;
  153. }
  154. } catch (Exception $ex) {
  155. $values['error'] = $ex->getMessage();
  156. }
  157. if (!empty($client))
  158. switchepp_logoutepp($client, $params);
  159. return $values;
  160. }
  161. #*********************Save mameserver**************************#
  162. function switchepp_SaveNameservers($params)
  163. {
  164. try {
  165. // $check_license = switchepp_license_status($params); #Check License
  166. $client = switchepp_clientloginepp($params); #Epp Connection
  167. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  168. #get domain info
  169. $xml = switchepp_domain_info($params);
  170. $info_domain = switchepp_write_xml($client, $xml, __FUNCTION__ . '(domain info)');
  171. $ns = $info_domain->response->resData->children("domain", true)->infData->ns->hostObj;
  172. $newarray = [$params["ns1"], $params["ns2"], $params["ns3"], $params["ns4"], $params["ns5"]];
  173. $exist = false;
  174. foreach ($ns as $nn) {
  175. if (in_array($nn, $newarray)) {
  176. $exist = true;
  177. } else {
  178. $exist = false;
  179. break;
  180. }
  181. }
  182. $rem_hosts = '';
  183. foreach ($ns as $nn) {
  184. $rem_hosts .= ' <domain:hostObj>' . $nn . '</domain:hostObj> ';
  185. }
  186. # Generate XML for nameservers
  187. if ($nameserver1 = $params["ns1"]) {
  188. $add_hosts = ' <domain:hostObj>' . $nameserver1 . '</domain:hostObj> ';
  189. }
  190. if ($nameserver2 = $params["ns2"]) {
  191. $add_hosts .= ' <domain:hostObj>' . $nameserver2 . '</domain:hostObj> ';
  192. }
  193. if ($nameserver3 = $params["ns3"]) {
  194. $add_hosts .= ' <domain:hostObj>' . $nameserver3 . '</domain:hostObj> ';
  195. }
  196. if ($nameserver4 = $params["ns4"]) {
  197. $add_hosts .= ' <domain:hostObj>' . $nameserver4 . '</domain:hostObj> ';
  198. }
  199. if ($nameserver5 = $params["ns5"]) {
  200. $add_hosts .= ' <domain:hostObj>' . $nameserver5 . '</domain:hostObj> ';
  201. }
  202. $domainname = $params['domain_punycode'];
  203. if ($params['dnssec'] == "on") {
  204. $digestType = $params['digest_type'];
  205. if (empty($digestType))
  206. $digestType = 1;
  207. if ($digestType == 1) {
  208. $string = switchepp_generateDigestRandomString(40);
  209. $digest = strtoupper(bin2hex($string));
  210. $digest = substr($digest, 0, 40);
  211. } elseif ($digestType == 2) {
  212. $string = switchepp_generateDigestRandomString(64);
  213. $digest = strtoupper(bin2hex($string));
  214. $digest = substr($digest, 0, 64);
  215. } elseif ($digestType == 3 || $digestType == 4) {
  216. $string = switchepp_generateDigestRandomString(96);
  217. $digest = strtoupper(bin2hex($string));
  218. $digest = substr($digest, 0, 96);
  219. }
  220. $params['algorithm'] = (!empty($params['algorithm'])) ? $params['algorithm'] : '5';
  221. $dnssec = '<extension>
  222. <secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
  223. <secDNS:add>
  224. <secDNS:dsData>
  225. <secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag>
  226. <secDNS:alg>' . $params['algorithm'] . '</secDNS:alg>
  227. <secDNS:digestType>' . $digestType . '</secDNS:digestType>
  228. <secDNS:digest>' . $digest . '</secDNS:digest>
  229. </secDNS:dsData>
  230. </secDNS:add>
  231. </secDNS:update>
  232. </extension>';
  233. }
  234. $xmlUpdate = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  235. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  236. <command>
  237. <update>
  238. <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
  239. <domain:name>' . $domainname . '</domain:name>
  240. <domain:add>
  241. <domain:ns>
  242. ' . $add_hosts . '
  243. </domain:ns>
  244. </domain:add>
  245. <domain:rem>
  246. <domain:ns>
  247. ' . $rem_hosts . '
  248. </domain:ns>
  249. </domain:rem>
  250. </domain:update>
  251. </update>
  252. ' . $dnssec . '
  253. <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
  254. </command>
  255. </epp>';
  256. if ($exist)
  257. return "success";
  258. else
  259. $update_domain = switchepp_write_xml($client, $xmlUpdate, __FUNCTION__);
  260. } catch (Exception $ex) {
  261. $values['error'] = $ex->getMessage();
  262. }
  263. if (!empty($client))
  264. switchepp_logoutepp($client, $params);
  265. return $values;
  266. }
  267. #*************************Domain Register****************************#
  268. function switchepp_RegisterDomain($params)
  269. {
  270. try {
  271. // $check_license = switchepp_license_status($params); #Check License
  272. $client = switchepp_clientloginepp($params); #Epp Connection
  273. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  274. #get domain info
  275. $xmlcheck = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  276. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  277. <command>
  278. <check>
  279. <domain:check xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
  280. <domain:name>' . switcheppGetDomainName($params['domainid']) . '</domain:name>
  281. </domain:check>
  282. </check>
  283. <clTRID>' . rand(9999999, 100000) . '</clTRID>
  284. </command>
  285. </epp>';
  286. $domain_check = switchepp_write_xml($client, $xmlcheck, __FUNCTION__ . '( check domain)');
  287. if (0 == (int) $domain_check->response->resData->children("domain", true)->chkData->cd[0]->name->attributes()->avail)
  288. throw new exception($domain_check->response->resData->children("domain", true)->chkData->cd[0]->name . ' ' . $domain_check->response->resData->children("domain", true)->chkData->cd[0]->reason);
  289. $regContactId = strtoupper(switchepp_generateContactID(8) . $params['domainid']);
  290. $contactCheckXml = switchepp_checkContact($regContactId);
  291. $contact_check = switchepp_write_xml($client, $contactCheckXml, __FUNCTION__ . ' (check contact)');
  292. if (1 == (int) $contact_check->response->resData->children("contact", true)->chkData->cd[0]->id->attributes()->avail) {
  293. $xmlclient = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  294. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  295. <command>
  296. <create>
  297. <contact:create xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
  298. <contact:id>REG' . $regContactId . '</contact:id>
  299. <contact:postalInfo type="loc">
  300. <contact:name>' . $params['fullname'] . '</contact:name>
  301. <contact:org>' . $params['companyname'] . '</contact:org>
  302. <contact:addr>
  303. <contact:street>' . $params['address1'] . '</contact:street>
  304. <contact:street>' . $params['address2'] . '</contact:street>
  305. <contact:city>' . $params['city'] . '</contact:city>
  306. <contact:pc>' . $params['postcode'] . '</contact:pc>
  307. <contact:cc>' . $params['country'] . '</contact:cc>
  308. </contact:addr>
  309. </contact:postalInfo>
  310. <contact:voice>' . $params['phonenumberformatted'] . '</contact:voice>
  311. <contact:email>' . $params['email'] . '</contact:email>
  312. <contact:authInfo>
  313. <contact:pw>Con-' . time() . '</contact:pw>
  314. </contact:authInfo>
  315. </contact:create>
  316. </create>
  317. <clTRID>Regcon-' . rand(1000, 9999) . '</clTRID>
  318. </command>
  319. </epp>';
  320. $create_reg_contact = switchepp_write_xml($client, $xmlclient, __FUNCTION__ . '( create reg contact)');
  321. $reg_contact_id = $create_reg_contact->response->resData->children('contact', true)->creData->id;
  322. } else {
  323. $reg_contact_id = $regContactId;
  324. }
  325. #*************tech create*****************#
  326. $techContactId = strtoupper(switchepp_generateContactID(6) . $params['domainid']);
  327. $contactCheckXml = switchepp_checkContact($techContactId);
  328. $contact_check = switchepp_write_xml($client, $contactCheckXml, __FUNCTION__ . ' (check contact)');
  329. if (1 == (int) $contact_check->response->resData->children("contact", true)->chkData->cd[0]->id->attributes()->avail) {
  330. $xmlTech = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  331. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  332. <command>
  333. <create>
  334. <contact:create xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
  335. <contact:id>TE' . $techContactId . '</contact:id>
  336. <contact:postalInfo type="loc">
  337. <contact:name>' . $params['adminfirstname'] . ' ' . $params['adminlastname'] . '</contact:name>
  338. <contact:org>' . $params['admincompanyname'] . '</contact:org>
  339. <contact:addr>
  340. <contact:street>' . $params['adminaddress1'] . '</contact:street>
  341. <contact:street>' . $params['adminaddress2'] . '</contact:street>
  342. <contact:city>' . $params['admincity'] . '</contact:city>
  343. <contact:pc>' . $params['adminpostcode'] . '</contact:pc>
  344. <contact:cc>' . $params['admincountry'] . '</contact:cc>
  345. </contact:addr>
  346. </contact:postalInfo>
  347. <contact:voice>' . $params['adminfullphonenumber'] . '</contact:voice>
  348. <contact:email>' . $params['adminemail'] . '</contact:email>
  349. <contact:authInfo>
  350. <contact:pw>Tec-' . time() . '</contact:pw>
  351. </contact:authInfo>
  352. </contact:create>
  353. </create>
  354. <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
  355. </command>
  356. </epp>';
  357. $create_tech_contact = switchepp_write_xml($client, $xmlTech, __FUNCTION__ . '( create tech contact)');
  358. $tech_contact_id = $create_tech_contact->response->resData->children('contact', true)->creData->id;
  359. } else {
  360. $tech_contact_id = $techContactId;
  361. }
  362. #*******************NameServer*************#
  363. if ($params['ns1']) {
  364. $ns .= '<domain:hostObj>' . $params['ns1'] . '</domain:hostObj>';
  365. }
  366. if ($params['ns2']) {
  367. $ns .= '<domain:hostObj>' . $params['ns2'] . '</domain:hostObj>';
  368. }
  369. if ($params['ns3']) {
  370. $ns .= '<domain:hostObj>' . $params['ns3'] . '</domain:hostObj>';
  371. }
  372. if ($params['ns4']) {
  373. $ns .= '<domain:hostObj>' . $params['ns4'] . '</domain:hostObj>';
  374. }
  375. if ($ns) {
  376. $nsnameserver = ' <domain:ns>
  377. ' . $ns . '
  378. </domain:ns>';
  379. }
  380. $domainname = $params['domain_punycode'];
  381. if ($params['dnssec'] == "on") {
  382. $digestType = $params['digest_type'];
  383. if (empty($digestType))
  384. $digestType = 1;
  385. if ($digestType == 1) {
  386. $string = switchepp_generateDigestRandomString(40);
  387. $digest = strtoupper(bin2hex($string));
  388. $digest = substr($digest, 0, 40);
  389. } elseif ($digestType == 2) {
  390. $string = switchepp_generateDigestRandomString(64);
  391. $digest = strtoupper(bin2hex($string));
  392. $digest = substr($digest, 0, 64);
  393. } elseif ($digestType == 3 || $digestType == 4) {
  394. $string = switchepp_generateDigestRandomString(96);
  395. $digest = strtoupper(bin2hex($string));
  396. $digest = substr($digest, 0, 96);
  397. }
  398. $params['algorithm'] = (!empty($params['algorithm'])) ? $params['algorithm'] : '5';
  399. $dnssec = '<extension>
  400. <secDNS:create xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
  401. <secDNS:dsData>
  402. <secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag>
  403. <secDNS:alg>' . $params['algorithm'] . '</secDNS:alg>
  404. <secDNS:digestType>' . $digestType . '</secDNS:digestType>
  405. <secDNS:digest>' . $digest . '</secDNS:digest>
  406. </secDNS:dsData>
  407. </secDNS:create>
  408. </extension>';
  409. }
  410. $domainPw = switchepp_generateRandomString(15);
  411. #domian create command
  412. $xmldomain = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  413. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  414. <command>
  415. <create>
  416. <domain:create xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
  417. <domain:name>' . $domainname . '</domain:name>
  418. ' . $nsnameserver . '
  419. <domain:registrant>' . $reg_contact_id . '</domain:registrant>
  420. <domain:contact type="tech">' . $tech_contact_id . '</domain:contact>
  421. <domain:authInfo>
  422. <domain:pw>' . $domainPw . '</domain:pw>
  423. </domain:authInfo>
  424. </domain:create>
  425. </create>
  426. ' . $dnssec . '
  427. <clTRID>' . rand(9999999, 100000) . '</clTRID>
  428. </command>
  429. </epp>';
  430. $domain_create = switchepp_write_xml($client, $xmldomain, __FUNCTION__);
  431. } catch (Exception $ex) {
  432. $values['error'] = $ex->getMessage();
  433. }
  434. if (!empty($client))
  435. switchepp_logoutepp($client, $params);
  436. return $values;
  437. }
  438. #**********************************Get Contact Detail*******************************#
  439. function switchepp_GetContactDetails($params)
  440. {
  441. try {
  442. // $check_license = switchepp_license_status($params); #Check License
  443. $client = switchepp_clientloginepp($params); #Epp Connection
  444. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  445. #get domain info
  446. $xml = switchepp_domain_info($params);
  447. $info_domain = switchepp_write_xml($client, $xml, __FUNCTION__ . '(domain info)');
  448. $registrant_id = $info_domain->response->resData->children("domain", true)->infData->registrant; #registrant id
  449. $Tech_id = $info_domain->response->resData->children("domain", true)->infData->contact; #Tech id
  450. $xml2 = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  451. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  452. <command>
  453. <info>
  454. <contact:info xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
  455. <contact:id>' . $registrant_id . '</contact:id>
  456. </contact:info>
  457. </info>
  458. <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
  459. </command>
  460. </epp>';
  461. $info_contact = switchepp_write_xml($client, $xml2, __FUNCTION__ . '(registrant contact info)');
  462. $contactdataArr = $info_contact->response->resData->children("contact", true)->infData;
  463. $results["Registrant"]["Contact Name"] = $contactdataArr->postalInfo->name;
  464. $results["Registrant"]["Company Name"] = $contactdataArr->postalInfo->org;
  465. $results["Registrant"]["Address line 1"] = $contactdataArr->postalInfo->addr->street[0];
  466. $results["Registrant"]["Address 2"] = $contactdataArr->postalInfo->addr->street[1];
  467. $results["Registrant"]["City"] = $contactdataArr->postalInfo->addr->city;
  468. $results["Registrant"]["Postcode"] = $contactdataArr->postalInfo->addr->pc;
  469. $results["Registrant"]["Country"] = $contactdataArr->postalInfo->addr->cc;
  470. $results["Registrant"]["Phone Number"] = $contactdataArr->voice;
  471. $results["Registrant"]["Email"] = $contactdataArr->email;
  472. if (!empty($Tech_id)) {
  473. #get tech detail
  474. $xml3 = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  475. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  476. <command>
  477. <info>
  478. <contact:info xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
  479. <contact:id>' . $Tech_id . '</contact:id>
  480. </contact:info>
  481. </info>
  482. <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
  483. </command>
  484. </epp>';
  485. $tect_info_contact = switchepp_write_xml($client, $xml3, __FUNCTION__ . '(tech contact info)');
  486. #*************************Show tech information in field****************************#
  487. $techdataArr = $tect_info_contact->response->resData->children("contact", true)->infData;
  488. $results["Technical"]["Contact Name"] = $techdataArr->postalInfo->name;
  489. $results["Technical"]["Company Name"] = $techdataArr->postalInfo->org;
  490. $results["Technical"]["Address line 1"] = $techdataArr->postalInfo->addr->street[0];
  491. $results["Technical"]["Address 2"] = $techdataArr->postalInfo->addr->street[1];
  492. $results["Technical"]["City"] = $techdataArr->postalInfo->addr->city;
  493. $results["Technical"]["Postcode"] = $techdataArr->postalInfo->addr->pc;
  494. $results["Technical"]["Country"] = $techdataArr->postalInfo->addr->cc;
  495. $results["Technical"]["Phone Number"] = $techdataArr->voice;
  496. $results["Technical"]["Email"] = $techdataArr->email;
  497. }
  498. } catch (Exception $ex) {
  499. $results['error'] = $ex->getMessage();
  500. }
  501. if (!empty($client))
  502. switchepp_logoutepp($client, $params);
  503. return $results;
  504. }
  505. #******************Save Contact/Tech Detail*********************#
  506. function switchepp_SaveContactDetails($params)
  507. {
  508. try {
  509. // $check_license = switchepp_license_status($params); #Check License
  510. $client = switchepp_clientloginepp($params); #Epp Connection
  511. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  512. #get domain info
  513. $xml = switchepp_domain_info($params);
  514. $info_domain = switchepp_write_xml($client, $xml, __FUNCTION__ . '(domain info)');
  515. $registrant_id = $info_domain->response->resData->children("domain", true)->infData->registrant; #registrant id
  516. $Tech_id = $info_domain->response->resData->children("domain", true)->infData->contact; #Tech id
  517. $contactArr = ['Registrant' => $registrant_id, 'Technical' => $Tech_id];
  518. $updateContactArr = $getContactArr = [];
  519. foreach ($contactArr as $type => $contactId) {
  520. if (!empty($contactArr[$type])) {
  521. $contact = [];
  522. $contact = $params['contactdetails'][$type];
  523. $updateName = ($contact['Full Name']) ? $contact['Full Name'] : $contact['Full Name'];
  524. $updateOrg = ($contact['Company Name']) ? $contact['Company Name'] : $contact['Company Name'];
  525. $updateAdd1 = ($contact['Address 1']) ? $contact['Address 1'] : $contact['Address 1'];
  526. $updateAdd2 = ($contact['Address 2']) ? $contact['Address 2'] : $contact['Address 2'];
  527. $updateCity = ($contact['City']) ? $contact['City'] : $contact['City'];
  528. $updateZip = ($contact['Postcode']) ? $contact['Postcode'] : $contact['Postcode'];
  529. $updateCc = ($contact['Country']) ? $contact['Country'] : $contact['Country'];
  530. $updateEmail = $contact['Email'];
  531. $updatePhn = ($contact['Phone Number']) ? $contact['Phone Number'] : $contact['Phone Number'];
  532. $updateContactArr['Full Name'] = htmlspecialchars(trim($updateName));
  533. $updateContactArr['Company Name'] = htmlspecialchars(trim($updateOrg));
  534. $updateContactArr['Address 1'] = htmlspecialchars(trim($updateAdd1));
  535. $updateContactArr['Address 2'] = htmlspecialchars(trim($updateAdd2));
  536. $updateContactArr['City'] = htmlspecialchars(trim($updateCity));
  537. $updateContactArr['Postcode'] = htmlspecialchars(trim($updateZip));
  538. $updateContactArr['Country'] = htmlspecialchars(trim($updateCc));
  539. $updateContactArr['Phone Number'] = htmlspecialchars(trim($updatePhn));
  540. $updateContactArr['Email'] = htmlspecialchars(trim($updateEmail));
  541. $contactInfo = switchepp_contact_info($client, $contactId, 'Get ' . $type);
  542. $contact_detail = simplexml_load_string($contactInfo);
  543. $contactdataArr = $contact_detail->response->resData->children("contact", true)->infData;
  544. foreach ($contactdataArr->postalInfo as $contactFromSwitch) {
  545. $getName = htmlspecialchars($contactFromSwitch->name);
  546. $getOrg = htmlspecialchars($contactFromSwitch->org);
  547. $getAdd1 = htmlspecialchars($contactFromSwitch->addr->street[0]);
  548. $getAdd2 = htmlspecialchars($contactFromSwitch->addr->street[1]);
  549. $getCity = htmlspecialchars($contactFromSwitch->addr->city);
  550. $getZip = htmlspecialchars($contactFromSwitch->addr->pc);
  551. $getCc = htmlspecialchars($contactFromSwitch->addr->cc);
  552. $getContactArr['Full Name'] = trim($getName);
  553. $getContactArr['Company Name'] = trim($getOrg);
  554. $getContactArr['Address 1'] = trim($getAdd1);
  555. $getContactArr['Address 2'] = trim($getAdd2);
  556. $getContactArr['City'] = trim($getCity);
  557. $getContactArr['Postcode'] = trim($getZip);
  558. $getContactArr['Country'] = trim($getCc);
  559. }
  560. $getEmail = htmlspecialchars($contactdataArr->email);
  561. $getPhn = htmlspecialchars($contactdataArr->voice);
  562. $getContactArr['Phone Number'] = trim($getPhn);
  563. $getContactArr['Email'] = trim($getEmail);
  564. if ($getContactArr == $updateContactArr)
  565. continue;
  566. $updateXml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  567. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  568. <command>
  569. <update>
  570. <contact:update xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
  571. <contact:id>' . $contactId . '</contact:id>
  572. <contact:chg>
  573. <contact:postalInfo type="loc">
  574. <contact:name>' . $updateContactArr['Full Name'] . '</contact:name>
  575. <contact:org>' . $updateContactArr['Company Name'] . '</contact:org>
  576. <contact:addr>
  577. <contact:street>' . $updateContactArr['Address 1'] . '</contact:street>
  578. <contact:street>' . $updateContactArr['Address 2'] . '</contact:street>
  579. <contact:city>' . $updateContactArr['City'] . '</contact:city>
  580. <contact:sp>' . $updateContactArr['City'] . '</contact:sp>
  581. <contact:pc>' . $updateContactArr['Postcode'] . '</contact:pc>
  582. <contact:cc>' . $updateContactArr['Country'] . '</contact:cc>
  583. </contact:addr>
  584. </contact:postalInfo>
  585. <contact:voice>' . $updateContactArr['Phone Number'] . '</contact:voice>
  586. <contact:fax/>
  587. <contact:email>' . $updateContactArr['Email'] . '</contact:email>
  588. <contact:authInfo>
  589. <contact:pw>con-' . time() . '</contact:pw>
  590. </contact:authInfo>
  591. </contact:chg>
  592. </contact:update>
  593. </update>
  594. <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
  595. </command>
  596. </epp>';
  597. switchepp_write_xml($client, $updateXml, 'Save ' . $type);
  598. }
  599. }
  600. } catch (Exception $ex) {
  601. $values['error'] = $ex->getMessage();
  602. }
  603. if (!empty($client))
  604. switchepp_logoutepp($client, $params);
  605. return $values;
  606. }
  607. #************************Domain Delete*************************#
  608. function switchepp_RequestDelete($params)
  609. {
  610. try {
  611. // $check_license = switchepp_license_status($params); #Check License
  612. $client = switchepp_clientloginepp($params); #Epp Connection
  613. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  614. #get domain info
  615. $xml = switchepp_domain_info($params);
  616. $info_domain = switchepp_write_xml($client, $xml, __FUNCTION__ . '(domain info)');
  617. $domainname = $params['domain_punycode'];
  618. $deletxml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  619. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  620. <command>
  621. <delete>
  622. <domain:delete xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
  623. <domain:name>' . $domainname . '</domain:name>
  624. </domain:delete>
  625. </delete>
  626. <clTRID>delete-domain-' . rand(1000, 9999) . '</clTRID>
  627. </command>
  628. </epp>';
  629. $delete_domain = switchepp_write_xml($client, $deletxml, __FUNCTION__);
  630. } catch (Exception $ex) {
  631. $values['error'] = $ex->getMessage();
  632. }
  633. if (!empty($client))
  634. switchepp_logoutepp($client, $params);
  635. return $values;
  636. }
  637. #******************************Domain transfer********************************#
  638. function switchepp_TransferDomain($params)
  639. {
  640. try {
  641. // $check_license = switchepp_license_status($params); #Check License
  642. $client = switchepp_clientloginepp($params); #Epp Connection
  643. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  644. #get domain info
  645. $xml = switchepp_domain_info($params);
  646. $domainname = $params['domain_punycode'];
  647. #domain transfer
  648. $xmlTransfer = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  649. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  650. <command>
  651. <transfer op="request">
  652. <domain:transfer xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
  653. <domain:name>' . $domainname . '</domain:name>
  654. <domain:authInfo>
  655. <domain:pw>' . htmlentities($params['transfersecret']) . '</domain:pw>
  656. </domain:authInfo>
  657. </domain:transfer>
  658. </transfer>
  659. <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
  660. </command>
  661. </epp>';
  662. $Transfer_domain = switchepp_write_xml($client, $xmlTransfer, __FUNCTION__);
  663. $regContactId = strtoupper(switchepp_generateContactID(8) . $params['domainid']);
  664. $contactCheckXml = switchepp_checkContact($regContactId);
  665. $contact_check = switchepp_write_xml($client, $contactCheckXml, __FUNCTION__ . ' (check contact)');
  666. if (1 == (int) $contact_check->response->resData->children("contact", true)->chkData->cd[0]->id->attributes()->avail) {
  667. $xmlclient = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  668. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  669. <command>
  670. <create>
  671. <contact:create xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
  672. <contact:id>RE' . $regContactId . '</contact:id>
  673. <contact:postalInfo type="loc">
  674. <contact:name>' . $params['fullname'] . '</contact:name>
  675. <contact:org>' . $params['companyname'] . '</contact:org>
  676. <contact:addr>
  677. <contact:street>' . $params['address1'] . '</contact:street>
  678. <contact:street>' . $params['address2'] . '</contact:street>
  679. <contact:city>' . $params['city'] . '</contact:city>
  680. <contact:pc>' . $params['postcode'] . '</contact:pc>
  681. <contact:cc>' . $params['country'] . '</contact:cc>
  682. </contact:addr>
  683. </contact:postalInfo>
  684. <contact:voice>' . $params['phonenumberformatted'] . '</contact:voice>
  685. <contact:email>' . $params['email'] . '</contact:email>
  686. <contact:authInfo>
  687. <contact:pw>Con-' . time() . '</contact:pw>
  688. </contact:authInfo>
  689. </contact:create>
  690. </create>
  691. <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
  692. </command>
  693. </epp>';
  694. $create_reg_contact = switchepp_write_xml($client, $xmlclient, __FUNCTION__ . ' (create reg contact)');
  695. $reg_contact_id = $create_reg_contact->response->resData->children('contact', true)->creData->id;
  696. } else
  697. $reg_contact_id = $regContactId;
  698. #*************tech create*****************#
  699. $techContactId = strtoupper(switchepp_generateContactID(6) . $params['domainid']);
  700. $contactCheckXml = switchepp_checkContact($techContactId);
  701. $contact_check = switchepp_write_xml($client, $contactCheckXml, __FUNCTION__ . ' (check contact)');
  702. if (1 == (int) $contact_check->response->resData->children("contact", true)->chkData->cd[0]->id->attributes()->avail) {
  703. $xmlTech = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  704. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  705. <command>
  706. <create>
  707. <contact:create xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
  708. <contact:id>TE' . $techContactId . '</contact:id>
  709. <contact:postalInfo type="loc">
  710. <contact:name>' . $params['adminfirstname'] . ' ' . $params['adminlastname'] . '</contact:name>
  711. <contact:org>' . $params['admincompanyname'] . '</contact:org>
  712. <contact:addr>
  713. <contact:street>' . $params['adminaddress1'] . '</contact:street>
  714. <contact:street>' . $params['adminaddress2'] . '</contact:street>
  715. <contact:city>' . $params['admincity'] . '</contact:city>
  716. <contact:pc>' . $params['adminpostcode'] . '</contact:pc>
  717. <contact:cc>' . $params['admincountry'] . '</contact:cc>
  718. </contact:addr>
  719. </contact:postalInfo>
  720. <contact:voice>' . $params['adminfullphonenumber'] . '</contact:voice>
  721. <contact:email>' . $params['adminemail'] . '</contact:email>
  722. <contact:authInfo>
  723. <contact:pw>Tec-' . time() . '</contact:pw>
  724. </contact:authInfo>
  725. </contact:create>
  726. </create>
  727. <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
  728. </command>
  729. </epp>';
  730. $create_tech_contact = switchepp_write_xml($client, $xmlTech, __FUNCTION__ . ' (create tech contact)');
  731. $tech_contact_id = $create_tech_contact->response->resData->children('contact', true)->creData->id;
  732. } else
  733. $tech_contact_id = $techContactId;
  734. if ($params['dnssec'] == "on") {
  735. $digestType = $params['digest_type'];
  736. if (empty($digestType))
  737. $digestType = 1;
  738. if ($digestType == 1) {
  739. $string = switchepp_generateDigestRandomString(40);
  740. $digest = strtoupper(bin2hex($string));
  741. $digest = substr($digest, 0, 40);
  742. } elseif ($digestType == 2) {
  743. $string = switchepp_generateDigestRandomString(64);
  744. $digest = strtoupper(bin2hex($string));
  745. $digest = substr($digest, 0, 64);
  746. } elseif ($digestType == 3 || $digestType == 4) {
  747. $string = switchepp_generateDigestRandomString(96);
  748. $digest = strtoupper(bin2hex($string));
  749. $digest = substr($digest, 0, 96);
  750. }
  751. $params['algorithm'] = (!empty($params['algorithm'])) ? $params['algorithm'] : '5';
  752. $dnssec = '<extension>
  753. <secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
  754. <secDNS:add>
  755. <secDNS:dsData>
  756. <secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag>
  757. <secDNS:alg>' . $params['algorithm'] . '</secDNS:alg>
  758. <secDNS:digestType>' . $digestType . '</secDNS:digestType>
  759. <secDNS:digest>' . $digest . '</secDNS:digest>
  760. </secDNS:dsData>
  761. </secDNS:add>
  762. </secDNS:update>
  763. </extension>';
  764. }
  765. $xmlUpdate = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  766. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  767. <command>
  768. <update>
  769. <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
  770. <domain:name>' . $domainname . '</domain:name>
  771. <domain:add>
  772. <domain:contact type="tech">' . $tech_contact_id . '</domain:contact>
  773. </domain:add>
  774. <domain:chg>
  775. <domain:registrant>' . $reg_contact_id . '</domain:registrant>
  776. </domain:chg>
  777. </domain:update>
  778. </update>
  779. ' . $dnssec . '
  780. <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
  781. </command>
  782. </epp>';
  783. $update_domain = switchepp_write_xml($client, $xmlUpdate, __FUNCTION__ . ' (Domain update)');
  784. } catch (Exception $ex) {
  785. $values['error'] = $ex->getMessage();
  786. }
  787. if (!empty($client))
  788. switchepp_logoutepp($client, $params);
  789. return $values;
  790. }
  791. #***************************Get Epp Code******************************#
  792. function switchepp_GetEPPCode($params)
  793. {
  794. try {
  795. // $check_license = switchepp_license_status($params); #Check License
  796. $client = switchepp_clientloginepp($params); #Epp Connection
  797. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  798. #get domain info
  799. $xml = switchepp_domain_info($params);
  800. $domainPw = switchepp_generateRandomString(15);
  801. $xml = switchepp_update_domain_auth($params, $domainPw);
  802. $domainUpdate = switchepp_write_xml($client, $xml, __FUNCTION__);
  803. $values['eppcode'] = $domainPw;
  804. } catch (Exception $ex) {
  805. $values['error'] = $ex->getMessage();
  806. }
  807. if (!empty($client))
  808. switchepp_logoutepp($client, $params);
  809. return $values;
  810. }
  811. #***************************Custom button function******************************#
  812. function switchepp_AdminCustomButtonArray()
  813. {
  814. $buttonarray = array(
  815. "Restore Domain" => "Restore",
  816. "Disable DNSSEC" => "Disable_DNSSEC",
  817. "Enable DNSSEC" => "Enable_DNSSEC",
  818. );
  819. return $buttonarray;
  820. }
  821. //registrarmodule_ClientAreaCustomButtonArray
  822. function switchepp_ClientAreaCustomButtonArray()
  823. {
  824. return array(
  825. "Enable DNSSEC" => "Enable_DNSSEC",
  826. "Disable DNSSEC" => "Disable_DNSSEC",
  827. );
  828. }
  829. #***************************Restore Domain******************************#
  830. function switchepp_Restore($params)
  831. {
  832. try {
  833. // $check_license = switchepp_license_status($params); #Check License
  834. $client = switchepp_clientloginepp($params); #Epp Connection
  835. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  836. #Domain Restore XML
  837. $xml = switchepp_domain_restore($params);
  838. $domainRestore = switchepp_write_xml($client, $xml, __FUNCTION__);
  839. } catch (Exception $ex) {
  840. $values['error'] = $ex->getMessage();
  841. }
  842. if (!empty($client))
  843. switchepp_logoutepp($client, $params);
  844. return $values;
  845. }
  846. #***************************Disable DNSSEC******************************#
  847. function switchepp_Disable_DNSSEC($params)
  848. {
  849. try {
  850. // $check_license = switchepp_license_status($params); #Check License
  851. $client = switchepp_clientloginepp($params); #Epp Connection
  852. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  853. #Domain Restore XML
  854. $xml = switcheppDisableDnssec($params);
  855. $domainRestore = switchepp_write_xml($client, $xml, __FUNCTION__);
  856. $values['success'] = 'success';
  857. } catch (Exception $ex) {
  858. $values['error'] = $ex->getMessage();
  859. return $values;
  860. }
  861. if (!empty($client))
  862. switchepp_logoutepp($client, $params);
  863. return $values;
  864. }
  865. #***************************Enable DNSSEC******************************#
  866. function switchepp_Enable_DNSSEC($params)
  867. {
  868. try {
  869. // $check_license = switchepp_license_status($params); #Check License
  870. //if ($check_license['status'] == "Active") {
  871. $client = switchepp_clientloginepp($params); #Epp Connection
  872. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  873. //}
  874. #Domain Restore XML
  875. $xml = switcheppEnableDnssec($params);
  876. $domainRestore = switchepp_write_xml($client, $xml, __FUNCTION__);
  877. $values['success'] = 'success';
  878. } catch (Exception $ex) {
  879. $values['error'] = $ex->getMessage();
  880. }
  881. if (!empty($client))
  882. switchepp_logoutepp($client, $params);
  883. return $values;
  884. }
  885. #***************************Admin Fields******************************#
  886. function switchepp_AdminDomainsTabFields($params)
  887. {
  888. try {
  889. $settingArr = getSwitchEPP_setting($params['domainid']); #get registrar config settings
  890. $params = array_merge($params, $settingArr);
  891. // $check_license = switchepp_license_status($params); #Check License
  892. $client = switchepp_clientloginepp($params); #Epp Connection
  893. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  894. $params['domain_punycode'] = $params['sld_punycode'] . '.' . $params['tld'];
  895. #get domain info
  896. $xml = switchepp_domain_info($params);
  897. $info_domain = switchepp_write_xml($client, $xml, __FUNCTION__ . '(domain info)');
  898. $expDate = $info_domain->response->resData->children("domain", true)->infData->exDate ? date('m-d-Y', strtotime($info_domain->response->resData->children("domain", true)->infData->exDate)) : '';
  899. $status = $info_domain->response->resData->children("domain", true)->infData->status->attributes()->s;
  900. $upDate = $info_domain->response->resData->children("domain", true)->infData->upDate ? date('m-d-Y', strtotime($info_domain->response->resData->children("domain", true)->infData->upDate)) : '';
  901. $transferDate = $info_domain->response->resData->children("domain", true)->infData->trDate ? date('m-d-Y', strtotime($info_domain->response->resData->children("domain", true)->infData->trDate)) : '';
  902. $createDate = $info_domain->response->resData->children("domain", true)->infData->crDate ? date('m-d-Y', strtotime($info_domain->response->resData->children("domain", true)->infData->crDate)) : '';
  903. $DNSSecStatus = $info_domain->response->extension->children("secDNS", true)->infData->dsData->keyTag ? "Yes" : "No";
  904. $html = '';
  905. $html .= '<table width="100%" style="margin-bottom:0;" class="datatable">';
  906. $html .= '<tbody>';
  907. $html .= '<tr align="left">';
  908. $html .= '<th style="text-align: left;">Item</th>';
  909. $html .= '<th style="text-align: left;">Content</th>';
  910. $html .= '</tr>';
  911. $html .= '<tr align="left">';
  912. $html .= '<td>Status</td>';
  913. $html .= '<td>' . $status . '</td>';
  914. $html .= '</tr>';
  915. $html .= '<tr align="left">';
  916. $html .= '<td>Creation Date</td>';
  917. $html .= '<td>' . $createDate . '</td>';
  918. $html .= '</tr>';
  919. $html .= '<tr align="left">';
  920. $html .= '<td>Expiration Date</td>';
  921. $html .= '<td>' . $expDate . '</td>';
  922. $html .= '</tr>';
  923. $html .= '<tr align="left">';
  924. $html .= '<td>Last Update</td>';
  925. $html .= '<td>' . $upDate . '</td>';
  926. $html .= '</tr>';
  927. $html .= '<tr align="left">';
  928. $html .= '<td>Last Transfer</td>';
  929. $html .= '<td>' . $transferDate . '</td>';
  930. $html .= '</tr>';
  931. $html .= '<tr align="left">';
  932. $html .= '<td>DNSSec Status</td>';
  933. $html .= '<td>' . $DNSSecStatus . '</td>';
  934. $html .= '</tr>';
  935. $html .= '</tbody>';
  936. $html .= '</table>';
  937. $values['Domain Detail'] = $html;
  938. } catch (Exception $ex) {
  939. $values['error'] = $ex->getMessage();
  940. }
  941. if (!empty($client))
  942. switchepp_logoutepp($client, $params);
  943. return $values;
  944. }
  945. #*******************Module Syncronize********************#
  946. function switchepp_Sync($params)
  947. {
  948. try {
  949. $client = switchepp_clientloginepp($params); #Epp Connection
  950. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  951. #get domain info
  952. $xml = switchepp_domain_info($params);
  953. $info_domain = switchepp_write_xml($client, $xml, __FUNCTION__ . '(domain info)');
  954. $expDate = substr($info_domain->response->resData->children("domain", true)->infData->exDate, 0, 10);
  955. $statusres = $info_domain->response->resData->children("domain", true)->infData->status->attributes()->s;
  956. $timestamp = strtotime($info_domain->response->resData->children("domain", true)->infData->exDate);
  957. if ($timestamp === false) {
  958. return array(
  959. 'error' => 'Renewal date empty for domain: ' . $params['domain']
  960. );
  961. }
  962. Capsule::table('tbldomains')->where('id', $params['domainid'])->update(['expirydate' => $expDate]);
  963. $domain = Capsule::table('tbldomains')
  964. ->where('id', '=', $params['domainid'])
  965. ->where('donotrenew', '=', '1')
  966. ->where('registrar', '=', 'switchepp')
  967. ->whereRaw('`expirydate` >= CURRENT_DATE() AND `expirydate` < ADDDATE(CURRENT_DATE(), INTERVAL 1 DAY)')
  968. ->first();
  969. if (isset($domain->expirydate)) {
  970. $domainname = $params['domain_punycode'];
  971. $deletxml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  972. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  973. <command>
  974. <delete>
  975. <domain:delete xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
  976. <domain:name>' . $domainname . '</domain:name>
  977. </domain:delete>
  978. </delete>
  979. <clTRID>delete-domain-' . rand(1000, 9999) . '</clTRID>
  980. </command>
  981. </epp>';
  982. $delete_domain = switchepp_write_xml($client, $deletxml, __FUNCTION__ . ' (delete domain)');
  983. }
  984. if ($timestamp < time()) {
  985. $values['expirydate'] = $expDate;
  986. $values['expired'] = true;
  987. } else {
  988. $values['expirydate'] = $expDate;
  989. $values['active'] = true;
  990. }
  991. } catch (Exception $ex) {
  992. $values['error'] = $ex->getMessage();
  993. }
  994. if (!empty($client))
  995. switchepp_logoutepp($client, $params);
  996. return $values;
  997. }
  998. #*******************Transfer Syncronize********************#
  999. function switchepp_TransferSync($params)
  1000. {
  1001. try {
  1002. $client = switchepp_clientloginepp($params); #Epp Connection
  1003. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  1004. #get domain info
  1005. $xml = switchepp_domain_info($params);
  1006. $info_domain = switchepp_write_xml($client, $xml, __FUNCTION__ . '(domain info)');
  1007. $expDate = substr($info_domain->response->resData->children("domain", true)->infData->exDate, 0, 10);
  1008. $statusres = $info_domain->response->resData->children("domain", true)->infData->status->attributes()->s;
  1009. if (!$statusres) {
  1010. Capsule::table('tbldomains')->where('id', $params['domainid'])->update(["status" => "Cancelled"]);
  1011. $values['error'] = "TransferSync/domain-info: Domain not found";
  1012. }
  1013. Capsule::table('tbldomains')->where('id', $params['domainid'])->update(['expirydate' => $expDate]);
  1014. if ($statusres == "ok" || $statusres == "serverTransferProhibited") {
  1015. $values['completed'] = true;
  1016. } else {
  1017. $values['error'] = "Sync/domain-info: Unknown status code '$statusres' ";
  1018. }
  1019. $values['expirydate'] = $expDate;
  1020. } catch (Exception $ex) {
  1021. $values['error'] = $ex->getMessage();
  1022. }
  1023. if (!empty($client))
  1024. switchepp_logoutepp($client, $params);
  1025. return $values;
  1026. }
  1027. #***********************Register Nameserver**************************#
  1028. function switchepp_RegisterNameserver($params)
  1029. {
  1030. try {
  1031. // $check_license = switchepp_license_status($params); #Check License
  1032. $client = switchepp_clientloginepp($params); #Epp Connection
  1033. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  1034. #get domain info
  1035. $xml = switchepp_domain_info($params);
  1036. $xml_Hostcreate = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  1037. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  1038. <command>
  1039. <create>
  1040. <host:create xmlns:host="urn:ietf:params:xml:ns:host-1.0">
  1041. <host:name>' . $params['nameserver'] . '</host:name>
  1042. <host:addr ip="v4">' . $params['ipaddress'] . '</host:addr>
  1043. </host:create>
  1044. </create>
  1045. <clTRID>' . rand(9999999, 100000) . '</clTRID>
  1046. </command>
  1047. </epp>';
  1048. $host_create = switchepp_write_xml($client, $xml_Hostcreate, __FUNCTION__);
  1049. } catch (Exception $ex) {
  1050. $values['error'] = $ex->getMessage();
  1051. }
  1052. if (!empty($client))
  1053. switchepp_logoutepp($client, $params);
  1054. return $values;
  1055. }
  1056. #**************************Update Nameserver************************#
  1057. function switchepp_ModifyNameserver($params)
  1058. {
  1059. try {
  1060. // $check_license = switchepp_license_status($params); #Check License
  1061. $client = switchepp_clientloginepp($params); #Epp Connection
  1062. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  1063. #get domain info
  1064. $xml = switchepp_domain_info($params);
  1065. $update_req = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  1066. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  1067. <command>
  1068. <update>
  1069. <host:update xmlns:host="urn:ietf:params:xml:ns:host-1.0">
  1070. <host:name>' . $params['nameserver'] . '</host:name>
  1071. <host:add>
  1072. <host:addr ip="v4">' . $params['newipaddress'] . '</host:addr>
  1073. </host:add>
  1074. <host:rem>
  1075. <host:addr ip="v4">' . $params['currentipaddress'] . '</host:addr>
  1076. </host:rem>
  1077. </host:update>
  1078. </update>
  1079. <clTRID>' . rand(9999999, 100000) . '</clTRID>
  1080. </command>
  1081. </epp>';
  1082. $update = switchepp_write_xml($client, $update_req, __FUNCTION__);
  1083. } catch (Exception $ex) {
  1084. $values['error'] = $ex->getMessage();
  1085. }
  1086. if (!empty($client))
  1087. switchepp_logoutepp($client, $params);
  1088. return $values;
  1089. }
  1090. #**********************Delete Nameserver****************************#
  1091. function switchepp_DeleteNameserver($params)
  1092. {
  1093. try {
  1094. // $check_license = switchepp_license_status($params); #Check License
  1095. $client = switchepp_clientloginepp($params); #Epp Connection
  1096. $login = switchepp_loggedinepp($client, $params); #Epp Client login
  1097. #get domain info
  1098. $xml = switchepp_domain_info($params);
  1099. $delete_xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  1100. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  1101. <command>
  1102. <delete>
  1103. <host:delete
  1104. xmlns:host="urn:ietf:params:xml:ns:host-1.0">
  1105. <host:name>' . $params['nameserver'] . '</host:name>
  1106. </host:delete>
  1107. </delete>
  1108. <clTRID>' . rand(9999999, 100000) . '</clTRID>
  1109. </command>
  1110. </epp>';
  1111. $delete = switchepp_write_xml($client, $delete_xml, __FUNCTION__);
  1112. } catch (Exception $ex) {
  1113. $values['error'] = $ex->getMessage();
  1114. }
  1115. if (!empty($client))
  1116. switchepp_logoutepp($client, $params);
  1117. return $values;
  1118. }
  1119. #*********************Create Epp Connection**************************#
  1120. function switchepp_clientloginepp($params)
  1121. {
  1122. try {
  1123. $certFile = __DIR__ . '/cert/cert.pem';
  1124. $client = new Net_EPP_Client();
  1125. $use_ssl = true;
  1126. $eppurl = $params['eppurl'];
  1127. $port = $params['eppport'];
  1128. if ($params['testMode'] == "on") {
  1129. $eppurl = trim($params['ote_eppurl']);
  1130. $port = $params['ote_eppport'];
  1131. }
  1132. if (file_exists($certFile)) {
  1133. $context = stream_context_create();
  1134. stream_context_set_option($context, 'ssl', 'verify_peer', false);
  1135. stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
  1136. stream_context_set_option($context, 'ssl', 'local_cert', $certFile);
  1137. stream_context_set_option($context, 'ssl', 'passphrase', $params['passphrase']);
  1138. $client->connect($eppurl, $port, 300, $use_ssl, $context) or die("Not connected with epp server");
  1139. } else {
  1140. $context = false;
  1141. $client->connect($eppurl, $port, 300, $use_ssl, $context) or die("Not connected with epp server");
  1142. }
  1143. } catch (Exception $e) {
  1144. $port = $params['eppport'];
  1145. throw new exception("Connection Error: " . $e->getMessage());
  1146. }
  1147. return $client;
  1148. }
  1149. #*********************Epp client login**************************#
  1150. function switchepp_loggedinepp($client, $params)
  1151. {
  1152. if($params['testMode'] == "on"){
  1153. $params['registrar_id'] = $params['ote_registrar_id'];
  1154. $params['registrar_password'] = $params['ote_registrar_password'];
  1155. }
  1156. $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  1157. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  1158. <command>
  1159. <login>
  1160. <clID>' . $params['registrar_id'] . '</clID>
  1161. <pw>' . $params['registrar_password'] . '</pw>
  1162. <options>
  1163. <version>1.0</version>
  1164. <lang>en</lang>
  1165. </options>
  1166. <svcs>
  1167. <objURI>urn:ietf:params:xml:ns:domain-1.0</objURI>
  1168. <objURI>urn:ietf:params:xml:ns:contact-1.0</objURI>
  1169. <objURI>urn:ietf:params:xml:ns:host-1.0</objURI>
  1170. <svcExtension>
  1171. <extURI>urn:ietf:params:xml:ns:secDNS-1.1</extURI>
  1172. <extURI>urn:ietf:params:xml:ns:rgp-1.0</extURI>
  1173. <extURI>urn:ietf:params:xml:ns:changePoll-1.0</extURI>
  1174. <extURI>https://www.nic.ch/epp/balance-1.0</extURI>
  1175. <extURI>urn:ietf:params:xml:ns:epp:unhandled-namespaces-1.0</extURI>
  1176. </svcExtension>
  1177. </svcs>
  1178. </login>
  1179. <clTRID>' . rand(9999999, 100000) . '</clTRID>
  1180. </command>
  1181. </epp>';
  1182. $response = $client->request($xml);
  1183. logModuleCall('SWITCH EPP', 'login', $xml, $response);
  1184. $result = new SimpleXMLElement($response);
  1185. if ($result->response->result->attributes()->code >= 2000) {
  1186. throw new exception($result->response->result->msg . '. ' . $result->response->result->extValue->reason);
  1187. }
  1188. return $result;
  1189. }
  1190. function switchepp_logoutepp($client, $params)
  1191. {
  1192. if($params['testMode'] == "on"){
  1193. $params['registrar_id'] = $params['ote_registrar_id'];
  1194. }
  1195. $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  1196. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  1197. <epp:command xmlns:epp="urn:ietf:params:xml:ns:epp-1.0">
  1198. <epp:logout />
  1199. <epp:clTRID>' . $params['registrar_id'] . '</epp:clTRID>
  1200. </epp:command>
  1201. </epp>';
  1202. $response = $client->request($xml);
  1203. logModuleCall('SWITCH EPP', 'logout', $xml, $response);
  1204. }
  1205. #******************** Get Contact info*****************#
  1206. function switchepp_contact_info($client, $contactId, $contactType)
  1207. {
  1208. #get contact detail
  1209. $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  1210. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  1211. <command>
  1212. <info>
  1213. <contact:info xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
  1214. <contact:id>' . $contactId . '</contact:id>
  1215. </contact:info>
  1216. </info>
  1217. <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
  1218. </command>
  1219. </epp>';
  1220. $response = $client->request($xml);
  1221. logModuleCall('SWITCH EPP', $contactType, $xml, $response);
  1222. return $response;
  1223. }
  1224. #***********************Get domain info*************************#
  1225. function switchepp_domain_info($params)
  1226. {
  1227. $domainname = $params['domain_punycode'];
  1228. $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  1229. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  1230. <command>
  1231. <info>
  1232. <domain:info xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
  1233. <domain:name hosts="all">' . $domainname . '</domain:name>
  1234. </domain:info>
  1235. </info>
  1236. <clTRID>clientref-' . rand(100, 999) . '</clTRID>
  1237. </command>
  1238. </epp>';
  1239. return $xml;
  1240. }
  1241. function switchepp_domain_restore($params)
  1242. {
  1243. $domainname = $params['domain_punycode'];
  1244. $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  1245. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  1246. <command>
  1247. <update>
  1248. <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
  1249. <domain:name>' . $domainname . '</domain:name>
  1250. <domain:chg />
  1251. </domain:update>
  1252. </update>
  1253. <extension>
  1254. <rgp:update xmlns:rgp="urn:ietf:params:xml:ns:rgp-1.0">
  1255. <rgp:restore op="request" />
  1256. </rgp:update>
  1257. </extension>
  1258. </command>
  1259. </epp>';
  1260. return $xml;
  1261. }
  1262. function switcheppDisableDnssec($params)
  1263. {
  1264. $domainname = $params['domain_punycode'];
  1265. ;
  1266. $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  1267. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  1268. <command>
  1269. <update>
  1270. <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
  1271. <domain:name>' . $domainname . '</domain:name>
  1272. </domain:update>
  1273. </update>
  1274. <extension>
  1275. <secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
  1276. <secDNS:rem>
  1277. <secDNS:all>true</secDNS:all>
  1278. </secDNS:rem>
  1279. </secDNS:update>
  1280. </extension>
  1281. <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
  1282. </command>
  1283. </epp>';
  1284. return $xml;
  1285. }
  1286. function switcheppEnableDnssec($params)
  1287. {
  1288. $domainname = $params['domain_punycode'];
  1289. $digestType = $params['digest_type'];
  1290. if (empty($digestType))
  1291. $digestType = 1;
  1292. if ($digestType == 1) {
  1293. $string = switchepp_generateDigestRandomString(40);
  1294. $digest = strtoupper(bin2hex($string));
  1295. $digest = substr($digest, 0, 40);
  1296. } elseif ($digestType == 2) {
  1297. $string = switchepp_generateDigestRandomString(64);
  1298. $digest = strtoupper(bin2hex($string));
  1299. $digest = substr($digest, 0, 64);
  1300. } elseif ($digestType == 3 || $digestType == 4) {
  1301. $string = switchepp_generateDigestRandomString(96);
  1302. $digest = strtoupper(bin2hex($string));
  1303. $digest = substr($digest, 0, 96);
  1304. }
  1305. $params['algorithm'] = (!empty($params['algorithm'])) ? $params['algorithm'] : '5';
  1306. $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  1307. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  1308. <command>
  1309. <update>
  1310. <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
  1311. <domain:name>' . $domainname . '</domain:name>
  1312. </domain:update>
  1313. </update>
  1314. <extension>
  1315. <secDNS:update xmlns:secDNS="urn:ietf:params:xml:ns:secDNS-1.1">
  1316. <secDNS:add>
  1317. <secDNS:dsData>
  1318. <secDNS:keyTag>' . substr(time(), 0, 5) . '</secDNS:keyTag>
  1319. <secDNS:alg>' . $params['algorithm'] . '</secDNS:alg>
  1320. <secDNS:digestType>' . $digestType . '</secDNS:digestType>
  1321. <secDNS:digest>' . $digest . '</secDNS:digest>
  1322. </secDNS:dsData>
  1323. </secDNS:add>
  1324. </secDNS:update>
  1325. </extension>
  1326. <clTRID>clientref-' . rand(1000, 9999) . '</clTRID>
  1327. </command>
  1328. </epp>';
  1329. return $xml;
  1330. }
  1331. function switchepp_update_domain_auth($params, $domainPw)
  1332. {
  1333. $domainname = $params['domain_punycode'];
  1334. $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  1335. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  1336. <command>
  1337. <update>
  1338. <domain:update xmlns:domain="urn:ietf:params:xml:ns:domain-1.0">
  1339. <domain:name>' . $domainname . '</domain:name>
  1340. <domain:chg>
  1341. <domain:authInfo>
  1342. <domain:pw>' . $domainPw . '</domain:pw>
  1343. </domain:authInfo>
  1344. </domain:chg>
  1345. </domain:update>
  1346. </update>
  1347. <clTRID>domainupdate-' . rand(1000, 9999) . '</clTRID>
  1348. </command>
  1349. </epp>';
  1350. return $xml;
  1351. }
  1352. function switchepp_checkContact($id)
  1353. {
  1354. $xml = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
  1355. <epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
  1356. <command>
  1357. <check>
  1358. <contact:check xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
  1359. <contact:id>' . $id . '</contact:id>
  1360. </contact:check>
  1361. </check>
  1362. <clTRID>ABC-12345</clTRID>
  1363. </command>
  1364. </epp>';
  1365. return $xml;
  1366. }
  1367. function switchepp_generateRandomString($length = 15)
  1368. {
  1369. $characters = 'abcdefghijklmnopqrstuvwxyz123456789!@$*%#ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  1370. $charactersLength = strlen($characters);
  1371. $randomString = '';
  1372. for ($i = 0; $i < $length; $i++) {
  1373. $randomString .= $characters[rand(0, $charactersLength - 1)];
  1374. }
  1375. return $randomString;
  1376. }
  1377. function switchepp_generateDigestRandomString($length = 15)
  1378. {
  1379. $characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  1380. $charactersLength = strlen($characters);
  1381. $randomString = '';
  1382. for ($i = 0; $i < $length; $i++) {
  1383. $randomString .= $characters[rand(0, $charactersLength - 1)];
  1384. }
  1385. return $randomString;
  1386. }
  1387. function switchepp_generateContactID($length = 15)
  1388. {
  1389. $characters = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  1390. $charactersLength = strlen($characters);
  1391. $randomString = '';
  1392. for ($i = 0; $i < $length; $i++) {
  1393. $randomString .= $characters[rand(0, $charactersLength - 1)];
  1394. }
  1395. return $randomString;
  1396. }
  1397. function switcheppGetDomainName($id)
  1398. {
  1399. $data = Capsule::table('tbldomains')->where('id', $id)->first();
  1400. return $data->domain;
  1401. }
  1402. function switchepp_write_xml($client, $xml, $action, $extra = NULL)
  1403. {
  1404. $response = $client->request($xml);
  1405. if (empty($extra)) {
  1406. logModuleCall('SWITCH EPP', $action, $xml, $response);
  1407. $result = new SimpleXMLElement($response);
  1408. if ($result->response->result->attributes()->code >= 2000) {
  1409. throw new exception($result->response->result->msg . '. ' . $result->response->result->extValue->reason);
  1410. }
  1411. return $result;
  1412. }
  1413. }
  1414. function getSwitchEPP_setting($id)
  1415. {
  1416. #select table domain data
  1417. $domain_select_data = Capsule::table('tbldomains')->where('id', $id)->first();
  1418. #select registrar data
  1419. foreach (Capsule::table('tblregistrars')->where('registrar', $domain_select_data->registrar)->get() as $registrar_data) {
  1420. $data[$registrar_data->setting] = decrypt($registrar_data->value);
  1421. }
  1422. return $data;
  1423. }
  1424. function switchepp_license_status($params)
  1425. {
  1426. $license_check = SwitchEpp_license_checklicense($params['licensenum']);
  1427. if ($license_check['status'] != 'Active') {
  1428. throw new exception('license is ' . $license_check['status']);
  1429. }
  1430. return $license_check;
  1431. }
  1432. #License function
  1433. function SwitchEpp_license_checklicense($licensekey, $localkey = "")
  1434. {
  1435. $results['status'] = "Active";
  1436. return $results;
  1437. }