示例#1
0
    if (Is_Error($Sourse)) {
        return ERROR | @Trigger_Error(500);
    }
    #-----------------------------------------------------------------------------
    //if(!Preg_Match('/\.comp.php/',$File))
    //  continue;
    #-----------------------------------------------------------------------------
    $Function = isset($Args['RegEx']) ? 'Preg_Replace' : 'Str_Replace';
    #-----------------------------------------------------------------------------
    $Out = $Function($Search, $Replace, $Sourse);
    #-----------------------------------------------------------------------------
    if ($Out != $Sourse) {
        #---------------------------------------------------------------------------
        if ($IsWrite) {
            #-------------------------------------------------------------------------
            $IsWrite = IO_Write($File, $Out, TRUE);
            if (Is_Error($IsWrite)) {
                return ERROR | @Trigger_Error(500);
            }
        }
        #---------------------------------------------------------------------------
        $Name = Mb_SubStr($File, Mb_StrLen($Folder) + 1);
        #---------------------------------------------------------------------------
        echo SPrintF("%s\n", $Name);
        #---------------------------------------------------------------------------
        $Count++;
    }
}
#-------------------------------------------------------------------------------
echo SPrintF("Replaced in %s files\n", $Count);
#-------------------------------------------------------------------------------
示例#2
0
 case 'array':
     #---------------------------------------------------------------------------
     foreach ($Profiles as $Profile) {
         #-------------------------------------------------------------------------
         $Attribs = $Profile['Attribs'];
         #-------------------------------------------------------------------------
         $Director = $Attribs['Director'];
         #-------------------------------------------------------------------------
         $Director = Preg_Split('/\\s+/', $Director);
         #-------------------------------------------------------------------------
         $Attribs['dSourname'] = Current($Director);
         $Attribs['dName'] = Next($Director);
         $Attribs['dLastname'] = Next($Director);
         #-------------------------------------------------------------------------
         $Attribs['NameEn'] = Translit($Attribs['dName']);
         $Attribs['LastnameEn'] = Translit(Mb_SubStr($Attribs['dLastname'], 0, 1));
         $Attribs['SournameEn'] = Translit($Attribs['dSourname']);
         #-------------------------------------------------------------------------
         #-------------------------------------------------------------------------
         $Attribs['jCountry'] = $Attribs['Country'];
         $Attribs['pCountry'] = $Attribs['Country'];
         #-------------------------------------------------------------------------
         $Attribs['jState'] = $Attribs['State'];
         $Attribs['pState'] = $Attribs['State'];
         $Attribs['StateEn'] = Translit($Attribs['State']);
         #-------------------------------------------------------------------------
         $Attribs['jCity'] = $Attribs['City'];
         $Attribs['pCity'] = $Attribs['City'];
         $Attribs['CityEn'] = Translit($Attribs['City']);
         #-------------------------------------------------------------------------
         $Attribs['jAddress'] = Trim(Preg_Replace('/(ул|пр)\\./iu', '', $Attribs['jAddress']));
    }
    #-------------------------------------------------------------------------------
    #return new gException('NAME_NS3_NOT_FILL','Укажите имя дополнительного сервера имен');
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$Ns4Name = Trim(Mb_StrToLower($Ns4Name, 'UTF-8'), '.');
#-------------------------------------------------------------------------------
if ($Ns4Name) {
    #-------------------------------------------------------------------------------
    if (!Preg_Match($Regulars['DnsDomain'], $Ns4Name)) {
        return new gException('WRONG_NAME_NS4', 'Неверное имя расширенного сервера имен');
    }
    #-------------------------------------------------------------------------------
    if (Mb_SubStr($Ns4Name, -Mb_StrLen($Domain)) == $Domain) {
        #-------------------------------------------------------------------------------
        if (!Preg_Match($Regulars['IP'], $Ns4IP)) {
            return new gException('WRONG_IP_NS4', 'Неверный IP адрес расширенного сервера имен');
        }
        #-------------------------------------------------------------------------------
    } else {
        #-------------------------------------------------------------------------------
        if ($Ns4IP) {
            $Ns4IP = '';
        }
        #-------------------------------------------------------------------------------
        #return new gException('IP_NS4_CAN_NOT_FILL','IP адрес расширенного сервера имен не может быть указан');
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
示例#4
0
/******************************************************************************/
/******************************************************************************/
$IPs = $ExtraIP ? Explode("\n", $ExtraIP) : array();
#-------------------------------------------------------------------------------
$IPs[] = $IP;
#-------------------------------------------------------------------------------
$IPs = Array_Unique($IPs);
#-------------------------------------------------------------------------------
$Count = Count($IPs);
#-------------------------------------------------------------------------------
if ($Count > 10) {
    $IPs = Array_Slice($IPs, 0, 9);
}
#-------------------------------------------------------------------------------
if (Mb_StrLen($IP) > $Length) {
    $IP = SPrintF('%s...', Mb_SubStr($IP, 0, $Length));
}
#-------------------------------------------------------------------------------
$A = new Tag('A', array('target' => 'blank', 'href' => SPrintF('http://%s/', $IP)), $IP);
#-------------------------------------------------------------------------------
$LinkID = UniqID('IPs');
#-------------------------------------------------------------------------------
$Links =& Links();
# Коллекция ссылок
$Links[$LinkID] =& $A;
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Form/Prompt', $LinkID, SPrintF('<B>Всего: %u</B><BR />%s', $Count, Implode('<BR />', $IPs)));
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
示例#5
0
     return new gException('PROFILES_NOT_FOUND', 'Профили клиента не найдены');
 case 'array':
     #-----------------------------------------------------------------------
     $Options = array();
     #-----------------------------------------------------------------------
     foreach ($Profiles as $Profile) {
         #---------------------------------------------------------------------
         $Comp = Comp_Load('Formats/Profile/Number', $Profile['ID']);
         if (Is_Error($Comp)) {
             return ERROR | @Trigger_Error(500);
         }
         #---------------------------------------------------------------------
         $Name = SPrintF('%s - %s', $Comp, $Profile['Name']);
         #---------------------------------------------------------------------
         if (Mb_StrLen($Name) > 30) {
             $Name = SPrintF('%s...', Mb_SubStr($Name, 0, 30));
         }
         #---------------------------------------------------------------------
         $Options[$Profile['ID']] = $Name;
     }
     #-----------------------------------------------------------------------
     $Comp = Comp_Load('Form/Select', array('name' => 'ProfileID', 'style' => 'width:100%'), $Options, $Contract['ProfileID']);
     if (Is_Error($Comp)) {
         return ERROR | @Trigger_Error(500);
     }
     #-----------------------------------------------------------------------
     $Table[] = array('Профиль', $Comp);
     #-----------------------------------------------------------------------
     $Comp = Comp_Load('Form/Input', array('name' => 'IsEnclosures', 'type' => 'checkbox', 'value' => 'yes'));
     if (Is_Error($Comp)) {
         return ERROR | @Trigger_Error(500);
示例#6
0
function LogicBoxes_Contract_Register($Settings, $PepsonID, $Person, $DomainZone)
{
    /****************************************************************************/
    $__args_types = array('array', 'string', 'array', 'string');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $Wsdl = System_Element('config/Wsdl/Customer.wsdl');
    if (Is_Error($Wsdl)) {
        return ERROR | @Trigger_Error(500);
    }
    #-----------------------------------------------------------------------------
    $AddCustomer = new SoapClient($Wsdl, array('exceptions' => 0));
    #-----------------------------------------------------------------------------
    $Params = array('SERVICE_USERNAME' => $Settings['Login'], 'SERVICE_PASSWORD' => $Settings['Password'], 'SERVICE_ROLE' => 'reseller', 'SERVICE_LANGPREF' => 'ru', 'SERVICE_PARENTID' => $Settings['ParentID'], 'customerUserName' => $Person['Email'], 'customerPassword' => UniqID());
    #-----------------------------------------------------------------------------
    switch ($PepsonID) {
        case 'Natural':
            #-------------------------------------------------------------------------
            $Params['name'] = SPrintF('%s %s %s', Translit($Person['Name']), Mb_SubStr(Translit($Person['Lastname']), 0, 1), Translit($Person['Sourname']));
            $Params['company'] = 'N/A';
            $Params['address1'] = Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress']));
            $Params['address2'] = Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress']));
            $Params['address3'] = Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress']));
            $Params['city'] = Translit($Person['pCity']);
            $Params['state'] = Translit($Person['pState']);
            $Params['country'] = isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry'];
            $Params['zip'] = $Person['pIndex'];
            break;
        case 'Juridical':
            #-------------------------------------------------------------------------
            $Params['name'] = SPrintF('%s %s %s', Translit($Person['dName']), Translit($Person['dLastname']), Translit($Person['dSourname']));
            $Params['company'] = SPrintF('%s %s', Translit($Person['CompanyName']), Translit($Person['CompanyFormFull']));
            $Params['address1'] = Translit(SPrintF('%s %s', $Person['jType'], $Person['jAddress']));
            $Params['address2'] = Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress']));
            $Params['address3'] = Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress']));
            $Params['city'] = Translit($Person['jCity']);
            $Params['state'] = Translit($Person['jState']);
            $Params['country'] = Translit($Person['jCountry']);
            $Params['zip'] = $Person['jIndex'];
            break;
        default:
            return ERROR | @Trigger_Error(400);
    }
    #-----------------------------------------------------------------------------
    $Phone = $Person['Phone'];
    #-----------------------------------------------------------------------------
    if ($Phone) {
        #---------------------------------------------------------------------------
        $Phone = Preg_Split('/\\s+/', $Phone);
        #---------------------------------------------------------------------------
        $Params['telNoCc'] = Trim(Current($Phone), '+');
        $Params['telNo'] = SPrintF('%s%s', Next($Phone), Next($Phone));
        #---------------------------------------------------------------------------
        Reset($Phone);
        #---------------------------------------------------------------------------
        $Params['altTelNoCc'] = Trim(Current($Phone), '+');
        $Params['altTelNo'] = SPrintF('%s%s', Next($Phone), Next($Phone));
    } else {
        #---------------------------------------------------------------------------
        $Params['telNoCc'] = '';
        $Params['telNo'] = '';
        $Params['altTelNoCc'] = '';
        $Params['altTelNo'] = '';
    }
    #-----------------------------------------------------------------------------
    $Fax = $Person['Fax'];
    #-----------------------------------------------------------------------------
    if ($Fax) {
        #---------------------------------------------------------------------------
        $Fax = Preg_Split('/\\s+/', $Fax);
        #---------------------------------------------------------------------------
        $Params['faxNoCc'] = Trim(Current($Fax), '+');
        $Params['faxNo'] = SPrintF('%s%s', Next($Fax), Next($Fax));
    } else {
        #---------------------------------------------------------------------------
        $Params['faxNoCc'] = '';
        $Params['faxNo'] = '';
    }
    #-----------------------------------------------------------------------------
    $Params['customerLangPref'] = 'ru';
    #-----------------------------------------------------------------------------
    Debug(Print_R($Params, TRUE));
    #-----------------------------------------------------------------------------
    $Response = $AddCustomer->__SoapCall('addCustomer', $Params);
    #-----------------------------------------------------------------------------
    if (Is_SOAP_Fault($Response)) {
        #---------------------------------------------------------------------------
        Debug($Response->faultstring);
        #---------------------------------------------------------------------------
        return new gException('ANSWER_ERROR', 'Ошибка обращения к регистратору');
    }
    #-----------------------------------------------------------------------------
    $CustomerID = $Response;
    #-----------------------------------------------------------------------------
    $Wsdl = System_Element('config/Wsdl/DomContact.wsdl');
    if (Is_Error($Wsdl)) {
        return ERROR | @Trigger_Error(500);
    }
    #-----------------------------------------------------------------------------
    $DefaultContact = new SoapClient($Wsdl, array('exceptions' => 0));
    #-----------------------------------------------------------------------------
    $Response = $DefaultContact->addDefaultContact($Settings['Login'], $Settings['Password'], 'reseller', 'ru', $Settings['ParentID'], $CustomerID);
    #-----------------------------------------------------------------------------
    if (Is_SOAP_Fault($Response)) {
        #---------------------------------------------------------------------------
        Debug($Response->faultstring);
        #---------------------------------------------------------------------------
        return new gException('ANSWER_ERROR', 'Ошибка обращения к регистратору');
    }
    #-----------------------------------------------------------------------------
    return array('TicketID' => $CustomerID);
}
示例#7
0
 #-----------------------------------------------------------------------------
 foreach ($Files as $File) {
     #---------------------------------------------------------------------------
     if (Preg_Match('/\\/others\\//', $File)) {
         continue;
     }
     #---------------------------------------------------------------------------
     $Sourse = IO_Read($File);
     if (Is_Error($Sourse)) {
         return ERROR | @Trigger_Error(500);
     }
     #---------------------------------------------------------------------------
     if (Preg_Match_All('/#[a-zA-F0-9]{6}/', $Sourse, $Matches) > 1) {
         #-------------------------------------------------------------------------
         foreach (Current($Matches) as $Match) {
             $Finded[Md5($Match)] = Mb_SubStr($Match, 1);
         }
     }
 }
 #-----------------------------------------------------------------------------
 if (Count($Finded) < 1) {
     continue;
 }
 #-----------------------------------------------------------------------------
 $Tr = new Tag('TR');
 #-----------------------------------------------------------------------------
 foreach ($Finded as $Color) {
     #---------------------------------------------------------------------------
     if (In_Array($Color, $Colors)) {
         continue;
     }
示例#8
0
文件: IO.php 项目: carriercomm/jbs
function IO_Read($Path, $IsUseLinks = TRUE)
{
    /******************************************************************************/
    $__args_types = array('string', 'boolean');
    #-------------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /******************************************************************************/
    Debug(SPrintF('[IO_Read]: открытие файла (%s)', $Path));
    #-------------------------------------------------------------------------------
    if (!File_Exists($Path)) {
        return ERROR | @Trigger_Error('[IO_Read]: файл не существует');
    }
    #-------------------------------------------------------------------------------
    if (!($File = @Fopen($Path, 'r'))) {
        return ERROR | @Trigger_Error('[IO_Read]: ошибка открытия файла');
    }
    #-------------------------------------------------------------------------------
    $Size = @FileSize($Path);
    if (!$Size) {
        return '';
    }
    #-------------------------------------------------------------------------------
    if (!($Result = @Fread($File, $Size))) {
        return ERROR | @Trigger_Error('[IO_Read]: ошибка чтения файла');
    }
    #-------------------------------------------------------------------------------
    if (!Fclose($File)) {
        return ERROR | @Trigger_Error('[IO_Read]: ошибка закрытия файла');
    }
    #-------------------------------------------------------------------------------
    if (Mb_StrLen($Result) > 4) {
        #-------------------------------------------------------------------------------
        if (Mb_SubStr($Result, 1, 4) == 'link' && $IsUseLinks) {
            #-------------------------------------------------------------------------------
            $LinkPath = Trim(Mb_SubStr($Result, Mb_StrPos($Result, ':') + 1));
            #-------------------------------------------------------------------------------
            switch ($Result[0]) {
                case '#':
                    # Абсолюная ссылка
                    # No more...
                    break;
                case '@':
                    # Относительная ссылка
                    #-------------------------------------------------------------------------------
                    $Folder = Mb_SubStr($Path, 0, Mb_StrrPos($Path, '/'));
                    #-------------------------------------------------------------------------------
                    $LinkPath = SPrintF('%s/%s', $Folder, $LinkPath);
                    #-------------------------------------------------------------------------------
                    break;
                    #-------------------------------------------------------------------------------
                #-------------------------------------------------------------------------------
                default:
                    return ERROR | @Trigger_Error('[IO_Read]: тип ссылки не определён');
            }
            #-------------------------------------------------------------------------------
            if ($Path == $LinkPath) {
                return ERROR | @Trigger_Error(SPrintF('[IO_Read]: ссылка сама на себя в файле(%s)', $Path));
            }
            #-------------------------------------------------------------------------------
            Debug(SPrintF('[IO_Read]: символическая ссылка (%s) на (%s)', $Path, $LinkPath));
            #-------------------------------------------------------------------------------
            $Result = IO_Read($LinkPath);
            if (Is_Error($Result)) {
                return ERROR | @Trigger_Error('[IO_Read]: ошибка рекурсивного вызова');
            }
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    return $Result;
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
}
示例#9
0
 foreach ($Clauses as $Clause) {
     #-------------------------------------------------------------------------
     $Li = new Tag('LI', array('style' => 'border-bottom:1px dashed #DCDCDC;'), new Tag('A', array('href' => SPrintF('/Clause?ClauseID=%s', $Clause['Partition'])), $Clause['Title']));
     #-------------------------------------------------------------------------
     $Text = '';
     #-------------------------------------------------------------------------
     if (Preg_Match_All('/<\\s*[P|TD|DIV].*>(.+)<\\s*\\/[P|TD|DIV].*>/siU', $Clause['Text'], $Matches)) {
         #-----------------------------------------------------------------------
         $Matches = Next($Matches);
         #-----------------------------------------------------------------------
         for ($i = 0; $i < Count($Matches); $i++) {
             $Text .= SPrintF('%s ', $Matches[$i]);
         }
     }
     #-------------------------------------------------------------------------
     $Text = Mb_SubStr(Html_Entity_Decode(Strip_Tags(Trim($Text))), 0, 200);
     #-------------------------------------------------------------------------
     if ($Text) {
         #-----------------------------------------------------------------------
         $Div = new Tag('DIV', array('style' => 'color:#848484;'), SPrintF('%s...', $Text));
         #-----------------------------------------------------------------------
         $Li->AddChild($Div);
     }
     #-------------------------------------------------------------------------
     $EditorID = $Clause['EditorID'];
     #-------------------------------------------------------------------------
     if ($EditorID > 1) {
         #-----------------------------------------------------------------------
         $Editor = DB_Select('Users', 'Name', array('UNIQ', 'ID' => $EditorID));
         #-----------------------------------------------------------------------
         switch (ValueOf($Editor)) {
示例#10
0
<?php

#-------------------------------------------------------------------------------
$Profiles = DB_Select('Profiles', '*', array('Where' => "`TemplateID` = 'Client'"));
#-------------------------------------------------------------------------------
switch (ValueOf($Profiles)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        # No more...
        break;
    case 'array':
        #---------------------------------------------------------------------------
        foreach ($Profiles as $Profile) {
            #-------------------------------------------------------------------------
            $Attribs = $Profile['Attribs'];
            #-------------------------------------------------------------------------
            $Attribs['Name'] = Mb_SubStr($Attribs['SiteURL'], 7);
            #-------------------------------------------------------------------------
            $IsUpdate = DB_Update('Profiles', array('Attribs' => $Attribs), array('ID' => $Profile['ID']));
            if (Is_Error($IsUpdate)) {
                return ERROR | @Trigger_Error(500);
            }
        }
        break;
    default:
        return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
return TRUE;
#-------------------------------------------------------------------------------
示例#11
0
function NauNet_Domain_Register($Settings, $DomainName, $DomainZone, $Years, $Ns1Name, $Ns1IP, $Ns2Name, $Ns2IP, $Ns3Name, $Ns3IP, $Ns4Name, $Ns4IP, $IsPrivateWhoIs, $ContractID = '', $PepsonID = 'Default', $Person = array())
{
    /****************************************************************************/
    $__args_types = array('array', 'string', 'string', 'integer', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'boolean', 'string', 'string', 'array');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $HTTP = array('Address' => $Settings['Address'], 'Port' => $Settings['Port'], 'Host' => $Settings['Address'], 'Protocol' => $Settings['Protocol'], 'Charset' => 'KOI8-R', 'IsLogging' => $Settings['Params']['IsLogging']);
    #-----------------------------------------------------------------------------
    $Domain = SPrintF('%s.%s', $DomainName, $DomainZone);
    #-----------------------------------------------------------------------------
    $Query = array('action' => 'NEW', 'login' => $Settings['Login'], 'passwd' => $Settings['Password'], 'domain' => $Domain, 'mode' => 'async');
    #-----------------------------------------------------------------------------
    $Query['private-whois'] = $IsPrivateWhoIs ? 'yes' : 'no';
    #-----------------------------------------------------------------------------
    if ($ContractID) {
        $Query['contact-login'] = $ContractID;
    } else {
        #---------------------------------------------------------------------------
        switch ($PepsonID) {
            case 'Natural':
                #---------------------------------------------------------------------
                $Query['person'] = SPrintF('%s %s %s', Translit($Person['Name']), Mb_SubStr(Translit($Person['Lastname']), 0, 1), Translit($Person['Sourname']));
                $Query['person-r'] = SPrintF('%s %s %s', $Person['Sourname'], $Person['Name'], $Person['Lastname']);
                $Query['passport'] = SPrintF('%s %s выдан %s %s', $Person['PasportLine'], $Person['PasportNum'], $Person['PasportWhom'], $Person['PasportDate']);
                $Query['residence'] = SPrintF('%s, %s, %s, %s %s', $Person['pIndex'], $Person['pState'], $Person['pCity'], $Person['pType'], $Person['pAddress']);
                $Query['birth-date'] = $Person['BornDate'];
                $Query['address-r'] = SPrintF('%s, %s, %s, %s %s, %s', $Person['pIndex'], $Person['pState'], $Person['pCity'], $Person['pType'], $Person['pAddress'], $Person['pRecipient']);
                $Query['p-addr'] = SPrintF('%s, %s, %s, %s %s, %s', $Person['pIndex'], $Person['pState'], $Person['pCity'], $Person['pType'], $Person['pAddress'], $Person['pRecipient']);
                $Query['phone'] = $Person['Phone'];
                $Query['sms-phone'] = $Person['CellPhone'];
                $Query['fax-no'] = $Person['Fax'];
                $Query['e-mail'] = $Person['Email'];
                break;
            case 'Juridical':
                #---------------------------------------------------------------------
                $Query['org'] = SPrintF('%s %s', Translit($Person['CompanyName']), Translit($Person['CompanyFormFull']));
                $Query['org-r'] = SPrintF('%s "%s"', $Person['CompanyFormFull'], $Person['CompanyName']);
                $Query['code'] = $Person['Inn'];
                $Query['kpp'] = $Person['Kpp'];
                $Query['address-r'] = SPrintF('%s, %s, %s, %s %s', $Person['jIndex'], $Person['jState'], $Person['jCity'], $Person['jType'], $Person['jAddress']);
                $Query['p-addr'] = SPrintF('%s, %s, %s, %s %s, %s "%s"', $Person['pIndex'], $Person['pState'], $Person['pCity'], $Person['pType'], $Person['pAddress'], $Person['CompanyFormFull'], $Person['CompanyName']);
                $Query['ogrn'] = $Person['Ogrn'];
                $Query['regdocuments'] = '';
                $Query['phone'] = $Person['Phone'];
                $Query['sms-phone'] = $Person['CellPhone'];
                $Query['fax-no'] = $Person['Fax'];
                $Query['e-mail'] = $Person['Email'];
                break;
            default:
                return new gException('WRONG_PROFILE_ID', 'Неверный идентификатор профиля');
        }
    }
    #-----------------------------------------------------------------------------
    $NsServers = array();
    #-----------------------------------------------------------------------------
    $NsServers[] = $Ns1IP ? SPrintF('%s %s', $Ns1Name, $Ns1IP) : $Ns1Name;
    $NsServers[] = $Ns2IP ? SPrintF('%s %s', $Ns1Name, $Ns2IP) : $Ns2Name;
    #-----------------------------------------------------------------------------
    if ($Ns3Name) {
        #---------------------------------------------------------------------------
        $NsServers[] = $Ns3IP ? SPrintF('%s %s', $Ns3Name, $Ns3IP) : $Ns3Name;
    }
    #-----------------------------------------------------------------------------
    if ($Ns4Name) {
        #---------------------------------------------------------------------------
        $NsServers[] = $Ns4IP ? SPrintF('%s %s', $Ns4Name, $Ns4IP) : $Ns4Name;
    }
    #-----------------------------------------------------------------------------
    $Query['nserver'] = $NsServers;
    #-----------------------------------------------------------------------------
    $Result = HTTP_Send('/c/registrar', $HTTP, array(), $Query);
    if (Is_Error($Result)) {
        return ERROR | @Trigger_Error('[NauNet_Domain_Register]: не удалось выполнить запрос к серверу');
    }
    #-----------------------------------------------------------------------------
    $Result = Trim($Result['Body']);
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s([0-9]+).+in\\sprogress/', $Result, $TicketID)) {
        #---------------------------------------------------------------------------
        $Result = array('TicketID' => Next($TicketID));
        #---------------------------------------------------------------------------
        if (!$ContractID) {
            $Result['ContractID'] = SPrintF('admin@%s', $Domain);
        }
        #---------------------------------------------------------------------------
        return $Result;
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\s[a-z_]+\\scanceled/', $Result)) {
        return new gException('CANCELED', 'От вас поступил запрос на отмену заявки');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\s[a-z_]+\\sabuse_domain_name/', $Result)) {
        return new gException('ABUSE_DOMAIN_NAME', 'Доменное имя противоречит принципам морали и т.п. Для уточнения деталей обратитесь к регистратору.');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\sregistrar_error\\sdocuments_wait/', $Result)) {
        return new gException('DOCUMENTS_WAIT', 'Истек срок ожидания документов для подтверждения (30 дней). Обратитесь к регистратору.');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\s[a-z_]+\\swrong_data/', $Result)) {
        return new gException('WRONG_DATA', 'Для выполнения заявки недостаточно данных');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\s[a-z_]+\\srequest_already_exists/', $Result)) {
        return new gException('REQUEST_ALREADY_EXISTS', 'Существует незавершенный запрос на регистрацию данного домена');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\s[a-z_]+\\swrong_client_id/', $Result)) {
        return new gException('WRONG_CLIENT_ID', 'Недостаточно данных для регистрации в cистеме управления услугами (наименование организации/ФИО иИНН/серия-номер паспорта)');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\s[a-z_]+\\swrong_domain/', $Result)) {
        return new gException('WRONG_DOMAIN', 'Название домена не указано или указано неверно');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\s[a-z_]+\\swrong_e-mail/', $Result)) {
        return new gException('WRONG_E_MAIL', 'Не удалось определить email администратора ни из самой заявки, ни в значениях по умолчанию');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\s[a-z_]+\\swrong_key_/', $Result)) {
        return new gException('WRONG_KEY', 'Ошибка синтаксиса в каком-либо поле');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\s[a-z_]+\\swrong_password_trycounter/', $Result)) {
        return new gException('WRONG_PASSWORD_TRYCOUNTER', 'Кол-во попыток ввода пароля превысило допустимое');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\s[a-z_]+\\swrong_password/', $Result)) {
        return new gException('WRONG_PASSWORD', 'Неверный пароль доступа к регистратору');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\s[a-z_]+\\swrong_ident/', $Result)) {
        return new gException('WRONG_IDENT', 'Ошибка идентификации пользователя');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\s[a-z_]+\\sunknown_login/', $Result)) {
        return new gException('WRONG_LOGIN', 'Указано неверное имя пользователя');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/NEW:\\s[0-9]+\\smoney_wait/', $Result)) {
        return new gException('MONEY_WAIT', 'Заявка будет обработана после поступления на счет денежных средств. Пополните баланс.');
    }
    #-----------------------------------------------------------------------------
    return new gException('WRONG_ANSWER', $Result);
}
示例#12
0
文件: RegRu.php 项目: carriercomm/jbs
function RegRu_Domain_Register($Settings, $DomainName, $DomainZone, $Years, $Ns1Name, $Ns1IP, $Ns2Name, $Ns2IP, $Ns3Name, $Ns3IP, $Ns4Name, $Ns4IP, $ContractID = '', $IsPrivateWhoIs, $PepsonID = 'Default', $Person = array())
{
    /****************************************************************************/
    $__args_types = array('array', 'string', 'string', 'integer', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'boolean', 'string', 'string', 'array');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $HTTP = RegRu_Build_HTTP($Settings);
    #-----------------------------------------------------------------------------
    $Domain = Mb_StrToLower(SPrintF('%s.%s', $DomainName, $DomainZone), 'UTF-8');
    #-----------------------------------------------------------------------------
    $Query = array('username' => $Settings['Login'], 'password' => $Settings['Password'], 'domain_name' => $Domain, 'enduser_ip' => '127.0.0.1', 'pay_type' => 'prepay', 'private_person_flag' => $IsPrivateWhoIs);
    #-----------------------------------------------------------------------------
    $Query['period'] = $Years;
    #-----------------------------------------------------------------------------
    if (In_Array($DomainZone, array('ru', 'su', 'рф'))) {
        #---------------------------------------------------------------------------
        switch ($PepsonID) {
            case 'Natural':
                #-----------------------------------------------------------------------
                $Query['person'] = SPrintF('%s %s %s', Translit($Person['Name']), Mb_SubStr(Translit($Person['Lastname']), 0, 1), Translit($Person['Sourname']));
                $Query['private_person_flag'] = 1;
                $Query['person_r'] = SPrintF('%s %s %s', $Person['Sourname'], $Person['Name'], $Person['Lastname']);
                $Query['passport'] = SPrintF('%s %s выдан %s %s', $Person['PasportLine'], $Person['PasportNum'], $Person['PasportWhom'], $Person['PasportDate']);
                $Query['birth_date'] = $Person['BornDate'];
                $Query['country'] = isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry'];
                $Query['p_addr'] = SPrintF('%s, %s, %s, %s %s, %s', $Person['pIndex'], $Person['pState'], $Person['pCity'], $Person['pType'], $Person['pAddress'], $Person['pRecipient']);
                $Query['phone'] = $Person['Phone'];
                $Query['sms_security_number'] = $Person['CellPhone'];
                $Query['fax'] = $Person['Fax'];
                $Query['e_mail'] = $Person['Email'];
                break;
            case 'Juridical':
                #-----------------------------------------------------------------------
                $Query['org'] = SPrintF('%s %s', Translit($Person['CompanyName']), Translit($Person['CompanyFormFull']));
                $Query['org_r'] = SPrintF('%s "%s"', $Person['CompanyFormFull'], $Person['CompanyName']);
                $Query['code'] = $Person['Inn'];
                $Query['kpp'] = $Person['Kpp'];
                $Query['country'] = $Person['jCountry'];
                $Query['address_r'] = SPrintF('%s, %s, %s, %s %s', $Person['jIndex'], $Person['jState'], $Person['jCity'], $Person['jType'], $Person['jAddress']);
                $Query['p_addr'] = SPrintF('%s, %s, %s, %s %s, %s "%s"', $Person['pIndex'], $Person['pState'], $Person['pCity'], $Person['pType'], $Person['pAddress'], $Person['CompanyFormFull'], $Person['CompanyName']);
                $Query['phone'] = $Person['Phone'];
                $Query['sms_security_number'] = $Person['CellPhone'];
                $Query['fax'] = $Person['Fax'];
                $Query['e_mail'] = $Person['Email'];
                break;
            default:
                return new gException('WRONG_PROFILE_ID', 'Неверный идентификатор профиля');
        }
        #---------------------------------------------------------------------------
    } elseif (In_Array($DomainZone, array('info', 'biz', 'org', 'com', 'net', 'be', 'cc', 'tv', 'pro', 'site'))) {
        #---------------------------------------------------------------------------
        switch ($PepsonID) {
            case 'Natural':
                #-----------------------------------------------------------------------
                $Query['o_company'] = 'Private person';
                $Query['a_company'] = 'Private person';
                $Query['t_company'] = 'Private person';
                $Query['b_company'] = 'Private person';
                #-----------------------------------------------------------------------
                $Query['o_country_code'] = $Person['pCountry'];
                $Query['a_country_code'] = $Person['pCountry'];
                $Query['t_country_code'] = $Person['pCountry'];
                $Query['b_country_code'] = $Person['pCountry'];
                #-----------------------------------------------------------------------
                $Query['o_postcode'] = $Person['pIndex'];
                $Query['a_postcode'] = $Person['pIndex'];
                $Query['t_postcode'] = $Person['pIndex'];
                $Query['b_postcode'] = $Person['pIndex'];
                #-----------------------------------------------------------------------
                $Query['o_first_name'] = Translit($Person['Name']);
                $Query['a_first_name'] = Translit($Person['Name']);
                $Query['t_first_name'] = Translit($Person['Name']);
                $Query['b_first_name'] = Translit($Person['Name']);
                #-----------------------------------------------------------------------
                $Query['o_last_name'] = Translit($Person['Sourname']);
                $Query['a_last_name'] = Translit($Person['Sourname']);
                $Query['t_last_name'] = Translit($Person['Sourname']);
                $Query['b_last_name'] = Translit($Person['Sourname']);
                #-----------------------------------------------------------------------
                $Query['o_email'] = $Person['Email'];
                $Query['a_email'] = $Person['Email'];
                $Query['t_email'] = $Person['Email'];
                $Query['b_email'] = $Person['Email'];
                #-----------------------------------------------------------------------
                $Query['o_addr'] = Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress']));
                $Query['a_addr'] = Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress']));
                $Query['t_addr'] = Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress']));
                $Query['b_addr'] = Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress']));
                #-----------------------------------------------------------------------
                $Query['o_city'] = Translit($Person['pCity']);
                $Query['a_city'] = Translit($Person['pCity']);
                $Query['t_city'] = Translit($Person['pCity']);
                $Query['b_city'] = Translit($Person['pCity']);
                #-----------------------------------------------------------------------
                $Query['o_state'] = Translit($Person['pState']);
                $Query['a_state'] = Translit($Person['pState']);
                $Query['t_state'] = Translit($Person['pState']);
                $Query['b_state'] = Translit($Person['pState']);
                break;
            case 'Juridical':
                #-----------------------------------------------------------------------
                $CompanyEn = SPrintF('%s %s', Translit($Person['CompanyName']), Translit($Person['CompanyFormFull']));
                #-----------------------------------------------------------------------
                $Query['o_company'] = $CompanyEn;
                $Query['a_company'] = $CompanyEn;
                $Query['t_company'] = $CompanyEn;
                $Query['b_company'] = $CompanyEn;
                #-----------------------------------------------------------------------
                $Query['o_country_code'] = $Person['jCountry'];
                $Query['a_country_code'] = $Person['jCountry'];
                $Query['t_country_code'] = $Person['jCountry'];
                $Query['b_country_code'] = $Person['jCountry'];
                #-----------------------------------------------------------------------
                $Query['o_postcode'] = $Person['jIndex'];
                $Query['a_postcode'] = $Person['jIndex'];
                $Query['t_postcode'] = $Person['jIndex'];
                $Query['b_postcode'] = $Person['jIndex'];
                #-----------------------------------------------------------------------
                $Query['o_first_name'] = Translit($Person['dName']);
                $Query['a_first_name'] = Translit($Person['dName']);
                $Query['t_first_name'] = Translit($Person['dName']);
                $Query['b_first_name'] = Translit($Person['dName']);
                #-----------------------------------------------------------------------
                $Query['o_last_name'] = Translit($Person['dSourname']);
                $Query['a_last_name'] = Translit($Person['dSourname']);
                $Query['t_last_name'] = Translit($Person['dSourname']);
                $Query['b_last_name'] = Translit($Person['dSourname']);
                #-----------------------------------------------------------------------
                $Query['o_email'] = $Person['Email'];
                $Query['a_email'] = $Person['Email'];
                $Query['t_email'] = $Person['Email'];
                $Query['b_email'] = $Person['Email'];
                #-----------------------------------------------------------------------
                $Query['o_addr'] = Translit(SPrintF('%s %s', $Person['jType'], $Person['jAddress']));
                $Query['a_addr'] = Translit(SPrintF('%s %s', $Person['jType'], $Person['jAddress']));
                $Query['t_addr'] = Translit(SPrintF('%s %s', $Person['jType'], $Person['jAddress']));
                $Query['b_addr'] = Translit(SPrintF('%s %s', $Person['jType'], $Person['jAddress']));
                #-----------------------------------------------------------------------
                $Query['o_city'] = Translit($Person['jCity']);
                $Query['a_city'] = Translit($Person['jCity']);
                $Query['t_city'] = Translit($Person['jCity']);
                $Query['b_city'] = Translit($Person['jCity']);
                #-----------------------------------------------------------------------
                $Query['o_state'] = Translit($Person['jState']);
                $Query['a_state'] = Translit($Person['jState']);
                $Query['t_state'] = Translit($Person['jState']);
                $Query['b_state'] = Translit($Person['jState']);
                break;
            default:
                return new gException('WRONG_PERSON_TYPE_ID', 'Неверный идентификатор типа персоны');
        }
        #---------------------------------------------------------------------------
        #---------------------------------------------------------------------------
        if ($DomainZone == 'pro') {
            $Query['pro_profession'] = 'Other';
        }
        #---------------------------------------------------------------------------
        #---------------------------------------------------------------------------
        $Phone = $Person['Phone'];
        #---------------------------------------------------------------------------
        if ($Phone) {
            #-------------------------------------------------------------------------
            $Phone = Preg_Split('/\\s+/', $Phone);
            #-------------------------------------------------------------------------
            $Phone = SPrintF('%s.%s%s', Current($Phone), Next($Phone), Next($Phone));
            #-------------------------------------------------------------------------
            $Query['o_phone'] = $Phone;
            $Query['a_phone'] = $Phone;
            $Query['t_phone'] = $Phone;
            $Query['b_phone'] = $Phone;
        } else {
            #-------------------------------------------------------------------------
            $Query['o_phone'] = '';
            $Query['a_phone'] = '';
            $Query['t_phone'] = '';
            $Query['b_phone'] = '';
        }
        #---------------------------------------------------------------------------
        $Fax = $Person['Fax'];
        #---------------------------------------------------------------------------
        if ($Fax) {
            #-------------------------------------------------------------------------
            $Fax = Preg_Split('/\\s+/', $Fax);
            #-------------------------------------------------------------------------
            $Fax = SPrintF('%s.%s%s', Current($Fax), Next($Fax), Next($Fax));
            #-------------------------------------------------------------------------
            $Query['o_fax'] = $Fax;
            $Query['a_fax'] = $Fax;
            $Query['t_fax'] = $Fax;
            $Query['b_fax'] = $Fax;
        } else {
            #-------------------------------------------------------------------------
            $Query['o_fax'] = '';
            $Query['a_fax'] = '';
            $Query['t_fax'] = '';
            $Query['b_fax'] = '';
        }
    } else {
        return new gException('WRONG_ZONE_NAME', 'Указанная зона не поддерживается в автоматическом режиме');
    }
    #-----------------------------------------------------------------------------
    $Query['ns0'] = $Ns1Name;
    $Query['ns1'] = $Ns2Name;
    #-----------------------------------------------------------------------------
    if ($Ns1IP && $Ns2IP) {
        #---------------------------------------------------------------------------
        $Query['ns0ip'] = $Ns1IP;
        $Query['ns1ip'] = $Ns2IP;
    }
    #-----------------------------------------------------------------------------
    $Settings['PrefixAPI'] = SprintF("https://api.reg.ru/api/regru2/%s", "domain/create");
    #-----------------------------------------------------------------------------
    $Result = HTTP_Send($Settings['PrefixAPI'], $HTTP, array(), $Query);
    if (Is_Error($Result)) {
        return ERROR | @Trigger_Error('[RegRu_Domain_Register]: не удалось выполнить запрос к серверу');
    }
    #-----------------------------------------------------------------------------
    $Result = Trim($Result['Body']);
    #-----------------------------------------------------------------------------
    $Result = Json_Decode($Result, TRUE);
    #-----------------------------------------------------------------------------
    if ($Result['result'] == 'success') {
        if (isset($Result['error_code'])) {
            return new gException('REGISTRATOR_ERROR_1', $Result['error_code']);
        } else {
            foreach (Array_Keys($Result['answer']) as $Key) {
                Debug(SPrintF("[RegRu_Answer::Domain_Register]: %s => %s", $Key, $Result['answer'][$Key]));
            }
            #---------------------------------------------------------------------------
            if ($Result['answer']['dname'] == $Domain) {
                return array('TicketID' => (int) $Result['answer']['service_id']);
                #---------------------------------------------------------------------------
            }
        }
    }
    #-----------------------------------------------------------------------------
    if ($Result['result'] == 'error') {
        return new gException('REGISTRATOR_ERROR', 'Регистратор вернул ошибку');
    }
    #-----------------------------------------------------------------------------
    return new gException('WRONG_ANSWER', $Result);
}
示例#13
0
/******************************************************************************/
$__args_list = array('Value', 'Length', 'Url', 'IsHtmlEncode');
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
#Debug(SPrintF('[comp/Formats/String]: Value = %s; Length = %s; Url = %s',$Value,$Length,$Url));
#-------------------------------------------------------------------------------
if ($IsHtmlEncode) {
    $Value = HtmlSpecialChars($Value);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
if (Mb_StrLen($Value) > $Length) {
    #-------------------------------------------------------------------------------
    $Text = Mb_SubStr($Value, 0, $Length);
    #-------------------------------------------------------------------------------
    $Result = Is_Null($Url) ? new Tag('SPAN', SPrintF('%s...', $Text)) : new Tag('A', array('href' => $Url, 'target' => 'blank'), SPrintF('%s...', $Text));
    #-------------------------------------------------------------------------------
    $LinkID = UniqID('String');
    #-------------------------------------------------------------------------------
    $Links =& Links();
    #-------------------------------------------------------------------------------
    $Links[$LinkID] =& $Result;
    #-------------------------------------------------------------------------------
    $Comp = Comp_Load('Form/Prompt', $LinkID, $Value);
    if (Is_Error($Comp)) {
        return ERROR | @Trigger_Error(500);
    }
    #-------------------------------------------------------------------------------
    unset($Links[$LinkID]);
示例#14
0
文件: WhoIs.php 项目: carriercomm/jbs
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;
    #-------------------------------------------------------------------------------
}
示例#15
0
             #-------------------------------------------------------------------------------
         } else {
             #-------------------------------------------------------------------------------
             $Value = 'Список выбора поля';
             #-------------------------------------------------------------------------------
         }
         #-------------------------------------------------------------------------------
         break;
         #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     case 'File':
         #-------------------------------------------------------------------------------
         $FileName = $ServiceOrderField['FileName'];
         #-------------------------------------------------------------------------------
         if (Mb_StrLen($FileName) > 15) {
             $FileName = SPrintF('%s...', Mb_SubStr($FileName, 0, 15));
         }
         #-------------------------------------------------------------------------------
         $Value = new Tag('TD', array('class' => 'Standard'), new Tag('A', array('href' => SPrintF('/OrderFileDownload?OrderFieldID=%u', $ServiceOrderField['ID'])), SPrintF('%s (%01.2f Кб.)', $FileName, StrLen(Base64_Decode($Value)) / 1024)));
         #-------------------------------------------------------------------------------
         break;
         #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     case 'Hidden':
         continue 2;
     default:
         # No more...
 }
 #-------------------------------------------------------------------------------
 $Fields[] = array($ServiceField['Name'], $Value);
 #-------------------------------------------------------------------------------
示例#16
0
function MasterName_Contract_Register($Settings, $PepsonID, $Person, $DomainZone)
{
    /****************************************************************************/
    $__args_types = array('array', 'string', 'array', 'string');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $HTTP = array('Address' => $Settings['Address'], 'Port' => $Settings['Port'], 'Host' => $Settings['Address'], 'Protocol' => $Settings['Protocol'], 'Charset' => 'CP1251', 'IsLogging' => $Settings['Params']['IsLogging']);
    #-----------------------------------------------------------------------------
    $Query = array();
    #-----------------------------------------------------------------------------
    $Query[] = '[request]';
    $Query[] = SPrintF('login: %s', $Settings['Login']);
    $Query[] = SPrintF('password: %s', $Settings['Password']);
    $Query[] = 'action: create_client';
    #-----------------------------------------------------------------------------
    $RequestID = UniqID('ID');
    #-----------------------------------------------------------------------------
    $Query[] = SPrintF('request-id: %s', $RequestID);
    #-----------------------------------------------------------------------------
    $Query[] = '';
    #-----------------------------------------------------------------------------
    switch ($PepsonID) {
        case 'Natural':
            #-------------------------------------------------------------------------
            $Query[] = '[client]';
            #-------------------------------------------------------------------------
            $Query[] = 'client-type: ФИЗЛИЦО';
            $Query[] = $Person['PasportCountry'] != 'RU' ? 'non-resident:' : 'resident:';
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('person-r: %s %s %s', $Person['Sourname'], $Person['Name'], $Person['Lastname']);
            $Query[] = SPrintF('person: %s %s %s', Translit($Person['Name']), Mb_SubStr(Translit($Person['Lastname']), 0, 1), Translit($Person['Sourname']));
            $Query[] = SPrintF('email: %s', $Person['Email']);
            #-------------------------------------------------------------------------
            $Phone = $Person['Phone'];
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('phone: %s', $Phone);
            #-------------------------------------------------------------------------
            $Fax = $Person['Fax'];
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('fax: %s', $Fax ? $Fax : $Phone);
            #-------------------------------------------------------------------------
            $BornDate = Explode('.', $Person['BornDate']);
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('birth-date: %s-%s-%s', End($BornDate), Prev($BornDate), Prev($BornDate));
            #-------------------------------------------------------------------------
            $PasportLine = Preg_Split('/^([0-9]{2})/', $Person['PasportLine'], -1, PREG_SPLIT_DELIM_CAPTURE);
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('passport-series: %s %s', Next($PasportLine), Next($PasportLine));
            $Query[] = SPrintF('passport-number: %s', $Person['PasportNum']);
            #-------------------------------------------------------------------------
            $PasportDate = Explode('.', $Person['PasportDate']);
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('passport-date: %s-%s-%s', End($PasportDate), Prev($PasportDate), Prev($PasportDate));
            $Query[] = SPrintF('passport-org: %s', $Person['PasportWhom']);
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('post-country: %s', $Person['pCountry']);
            $Query[] = SPrintF('post-region: %s', $Person['pState']);
            $Query[] = SPrintF('post-zip-code: %s', $Person['pIndex']);
            $Query[] = SPrintF('post-city: %s', $Person['pCity']);
            $Query[] = SPrintF('post-street: %s %s, %s', $Person['pType'], $Person['pAddress'], $Person['pRecipient']);
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('reg-country: %s', $Person['pCountry']);
            $Query[] = SPrintF('reg-region: %s', $Person['pState']);
            $Query[] = SPrintF('reg-city: %s', $Person['pCity']);
            $Query[] = SPrintF('reg-street: %s %s', $Person['pType'], $Person['pAddress']);
            break;
        case 'Juridical':
            #-------------------------------------------------------------------------
            $Query[] = '[client]';
            #-------------------------------------------------------------------------
            $Query[] = 'client-type: ЮРЛИЦО';
            $Query[] = 'resident:';
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('ownership: %s', $Person['CompanyFormFull']);
            $Query[] = SPrintF('org-r: %s', $Person['CompanyName']);
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('org: %s %s', Translit($Person['CompanyName']), Translit($Person['CompanyFormFull']));
            $Query[] = SPrintF('email: %s', $Person['Email']);
            #-------------------------------------------------------------------------
            $Phone = $Person['Phone'];
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('phone: %s', $Phone);
            #-------------------------------------------------------------------------
            $Fax = $Person['Fax'];
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('fax: %s', $Fax ? $Fax : $Phone);
            $Query[] = SPrintF('contact: %s %s %s', $Person['dSourname'], $Person['dName'], $Person['dLastname']);
            $Query[] = SPrintF('inn: %s', $Person['Inn']);
            $Query[] = SPrintF('kpp: %s', $Person['Kpp']);
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('post-country: %s', $Person['pCountry']);
            $Query[] = SPrintF('post-zip-code: %s', $Person['pIndex']);
            $Query[] = SPrintF('post-region: %s', $Person['pState']);
            $Query[] = SPrintF('post-city: %s', $Person['pCity']);
            $Query[] = SPrintF('post-street: %s %s, %s "%s"', $Person['pType'], $Person['pAddress'], $Person['CompanyFormFull'], $Person['CompanyName']);
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('jur-country: %s', $Person['jCountry']);
            $Query[] = SPrintF('jur-zip-code: %s', $Person['jIndex']);
            $Query[] = SPrintF('jur-region: %s', $Person['jState']);
            $Query[] = SPrintF('jur-city: %s', $Person['jCity']);
            $Query[] = SPrintF('jur-street: %s %s', $Person['jType'], $Person['jAddress']);
            #-------------------------------------------------------------------------
            $Query[] = SPrintF('real-country: %s', $Person['jCountry']);
            $Query[] = SPrintF('real-zip-code: %s', $Person['jIndex']);
            $Query[] = SPrintF('real-region: %s', $Person['jState']);
            $Query[] = SPrintF('real-city: %s', $Person['jCity']);
            $Query[] = SPrintF('real-street: %s %s', $Person['pType'], $Person['jAddress']);
            break;
        default:
            return new gException('WRONG_PROFILE_ID', 'Неверный идентификатор профиля');
    }
    #-----------------------------------------------------------------------------
    $Query = array('request' => Implode("\n", $Query));
    #-----------------------------------------------------------------------------
    $Result = HTTP_Send('/partner_gateway', $HTTP, array(), $Query);
    if (Is_Error($Result)) {
        return ERROR | @Trigger_Error('[MasterName_Contract_Register]:не удалось выполнить запрос к серверу');
    }
    #-----------------------------------------------------------------------------
    $Result = Trim($Result['Body']);
    #-----------------------------------------------------------------------------
    if (Preg_Match('/status:\\s([0-9]+)\\s/', $Result, $CodeID)) {
        #---------------------------------------------------------------------------
        $CodeID = Next($CodeID);
        #---------------------------------------------------------------------------
        switch ($CodeID) {
            case '200':
                # No more...
            # No more...
            case '201':
                # No more...
            # No more...
            case '202':
                return array('TicketID' => $RequestID);
            case '203':
                return new gException('REQUEST_FAILED', 'Обработка запроса завершилась с ошибкой');
            case '400':
                return new gException('BAD_REQUEST', 'Неверный формат запроса');
            case '401':
                return new gException('AUTH_ERROR', 'Ошибка авторизации');
            case '402':
                return new gException('DATA_ERROR', 'Ошибка в данных запроса');
            case '403':
                return new gException('FORBIDDEN', 'Доступ к запрашиваемому объекту запрещен');
            case '404':
                return new gException('NOT_FOUND', 'Запрашиваемый объект не найден');
            case '405':
                return new gException('INVALID_REQUEST', 'Невозможно выполнить запрос');
            case '500':
                return new gException('SERVER_ERROR', 'Внутренняя ошибка сервера');
            default:
                return new gException('WRONG_ERROR', 'Неизвестный статус ошибки');
        }
    }
    #-----------------------------------------------------------------------------
    return new gException('WRONG_ANSWER', $Result);
}
示例#17
0
文件: R01.php 项目: carriercomm/jbs
function R01_Contract_Register($Settings, $PepsonID, $Person, $DomainZone)
{
    /****************************************************************************/
    $__args_types = array('array', 'string', 'array', 'string');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $AddCustomer = new SoapClient(null, array('location' => SPrintF('https://%s:%d/%s', $Settings['Address'], $Settings['Port'], $Settings['Params']['PrefixAPI']), 'uri' => 'urn:RegbaseSoapInterface', 'exceptions' => 1, 'user_agent' => 'RegbaseSoapInterfaceClient', 'trace' => 1));
    #-----------------------------------------------------------------------------
    if (Is_SOAP_Fault($AddCustomer)) {
        #---------------------------------------------------------------------------
        $Msg = SPrintF('Ошибка обращения к регистратору: %s', $AddCustomer->faultstring);
        #---------------------------------------------------------------------------
        return new gException('REQUEST_ERROR', $Msg);
    }
    #-----------------------------------------------------------------------------
    $loginResult = $AddCustomer->logIn($Settings['Login'], $Settings['Password']);
    #-----------------------------------------------------------------------------
    if (Is_SOAP_Fault($loginResult)) {
        #---------------------------------------------------------------------------
        $Msg = SPrintF('Ошибка при авторизации: %s', $loginResult->faultstring);
        #---------------------------------------------------------------------------
        return new gException('REQUEST_ERROR', $Msg);
    }
    #-----------------------------------------------------------------------------
    if ($loginResult->status->code == '0') {
        #---------------------------------------------------------------------------
        $Msg = SPrintF('Ошибка авторизации [name=%s, message=%s]', $loginResult->status->name, $loginResult->status->message);
        #---------------------------------------------------------------------------
        return new gException('AUTHORIZATION_FAILED', $Msg);
    }
    #-----------------------------------------------------------------------------
    $AddCustomer->__setCookie('SOAPClient', $loginResult->status->message);
    #-----------------------------------------------------------------------------
    switch ($PepsonID) {
        case 'Natural':
            #-------------------------------------------------------------------------
            $Params = array();
            #-------------------------------------------------------------------------
            $Params['NICHDL'] = SprintF('%s%s_%s-GPT', Mb_SubStr(Translit($Person['Name']), 0, 1), Translit($Person['Sourname']), Mb_SubStr(UniqID(), 0, 5));
            #-------------------------------------------------------------------------
            Debug(Print_R($Params, TRUE));
            #-------------------------------------------------------------------------
            $Response = $AddCustomer->addDadminPerson($Params['NICHDL'], SPrintF('%s %s %s', $Person['Sourname'], $Person['Name'], $Person['Lastname']), SPrintF('%s %s %s', Translit($Person['Name']), Mb_SubStr(Translit($Person['Lastname']), 0, 1), Translit($Person['Sourname'])), SPrintF('%s %s, %s, %s', $Person['PasportLine'], $Person['PasportNum'], $Person['PasportWhom'], $Person['PasportDate']), $Person['BornDate'], SPrintF('%d, %s, %s, %s, %s %s', $Person['pIndex'], $Person['pCountry'], $Person['pState'], $Person['pCity'], $Person['pType'], $Person['pAddress']), $Person['Phone'], $Person['Fax'], $Person['Email'], 1, 1);
            break;
        case 'Juridical':
            #-------------------------------------------------------------------------
            $Params['NICHDL'] = SprintF('%s_%s-ORG-GPT', Translit($Person['CompanyName']), Mb_SubStr(UniqID(), 0, 5));
            #-------------------------------------------------------------------------
            $Response = $AddCustomer->addDadminOrg($Params['NICHDL'], SPrintF('%s %s', $Person['CompanyFormFull'], $Person['CompanyName']), SPrintF('%s %s', Translit($Person['CompanyFormFull']), Translit($Person['CompanyName'])), $Person['Inn'], $Person['Ogrn'], SPrintF('%d, %s, %s, %s, %s %s', $Person['jIndex'], $Person['jCountry'], $Person['jState'], $Person['jCity'], $Person['jType'], $Person['jAddress']), SPrintF('%d, %s, %s, %s, %s %s', $Person['jIndex'], $Person['jCountry'], $Person['jState'], $Person['jCity'], $Person['pType'], $Person['pAddress']), $Person['Phone'], $Person['Fax'], $Person['Email'], SPrintF('%s %s %s', $Person['dSourname'], $Person['dName'], $Person['dLastname']), $Person['BankName'], $Person['BankAccount'], $Person['Kor'], $Person['Bik'], 1);
            break;
        default:
            return ERROR | @Trigger_Error(400);
    }
    #-----------------------------------------------------------------------------
    Debug(Print_R($Response, TRUE));
    #-----------------------------------------------------------------------------
    if (Is_SOAP_Fault($Response)) {
        #---------------------------------------------------------------------------
        $Msg = SPrintF('Ошибка при выполнении запроса: %s', $Response->faultstring);
        #---------------------------------------------------------------------------
        return new gException('REQUEST_ERROR', $Msg);
    }
    #-----------------------------------------------------------------------------
    if ($Response->status->code == '0') {
        #---------------------------------------------------------------------------
        $Msg = SPrintF('Ошибка регистрации домена [name=%s, message=%s]', $Response->status->name, $Response->status->message);
        #---------------------------------------------------------------------------
        return new gException('ADD_DOMAIN_FAILED', $Msg);
    }
    #-----------------------------------------------------------------------------
    $CustomerID = $Response->nic_hdl;
    #-----------------------------------------------------------------------------
    Debug($CustomerID);
    #-----------------------------------------------------------------------------
    $logoutResult = $AddCustomer->logOut();
    #-----------------------------------------------------------------------------
    if (Is_SOAP_Fault($logoutResult)) {
        #---------------------------------------------------------------------------
        $Msg = SPrintF('Ошибка закрытия сессии: %s', $logoutResult->faultstring);
        #---------------------------------------------------------------------------
        return new gException('REQUEST_ERROR', $Msg);
    }
    #-----------------------------------------------------------------------------
    return array('TicketID' => $CustomerID);
}
示例#18
0
$Domains = $Parked ? Explode(',', $Parked) : array();
#-------------------------------------------------------------------------------
$Domains[] = $Domain;
#-------------------------------------------------------------------------------
$Domains = Array_Unique($Domains);
#-------------------------------------------------------------------------------
$Count = Count($Domains);
#-------------------------------------------------------------------------------
if ($Count > 10) {
    $Domains = Array_Slice($Domains, 0, 9);
}
#-------------------------------------------------------------------------------
$Domain = $Text = Current($Domains);
#-------------------------------------------------------------------------------
if (Mb_StrLen($Text) > $Length) {
    $Text = SPrintF('%s...', Mb_SubStr($Text, 0, $Length));
}
#-------------------------------------------------------------------------------
$A = new Tag('A', array('target' => 'blank', 'href' => SPrintF('http://%s/', $Domain)), $Text);
#-------------------------------------------------------------------------------
$LinkID = UniqID('Domains');
#-------------------------------------------------------------------------------
$Links =& Links();
# Коллекция ссылок
$Links[$LinkID] =& $A;
#-------------------------------------------------------------------------------
$Comp = Comp_Load('Form/Prompt', $LinkID, SPrintF('<B>Всего: %u</B><BR />%s', $Count, Implode('<BR />', $Domains)));
if (Is_Error($Comp)) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
示例#19
0
function String_Xml_Parse($String, $IsUseCache = TRUE)
{
    #-------------------------------------------------------------------------------
    # костыль для удаления не-UTF8 символов
    $String = iconv('UTF-8', 'UTF-8//IGNORE', $String);
    #-------------------------------------------------------------------------------
    $Length = Mb_StrLen($String);
    #-------------------------------------------------------------------------------
    $IsUseCache = $IsUseCache && $Length > 1024;
    #-------------------------------------------------------------------------------
    if ($IsUseCache) {
        #-------------------------------------------------------------------------------
        $CacheID = SPrintF('String_XML_Parse[%s]', Md5(Crc32($String)));
        #-------------------------------------------------------------------------------
        $Result = CacheManager::get($CacheID);
        if ($Result) {
            return $Result;
        }
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    Debug(SPrintF('[String_XML_Parse]: парсирование строки (%u bytes)', $Length));
    #-------------------------------------------------------------------------------
    $XmlParser = Xml_Parser_Create('UTF-8');
    #-------------------------------------------------------------------------------
    if (!Xml_Parser_Set_Option($XmlParser, XML_OPTION_CASE_FOLDING, FALSE)) {
        return ERROR | Trigger_Error('[String_Xml_Parse]: не удалось установить опцию парсирования (XML_OPTION_CASE_FOLDING)');
    }
    #-------------------------------------------------------------------------------
    if (!Xml_Parser_Set_Option($XmlParser, XML_OPTION_SKIP_WHITE, FALSE)) {
        return ERROR | Trigger_Error('[String_Xml_Parse]: не удалось установить опцию парсирования (XML_OPTION_SKIP_WHITE)');
    }
    #-------------------------------------------------------------------------------
    if (!Xml_Parse_Into_Struct($XmlParser, $String, $Nodes)) {
        #-------------------------------------------------------------------------------
        $ByteIndex = Xml_Get_Current_Byte_Index($XmlParser);
        #-------------------------------------------------------------------------------
        Debug(SPrintF('[system/libs/auto/String.php]: xml_error_string = %s', Xml_Error_String(Xml_Get_Error_Code($XmlParser))));
        #-------------------------------------------------------------------------------
        Debug(SPrintF('[system/libs/auto/String.php]: %s', Mb_SubStr($String, $ByteIndex - 100, $ByteIndex + 100)));
        #-------------------------------------------------------------------------------
        $Buffer = Mb_SubStr($String, 0, $ByteIndex);
        #-------------------------------------------------------------------------------
        $Line = Preg_Match_All("/(\r\n|\n)/sU", $Buffer, $Matches) + 1;
        #-------------------------------------------------------------------------------
        return new gException('XML_PARSE_ERROR', SPrintF('%s в линии %u', Xml_Error_String($XmlParser), $Line));
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    #-----------------------------------------------------------------------------
    Xml_Parser_Free($XmlParser);
    #-----------------------------------------------------------------------------
    $Root = new Tag('__ROOT__');
    #-----------------------------------------------------------------------------
    $Links = array(&$Root);
    #-----------------------------------------------------------------------------
    foreach ($Nodes as $Node) {
        #---------------------------------------------------------------------------
        $Current = $Links[Count($Links) - 1];
        #---------------------------------------------------------------------------
        switch ($Node['type']) {
            case 'open':
                #-----------------------------------------------------------------------
                $Tag = new Tag($Node['tag']);
                #-----------------------------------------------------------------------
                if (isset($Node['attributes'])) {
                    $Tag->AddAttribs($Node['attributes']);
                }
                #-----------------------------------------------------------------------
                if (isset($Node['value'])) {
                    #---------------------------------------------------------------------
                    $Value = $Node['value'];
                    #---------------------------------------------------------------------
                    if (Trim($Value)) {
                        $Tag->AddChild(new Tag('CDATA', $Value));
                    }
                }
                #-----------------------------------------------------------------------
                $Current->Childs[] = $Tag;
                #-----------------------------------------------------------------------
                $Links[] =& $Current->Childs[Count($Current->Childs) - 1];
                break;
            case 'cdata':
                #-----------------------------------------------------------------------
                $Value = $Node['value'];
                #-----------------------------------------------------------------------
                if (Trim($Value)) {
                    #---------------------------------------------------------------------
                    $Tag = new Tag('CDATA', $Value);
                    #---------------------------------------------------------------------
                    $Current->Childs[] = $Tag;
                }
                break;
            case 'complete':
                #-----------------------------------------------------------------------
                $Tag = new Tag($Node['tag']);
                #-----------------------------------------------------------------------
                if (isset($Node['attributes'])) {
                    $Tag->AddAttribs($Node['attributes']);
                }
                #-----------------------------------------------------------------------
                if (isset($Node['value'])) {
                    $Tag->AddText($Node['value']);
                }
                #-----------------------------------------------------------------------
                $Current->Childs[] = $Tag;
                break;
            case 'close':
                Array_Pop($Links);
                break;
            default:
                # No more...
        }
    }
    #-----------------------------------------------------------------------------
    if ($IsUseCache) {
        CacheManager::add($CacheID, $Root);
    }
    #-----------------------------------------------------------------------------
    return $Root;
}
示例#20
0
    case 'exception':
        return $Rss->ToXMLString();
    case 'array':
        break;
    default:
        return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
foreach ($Versions as $Version) {
    #-------------------------------------------------------------------------------
    $Link = SPrintF('http://%s/Rss/New?NewID=%u', HOST_ID, $Version['ID']);
    #-------------------------------------------------------------------------------
    $Text = Strip_Tags($Version['Text']);
    #-------------------------------------------------------------------------------
    if (Mb_StrLen($Text) > 120) {
        $Text = SPrintF('%s...', Mb_SubStr($Text, 0, 120));
    }
    #-------------------------------------------------------------------------------
    $Item = new Tag('item');
    $Item->AddChild(new Tag('guid', $Link));
    $Item->AddChild(new Tag('title', $Version['Title']));
    $Item->AddChild(new Tag('description', $Text));
    $Item->AddChild(new Tag('author', $Email));
    $Item->AddChild(new Tag('pubDate', Date('r', $Version['PublicDate'])));
    $Item->AddChild(new Tag('link', $Link));
    #-------------------------------------------------------------------------------
    $Channel->AddChild($Item);
    #-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
$Rss->AddChild($Channel);
示例#21
0
function RuCenter_Contract_Register($Settings, $PepsonID, $Person, $DomainZone)
{
    /****************************************************************************/
    $__args_types = array('array', 'string', 'array', 'string');
    #-----------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /****************************************************************************/
    $HTTP = array('Address' => $Settings['Address'], 'Port' => $Settings['Port'], 'Host' => $Settings['Address'], 'Protocol' => $Settings['Protocol'], 'Charset' => 'KOI8-R', 'IsLogging' => $Settings['Params']['IsLogging']);
    #-----------------------------------------------------------------------------
    $Query = array();
    #---------------------------------------------------------------------------
    $RequestID = UniqID('ID');
    #---------------------------------------------------------------------------
    $Query[] = 'lang: ru';
    $Query[] = 'request: contract';
    $Query[] = 'operation: create';
    $Query[] = SPrintF('login: %s', $Settings['Login']);
    $Query[] = SPrintF('password: %s', $Settings['Password']);
    $Query[] = SPrintF('request-id: %s', $RequestID);
    #---------------------------------------------------------------------------
    $Query[] = '';
    #---------------------------------------------------------------------------
    $Query[] = '[contract]';
    $Query[] = SPrintF('password: %s', UniqID());
    $Query[] = SPrintF('tech-password: %s', UniqID());
    $Query[] = 'currency-id: RUR';
    #---------------------------------------------------------------------------
    $Query[] = '';
    #---------------------------------------------------------------------------
    switch ($PepsonID) {
        case 'Natural':
            #-----------------------------------------------------------------------
            $Query[] = 'contract-type: PRS';
            $Query[] = SPrintF('person: %s %s %s', Translit($Person['Name']), Mb_SubStr(Translit($Person['Lastname']), 0, 1), Translit($Person['Sourname']));
            $Query[] = SPrintF('person-r: %s %s %s', $Person['Sourname'], $Person['Name'], $Person['Lastname']);
            $Query[] = SPrintF('country: %s', isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry']);
            $Query[] = SPrintF('phone: %s', $Person['Phone']);
            $Query[] = SPrintF('fax-no: %s', $Person['Fax']);
            $Query[] = SPrintF('birth-date: %s', $Person['BornDate']);
            $Query[] = SPrintF('passport: %s %s выдан %s, %s', $Person['PasportLine'], $Person['PasportNum'], $Person['PasportWhom'], $Person['PasportDate']);
            $Query[] = SPrintF('p-addr: %s, %s, %s, %s %s, %s', $Person['pIndex'], $Person['pState'], $Person['pCity'], $Person['pType'], $Person['pAddress'], $Person['pRecipient']);
            $Query[] = SPrintF('e-mail: %s', $Person['Email']);
            break;
        case 'Juridical':
            #-----------------------------------------------------------------------
            $Query[] = 'client-type: ORG';
            $Query[] = SPrintF('org: %s %s', Translit($Person['CompanyName']), Translit($Person['CompanyFormFull']));
            $Query[] = SPrintF('org-r: %s', SPrintF('%s "%s"', $Person['CompanyFormFull'], $Person['CompanyName']));
            $Query[] = SPrintF('country: %s', $Person['jCountry']);
            $Query[] = SPrintF('e-mail: %s', $Person['Email']);
            $Query[] = SPrintF('phone: %s', $Person['Phone']);
            $Query[] = SPrintF('fax-no: %s', $Person['Fax']);
            $Query[] = SPrintF('code: %s', $Person['Inn']);
            $Query[] = SPrintF('kpp: %s', $Person['Kpp']);
            $Query[] = SPrintF('address-r: %s, %s, %s, %s %s', $Person['jIndex'], $Person['jState'], $Person['jCity'], $Person['jType'], $Person['jAddress']);
            $Query[] = SPrintF('p-addr: %s, %s, %s, %s %s, %s "%s"', $Person['pIndex'], $Person['pState'], $Person['pCity'], $Person['pType'], $Person['pAddress'], $Person['CompanyFormFull'], $Person['CompanyName']);
            $Query[] = SPrintF('d-addr: %s, %s, %s, %s %s', $Person['jIndex'], $Person['jState'], $Person['jCity'], $Person['jType'], $Person['jAddress']);
            break;
        default:
            return new gException('WRONG_PROFILE_ID', 'Неверный идентификатор профиля');
    }
    #-----------------------------------------------------------------------------
    $Result = HTTP_Send('/dns/dealer', $HTTP, array(), array('SimpleRequest' => Implode("\n", $Query)));
    if (Is_Error($Result)) {
        return ERROR | @Trigger_Error('[RuCenter_Contract_Register]: не удалось выполнить запрос к серверу');
    }
    #-----------------------------------------------------------------------------
    if (Preg_Match('/HTTP\\/1.0\\s502/i', $Result['Heads'])) {
        return false;
    }
    #-----------------------------------------------------------------------------
    $Result = Trim($Result['Body']);
    #-----------------------------------------------------------------------------
    if (Preg_Match('/State:\\s([0-9]+)/', $Result, $CodeID)) {
        #---------------------------------------------------------------------------
        $CodeID = Next($CodeID);
        #---------------------------------------------------------------------------
        switch ($CodeID) {
            case '200':
                #-----------------------------------------------------------------------
                if (!Preg_Match('/nic-hdl:\\s([0-9]+\\/[A-Z\\-]+)/', $Result, $ContractID)) {
                    return new gException('LOGIN_NOT_FOUND', 'Неудалось получить номер договора');
                } else {
                    $ContractID = Next($ContractID);
                }
                break;
            case '500':
                return FALSE;
            default:
                return new gException('WRONG_ERROR', SPrintF('Неизвестный статус ошибки (%s)', $Result));
        }
    } else {
        return new gException('WRONG_ANSWER', $Result);
    }
    #-----------------------------------------------------------------------------
    # Делаем паузу перед запросом
    Sleep(10);
    #-----------------------------------------------------------------------------
    if (!In_Array($DomainZone, array('ru', 'su'))) {
        #---------------------------------------------------------------------------
        $Query = array();
        #---------------------------------------------------------------------------
        $RequestID = UniqID('ID');
        #---------------------------------------------------------------------------
        $Query[] = SPrintF('login: %s', $Settings['Login']);
        $Query[] = SPrintF('password: %s', $Settings['Password']);
        $Query[] = SPrintF('subject-contract: %s', $ContractID);
        $Query[] = 'request: contact';
        $Query[] = 'operation: create';
        $Query[] = 'lang: ru';
        $Query[] = SPrintF('request-id: %s', $RequestID);
        #---------------------------------------------------------------------------
        $Query[] = '';
        #---------------------------------------------------------------------------
        $Query[] = '[contact]';
        $Query[] = SPrintF('status:registrant');
        $Query[] = SPrintF('org:');
        $Query[] = SPrintF('name: %s, %s', Translit($Person['Name']), Translit($Person['Lastname']));
        $Query[] = SPrintF('country: %s', isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry']);
        $Query[] = SPrintF('region: %s', Translit($Person['pCity']));
        $Query[] = SPrintF('city: %s', Translit($Person['pCity']));
        $Query[] = SPrintF('street: %s', Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress'])));
        $Query[] = SPrintF('zipcode: %s', $Person['pIndex']);
        $Query[] = SPrintF('phone: %s', $Person['Phone']);
        $Query[] = SPrintF('fax: %s', $Person['Fax']);
        $Query[] = SPrintF('email: %s', $Person['Email']);
        #---------------------------------------------------------------------------
        $Result = HTTP_Send('/dns/dealer', $HTTP, array(), array('SimpleRequest' => Implode("\n", $Query)));
        if (Is_Error($Result)) {
            return ERROR | @Trigger_Error('[RuCenter_Contract_Register]: не удалось выполнить запрос к серверу');
        }
        #---------------------------------------------------------------------------
        if (Preg_Match('/HTTP\\/1.0\\s502/i', $Result['Heads'])) {
            return FALSE;
        }
        #---------------------------------------------------------------------------
        $Result = Trim($Result['Body']);
        #---------------------------------------------------------------------------
        if (Preg_Match('/State:\\s([0-9]+)/', $Result, $CodeID)) {
            #-------------------------------------------------------------------------
            $CodeID = Next($CodeID);
            #-------------------------------------------------------------------------
            switch ($CodeID) {
                case '200':
                    #-----------------------------------------------------------------------
                    if (!Preg_Match('/nic-hdl:([0-9A-Za-z\\-]+)/', $Result, $NicHDL)) {
                        return array('TicketID' => SPrintF('%s:%s', $ContractID, Next($NicHDL)));
                    }
                    #-----------------------------------------------------------------------
                    return new gException('LOGIN_NOT_FOUND', 'Неудалось получить номер договора');
                case '500':
                    return FALSE;
                default:
                    return new gException('WRONG_ERROR', SPrintF('Неизвестный статус ошибки (%s)', $Result));
            }
        } else {
            return new gException('WRONG_ANSWER', $Result);
        }
    }
    #-----------------------------------------------------------------------------
    return array('TicketID' => $ContractID);
}
示例#22
0
<?php

#-------------------------------------------------------------------------------
/** @author Великодный В.В. (Joonte Ltd.) */
/******************************************************************************/
/******************************************************************************/
$__args_list = array('Domain', 'Zone', 'Length', 'DomainZone');
/******************************************************************************/
eval(COMP_INIT);
/******************************************************************************/
/******************************************************************************/
#-------------------------------------------------------------------------------
if (Mb_StrLen($Domain) > $Length) {
    $Domain1 = SPrintF('%s...', Mb_SubStr($Domain, 0, $Length));
} else {
    $Domain1 = $Domain;
}
#-------------------------------------------------------------------------------
$A = new Tag('A', array('target' => 'blank', 'href' => SPrintF('http://%s.%s/', $Domain, $DomainZone), 'title' => 'Перейти на сайт'), $Domain1);
#-------------------------------------------------------------------------------
return $A;
#-------------------------------------------------------------------------------
示例#23
0
     #-------------------------------------------------------------------------------
     return $Comp;
     #-------------------------------------------------------------------------------
 #-------------------------------------------------------------------------------
 case 'array':
     #-------------------------------------------------------------------------------
     $Table[] = array('Платежная система', $PaymentSystem['Name']);
     #-------------------------------------------------------------------------------
     $Options = array();
     #-------------------------------------------------------------------------------
     foreach ($Contracts as $Contract) {
         #-------------------------------------------------------------------------------
         $Customer = $Contract['Customer'];
         #-------------------------------------------------------------------------------
         if (Mb_StrLen($Customer) > 20) {
             $Customer = SPrintF('%s...', Mb_SubStr($Customer, 0, 20));
         }
         #-------------------------------------------------------------------------------
         $Options[$Contract['ID']] = $Customer;
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     $Comp = Comp_Load('Form/Select', array('name' => 'ContractID', 'style' => 'width: 100%;'), $Options, $ContractID);
     if (Is_Error($Comp)) {
         return ERROR | @Trigger_Error(500);
     }
     #-------------------------------------------------------------------------------
     $Table[] = array('Базовый договор', $Comp);
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     $Count = DB_Count('BasketOwners', array('Where' => SPrintF('`ContractID` = %u', $Contract['ID'])));
示例#24
0
function Build_Query($Query = array(), $Params)
{
    #-------------------------------------------------------------------------------
    if (In_Array($Params['DomainZone'], array('ru', 'su', 'рф'))) {
        #-------------------------------------------------------------------------------
        switch ($Params['PersonID']) {
            case 'Natural':
                #-------------------------------------------------------------------------------
                $Query['person'] = SPrintF('%s %s %s', Translit($Params['Person']['Name']), Mb_SubStr(Translit($Params['Person']['Lastname']), 0, 1), Translit($Params['Person']['Sourname']));
                $Query['private_person'] = $Params['IsPrivateWhoIs'] ? '1' : '0';
                $Query['person_r'] = SPrintF('%s %s %s', $Params['Person']['Sourname'], $Params['Person']['Name'], $Params['Person']['Lastname']);
                $Query['passport'] = SPrintF('%s %s выдан %s %s', $Params['Person']['PasportLine'], $Params['Person']['PasportNum'], $Params['Person']['PasportWhom'], $Params['Person']['PasportDate']);
                $Query['residence'] = SPrintF('%s, %s, %s, %s %s', $Params['Person']['pIndex'], $Params['Person']['pState'], $Params['Person']['pCity'], $Params['Person']['pType'], $Params['Person']['pAddress']);
                $Query['birth_date'] = $Params['Person']['BornDate'];
                $Query['country'] = isset($Params['Person']['PasportCountry']) ? $Params['Person']['PasportCountry'] : $Params['Person']['pCountry'];
                $Query['p_addr'] = SPrintF('%s, %s, %s, %s %s, %s', $Params['Person']['pIndex'], $Params['Person']['pState'], $Params['Person']['pCity'], $Params['Person']['pType'], $Params['Person']['pAddress'], $Params['Person']['pRecipient']);
                $Query['phone'] = $Params['Person']['Phone'];
                $Query['cell_phone'] = Preg_Replace('/\\s+/', '', $Params['Person']['CellPhone']);
                $Query['fax'] = $Params['Person']['Fax'];
                $Query['e_mail'] = $Params['Person']['Email'];
                #-------------------------------------------------------------------------------
                break;
                #-------------------------------------------------------------------------------
            #-------------------------------------------------------------------------------
            case 'Juridical':
                #-------------------------------------------------------------------------------
                $Query['org'] = SPrintF('%s %s', Translit($Params['Person']['CompanyName']), Translit($Params['Person']['CompanyFormFull']));
                $Query['org_r'] = SPrintF('%s "%s"', $Params['Person']['CompanyFormFull'], $Params['Person']['CompanyName']);
                $Query['code'] = $Params['Person']['Inn'];
                $Query['kpp'] = $Params['Person']['Kpp'];
                $Query['country'] = $Params['Person']['jCountry'];
                $Query['address_r'] = SPrintF('%s, %s, %s, %s %s', $Params['Person']['jIndex'], $Params['Person']['pState'], $Params['Person']['jCity'], $Params['Person']['jType'], $Params['Person']['jAddress']);
                $Query['p_addr'] = SPrintF('%s, %s, %s, %s, %s %s, %s "%s"', $Params['Person']['pIndex'], $Params['Person']['pState'], $Params['Person']['pCountry'], $Params['Person']['pCity'], $Params['Person']['pType'], $Params['Person']['pAddress'], $Params['Person']['CompanyFormFull'], $Params['Person']['CompanyName']);
                $Query['phone'] = $Params['Person']['Phone'];
                $Query['cell_phone'] = Preg_Replace('/\\s+/', '', $Params['Person']['CellPhone']);
                $Query['fax'] = $Params['Person']['Fax'];
                $Query['e_mail'] = $Params['Person']['Email'];
                #-------------------------------------------------------------------------------
                if (In_Array($Params['DomainZone'], array('ru', 'su', 'рф'))) {
                    $Query['ogrn_org'] = $Params['Person']['Ogrn'];
                }
                #-------------------------------------------------------------------------------
                break;
                #-------------------------------------------------------------------------------
            #-------------------------------------------------------------------------------
            default:
                return new gException('WRONG_PROFILE_ID', 'Неверный идентификатор профиля');
        }
        #-------------------------------------------------------------------------------
    } elseif (In_Array($Params['DomainZone'], array('moscow', 'москва', 'by', 'tatar', 'дети'))) {
        #-------------------------------------------------------------------------------
        # Общие поля для организации и физ.лица
        $Phone = $Params['Person']['Phone'];
        #-------------------------------------------------------------------------------
        $Phone = Preg_Split('/\\s+/', $Phone);
        #-------------------------------------------------------------------------------
        $Phone = SPrintF('%s.%s%s', Current($Phone), Next($Phone), Next($Phone));
        #-------------------------------------------------------------------------------
        $Query['o_phone'] = $Phone;
        $Query['addr_lang'] = isset($Params['Person']['jCountry']) ? $Params['Person']['jCountry'] : (isset($Params['Person']['PasportCountry']) ? $Params['Person']['PasportCountry'] : $Params['Person']['pCountry']);
        $Query['o_email'] = $Params['Person']['Email'];
        $Query['addr_cc'] = $Query['addr_lang'];
        $Query['country'] = $Query['addr_lang'];
        $Query['descr'] = 'Для представительских функций';
        #-------------------------------------------------------------------------------
        switch ($Params['PersonID']) {
            case 'Natural':
                #-------------------------------------------------------------------------------
                $Query['person_r'] = SPrintF('%s %s %s', $Params['Person']['Sourname'], $Params['Person']['Name'], $Params['Person']['Lastname']);
                $Query['birth_date'] = $Params['Person']['BornDate'];
                $Query['passport'] = SPrintF('%s %s выдан %s %s', $Params['Person']['PasportLine'], $Params['Person']['PasportNum'], $Params['Person']['PasportWhom'], $Params['Person']['PasportDate']);
                $Query['addr_street'] = SPrintF('%s %s', $Params['Person']['pType'], $Params['Person']['pAddress']);
                $Query['addr_city'] = $Params['Person']['pCity'];
                $Query['addr_sp'] = $Params['Person']['pState'];
                $Query['addr_pc'] = $Params['Person']['pIndex'];
                #-------------------------------------------------------------------------------
                break;
                #-------------------------------------------------------------------------------
            #-------------------------------------------------------------------------------
            case 'Juridical':
                #-------------------------------------------------------------------------------
                #Контактные данные организации (только при регистрации домена на организацию!)
                $Query['company_name'] = SPrintF('%s %s', $Params['Person']['CompanyName'], $Params['Person']['CompanyFormFull']);
                $Query['company_tin'] = $Params['Person']['Inn'];
                $Query['addr_street'] = SPrintF('%s %s', $Params['Person']['pType'], $Params['Person']['pAddress']);
                $Query['addr_city'] = $Params['Person']['pCity'];
                $Query['addr_sp'] = $Params['Person']['pState'];
                $Query['addr_pc'] = $Params['Person']['pIndex'];
                #-------------------------------------------------------------------------------
                $Query['legal_lang'] = 'RU';
                $Query['legal_street'] = SPrintF('%s %s', $Params['Person']['jType'], $Params['Person']['jAddress']);
                $Query['legal_city'] = $Params['Person']['jCity'];
                $Query['legal_sp'] = $Params['Person']['jState'];
                $Query['legal_pc'] = $Params['Person']['jIndex'];
                #-------------------------------------------------------------------------------
                break;
                #-------------------------------------------------------------------------------
            #-------------------------------------------------------------------------------
            default:
                return new gException('WRONG_PERSON_TYPE_ID_2', 'Неверный идентификатор типа персоны');
        }
        #-------------------------------------------------------------------------------
    } else {
        #-------------------------------------------------------------------------------
        # для .kz - Местонахождение серверного оборудования... Москва, пл. Дзержинского, д. 2 =)
        $Query['street'] = 'ploschad Dzerzinskogo, dom 2';
        $Query['city'] = 'Moscow';
        $Query['sp'] = 'Moscow';
        #-------------------------------------------------------------------------------
        switch ($Params['PersonID']) {
            case 'Natural':
                #-------------------------------------------------------------------------------
                $Query['o_company'] = 'Private person';
                $Query['a_company'] = 'Private person';
                $Query['t_company'] = 'Private person';
                $Query['b_company'] = 'Private person';
                #-------------------------------------------------------------------------------
                $Query['o_country_code'] = $Params['Person']['pCountry'];
                $Query['a_country_code'] = $Params['Person']['pCountry'];
                $Query['t_country_code'] = $Params['Person']['pCountry'];
                $Query['b_country_code'] = $Params['Person']['pCountry'];
                #-------------------------------------------------------------------------------
                $Query['o_postcode'] = $Params['Person']['pIndex'];
                $Query['a_postcode'] = $Params['Person']['pIndex'];
                $Query['t_postcode'] = $Params['Person']['pIndex'];
                $Query['b_postcode'] = $Params['Person']['pIndex'];
                #-------------------------------------------------------------------------------
                $Query['o_first_name'] = Translit($Params['Person']['Name']);
                $Query['a_first_name'] = Translit($Params['Person']['Name']);
                $Query['t_first_name'] = Translit($Params['Person']['Name']);
                $Query['b_first_name'] = Translit($Params['Person']['Name']);
                #-------------------------------------------------------------------------------
                $Query['o_last_name'] = Translit($Params['Person']['Sourname']);
                $Query['a_last_name'] = Translit($Params['Person']['Sourname']);
                $Query['t_last_name'] = Translit($Params['Person']['Sourname']);
                $Query['b_last_name'] = Translit($Params['Person']['Sourname']);
                #-------------------------------------------------------------------------------
                $Query['o_email'] = $Params['Person']['Email'];
                $Query['a_email'] = $Params['Person']['Email'];
                $Query['t_email'] = $Params['Person']['Email'];
                $Query['b_email'] = $Params['Person']['Email'];
                #-------------------------------------------------------------------------------
                $Query['o_addr'] = Translit(SPrintF('%s %s', $Params['Person']['pType'], $Params['Person']['pAddress']));
                $Query['a_addr'] = Translit(SPrintF('%s %s', $Params['Person']['pType'], $Params['Person']['pAddress']));
                $Query['t_addr'] = Translit(SPrintF('%s %s', $Params['Person']['pType'], $Params['Person']['pAddress']));
                $Query['b_addr'] = Translit(SPrintF('%s %s', $Params['Person']['pType'], $Params['Person']['pAddress']));
                #-------------------------------------------------------------------------------
                $Query['o_city'] = Translit($Params['Person']['pCity']);
                $Query['a_city'] = Translit($Params['Person']['pCity']);
                $Query['t_city'] = Translit($Params['Person']['pCity']);
                $Query['b_city'] = Translit($Params['Person']['pCity']);
                #-------------------------------------------------------------------------------
                $Query['o_state'] = Translit($Params['Person']['pState']);
                $Query['a_state'] = Translit($Params['Person']['pState']);
                $Query['t_state'] = Translit($Params['Person']['pState']);
                $Query['b_state'] = Translit($Params['Person']['pState']);
                #-------------------------------------------------------------------------------
                break;
                #-------------------------------------------------------------------------------
            #-------------------------------------------------------------------------------
            case 'Juridical':
                #-------------------------------------------------------------------------------
                $Query['o_company'] = SPrintF('%s %s', Translit($Params['Person']['CompanyName']), Translit($Params['Person']['CompanyFormFull']));
                $Query['a_company'] = SPrintF('%s %s', Translit($Params['Person']['CompanyName']), Translit($Params['Person']['CompanyFormFull']));
                $Query['t_company'] = SPrintF('%s %s', Translit($Params['Person']['CompanyName']), Translit($Params['Person']['CompanyFormFull']));
                $Query['b_company'] = SPrintF('%s %s', Translit($Params['Person']['CompanyName']), Translit($Params['Person']['CompanyFormFull']));
                #-------------------------------------------------------------------------------
                $Query['o_country_code'] = $Params['Person']['jCountry'];
                $Query['a_country_code'] = $Params['Person']['jCountry'];
                $Query['t_country_code'] = $Params['Person']['jCountry'];
                $Query['b_country_code'] = $Params['Person']['jCountry'];
                #-------------------------------------------------------------------------------
                $Query['o_postcode'] = $Params['Person']['jIndex'];
                $Query['a_postcode'] = $Params['Person']['jIndex'];
                $Query['t_postcode'] = $Params['Person']['jIndex'];
                $Query['b_postcode'] = $Params['Person']['jIndex'];
                #-------------------------------------------------------------------------------
                $Query['o_first_name'] = Translit($Params['Person']['dName']);
                $Query['a_first_name'] = Translit($Params['Person']['dName']);
                $Query['t_first_name'] = Translit($Params['Person']['dName']);
                $Query['b_first_name'] = Translit($Params['Person']['dName']);
                #-------------------------------------------------------------------------------
                $Query['o_last_name'] = Translit($Params['Person']['dSourname']);
                $Query['a_last_name'] = Translit($Params['Person']['dSourname']);
                $Query['t_last_name'] = Translit($Params['Person']['dSourname']);
                $Query['b_last_name'] = Translit($Params['Person']['dSourname']);
                #-------------------------------------------------------------------------------
                $Query['o_email'] = $Params['Person']['Email'];
                $Query['a_email'] = $Params['Person']['Email'];
                $Query['t_email'] = $Params['Person']['Email'];
                $Query['b_email'] = $Params['Person']['Email'];
                #-------------------------------------------------------------------------------
                $Query['o_addr'] = Translit(SPrintF('%s %s', $Params['Person']['jType'], $Params['Person']['jAddress']));
                $Query['a_addr'] = Translit(SPrintF('%s %s', $Params['Person']['jType'], $Params['Person']['jAddress']));
                $Query['t_addr'] = Translit(SPrintF('%s %s', $Params['Person']['jType'], $Params['Person']['jAddress']));
                $Query['b_addr'] = Translit(SPrintF('%s %s', $Params['Person']['jType'], $Params['Person']['jAddress']));
                #-------------------------------------------------------------------------------
                $Query['o_city'] = Translit($Params['Person']['jCity']);
                $Query['a_city'] = Translit($Params['Person']['jCity']);
                $Query['t_city'] = Translit($Params['Person']['jCity']);
                $Query['b_city'] = Translit($Params['Person']['jCity']);
                #-------------------------------------------------------------------------------
                $Query['o_state'] = Translit($Params['Person']['jState']);
                $Query['a_state'] = Translit($Params['Person']['jState']);
                $Query['t_state'] = Translit($Params['Person']['jState']);
                $Query['b_state'] = Translit($Params['Person']['jState']);
                #-------------------------------------------------------------------------------
                break;
                #-------------------------------------------------------------------------------
            #-------------------------------------------------------------------------------
            default:
                return new gException('WRONG_PERSON_TYPE_ID', 'Неверный идентификатор типа персоны');
        }
        #-------------------------------------------------------------------------------
        #-------------------------------------------------------------------------------
        $Phone = $Params['Person']['Phone'];
        #-------------------------------------------------------------------------------
        if ($Phone) {
            #-------------------------------------------------------------------------------
            $Phone = Preg_Split('/\\s+/', $Phone);
            #-------------------------------------------------------------------------------
            $Phone = SPrintF('%s.%s%s', Current($Phone), Next($Phone), Next($Phone));
            #-------------------------------------------------------------------------------
            $Query['o_phone'] = $Phone;
            $Query['a_phone'] = $Phone;
            $Query['t_phone'] = $Phone;
            $Query['b_phone'] = $Phone;
            #-------------------------------------------------------------------------------
        } else {
            #-------------------------------------------------------------------------------
            $Query['o_phone'] = '';
            $Query['a_phone'] = '';
            $Query['t_phone'] = '';
            $Query['b_phone'] = '';
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
        #-------------------------------------------------------------------------------
        $Fax = $Params['Person']['Fax'];
        #-------------------------------------------------------------------------------
        if ($Fax) {
            #-------------------------------------------------------------------------------
            $Fax = Preg_Split('/\\s+/', $Fax);
            #-------------------------------------------------------------------------------
            $Fax = SPrintF('%s.%s%s', Current($Fax), Next($Fax), Next($Fax));
            #-------------------------------------------------------------------------------
            $Query['o_fax'] = $Fax;
            $Query['a_fax'] = $Fax;
            $Query['t_fax'] = $Fax;
            $Query['b_fax'] = $Fax;
            #-------------------------------------------------------------------------------
        } else {
            #-------------------------------------------------------------------------------
            $Query['o_fax'] = '';
            $Query['a_fax'] = '';
            $Query['t_fax'] = '';
            $Query['b_fax'] = '';
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    $Query['ns0'] = $Params['Ns1Name'];
    $Query['ns1'] = $Params['Ns2Name'];
    #-------------------------------------------------------------------------------
    if ($Params['Ns3Name']) {
        $Query['ns3'] = $Params['Ns3Name'];
    }
    #-------------------------------------------------------------------------------
    if ($Params['Ns4Name']) {
        $Query['ns4'] = $Params['Ns4Name'];
    }
    #-------------------------------------------------------------------------------
    if ($Params['Ns1IP'] && $Params['Ns2IP']) {
        #-------------------------------------------------------------------------------
        $Query['ns0ip'] = $Params['Ns1IP'];
        $Query['ns1ip'] = $Params['Ns2IP'];
    }
    #-------------------------------------------------------------------------------
    if ($Params['Ns3IP']) {
        $Query['ns3ip'] = $Params['Ns3IP'];
    }
    #-------------------------------------------------------------------------------
    if ($Params['Ns4IP']) {
        $Query['ns4ip'] = $Params['Ns4IP'];
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    if ($Params['DomainZone'] == 'aero') {
        $Query['aerodata'] = SPrintF('%s.%s', $Params['DomainName'], $Params['DomainZone']);
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    return $Query;
    #-------------------------------------------------------------------------------
}