/** * Get domain hosts (records) for a domain name. * * Executes the '...' command on Registrar's servers, to get domain hosts (records) * for a domain name that is active and belongs to your Ascio account. * * @param integer $domainID Domain code identifier * @return bool True if succeed and False if failed. * @access public * @see getDomainHosts */ function getDomainHosts($domainID) { try { // Connection to the SOAP system $soap = $this->Connect(); if (empty($this->session)) { throw new Exception('SOAP connection system error'); } // Get the domain information $domain = Domains::find($domainID); if (!empty($domain[0])) { $domain_name = $domain[0]['domain'] . "." . $domain[0]['DomainsTlds']['WhoisServers']['tld']; } $dnszone = array(); $zones = $soap->zoneEntryList($this->session['id'], $domain_name); if (is_array($zones)) { $i = 0; foreach ($zones as $zone) { $dnszone[$i]['subdomain'] = $zone->subdomain; $dnszone[$i]['fieldtype'] = $zone->fieldtype; $dnszone[$i]['target'] = $zone->target; $i++; } return Dns_Zones::saveZone($domainID, $dnszone); } return false; } catch (Exception $e) { throw new Exception($e->getMessage()); } }
/** * Add a dns zone * * @params $id * @params $subdomain * @params $target * @params $typeId * * @return ARRAY Record */ public static function addDnsZone($domainId, $subdomain, $target, $typeId) { $myzone = new Dns_Zones(); $myzone->domain_id = $domainId; $myzone->subdomain = $subdomain; $myzone->type_id = $typeId; $myzone->target = $target; $myzone->updating_date = date('Y-m-d H:i:s'); return $myzone->trySave(); }
public static function saveDnsZones($domainid, $data) { $zone = new Dns_Zones(); if (!empty($data['target']) && is_numeric($domainid)) { $zone->subdomain = $data['subdomain']; $zone->target = $data['target']; $zone->type_id = $data['zone']; $zone->domain_id = $domainid; $zone->save(); return true; } return false; }
/** * processAction * Update the record previously selected * @return unknown_type */ public function processAction() { $request = $this->getRequest(); try { // Check if we have a POST request if (!$request->isPost()) { return $this->_helper->redirector('index'); } // Get our form and validate it $form = $this->getForm('/admin/domains/process'); if (!$form->isValid($request->getPost())) { // Invalid entries $this->view->form = $form; $this->view->title = $this->translator->translate("Domain Process"); $this->view->description = $this->translator->translate("Check all the information posted before saving them."); return $this->_helper->viewRenderer('customform'); // re-render the login form } // Get the values posted $params = $form->getValues(); // Get the id $id = $params['domain_id']; if (!empty($params['dnsform']['target']) && !empty($params['dnsform']['zones'])) { Dns_Zones::addDnsZone($id, $params['dnsform']['subdomain'], $params['dnsform']['target'], $params['dnsform']['zones']); } // Save the message note if (!empty($params['note'])) { Messages::addMessage($params['note'], $this->customer['customer_id'], $id); $isp = Shineisp_Registry::get('ISP'); $placeholder['fullname'] = $this->customer['firstname'] . " " . $this->customer['lastname']; $placeholder['domain'] = domains::getDomainName($id); $placeholder['message'] = $params['note']; $placeholder['messagetype'] = $this->translator->translate('Domain'); Messages::sendMessage("message_new", $this->customer['email'], $placeholder); Messages::sendMessage("message_admin", $isp->email, $placeholder); } Domains::setAuthInfo($id, $params['authinfocode']); Domains::setAutorenew($id, $params['autorenew']); $this->_helper->redirector('edit', 'domains', 'default', array('id' => $id, 'mex' => 'The task requested has been executed successfully.', 'status' => 'success')); } catch (Exception $e) { die($e->getMessage()); } }
/** * dnsGrid * Get the dns zone information. * @return array */ private function dnsGrid() { $request = Zend_Controller_Front::getInstance()->getRequest(); if (isset($request->id) && is_numeric($request->id)) { $zones = new Dns_Zones(); $records = $zones->findAllbyDomain($request->id, 'subdomain, zt.zone, target', true); if (isset($records[0])) { return array('records' => $records); } } }
/** * deletednszone * Delete a dns record * @return unknown_type */ public function deletednszoneAction() { $id = $this->getRequest()->getParam('id'); try { $domain = Dns_Zones::getDomain($id); if (!empty($domain[0]['Domains']['domain_id'])) { $domainid = $domain[0]['Domains']['domain_id']; if (Dns_Zones::deleteZone($id)) { $this->_helper->redirector('edit', 'domains', 'admin', array('id' => $domainid)); } } } catch (Exception $e) { die($e->getMessage()); } $this->_helper->redirector('list', 'domains', 'admin'); }