/** * Check the domain availability * @param $name * @param $tldid * @return boolean */ public static function check_availability($name, $tldid) { $translator = Shineisp_Registry::getInstance()->Zend_Translate; $dchecker = new Shineisp_Commons_DomainChecker(); if (!empty($name)) { $record = DomainsTlds::getAllInfo($tldid); if (!empty($record)) { if (!empty($record['name'])) { $domain = $name . "." . $record['name']; if (Shineisp_Commons_Utilities::is_valid_domain_name($domain)) { if ($dchecker->checkDomainAvailability($domain)) { return true; } else { return false; } } } else { throw new Exception($translator->_('TLD name have been not set in the administration panel yet')); } throw new Exception($translator->_('Domain name is not correct: %s', $domain)); } throw new Exception($translator->translate("TLD {$tldid} has been not found!")); } throw new Exception($translator->translate('Domain name is empty!')); }