#------------------------------------------------------------------------------- $Links =& Links(); # Коллекция ссылок $Links['DOM'] =& $DOM; #------------------------------------------------------------------------------- if (Is_Error($DOM->Load('Base'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $DOM->AddAttribs('MenuLeft', array('args' => 'User/Services')); #------------------------------------------------------------------------------- $DOM->AddText('Title', 'Услуги → Лицензии ISPsystem → Мои тарифы'); #------------------------------------------------------------------------------- $NoBody = new Tag('NOBODY'); #------------------------------------------------------------------------------- $UniqID = UniqID('ISPswSchemes'); #------------------------------------------------------------------------------- $Comp = Comp_Load('Services/Schemes', 'ISPswSchemes', $GLOBALS['__USER']['ID'], array('Name'), $UniqID); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Comp = Comp_Load('Tables/Super', 'ISPswSchemes[User]', array('Source' => array('TableID' => $UniqID))); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $NoBody->AddChild($Comp); #------------------------------------------------------------------------------- $Comp = Comp_Load('Tab', 'User/ISPsw', $NoBody); if (Is_Error($Comp)) {
#------------------------------------------------------------------------------- $StatusID = 'Payed'; #------------------------------------------------------------------------------- $Comment = 'Оплачен (выполнена финансовая транзакция или заказ оплачен в электронной платёжной системе)'; #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- case 'canceled': #------------------------------------------------------------------------------- $StatusID = 'Rejected'; #------------------------------------------------------------------------------- $Comment = 'Отменён (выполнена транзакция разблокировки средств или выполнена операция по возврату платежа после списания средств)'; #------------------------------------------------------------------------------- #----------------------------------TRANSACTION---------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('Merchant/Uniteller')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # ставим счёт как неоплаченный # плохая идея. появляется кнопка про оплату, а оплатить нельзя - юнителлер не даёт #$IsUpdate = DB_Update('Invoices',Array('IsPosted'=>FALSE),Array('ID'=>$Invoice['ID'])); #if(Is_Error($IsUpdate)) # return ERROR | @Trigger_Error(500); #------------------------------------------------------------------------------- # вычитаем сумму счёта из договора, на который счёт. $Contract = DB_Select('ContractsOwners', 'Balance', array('UNIQ', 'ID' => $Invoice['ContractID'])); switch (ValueOf($Contract)) { case 'error': return ERROR | @Trigger_Error(500);
/** * Формирует объект * * Сформировывает объект класса DOM и подготавливает к выводу в браузер. После * вызова этой функции переменная, куда записывался результат выполнения функции * выводится с помощью оператора echo. * * @param boolean <необходимость преобразования в XML строку> */ public function Build($IsToXML = TRUE) { #----------------------------------------------------------------------------- if ($this->TemplateID) { #--------------------------------------------------------------------------- $Trigger = SPrintF('Triggers/DOM/After/%s', $this->TemplateID); #--------------------------------------------------------------------------- if (!Is_Error(System_Element(SPrintF('comp/%s.comp.php', $Trigger)))) { #------------------------------------------------------------------------- $LinkID = UniqID('DOM-'); #------------------------------------------------------------------------- $Links =& Links(); # Коллекция ссылок $Links[$LinkID] =& $this; #------------------------------------------------------------------------- if (Is_Error(Comp_Load($Trigger, $LinkID, COMP_ALL_HOSTS))) { return ERROR | @Trigger_Error('[DOM->Build]: ошибка загрузки предобработчика'); } #------------------------------------------------------------------------- unset($Links[$LinkID]); } } #----------------------------------------------------------------------------- # Номализация документа $this->Normalize(); #----------------------------------------------------------------------------- $this->Apply('Sources'); #----------------------------------------------------------------------------- if ($IsToXML) { #--------------------------------------------------------------------------- $Result = $this->Object->ToXMLString(); if (Is_Error($Result)) { return ERROR | Trigger_Error('[DOM->Build]: не удалось преобразовать DOM в строку'); } #--------------------------------------------------------------------------- return SPrintF("<!-- Joonte Billing System http://www.joonte.com -->\n%s", $Result); } #----------------------------------------------------------------------------- return TRUE; }
#------------------------------------------------------------------------- $Group = DB_Select('Groups', 'ID', array('UNIQ', 'Where' => "`IsDefault` = 'yes'")); #------------------------------------------------------------------------- switch (ValueOf($Group)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': $IUser['GroupID'] = $Group['ID']; break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('Import')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------- $UserID = DB_Insert('Users', $IUser); if (Is_Error($UserID)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------- $Contracts = $User['Contracts']; #------------------------------------------------------------------------- $Contracts = Is_Array($Contracts) ? $Contracts : array(); #------------------------------------------------------------------------- foreach ($Contracts as $Contract) { #----------------------------------------------------------------------- $TypeID = $Contract['TypeID'];
/******************************************************************************/ /******************************************************************************/ $Where = SPrintF("`StatusID` = 'Waiting' AND `StatusDate` < UNIX_TIMESTAMP( ) - %d *86400", $Params['Invoices']['DaysBeforeDeleted']); #------------------------------------------------------------------------------- $Invoices = DB_Select('InvoicesOwners', array('ID', 'UserID'), array('SortOn' => 'CreateDate', 'IsDesc' => TRUE, 'Where' => $Where)); switch (ValueOf($Invoices)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return TRUE; case 'array': #--------------------------------------------------------------------------- foreach ($Invoices as $Invoice) { Debug(SPrintF("[Tasks/GC/SetDeletedWaitingInvoice]: Отмена счёта #%d.", $Invoice['ID'])); #----------------------------------TRANSACTION---------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('comp/Tasks/GC/SetDeletedWaitingInvoice')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------- $Comp = Comp_Load('www/API/StatusSet', array('ModeID' => 'Invoices', 'StatusID' => 'Rejected', 'RowsIDs' => $Invoice['ID'], 'Comment' => SPrintF('Автоматическая отмена счёта, неоплачен более %d дней', $Params['Invoices']['DaysBeforeDeleted']))); #------------------------------------------------------------------------- switch (ValueOf($Comp)) { case 'array': $Event = array('UserID' => $Invoice['UserID'], 'PriorityID' => 'Billing', 'Text' => SPrintF('Автоматическая отмена счёта #%d, неоплачен более %d дней', $Invoice['ID'], $Params['Invoices']['DaysBeforeDeleted'])); $Event = Comp_Load('Events/EventInsert', $Event); if (!$Event) { return ERROR | @Trigger_Error(500); } break; default: return ERROR | @Trigger_Error(500);
$UserID = 1; } #------------------------------------------------------------------------------- $User = DB_Select('Users', array('ID', 'GroupID', 'Email', 'Name'), array('UNIQ', 'ID' => $UserID)); #------------------------------------------------------------------------------- switch (ValueOf($User)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': #--------------------------------------------------------------------------- $NoBody = new Tag('NOBODY'); #--------------------------------------------------------------------------- if (Is_Null($UniqID)) { $UniqID = UniqID('ID'); } #--------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('name' => $UniqID, 'onfocus' => "value='';", 'onclick' => SPrintF("AutoComplite(this,GetPosition(this),'/Administrator/AutoComplite/UserID',function(Text,Value){form.%s.value = Text;form.%s.value = Value;});", $UniqID, $Name), 'type' => 'text', 'value' => SPrintF('%s (%s)', $User['Email'], $User['Name']), 'prompt' => $Prompt ? $Prompt : 'Для поиска пользователя введите первые буквы его имени или email адреса', 'style' => 'width:100%')); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------------- if ($IsDisabled) { $Comp->AddAttribs(array('disabled' => TRUE)); } #--------------------------------------------------------------------------- if ($User['GroupID'] != 4000000) { $Comp->AddAttribs(array('value' => SPrintF('%s (%s)', $User['Email'], $User['Name']))); } #---------------------------------------------------------------------------
$Theme = (string) @$Args['Theme']; $Message = (string) @$Args['Message']; #------------------------------------------------------------------------------- if (Is_Error(System_Load('modules/Authorisation.mod', 'libs/Upload.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- if (!$Theme) { return new gException('THEME_IS_EMPTY', 'Введите тему обсуждения'); } #------------------------------------------------------------------------------- if (!$Message) { return new gException('MESSAGE_IS_EMPTY', 'Введите сообщение'); } #------------------------------------------------------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('EdeskEdit')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #------------------------------------------------------------------------------- $IEdesk = array('UserID' => $__USER['ID'], 'TargetGroupID' => 1, 'TargetUserID' => 1, 'PriorityID' => 'Low', 'Theme' => $Theme, 'UpdateDate' => Time()); #------------------------------------------------------------------------------- $EdeskID = DB_Insert('Edesks', $IEdesk); if (Is_Error($EdeskID)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Comp = Comp_Load('www/API/StatusSet', array('ModeID' => 'Edesks', 'StatusID' => 'Opened', 'RowsIDs' => $EdeskID)); #------------------------------------------------------------------------------- switch (ValueOf($Comp)) {
eval(COMP_INIT); #******************************************************************************# #******************************************************************************# if (!Count($Options)) { return ERROR | @Trigger_Error('[comp/Form/Select]: параметр вариантов оказался пустым'); } #------------------------------------------------------------------------------- $Select = new Tag('SELECT'); #------------------------------------------------------------------------------- if (isset($Attribs['prompt'])) { #----------------------------------------------------------------------------- $Prompt = $Attribs['prompt']; #----------------------------------------------------------------------------- unset($Attribs['prompt']); #----------------------------------------------------------------------------- $LinkID = UniqID('Select'); #----------------------------------------------------------------------------- $Links =& Links(); #----------------------------------------------------------------------------- $Links[$LinkID] =& $Select; #----------------------------------------------------------------------------- $Comp = Comp_Load('Form/Prompt', $LinkID, $Prompt); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- unset($Links[$LinkID]); } #------------------------------------------------------------------------------- $Select->AddAttribs($Attribs); #-------------------------------------------------------------------------------
# помечаем в локальной базе как свободные те которые уже больше 30 дней свободны (или 31?) #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # обновляем IP адреса заказов лицензий, у которых есть сслыка на elid $ISPswOrders = DB_Select('ISPswOrdersOwners', array('ID', 'OrderID', 'IP', 'LicenseID'), array('Where' => '`StatusID` = "Active"')); #------------------------------------------------------------------------------- switch (ValueOf($ISPswOrders)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': # No more... break; case 'array': #------------------------------------------------------------------------------- #----------------------------------TRANSACTION---------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('comp/Tasks/GC/ISPswCheckLicenses')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- foreach ($ISPswOrders as $ISPswOrder) { #------------------------------------------------------------------------------- if ($ISPswOrder['LicenseID']) { #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # выбираем данные лицензии на которую ссылается заказ $License = DB_Select('ISPswLicensesOwners', array('ID', 'IP', 'StatusID'), array('UNIQ', 'ID' => $ISPswOrder['LicenseID'])); #------------------------------------------------------------------------------- switch (ValueOf($License)) { case 'error': return ERROR | @Trigger_Error(500);
if (Is_Error($Count)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- if ($Count) { return new gException('PROMOCODE_ALREADY_EXTINGUISHED', 'Промокод уже был использован'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $ICode = array('PromoCodeID' => $PromoCode['ID'], 'UserID' => $GLOBALS['__USER']['ID'], 'CreateDate' => Time()); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $IBonus = array('UserID' => $GLOBALS['__USER']['ID'], 'ServiceID' => $PromoCode['ServiceID'], 'SchemeID' => $PromoCode['SchemeID'], 'SchemesGroupID' => $PromoCode['SchemesGroupID'], 'DaysReserved' => $PromoCode['DaysDiscont'], 'Discont' => $PromoCode['Discont'], 'Comment' => SPrintF('Активация промокода "%s"', $Code)); #------------------------------------------------------------------------------- #-------------------------------TRANSACTION------------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('PromoCodesExtinguished')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # фтыкаем в таблицу погашеных промокодов $IsInsert = DB_Insert('PromoCodesExtinguished', $ICode); if (Is_Error($IsInsert)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # втыкаем бонусы в таблицу бонусов $IsInsert = DB_Insert('Bonuses', $IBonus); if (Is_Error($IsInsert)) { return ERROR | @Trigger_Error(500);
} #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (!$Source) { return new gException('NO_SOURCE', 'Не указана исходная платёжная система'); } #------------------------------------------------------------------------------- if (!$Destination) { return new gException('NO_DESTINATION', 'Не указана система оплаты'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $UCollation = array('IsActive' => $IsActive, 'Source' => $Source, 'Destination' => $Destination, 'Image' => $Image, 'Prompt' => $Prompt, 'Description' => $Description, 'AdminNotice' => $AdminNotice, 'SortID' => $SortID); #------------------------------------------------------------------------------- #-----------------------------TRANSACTION--------------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('CollationEdit')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Answer = array('Status' => 'Ok'); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if ($CollationID) { #------------------------------------------------------------------------------- $IsUpdate = DB_Update('PaymentSystemsCollation', $UCollation, array('ID' => $CollationID)); if (Is_Error($IsUpdate)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } else {
/******************************************************************************/ $__args_list = array('Invoice'); /******************************************************************************/ eval(COMP_INIT); /******************************************************************************/ /******************************************************************************/ if ($Invoice['IsPosted']) { #------------------------------------------------------------------------------- Debug(SprintF('[comp/Triggers/Statuses/Invoices/Payed]: IsPosted = TRUE')); #------------------------------------------------------------------------------- return TRUE; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #----------------------------------TRANSACTION---------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('comp/Triggers/Statuses/Invoices/Payed')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Number = Comp_Load('Formats/Invoice/Number', $Invoice['ID']); if (Is_Error($Number)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $IsUpdate = Comp_Load('www/Administrator/API/PostingMake', array('ContractID' => $Invoice['ContractID'], 'Summ' => $Invoice['Summ'], 'ServiceID' => 1000, 'Comment' => SPrintF('по счёту №%s', $Number))); #------------------------------------------------------------------------------- switch (ValueOf($IsUpdate)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400);
function Report($Theme, $ReportID = '') { #------------------------------------------------------------------------------- if (File_Exists($File = SPrintF('%s/REPORTS', SYSTEM_PATH))) { #------------------------------------------------------------------------------- if (!$ReportID) { $ReportID = UniqID('ID'); } #------------------------------------------------------------------------------- $Emails = @File_Get_Contents($File); #------------------------------------------------------------------------------- if ($Emails) { foreach (Explode("\n", $Emails) as $Email) { if ($Email) { @Mail(Trim($Email), $ReportID, Implode("\n", $GLOBALS['__SYSLOG']), "MIME-Version: 1.0\r\nContent-type: text/plain; charset=UTF-8\r\n"); } } } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- }
case 'array': #--------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #--------------------------------------------------------------------------- $IsPermission = Permission_Check('ContractRead', (int) $__USER['ID'], (int) $Contract['UserID']); #--------------------------------------------------------------------------- switch (ValueOf($IsPermission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': #-----------------------------TRANSACTION------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('ContractEnclosureMake')))) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------- $IContractEnclosure = array('ContractID' => $Contract['ID'], 'TypeID' => $TypeID); #----------------------------------------------------------------------- $ContractEnclosureID = DB_Insert('ContractsEnclosures', $IContractEnclosure); if (Is_Error($ContractEnclosureID)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------- $Comp = Comp_Load('Contracts/Enclosures/Build', $ContractEnclosureID); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #-----------------------------------------------------------------------
return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- foreach ($DomainOrders as $DomainOrder) { #------------------------------------------------------------------------------- if (!($DomainOrder['StatusID'] == 'ForTransfer' || $DomainOrder['StatusID'] == 'OnTransfer' && In_Array($DomainOrder['Name'], array('ru', 'su', 'рф')))) { #------------------------------------------------------------------------------- Debug(SPrintF("[Tasks/GC/DeleteDomainForTransfer]: Домен не попал в условие: '%s.%s', статус: '%s'", $DomainOrder['DomainName'], $DomainOrder['Name'], $DomainOrder['StatusID'])); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- Debug(SPrintF("[Tasks/GC/DeleteDomainForTransfer]: Удаление домена '%s.%s', статус '%s'", $DomainOrder['DomainName'], $DomainOrder['Name'], $DomainOrder['StatusID'])); #----------------------------------TRANSACTION---------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('comp/Tasks/GC/DeleteDomainForTransfer')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Comp = Comp_Load('www/API/StatusSet', array('ModeID' => 'DomainOrders', 'StatusID' => 'Deleted', 'RowsIDs' => $DomainOrder['ID'], 'Comment' => SPrintF('Заказ домена не был перенесён к регистратору %s, более 180 дней', $DomainOrder['Params']['Name']))); #------------------------------------------------------------------------------- switch (ValueOf($Comp)) { case 'array': #------------------------------------------------------------------------------- $Event = array('UserID' => $DomainOrder['UserID'], 'PriorityID' => 'Hosting', 'Text' => SPrintF('Автоматическое удаление домена (%s.%s), находится в статусе "%s" более 180 дней', $DomainOrder['DomainName'], $DomainOrder['Name'], $DomainOrder['StatusID'])); $Event = Comp_Load('Events/EventInsert', $Event); #------------------------------------------------------------------------------- if (!$Event) { return ERROR | @Trigger_Error(500); } #-------------------------------------------------------------------------------
<?php #------------------------------------------------------------------------------- /** @author Alex Keda, for www.host-food.ru */ /******************************************************************************/ /******************************************************************************/ #------------------------------------------------------------------------------- #---------------------------TRANSACTION----------------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('Dedicated')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $CPUtype = array('Opteron' => 'AMD Opteron', 'Athlon' => 'AMD Athlon', 'Phenom' => 'AMD Phenom', 'Sempron' => 'AMD Sempron', 'Xeon' => 'Intel Xeon', 'Nehalem' => 'Intel Nehalem', 'PentiumD' => 'Pentium D', 'i5' => 'Intel Core i5', 'i3' => 'Intel Core i3', 'c2' => 'Intel Core 2 Duo', 'c4' => 'Intel Core 2 Quad', 'p4' => 'Intel Pentium IV', 'Celeron' => 'Intel Celeron', 'Atom' => 'Intel Atom', 'PIII' => 'Intel Pentium 3'); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Schemes = DB_Select('DSSchemes', '*'); #------------------------------------------------------------------------------- switch (ValueOf($Schemes)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': #------------------------------------------------------------------------------- $IsUpdate = FALSE; #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- case 'array': #------------------------------------------------------------------------------- $IsUpdate = TRUE;
#------------------------------------------------------------------------------- $Div = new Tag('DIV', array('style' => SPrintF('width: %upx', $Settings['WindowWidth']))); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $List = new Tag('UL', array('class' => 'pp-showcases')); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- foreach ($Collations as $Collation) { #------------------------------------------------------------------------------- $SRC = $Collation['Image'] ? $Collation['Image'] : 'Blank.png'; #------------------------------------------------------------------------------- $JS = SPrintF("var form = document.forms.InvoiceMakeForm; form.PaymentSystemID.value = '%s'; InvoiceMake();", $Collation['Source']); #------------------------------------------------------------------------------- $Image = new Tag('IMG', array('src' => SPrintF('SRC:{Images/PaymentSystems/%s}', $SRC), 'style' => 'cursor: pointer;', 'vspace' => 5, 'hspace' => 5, 'width' => $Settings['ImageWidth'], 'height' => $Settings['ImageHeight'], 'onclick' => $JS)); #------------------------------------------------------------------------------- $LinkID = UniqID('IMG'); #------------------------------------------------------------------------------- $Links[$LinkID] =& $Image; #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Prompt', $LinkID, $Collation['Prompt']); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- unset($Links[$LinkID]); #------------------------------------------------------------------------------- $Div1 = new Tag('DIV', $Image, new Tag('DIV', array('style' => 'margin:0 0 0 3px; width:145px; white-space:nowrap; overflow:hidden;'), $Collation['Description'])); #------------------------------------------------------------------------------- $List->AddChild(new Tag('LI', array('class' => 'pp-rounded-5px'), $Div1)); #------------------------------------------------------------------------------- }
<?php #------------------------------------------------------------------------------- /** @author Alex Keda, for www.host-food.ru */ /******************************************************************************/ /******************************************************************************/ $RS = array(); #------------------------------------------------------------------------------- #---------------------------TRANSACTION----------------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('Registrators')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $ServersGroups = DB_Select('ServersGroups', 'ID', array('Where' => '`ServiceID` = 20000')); #------------------------------------------------------------------------------- switch (ValueOf($ServersGroups)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': break; case 'array': #------------------------------------------------------------------------------- foreach ($ServersGroups as $ServersGroup) { #------------------------------------------------------------------------------- $IsDelete = DB_Delete('Servers', array('Where' => SPrintF('`ServersGroupID` = %u', $ServersGroup['ID']))); if (Is_Error($IsDelete)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $IsDelete = DB_Delete('ServersGroups', array('ID' => $ServersGroup['ID']));
#------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if ($ISPswOrder['SchemeID'] == $NewScheme['ID']) { return new gException('SCHEMES_MATCHED', 'Старый и новый тарифные планы совпадают'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (!$NewScheme['IsSchemeChangeable']) { return new gException('SCHEME_NOT_CHANGEABLE', 'Выбранный тариф не позволяет переход'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $ISPswOrderID = (int) $ISPswOrder['ID']; #------------------------------------------------------------------------------- #--------------------------TRANSACTION------------------------------------------ if (Is_Error(DB_Transaction($TransactionID = UniqID('ISPswOrderSchemeChange')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $IsAdd = Comp_Load('www/Administrator/API/TaskEdit', array('UserID' => $ISPswOrder['UserID'], 'TypeID' => 'ISPswSchemeChange', 'Params' => array($ISPswOrderID, $ISPswOrder['SchemeID']))); #------------------------------------------------------------------------------- switch (ValueOf($IsAdd)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); }
continue; } #--------------------------------------------------------------------- $Columns = array('MIN(`CreateDate`) as `CreateDate`', 'ContractID', 'Month', 'ServiceID', 'Comment', 'SUM(`Amount`) as `Amount`', 'Cost', 'Discont'); #--------------------------------------------------------------------- $WorksComplite = DB_Select('WorksComplite', $Columns, array('GroupBy' => array('ContractID', 'ServiceID', 'Comment', 'Cost', 'Discont'), 'Where' => SPrintF('`ContractID` = %u', $Contract['ID']))); #--------------------------------------------------------------------- switch (ValueOf($WorksComplite)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': # No more... break; case 'array': #---------------------------TRANSACTION--------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('WorksComplite')))) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------- $IsDelete = DB_Delete('WorksComplite', array('Where' => SPrintF('`ContractID` = %u', $Contract['ID']))); if (Is_Error($IsDelete)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------- foreach ($WorksComplite as $WorkComplite) { #--------------------------------------------------------------- $IsInsert = DB_Insert('WorksComplite', $WorkComplite); if (Is_Error($IsInsert)) { return ERROR | @Trigger_Error(500); } }
#------------------------------------------------------------------- # проверяем, это первая оплата или нет? если не первая, то минимальное число дней MinDaysProlong Debug(SPrintF('[comp/www/API/VPSOrderPay]: ранее оплачено за заказ %s', $VPSOrder['PayedSumm'])); if ($VPSOrder['PayedSumm'] > 0) { $MinDaysPay = $VPSScheme['MinDaysProlong']; } else { $MinDaysPay = $VPSScheme['MinDaysPay']; } #------------------------------------------------------------------- Debug(SPrintF('[comp/www/VPSOrderPay]: минимальное число дней %s', $MinDaysPay)); #------------------------------------------------------------------- if ($DaysPay < $MinDaysPay || $DaysPay > $VPSScheme['MaxDaysPay']) { return new gException('WRONG_DAYS_PAY', 'Неверное кол-во дней оплаты'); } #-------------------------TRANSACTION------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('VPSOrderPay')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------- #------------------------------------------------------------------- $Comp = Comp_Load('Services/Politics', $VPSOrder['UserID'], $VPSOrder['GroupID'], $VPSOrder['ServiceID'], $VPSScheme['ID'], $DaysPay, SPrintF('VPS/%s', $VPSOrder['Login'])); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------- #------------------------------------------------------------------- $VPSOrderID = (int) $VPSOrder['ID']; #------------------------------------------------------------------- $CostPay = 0.0; #------------------------------------------------------------------- $DaysRemainded = $DaysPay;
$Td = new Tag('TD', array('class' => 'Head', 'align' => 'center'), new Tag('SPAN', 'RAM'), new Tag('SPAN', array('style' => 'font-weight:bold;font-size:14px;'), '?')); #--------------------------------------------------------------------- $Links[$LinkID] =& $Td; #--------------------------------------------------------------------- $Comp = Comp_Load('Form/Prompt', $LinkID, 'Количество оперативной памяти'); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------- $Tr->AddChild($Td); #--------------------------------------------------------------------- unset($Links[$LinkID]); #--------------------------------------------------------------------- $Rows = array($Tr); #--------------------------------------------------------------------- $ServersGroupName = UniqID(); #--------------------------------------------------------------------- foreach ($VPSSchemes as $VPSScheme) { #------------------------------------------------------------------- if ($ServersGroupName != $VPSScheme['ServersGroupName']) { #----------------------------------------------------------------- $ServersGroupName = $VPSScheme['ServersGroupName']; #----------------------------------------------------------------- $Comp = Comp_Load('Formats/String', $VPSScheme['ServersGroupComment'], 75); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------- $Rows[] = new Tag('TR', new Tag('TD', array('colspan' => 8, 'class' => 'Separator'), new Tag('SPAN', array('style' => 'font-size:16px;'), SPrintF('%s |', $ServersGroupName)), new Tag('SPAN', array('style' => 'font-size:11px;'), $Comp))); } #-------------------------------------------------------------------
#------------------------------------------------------------------------------- $Count = DB_Count('OrdersOwners', array('Where' => $Where)); if (Is_Error($Count)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #Debug(SPrintF('[comp/Tasks/GC/ResetOrdersDays]: OrdersOwners Count = %s',$Count)); #------------------------------------------------------------------------------- if ($Count) { continue; } #------------------------------------------------------------------------------- Debug(SPrintF('[comp/Tasks/GC/ResetOrdersDays]: Изменено число оставшихся дней (%u->%u) для заказa OrderID = %s; юзер = %s', $OrderConsider['SumDaysRemainded'], $Settings['ResetDaysTo'], $OrderID, $UserID)); #------------------------------------------------------------------------------- #----------------------------------TRANSACTION---------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('ResetOrdersDays')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # удаляем весь учёт для заказа, где скидка 100% или цена 0 $IsDelete = DB_Delete('OrdersConsider', array('Where' => SPrintF('`OrderID` = %u', $OrderID))); if (Is_Error($IsDelete)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- # втыкаем новый учёт, на нужное число дней $IOrdersConsider = array('OrderID' => $OrderID, 'DaysReserved' => IntVal($Settings['ResetDaysTo']), 'Cost' => 0); #------------------------------------------------------------------------------- $OrdersConsiderID = DB_Insert('OrdersConsider', $IOrdersConsider); if (Is_Error($OrdersConsiderID)) {
$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); } #------------------------------------------------------------------------------- unset($Links[$LinkID]); #------------------------------------------------------------------------------- return $A; #-------------------------------------------------------------------------------
return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------- $Result[UniqID('ID')] = array('Text' => $Comp, 'Level' => 1, 'Paths' => array('^NULL$'), 'Href' => ''); } #--------------------------------------------------------------------- $Comp = Comp_Load('Formats/String', $Service['Item'], 40); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------- #------------------------------------------------------------------------- $Code = $Service['Code']; #--------------------------------------------------------------------- $Item = array('Text' => $Comp, 'Level' => 2, 'Paths' => array($Code != 'Default' ? SPrintF('\\/%s[a-zA-Z0-9]+', $Service['Code']) : SPrintF('\\/ServicesOrders\\?ServiceID=%u', $Service['ID'])), 'Href' => SPrintF('/%s', $Code != 'Default' ? SPrintF('%sOrders', $Code) : SPrintF('ServicesOrders?ServiceID=%s', $Service['ID']))); #--------------------------------------------------------------------- if (!$Service['IsActive']) { $Item['Attribs'] = array('style' => 'color:#969696;'); } #--------------------------------------------------------------------- $Result[UniqID('ID')] = $Item; } #----------------------------------------------------------------------- return $Result; default: return ERROR | @Trigger_Error(101); } default: return ERROR | @Trigger_Error(101); } #-------------------------------------------------------------------------------
# добавляем сервер к списку $Comp = Comp_Load('Form/Input', array('type' => 'checkbox', 'name' => 'Servers[]', 'id' => $Server['Address'], 'value' => $Server['ID'])); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- if (Is_Array($ExtraIPScheme['Params']['Servers'])) { if (In_Array($Server['ID'], $ExtraIPScheme['Params']['Servers'])) { $Comp->AddAttribs(array('checked' => 'yes')); } } #------------------------------------------------------------------------------- # отображаем примечание к серверу как подсказку, если оно есть if ($Server['AdminNotice']) { #------------------------------------------------------------------------------- $LinkID = UniqID('String'); #------------------------------------------------------------------------------- $Links =& Links(); #------------------------------------------------------------------------------- $Text = new Tag('DIV', $Server['Address']); #------------------------------------------------------------------------------- $Links[$LinkID] =& $Text; #------------------------------------------------------------------------------- $Comp1 = Comp_Load('Form/Prompt', $LinkID, $Server['AdminNotice']); if (Is_Error($Comp1)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- unset($Links[$LinkID]); #------------------------------------------------------------------------------- } else {
#------------------------------------------------------------------------------- /** @author Великодный В.В. (Joonte Ltd.) */ /******************************************************************************/ /******************************************************************************/ $__args_list = array('TableID', 'RowID', 'AdminNotice'); /******************************************************************************/ eval(COMP_INIT); /******************************************************************************/ /******************************************************************************/ $Img = new Tag('IMG', array('class' => 'Button', 'onclick' => SPrintF("ShowWindow('/Administrator/NoticeEdit',{TableID:'%s',RowID:%u});", $TableID, $RowID), 'alt' => 'Заметка', 'src' => SPrintF('SRC:{Images/Icons/%s}', $AdminNotice ? 'Notice2.gif' : 'Notice1.gif'), 'width' => 16, 'height' => 16)); #------------------------------------------------------------------------------- if (!$AdminNotice) { $AdminNotice = 'Добавить административную заметку'; } #----------------------------------------------------------------------------- $LinkID = UniqID('AdminNotice'); #----------------------------------------------------------------------------- $Links =& Links(); #----------------------------------------------------------------------------- $Links[$LinkID] =& $Img; #----------------------------------------------------------------------------- $Comp = Comp_Load('Form/Prompt', $LinkID, $AdminNotice); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- unset($Links[$LinkID]); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return $Img; #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (Is_Array($HostingServersGroups)) { #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $HS = array(); #------------------------------------------------------------------------------- #---------------------------TRANSACTION----------------------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('HostingServers')))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $iServersGroups = array(); #------------------------------------------------------------------------------- $ServersGroups = DB_Select('ServersGroups', 'ID', array('Where' => '`ServiceID` = 10000')); #------------------------------------------------------------------------------- switch (ValueOf($ServersGroups)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': break; case 'array': #-------------------------------------------------------------------------------
if (Is_Error($Contents)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------------- foreach ($Contents as $Content) { #------------------------------------------------------------------------- if (Preg_Match('/^statistics/', $Content)) { #----------------------------------------------------------------------- if (Is_Error(IO_RmDir(SPrintF('%s///%s', $Public, $Content)))) { return ERROR | @Trigger_Error(500); } } } } #----------------------------------------------------------------------------- $UniqID = UniqID('statistics'); #----------------------------------------------------------------------------- $Folder = SPrintF('%s/%s', $Public, $UniqID); #----------------------------------------------------------------------------- if (!File_Exists($Folder)) { #--------------------------------------------------------------------------- if (!@MkDir($Folder, 0777, TRUE)) { return ERROR | @Trigger_Error(500); } } #----------------------------------------------------------------------------- $HostsIDs = Array_Reverse($GLOBALS['HOST_CONF']['HostsIDs']); #----------------------------------------------------------------------------- foreach ($HostsIDs as $HostID) { #--------------------------------------------------------------------------- $Path = SPrintF('%s/hosts/%s/comp/Statistics', SYSTEM_PATH, $HostID);
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); }