| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <?php
- use MGModule\DNSManager2\mgLibs\custom\dns\utils as main;
- /**
- * This function is invoked to get DNS Records to display them in DNS Management section
- * @param Array $params Collection of WHMCS parameters
- * @return Array Array with error key is returned in case of error. With success key otherwise
- */
- if(!function_exists('%module_name%_GetDNS'))
- {
- function %module_name%_GetDNS($params)
- {
- $domainId = null;
- if(isset($params['domainid']))
- {
- $domainId = $params['domainid'];
- }
- if(empty($domainId))
- {
- $id = $_GET["id"];
- if (empty($id))
- {
- $id = $_GET['domainid'];
- }
- $domainId = $id;
- }
- try
- {
- $registrarHelper = new main\CustomDnsRegistrarHelper($domainId);
- $dns = $registrarHelper->getDNSRecords($domainId);
- }
- catch(Exception $e)
- {
- return array('error' => $e->getMessage());
- }
- return $dns;
- }
- }
- /**
- * This function is invoked when user tries to save DNS Records form DNS Management section
- * @param Array $params Collection of WHMCS parameters
- * @return Array Array with error key is returned in case of error. With success key otherwise
- */
- if(!function_exists('%module_name%_SaveDNS'))
- {
- function %module_name%_SaveDNS($params)
- {
- $domainId = null;
- if(isset($params['domainid']))
- {
- $domainId = $params['domainid'];
- }
- if(empty($domainId))
- {
- $id = $_GET["id"];
- if(empty($id))
- {
- $id = $_GET['domainid'];
- }
- $domainId = $id;
- }
- try
- {
- $registrarHelper = new main\CustomDnsRegistrarHelper($domainId);
- $registrarHelper->saveDNSRecords();
- }
- catch(Exception $ex)
- {
- return array(
- 'error' => $ex->getMessage()
- );
- }
- return array("success" => true);
- }
- }
|