public function getParams() { #------------------------------------------------------------------------------- $Server = new DomainServer(); #------------------------------------------------------------------------------- $IsSelected = $Server->Select((int) $this->params['ServerID']); #------------------------------------------------------------------------------- switch (ValueOf($IsSelected)) { #------------------------------------------------------------------------------- case 'error': return ERROR | @Trigger_Error(500); case 'true': #------------------------------------------------------------------------------- // For RegRu only if ($Server->Settings['Params']['SystemID'] == 'RegRu' && In_Array($this->params['Name'], array('ru', 'su', 'рф'))) { #------------------------------------------------------------------------------- $Domain = SprintF("%s.%s", $this->params['DomainName'], $this->params['Name']); #------------------------------------------------------------------------------- $Result = $Server->GetUploadID($Domain); #------------------------------------------------------------------------------- switch (ValueOf($Result)) { case 'error': return ERROR | @Trigger_Error(500); case 'array': #------------------------------------------------------------------------------- $UploadID = $Result['UploadID']; #------------------------------------------------------------------------------- $this->params['UploadID'] = $UploadID; #------------------------------------------------------------------------------- Debug(SPrintF('[system/classes/DomainOrdersOnRegisterMsg.class.php]: UploadID = %s', $UploadID)); #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- return $this->params; #------------------------------------------------------------------------------- }
#------------------------------------------------------------------------------- #------------------------------------------------------------------------------- case 'array': #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- foreach ($Servers as $Registrator) { #------------------------------------------------------------------------------- Debug(SPrintF('[comp/Tasks/GC/DomainCheckPriceList]: Проверка цен на домены для %s (ID %d, тип %s)', $Registrator['Params']['Name'], $Registrator['ID'], $Registrator['Params']['SystemID'])); #------------------------------------------------------------------------------- $Server = new DomainServer(); #------------------------------------------------------------------------------- $IsSelected = $Server->Select((int) $Registrator['ID']); #------------------------------------------------------------------------------- switch (ValueOf($IsSelected)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('TRANSFER_TO_OPERATOR', 'Задание не может быть выполнено автоматически и передано оператору'); case 'true': break; default: return new gException('WRONG_STATUS', 'Регистратор не определён'); } #------------------------------------------------------------------------------- $Prices = $Server->DomainPriceList();
#------------------------------------------------------------------------------- $DomainOrder = DB_Select('DomainOrdersOwners', $Columns, array('UNIQ', 'ID' => $DomainOrderID)); #------------------------------------------------------------------------------- switch (ValueOf($DomainOrder)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Server = new DomainServer(); #------------------------------------------------------------------------------- $IsSelected = $Server->Select((int) $DomainOrder['ServerID']); #------------------------------------------------------------------------------- switch (ValueOf($IsSelected)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('TRANSFER_TO_OPERATOR', 'Задание не может быть выполнено автоматически и передано оператору'); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
Debug("[comp/Tasks/GC/CheckBalance]: Регистраторы не найдены"); #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- case 'array': #------------------------------------------------------------------------------- $GLOBALS['TaskReturnInfo'] = array(); #------------------------------------------------------------------------------- foreach ($Servers as $NowReg) { #------------------------------------------------------------------------------- $GLOBALS['TaskReturnInfo'][] = $NowReg['Params']['Name']; #------------------------------------------------------------------------------- Debug(SPrintF('[comp/Tasks/GC/CheckBalance]: Проверка баланса для %s (ID %d, тип %s)', $NowReg['Params']['Name'], $NowReg['ID'], $NowReg['Params']['SystemID'])); #------------------------------------------------------------------------------- $Server = new DomainServer(); #------------------------------------------------------------------------------- $IsSelected = $Server->Select((int) $NowReg['ID']); #------------------------------------------------------------------------------- switch (ValueOf($IsSelected)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('TRANSFER_TO_OPERATOR', 'Задание не может быть выполнено автоматически и передано оператору'); case 'true': break; default: return new gException('WRONG_STATUS', 'Регистратор не определён'); } #------------------------------------------------------------------------------- $Balance = $Server->GetBalance();
if (Is_Error(System_Load('classes/DomainServer.class.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Columns = array('ID', 'UserID', 'DomainName', 'ProfileID', '(SELECT `Name` FROM `DomainSchemes` WHERE `DomainSchemes`.`ID` = `DomainOrdersOwners`.`SchemeID`) as `DomainZone`', 'ServerID', 'StatusID'); #------------------------------------------------------------------------------- $DomainOrder = DB_Select('DomainOrdersOwners', $Columns, array('UNIQ', 'ID' => $DomainOrderID)); #------------------------------------------------------------------------------- switch (ValueOf($DomainOrder)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': #--------------------------------------------------------------------------- $Server = new DomainServer(); #--------------------------------------------------------------------------- $IsSelected = $Server->Select((int) $DomainOrder['ServerID']); #--------------------------------------------------------------------------- switch (ValueOf($IsSelected)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('TRANSFER_TO_OPERATOR', 'Задание не может быть выполнено автоматически и передано оператору'); case 'true': #----------------------------------------------------------------------- switch ($DomainOrder['StatusID']) { case 'ForContractRegister': #------------------------------------------------------------------- $Profile = DB_Select('Profiles', array('TemplateID', 'Attribs'), array('UNIQ', 'ID' => $DomainOrder['ProfileID'])); #-------------------------------------------------------------------
case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $GLOBALS['TaskReturnInfo'] = array(); #------------------------------------------------------------------------------- foreach ($Servers as $NowReg) { #----------------------------------------------------------------------- $GLOBALS['TaskReturnInfo'][] = $NowReg['Params']['Name']; #------------------------------------------------------------------- Debug(SPrintF('[comp/Tasks/GC/DomainFindOdd]: Поиск лишних доменов у %s (ID %d, тип %s)', $NowReg['Params']['Name'], $NowReg['ID'], $NowReg['Params']['SystemID'])); #------------------------------------------------------------------- $Server = new DomainServer(); #------------------------------------------------------------------- $IsSelected = $Server->Select((int) $NowReg['ID']); #------------------------------------------------------------------- switch (ValueOf($IsSelected)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('TRANSFER_TO_OPERATOR', 'Задание не может быть выполнено автоматически и передано оператору'); case 'true': #------------------------------------------------------------------------------- # реализация JBS-805 $Accept = $Server->DomainAccept(); #return TRUE; #------------------------------------------------------------------------------- $RegDomains = $Server->GetListDomains();
#------------------------------------------------------------------------------- if (StrLen($PostalAddress) < 10) { return new gException('WRONG_POSTAL_ADDRESS', 'Введён некорректный почтовый адрес'); } #------------------------------------------------------------------------------- $Person['PostalAddress'] = $PostalAddress; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (!Count($Person)) { return new gException('NO_INPUT_DATA', 'Необходимо ввести хоть какие-то данные для изменения'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Server = new DomainServer(); #------------------------------------------------------------------------------- $IsSelected = $Server->Select((int) $DomainOrder['ServerID']); #------------------------------------------------------------------------------- switch (ValueOf($IsSelected)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- $ChangeContactDetail = $Server->ChangeContactDetail($Domain, $DomainOrder['DomainZone'], $Person);
function WhoIs_Check($DomainName, $ZoneName, $IsAvalible = FALSE) { #------------------------------------------------------------------------------- Debug(SPrintF('[system/libs/WhoIs]: run function WhoIs_Check, Domain = %s.%s', $DomainName, $ZoneName)); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $CacheID = SPrintF('WhoIs-%s.%s', $DomainName, $ZoneName); #------------------------------------------------------------------------------- $Answer = CacheManager::get($CacheID); #------------------------------------------------------------------------------- if (!$Answer) { #------------------------------------------------------------------------------- # смотрим доменную зону, на предмет того использовать ли данные whois сервера, или юзать запросы к регистратору $DomainZones = System_XML('config/DomainZones.xml'); if (Is_Error($DomainZones)) { return ERROR | @Trigger_Error('[comp/www/API/WhoIs]: не удалось загрузить базу WhoIs серверов'); } #------------------------------------------------------------------------------- $IsSuppoted = FALSE; #------------------------------------------------------------------------------- foreach ($DomainZones as $Zone) { #------------------------------------------------------------------------------- if ($Zone['Name'] == $ZoneName) { #------------------------------------------------------------------------------- $IsSuppoted = TRUE; #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (!$IsSuppoted || $Zone['IsUseRegistratorWhoIs']) { #------------------------------------------------------------------------------- if (!$IsSuppoted) { Debug(SPrintF('[comp/www/API/WhoIs]: доменная зона не поддерживается')); } #------------------------------------------------------------------------------- if ($IsSuppoted && $Zone['IsUseRegistratorWhoIs']) { Debug(SPrintF('[comp/www/API/WhoIs]: принудительное использование WhoIs регистратора')); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # чекаем доменную зону $Regulars = Regulars(); #------------------------------------------------------------------------------- if (!Preg_Match($Regulars['DomainZone'], $ZoneName)) { return ERROR | @Trigger_Error(SPrintF('[comp/www/API/WhoIs]: неверная доменная зона (%s)', $ZoneName)); } #------------------------------------------------------------------------------- # достаём список серверов на которых есть такой тариф $Servers = DB_Select('DomainSchemes', array('ServerID'), array('Where' => SPrintF('`Name` = "%s"', $ZoneName))); #------------------------------------------------------------------------------- switch (ValueOf($Servers)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('REGISTRATOR_SERVER_NOT_FOUND', 'Не найдены активные сервера регистраторов'); case 'array': #------------------------------------------------------------------------------- $Array = array(); #------------------------------------------------------------------------------- foreach ($Servers as $Server) { $Array[] = $Server['ServerID']; } #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- # достаём список активных серверов регистраторов $Servers = DB_Select('Servers', array('ID', 'Address', 'Params'), array('Where' => array(SPrintF('`ID` IN (%s)', Implode(',', $Array)), '`IsActive` = "yes"'), 'SortOn' => 'Address')); #------------------------------------------------------------------------------- switch (ValueOf($Servers)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('REGISTRATOR_SERVER_NOT_FOUND', 'Не найдены активные сервера регистраторов'); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- # перебираем регистраторов $UseServer = FALSE; #------------------------------------------------------------------------------- foreach ($Servers as $iServer) { #------------------------------------------------------------------------------- # если это не проверка доступности и в настройках сервера не стоит галка про получение WhoIs - пропускаем if (!$IsAvalible) { if (!$iServer['Params']['IsFetchWhoIs']) { continue; } } #------------------------------------------------------------------------------- # достаём использованные запросы к регистратору, на данную минуту $RatelimitID = SPrintF('ratelimit-%s-%s-00', $iServer['Address'], Date('H-i')); #------------------------------------------------------------------------------- $Ratelimit = CacheManager::get($RatelimitID); #------------------------------------------------------------------------------- # если из кэша что-то досталось и оно больше разрешённой частоты запросов - пропускаем цикл if ($Ratelimit && $Ratelimit >= $iServer['Params']['RatelimitAPI']) { #------------------------------------------------------------------------------- Debug(SPrintF('[comp/www/API/WhoIs]: превышена частота запросов к серверу %s (разрешено %u, использовано %u)', $iServer['Address'], $iServer['Params']['RatelimitAPI'], $Ratelimit)); #------------------------------------------------------------------------------- continue; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- # сохраняем, на пару минут, в кэш новое число запросов к регистратору CacheManager::add($RatelimitID, IntVal($Ratelimit) + 1, 120); #------------------------------------------------------------------------------- $UseServer = $iServer; #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- # если не задан сервер - частота превышена для всех серверов if (!$UseServer) { return new gException('REGISTRATOR_SERVER_RATELIMIT', 'Превышена максимальная частота запросов к интерфейсу регистратора'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # выбираем сервер регистратора if (Is_Error(System_Load('classes/DomainServer.class.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Server = new DomainServer(); #------------------------------------------------------------------------------- $IsSelected = $Server->Select((int) $UseServer['ID']); #------------------------------------------------------------------------------- switch (ValueOf($IsSelected)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('CANNOT_SELECT_REGISTRATOR', 'Не удалось выбрать регистратора'); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- # делаем запрос к API - функция в зависимости от $IsAvalible if ($IsAvalible) { #------------------------------------------------------------------------------- $DomainCheck = $Server->DomainCheck($DomainName, $ZoneName); #------------------------------------------------------------------------------- switch (ValueOf($DomainCheck)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'true': return TRUE; case 'false': return array(); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $DomainWhoIs = $Server->DomainWhoIs($DomainName, $ZoneName); #------------------------------------------------------------------------------- switch (ValueOf($DomainWhoIs)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': # a функции нет ... вылезаем на обычную проверку whois break; case 'true': return TRUE; case 'string': #------------------------------------------------------------------------------- CacheManager::add($CacheID, $DomainWhoIs, 1800); #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Config = Config(); #------------------------------------------------------------------------------- $UseSystemApplication = $Config['Other']['Libs']['WhoIs']['UseSystemApplication']; #------------------------------------------------------------------------------- $Regulars = Regulars(); #------------------------------------------------------------------------------- if (!Preg_Match($Regulars['DomainName'], $DomainName)) { return new gException('WRONG_DOMAIN_NAME', 'Неверное доменное имя'); } #------------------------------------------------------------------------------- $DomainZones = System_XML('config/DomainZones.xml'); if (Is_Error($DomainZones)) { return ERROR | @Trigger_Error('[WhoIs_Check]: не удалось загрузить базу WhoIs серверов'); } #------------------------------------------------------------------------------- $IsSuppoted = FALSE; #------------------------------------------------------------------------------- foreach ($DomainZones as $DomainZone) { #------------------------------------------------------------------------------- if ($DomainZone['Name'] == $ZoneName) { #------------------------------------------------------------------------------- $IsSuppoted = TRUE; #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (!$IsSuppoted && !isset($DomainWhoIs)) { return FALSE; } #------------------------------------------------------------------------------- if (Mb_StrLen($DomainName) < ($MinChars = $DomainZone['MinChars'])) { return new gException('WRONG_DOMAIN_NAME_LENGTH', SPrintF('Длина доменного имени должна быть не менее %u символа(ов)', $MinChars)); } #------------------------------------------------------------------------------- $Domain = SPrintF('%s.%s', $DomainName, $DomainZone['Name']); #------------------------------------------------------------------------------- $Answer = CacheManager::get($CacheID); #------------------------------------------------------------------------------- if (!$Answer) { #------------------------------------------------------------------------------- $IDNAConverter = new IDNAConvert(); #------------------------------------------------------------------------------- if ($UseSystemApplication) { #------------------------------------------------------------------------------- $IsExec = Exec(SPrintF('whois %s', $IDNAConverter->encode($Domain)), $Answer); #------------------------------------------------------------------------------- $Answer = Implode("\n", $Answer); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Socket = @FsockOpen($DomainZone['Server'], 43, $nError, $sError, 5); #------------------------------------------------------------------------------- if (!$Socket) { return ERROR | @Trigger_Error('[WhoIs_Check]: ошибка соединения с сервером WhoIs'); } #------------------------------------------------------------------------------- if (!@Fputs($Socket, SPrintF("%s\r\n", $IDNAConverter->encode($Domain)))) { return ERROR | @Trigger_Error('[WhoIs_Check]: ошибка работы с серверов WhoIs'); } #------------------------------------------------------------------------------- $Answer = ''; #------------------------------------------------------------------------------- do { #------------------------------------------------------------------------------- $Line = @Fgets($Socket, 10); #------------------------------------------------------------------------------- $Answer .= $Line; #------------------------------------------------------------------------------- } while ($Line); #------------------------------------------------------------------------------- Fclose($Socket); #------------------------------------------------------------------------------- CacheManager::add($CacheID, $Answer, 1800); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- Debug(SPrintF('[system/libs/WhoIs.php]: Answer = %s', print_r($Answer, true))); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (Preg_Match(SPrintF('/%s/', $DomainZone['Available']), $Answer)) { return TRUE; } #------------------------------------------------------------------------------- if (Preg_Match(SPrintF('/%s/', $DomainZone['NotAvailable']), $Answer)) { return new gException('DOMAIN_NOT_AVAILABLE', 'Доменное имя не доступно для регистрации'); } #------------------------------------------------------------------------------- $Result = array('Info' => Preg_Replace('/\\n\\s+\\n/sU', "\n", Preg_Replace('/\\%.+\\n/sU', '', $Answer)), 'ExpirationDate' => 0); #------------------------------------------------------------------------------- $ExpirationDate = $DomainZone['ExpirationDate']; #------------------------------------------------------------------------------- if ($ExpirationDate) { #------------------------------------------------------------------------------- if (Preg_Match(SPrintF('/%s/', $ExpirationDate), $Answer, $Mathes)) { #------------------------------------------------------------------------------- if (Count($Mathes) < 2) { return ERROR | @Trigger_Error('[WhoIs_Check]: шаблон поиска даты окончания задан неверно'); } #------------------------------------------------------------------------------- $ExpirationDate = $Mathes[1]; #------------------------------------------------------------------------------- $Months = array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'); #------------------------------------------------------------------------------- if (Preg_Match('/^[0-9]{4}\\.[0-9]{2}\\.[0-9]{2}$/', $ExpirationDate)) { #------------------------------------------------------------------------------- $Date = Array_Combine(array('Year', 'Month', 'Day'), Explode('.', $ExpirationDate)); #------------------------------------------------------------------------------- $ExpirationDate = MkTime(0, 0, 0, $Date['Month'], $Date['Day'], $Date['Year']); #------------------------------------------------------------------------------- } elseif (Preg_Match('/^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}$/', $ExpirationDate)) { #------------------------------------------------------------------------------- $Date = Array_Combine(array('Year', 'Month', 'Day'), Explode('-', $ExpirationDate)); #------------------------------------------------------------------------------- $ExpirationDate = MkTime(0, 0, 0, $Date['Month'], $Date['Day'], $Date['Year']); #------------------------------------------------------------------------------- } elseif (Preg_Match('/^[0-9]{2}\\-[a-zA-Z]{3}\\-[0-9]{4}$/', $ExpirationDate)) { #------------------------------------------------------------------------------- $Date = Array_Combine(array('Day', 'Month', 'Year'), Explode('-', $ExpirationDate)); #------------------------------------------------------------------------------- $Month = Array_Search(StrToLower($Date['Month']), $Months); #------------------------------------------------------------------------------- $ExpirationDate = MkTime(0, 0, 0, $Month + 1, $Date['Day'], $Date['Year']); #------------------------------------------------------------------------------- } elseif (Preg_Match('/^[0-9]{2}\\s[a-zA-Z]{2,10}\\s[0-9]{4}$/', $ExpirationDate)) { #------------------------------------------------------------------------------- $Months = array('january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'octember', 'november', 'decemeber'); #------------------------------------------------------------------------------- $Date = Array_Combine(array('Day', 'Month', 'Year'), Preg_Split('/\\s+/', $ExpirationDate)); #------------------------------------------------------------------------------- $Month = Array_Search(StrToLower($Date['Month']), $Months); #------------------------------------------------------------------------------- $ExpirationDate = MkTime(0, 0, 0, $Month + 1, $Date['Day'], $Date['Year']); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Date = Array_Combine(array('Week', 'Month', 'Day', 'Time', 'GMT', 'Year'), Preg_Split('/\\s+/', $ExpirationDate)); #------------------------------------------------------------------------------- $Month = Array_Search(StrToLower($Date['Month']), $Months); #------------------------------------------------------------------------------- $ExpirationDate = MkTime(0, 0, 0, $Month + 1, $Date['Day'], $Date['Year']); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Result['ExpirationDate'] = $ExpirationDate; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $NsName = $DomainZone['NsName']; #------------------------------------------------------------------------------- if ($NsName) { #------------------------------------------------------------------------------- if (Preg_Match_All(SPrintF('/%s/', $NsName), $Answer, $Mathes)) { #------------------------------------------------------------------------------- if (Count($Mathes) < 2) { return ERROR | @Trigger_Error('[WhoIs_Check]: шаблон поиска именных серверов задан неверно'); } #------------------------------------------------------------------------------- $NsNames = $Mathes[1]; #------------------------------------------------------------------------------- for ($i = 0; $i < Count($NsNames); $i++) { #------------------------------------------------------------------------------- $NsName = Trim(StrToLower($NsNames[$i]), '.'); #------------------------------------------------------------------------------- $Result[SPrintF('Ns%uName', $i + 1)] = $NsName; #------------------------------------------------------------------------------- if ($NsName) { #------------------------------------------------------------------------------- if (Mb_SubStr($NsName, -Mb_StrLen($Domain)) == $Domain) { #------------------------------------------------------------------------------- $IP = GetHostByName($NsName); #------------------------------------------------------------------------------- if ($IP != $NsName) { $Result[SPrintF('Ns%uIP', $i + 1)] = $IP; } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Registrar = $DomainZone['Registrar']; #------------------------------------------------------------------------------- if ($Registrar) { #------------------------------------------------------------------------------- if (Preg_Match(SPrintF('/%s/', $Registrar), $Answer, $Mathes)) { #------------------------------------------------------------------------------- if (Count($Mathes) < 2) { return ERROR | @Trigger_Error('[WhoIs_Check]: шаблон поиска регистратора серверов задан неверно'); } #------------------------------------------------------------------------------- $Registrar = Next($Mathes); #------------------------------------------------------------------------------- $Result['Registrar'] = $Registrar; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- return $Result; #------------------------------------------------------------------------------- }
case 'exception': return ERROR | @Trigger_Error(400); case 'array': #--------------------------------------------------------------------------- $GLOBALS['TaskReturnInfo'] = array(SPrintF('%s.%s', $DomainOrder['DomainName'], $DomainOrder['DomainZone']) => array($DomainOrder['Ns1Name'], $DomainOrder['Ns2Name'])); #--------------------------------------------------------------------------- if ($DomainOrder['Ns3Name']) { $GLOBALS['TaskReturnInfo'][SPrintF('%s.%s', $DomainOrder['DomainName'], $DomainOrder['DomainZone'])][] = $DomainOrder['Ns3Name']; } #--------------------------------------------------------------------------- if ($DomainOrder['Ns4Name']) { $GLOBALS['TaskReturnInfo'][SPrintF('%s.%s', $DomainOrder['DomainName'], $DomainOrder['DomainZone'])][] = $DomainOrder['Ns4Name']; } #--------------------------------------------------------------------------- #--------------------------------------------------------------------------- $Server = new DomainServer(); #--------------------------------------------------------------------------- $IsSelected = $Server->Select((int) $DomainOrder['ServerID']); #--------------------------------------------------------------------------- switch (ValueOf($IsSelected)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'true': #----------------------------------------------------------------------- switch ($DomainOrder['StatusID']) { case 'ForNsChange': #------------------------------------------------------------------- $DomainNsChange = $Server->DomainNsChange($DomainOrder['DomainName'], $DomainOrder['DomainZone'], $DomainOrder['PersonID'], $DomainOrder['DomainID'], $DomainOrder['Ns1Name'], $DomainOrder['Ns1IP'], $DomainOrder['Ns2Name'], $DomainOrder['Ns2IP'], $DomainOrder['Ns3Name'], $DomainOrder['Ns3IP'], $DomainOrder['Ns4Name'], $DomainOrder['Ns4IP']); #-------------------------------------------------------------------
#------------------------------------------------------------------------------- $DomainOrder = DB_Select('DomainOrdersOwners', $Columns, array('UNIQ', 'ID' => $DomainOrderID)); #------------------------------------------------------------------------------- switch (ValueOf($DomainOrder)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Server = new DomainServer(); #------------------------------------------------------------------------------- $ServerID = $DomainOrder['ServerID']; #------------------------------------------------------------------------------- $IsSelected = $Server->Select((int) $DomainOrder['ServerID']); #------------------------------------------------------------------------------- switch (ValueOf($IsSelected)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('CANNOT_SELECT_REGISTRATOR', 'Не удалось выбрать регистратора'); case 'true': break; default: return ERROR | @Trigger_Error(101); }
case 'array': #------------------------------------------------------------------------------- $GLOBALS['TaskReturnInfo'] = array($DomainOrder['Params']['Name'] => array(SPrintF('%s.%s', $DomainOrder['DomainName'], $DomainOrder['DomainZone']))); #------------------------------------------------------------------------------- $WhoIs = WhoIs_Check($DomainOrder['DomainName'], $DomainOrder['DomainZone']); #------------------------------------------------------------------------------- $Registrar = isset($WhoIs['Registrar']) ? $WhoIs['Registrar'] : 'NOT_FOUND'; #------------------------------------------------------------------------------- $Server = DB_Select('Servers', 'Params', array('UNIQ', 'ID' => $DomainOrder['ServerID'])); #------------------------------------------------------------------------------- Debug(SPrintF('[Task/DomainTransfer]: Registrar: %s; PrefixNic: %s', $Registrar, $Server['Params']['PrefixNic'])); #------------------------------------------------------------------------------- $IsInternal = Preg_Match(SPrintF('/%s/', $Server['Params']['PrefixNic']), $Registrar) ? TRUE : FALSE; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Server = new DomainServer(); #------------------------------------------------------------------------------- $IsSelected = $Server->Select((int) $DomainOrder['ServerID']); #------------------------------------------------------------------------------- switch (ValueOf($IsSelected)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('TRANSFER_TO_OPERATOR', 'Задание не может быть выполнено автоматически и передано оператору'); case 'true': #------------------------------------------------------------------------------- switch ($DomainOrder['StatusID']) { case 'OnTransfer': #------------------------------------------------------------------------------- # TODO у reg.ru такие переносы делаются отдельным таском, у webnames такого не реализовано if ($IsInternal) {
#------------------------------------------------------------------------------- $Links =& Links(); # Коллекция ссылок $Links['DOM'] =& $DOM; #------------------------------------------------------------------------------- if (Is_Error($DOM->Load('Window'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $DOM->AddText('Title', 'Смена контактных данных владельца домена'); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Domain = SPrintF('%s.%s', $DomainOrder['DomainName'], $DomainScheme['Name']); #------------------------------------------------------------------------------- # получем контактные данные домена $Server = new DomainServer(); #------------------------------------------------------------------------------- $IsSelected = $Server->Select((int) $DomainOrder['ServerID']); #------------------------------------------------------------------------------- switch (ValueOf($IsSelected)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'true': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------