/** * Generates a new instance of this form * @param Zend_Config options (Optional) Zend_Form Configuration options * @return void */ public function __construct($options = null) { parent::__construct($options); if (is_array($options) && count($options)) { $this->_defaults = Current($options); parent::__construct(array()); } else { parent::__construct($options); } $this->view = Zend_Registry::getInstance()->get('view'); $this->setName('Default_Form'); $this->setAction(''); $this->setDisableLoadDefaultDecorators(true); $this->clearDecorators(); $this->_fields = (object) array(); return $this; }
$DomainsOrders->AddChild($DomainOrder); } #----------------------------------------------------------------------------- $Contract->AddChild($DomainsOrders); #----------------------------------------------------------------------------- $Result = $Link->Query(SPrintF("SELECT SUM(`bonus`) as `Balance` FROM `partner` WHERE `userid` = %u", $dUser['ID'])); if (Is_Error($Result)) { return $Link->GetError(); } #----------------------------------------------------------------------------- $dBonuses = MySQL::Result($Result); if (Is_Error($dBonuses)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $dBonuse = Current($dBonuses); #----------------------------------------------------------------------------- $Contract->AddChild(new Tag('Balance', Round($Result['Balance'] * $Course))); #----------------------------------------------------------------------------- $Contracts->AddChild($Contract); #----------------------------------------------------------------------------- $User->AddChild($Contracts); #----------------------------------------------------------------------------- $Users->AddChild($User); } #------------------------------------------------------------------------------- $Dump = $Users->ToXMLString(); #------------------------------------------------------------------------------- $IsWrite = IO_Write('/work/ClientExec.xml.gz', GzEncode($Dump), TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500);
#------------------------------------------------------------------------------- $Orders = DB_Select('OrdersOwners', array('ID', 'UserID', 'StatusID'), array('Where' => $Where)); #------------------------------------------------------------------------------- switch (ValueOf($Orders)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Order = Current($Orders); #------------------------------------------------------------------------------- $UserID = $Order['UserID']; #------------------------------------------------------------------------------- # если сотрудник или исключение - ничего не делаем if (In_Array($UserID, $ExcludeIDs)) { continue; } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Array = array(); #------------------------------------------------------------------------------- foreach ($Orders as $Order) { #------------------------------------------------------------------------------- if ($Order['StatusID'] == 'Suspended') { #-------------------------------------------------------------------------------
} #------------------------------------------------------------------------------- $Session =& $Template['Session']; #------------------------------------------------------------------------------- if (isset($Session['PatternOutID'])) { $PatternOutID = $Session['PatternOutID']; } #------------------------------------------------------------------------------- $Args = Args(); #------------------------------------------------------------------------------- if (isset($Args['PatternOutID'])) { $PatternOutID = $Args['PatternOutID']; } #------------------------------------------------------------------------------- if (!isset($Patterns[$PatternOutID])) { $PatternOutID = Current(Array_Keys($Patterns)); } #------------------------------------------------------------------------------- $Session['PatternOutID'] = $PatternOutID; #------------------------------------------------------------------------------- $Where = $Patterns[$PatternOutID]['Where']; #------------------------------------------------------------------------------- if ($Where) { #----------------------------------------------------------------------------- $AddingWhere =& $Template['Source']['Adding']['Where']; #----------------------------------------------------------------------------- $AddingWhere[] = $Where; } #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Select', array('name' => 'PatternOutID', 'onchange' => 'TableSuperSetIndex();'), $Options, $PatternOutID); if (Is_Error($Comp)) {
function RuCenter_Domain_Register($Settings, $DomainName, $DomainZone, $Years, $Ns1Name, $Ns1IP, $Ns2Name, $Ns2IP, $Ns3Name, $Ns3IP, $Ns4Name, $Ns4IP, $IsPrivateWhoIs, $ContractID = '') { /****************************************************************************/ $__args_types = array('array', 'string', 'string', 'integer', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'string', 'boolean', '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']); #----------------------------------------------------------------------------- $Domain = SPrintF('%s.%s', $DomainName, $DomainZone); #----------------------------------------------------------------------------- $ContractItem = Explode(':', $ContractID); #----------------------------------------------------------------------------- $ContractID = Current($ContractItem); #----------------------------------------------------------------------------- $Query = array(); #----------------------------------------------------------------------------- $RequestID = UniqID('ID'); #----------------------------------------------------------------------------- $Query[] = 'lang: ru'; $Query[] = 'request: order'; $Query[] = 'operation: create'; $Query[] = SPrintF('login: %s', $Settings['Login']); $Query[] = SPrintF('password: %s', $Settings['Password']); $Query[] = SPrintF('subject-contract: %s', $ContractID); $Query[] = SPrintF('request-id: %s', $RequestID); #----------------------------------------------------------------------------- $Query[] = ''; #----------------------------------------------------------------------------- $Query[] = '[order-item]'; $Query[] = 'check-ns: off'; #----------------------------------------------------------------------------- switch ($DomainZone) { case 'ru': $Query[] = 'service: domain_ru'; $Query[] = 'template: client_ru'; break; case 'su': $Query[] = 'service: domain_su'; $Query[] = 'template: client_ru'; break; case 'рф': $Query[] = 'service: domain_rf'; $Query[] = 'template: domain_rf'; // Convert the domain $IDNAConverter = new IDNAConvert(); $Domain = $IDNAConverter->encode($Domain); break; case 'msk.ru': $Query[] = 'service: domain_msk_ru'; $Query[] = 'template: client_ru'; break; case 'msk.su': $Query[] = 'service: domain_msk_su'; $Query[] = 'template: client_ru'; break; case 'spb.ru': $Query[] = 'service: domain_spb_ru'; $Query[] = 'template: client_ru'; break; case 'spb.su': $Query[] = 'service: domain_spb_su'; $Query[] = 'template: client_ru'; break; default: #------------------------------------------------------------------------- if (Count($ContractItem) < 2) { #----------------------------------------------------------------------- $Query = array(); #----------------------------------------------------------------------- $RequestID = UniqID('ID'); #----------------------------------------------------------------------- $Query[] = 'lang: ru'; $Query[] = 'request: contract'; $Query[] = 'operation: get'; $Query[] = SPrintF('login: %s', $Settings['Login']); $Query[] = SPrintF('password: %s', $Settings['Password']); $Query[] = SPrintF('subject-contract: %s', $ContractID); $Query[] = SPrintF('request-id: %s', $RequestID); #----------------------------------------------------------------------- $Result = HTTP_Send('/dns/dealer', $HTTP, array(), array('SimpleRequest' => Implode("\n", $Query))); if (Is_Error($Result)) { return ERROR | @Trigger_Error('[RuCenter_Domain_Register]: не удалось выполнить запрос к серверу'); } #----------------------------------------------------------------------- if (Preg_Match('/HTTP\\/1.0\\s502/i', $Result['Heads'])) { return false; } #----------------------------------------------------------------------- $Result = Trim($Result['Body']); #----------------------------------------------------------------------- if (Preg_Match('/State:\\s([0-9]+)\\s/', $Result, $CodeID)) { #--------------------------------------------------------------------- $CodeID = Next($CodeID); #--------------------------------------------------------------------- switch ($CodeID) { case '200': #----------------------------------------------------------------- if (Preg_Match_All('/([a-z\\-])+\\:(.+)/', $Result, $Matches)) { #--------------------------------------------------------------- Debug(Print_R($Matches, 1)); #--------------------------------------------------------------- return new gException('NOT_SUPPORTED_YET', 'Пока не поддерживается'); } #----------------------------------------------------------------- break; case '500': return FALSE; default: return new gException('WRONG_ERROR', SPrintF('Неизвестный статус ошибки (%s)', $Result)); } } } else { $NicHDL = Next($ContractItem); } #------------------------------------------------------------------------- $Query[] = 'service: domain_rrp'; $Query[] = 'template: client_rrp'; $Query[] = SPrintF('period: %d', $Years); $Query[] = SPrintF('admin-c: %s', $NicHDL); $Query[] = SPrintF('bill-c: %s', $NicHDL); $Query[] = SPrintF('tech-c: %s', $NicHDL); $Query[] = 'lang-tag: RUS'; } #----------------------------------------------------------------------------- $Query[] = 'action: new'; $Query[] = SPrintF('domain: %s', $Domain); $Query[] = SPrintF('private-person: %s', $IsPrivateWhoIs ? 'ON' : 'OFF'); #----------------------------------------------------------------------------- if ($Ns1Name) { $Query[] = $Ns1IP ? SPrintF('nserver: %s %s', $Ns1Name, $Ns1IP) : SPrintF('nserver: %s', $Ns1Name); } #----------------------------------------------------------------------------- if ($Ns2Name) { $Query[] = $Ns2IP ? SPrintF('nserver: %s %s', $Ns2Name, $Ns2IP) : SPrintF('nserver: %s', $Ns2Name); } #----------------------------------------------------------------------------- if ($Ns3Name) { $Query[] = $Ns3IP ? SPrintF('nserver: %s %s', $Ns3Name, $Ns3IP) : SPrintF('nserver: %s', $Ns3Name); } #----------------------------------------------------------------------------- if ($Ns4Name) { $Query[] = $Ns4IP ? SPrintF('nserver: %s %s', $Ns4Name, $Ns4IP) : SPrintF('nserver: %s', $Ns4Name); } #----------------------------------------------------------------------------- $Query[] = 'type: CORPORATE'; #----------------------------------------------------------------------------- $Result = HTTP_Send('/dns/dealer', $HTTP, array(), array('SimpleRequest' => Implode("\n", $Query))); if (Is_Error($Result)) { return ERROR | @Trigger_Error('[RuCenter_Domain_Register]: не удалось выполнить запрос к серверу'); } #----------------------------------------------------------------------------- if (Preg_Match('/HTTP\\/1.0\\s502/i', $Result['Heads'])) { return false; } #----------------------------------------------------------------------------- $Result = Trim($Result['Body']); #----------------------------------------------------------------------------- if (Preg_Match('/State:\\s([0-9]+)\\s/', $Result, $CodeID)) { #--------------------------------------------------------------------------- $CodeID = Next($CodeID); #--------------------------------------------------------------------------- switch ($CodeID) { case '200': #----------------------------------------------------------------------- if (Preg_Match('/order_id:([0-9]+)/', $Result, $TicketID)) { return array('TicketID' => Next($TicketID)); } case '500': return FALSE; default: return new gException('WRONG_ERROR', SPrintF('Неизвестный статус ошибки (%s)', $Result)); } } #----------------------------------------------------------------------------- return new gException('WRONG_ANSWER', $Result); }
$Finded = array(); #----------------------------------------------------------------------------- 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;
$Script = new Tag('SCRIPT', array('type' => 'text/javascript', 'src' => 'SRC:{Js/Widget.js}')); #----------------------------------------------------------------------------- $DOM->AddChild('Head', $Script); } #------------------------------------------------------------------------------- $Table = new Tag('TABLE', array('id' => $WidgetID, 'class' => 'Widget', 'cellspacing' => 5, 'cellpadding' => 0)); #------------------------------------------------------------------------------- $lPosition = 0; $rPosition = 0; $IsOpened = TRUE; #------------------------------------------------------------------------------- if (isset($_COOKIE[$WidgetID])) { #----------------------------------------------------------------------------- $Settings = Explode(':', $_COOKIE[$WidgetID]); #----------------------------------------------------------------------------- $lPosition = (int) Current($Settings); $rPosition = (int) Next($Settings); #----------------------------------------------------------------------------- $IsOpened = (bool) Next($Settings); } #------------------------------------------------------------------------------- $Table->AddAttribs($lPosition && $rPosition ? array('style' => SPrintF('position:absolute;left:%u;top:%u;', $lPosition, $rPosition)) : array('style' => 'display:inline-table;')); #------------------------------------------------------------------------------- $Move = new Tag('IMG', array('class' => 'Button', 'alt' => 'Переместить', 'width' => 16, 'height' => 16, 'onmousedown' => SPrintF("WidgetInit(event,'%s');document.body.onmouseup = function(){ document.body.onmousemove = null;document.body.onmouseup = null;WidgetRender('%s'); };document.body.onmousemove = function(event){ WidgetMove(event,'%s'); };", $WidgetID, $WidgetID, $WidgetID), 'src' => 'SRC:{Images/Icons/WidgetMove.gif}')); #------------------------------------------------------------------------------- $Switch = new Tag('IMG', array('class' => 'Button', 'alt' => 'Показать (скрыть)', 'width' => 16, 'height' => 16, 'onclick' => SPrintF("WidgetSwitch('%s');", $WidgetID), 'src' => 'SRC:{Images/Icons/WidgetSwitch.gif}')); #------------------------------------------------------------------------------- $Dock = new Tag('IMG', array('class' => 'Button', 'alt' => 'Закрепить', 'width' => 16, 'height' => 16, 'onclick' => SPrintF("WidgetDock('%s');", $WidgetID), 'src' => 'SRC:{Images/Icons/WidgetDock.gif}')); #------------------------------------------------------------------------------- $Panel = new Tag('TR', array('height' => 16), new Tag('TD', array('width' => 16), $Move), new Tag('TD', $Title), new Tag('TD', array('width' => 16), $Switch), new Tag('TD', array('width' => 16, 'align' => 'right'), $Dock)); #-------------------------------------------------------------------------------
} #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- case 'Select': #------------------------------------------------------------------------------- $Options = Explode("\n", $ServiceField['Options']); #------------------------------------------------------------------------------- $Alternatives = array(); #------------------------------------------------------------------------------- foreach ($Options as $Option) { #------------------------------------------------------------------------------- $Option = Explode("=", $Option); #------------------------------------------------------------------------------- $Alternatives[] = Current($Option); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (!In_Array($Value, $Alternatives)) { return new gException('OPTION_NOT_EXISTS', SPrintF('Не верное значение (%s) поля (%s)', $Value, $ServiceField['Name'])); } #------------------------------------------------------------------------------- if ($ServiceField['IsKey']) { $Keys[] = $Value; } #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default:
$Attribs['pCity'] = $Attribs['City']; $Attribs['CityEn'] = Translit($Attribs['City']); #------------------------------------------------------------------------- $Attribs['jAddress'] = Trim(Preg_Replace('/(ул|пр)\\./iu', '', $Attribs['jAddress'])); $Attribs['pAddress'] = Trim(Preg_Replace('/(ул|пр)\\./iu', '', $Attribs['jAddress'])); $Attribs['AddressEn'] = Translit($Attribs['jAddress']); #------------------------------------------------------------------------- $Attribs['jIndex'] = $Attribs['PostIndex']; $Attribs['pIndex'] = $Attribs['PostIndex']; #------------------------------------------------------------------------- #------------------------------------------------------------------------- $CompanyName = $Attribs['CompanyName']; #------------------------------------------------------------------------- $CompanyName = Preg_Split('/\\s+/', $CompanyName); #------------------------------------------------------------------------- $Attribs['Form'] = Current($CompanyName); #------------------------------------------------------------------------- unset($CompanyName[0]); #------------------------------------------------------------------------- $CompanyName = Implode(' ', $CompanyName); #------------------------------------------------------------------------- if (Preg_Match('/(общество\\sс\\sограниченной\\sответственностью)\\s(.+)/ui', $CompanyName, $Matches)) { #----------------------------------------------------------------------- $Attribs['Form'] = 'ООО'; #----------------------------------------------------------------------- $CompanyName = $Matches[2]; #----------------------------------------------------------------------- } elseif (Preg_Match('/(закрытое\\sакционерное\\sобщество)\\s(.+)/ui', $CompanyName, $Matches)) { #----------------------------------------------------------------------- $Attribs['Form'] = 'ЗАО'; #-----------------------------------------------------------------------
#------------------------------------------------------------------------------- if (!isset($GLOBALS['TaskReturnInfo'][$Server['GroupName']])) { $GLOBALS['TaskReturnInfo'][$Server['GroupName']] = array(); } #------------------------------------------------------------------------------- $GLOBALS['TaskReturnInfo'][$Server['GroupName']][] = $Server['Address']; #------------------------------------------------------------------------------- if (StrLen($Server['Monitoring']) > 3) { #------------------------------------------------------------------------------- $Services = Preg_Split('/\\n+/', $Server['Monitoring']); #------------------------------------------------------------------------------- foreach ($Services as $Service) { #------------------------------------------------------------------------------- $Service = Explode('=', $Service); #------------------------------------------------------------------------------- $ServiceName = Current($Service); #------------------------------------------------------------------------------- $Port = IntVal(Next($Service)); #------------------------------------------------------------------------------- #Debug(SPrintF('[comp/Tasks/ServersUpTime]: connect to %s:%u',$Server['Address'],$Port)); #------------------------------------------------------------------------------- $Socket = @FsockOpen($Server['Address'], $Port, $nError, $sError, $Settings['SocketTimeout']); #------------------------------------------------------------------------------- if (!Is_Resource($Socket)) { #------------------------------------------------------------------------------- #Debug(SPrintF('[comp/Tasks/ServersUpTime]: cannot connect %s:%u with error: %s (%s)',$Server['Address'],$Port,$sError,$nError)); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $IPage = array('TestDate' => Time(), 'ServerID' => $Server['ID'], 'Service' => Trim($ServiceName), 'UpTime' => Is_Resource($Socket) ? 100 : 0, 'Day' => Date('d'), 'Month' => Date('m'), 'Year' => Date('Y')); #-------------------------------------------------------------------------------
return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return new gException('USER_MANAGMENT_DISABLED', 'Управление пользователем запрещено'); case 'true': Array_UnShift($UsersIDs, $UserID); break; default: return ERROR | @Trigger_Error(101); } } else { #----------------------------------------------------------------------- $Temp = $UsersIDs[$Index = Array_Search($UserID, $UsersIDs)]; #----------------------------------------------------------------------- $UsersIDs[$Index] = Current($UsersIDs); $UsersIDs[0] = $Temp; } break; default: return ERROR | @Trigger_Error(101); } } else { #----------------------------------------------------------------------------- $UserID = $Session->Data['RootID']; #----------------------------------------------------------------------------- $UsersIDs = array($UserID); } #------------------------------------------------------------------------------- if (!SetCookie(Md5($__USER['ID']), @$_SERVER['HTTP_REFERER'], Time() + 86400, '/')) { return ERROR | @Trigger_Error(500);
$XML = String_XML_Parse($Response['Body']); if (Is_Exception($XML)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $XML = $XML->ToArray('Valute'); #------------------------------------------------------------------------------- $Courses = (array) $XML['ValCurs']; #------------------------------------------------------------------------------- $Config = Config(); #------------------------------------------------------------------------------- $cPaymentSystems = $Config['Invoices']['PaymentSystems']; #------------------------------------------------------------------------------- $HostsIDs = $GLOBALS['HOST_CONF']['HostsIDs']; #------------------------------------------------------------------------------- $Config = System_XML('config/Config.xml', Current($HostsIDs)); if (Is_Error($Config)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- if (!isset($Config['Invoices'])) { $Config['Invoices'] = array(); } #------------------------------------------------------------------------------- $Invoices =& $Config['Invoices']; #------------------------------------------------------------------------------- if (!isset($Invoices['PaymentSystems'])) { $Invoices['PaymentSystems'] = array(); } #------------------------------------------------------------------------------- $PaymentSystems =& $Invoices['PaymentSystems'];
#------------------------------------------------------------------------- if (Count($Options)) { #----------------------------------------------------------------------- $Array = array(); #----------------------------------------------------------------------- foreach ($Options as $Option) { #--------------------------------------------------------------------- $Option = Explode("=", $Option); #--------------------------------------------------------------------- if (Count($Option) < 3) { $Option[] = 0; } #-------------------------------------------------------------------- Reset($Option); #--------------------------------------------------------------------- $Array[] = SPrintF('%s=%s=%01.2f', Trim(Current($Option)), Trim(Next($Option)), Trim(Next($Option))); } #----------------------------------------------------------------------- $Options = Implode("\n", $Array); #----------------------------------------------------------------------- $IsUpdate = DB_Update('ServicesFields', array('Options' => $Options), array('ID' => $ServiceField['ID'])); if (Is_Error($IsUpdate)) { return ERROR | @Trigger_Error(500); } } } break; default: return ERROR | @Trigger_Error(101); } #-------------------------------------------------------------------------------
function Config_Read($Array, $Path = array(), $Level = 1) { #------------------------------------------------------------------------------- # ASort added by lissyara for test purpose, 2014-01-16 in 15:22 MSK ASort($Array); #------------------------------------------------------------------------------- $TmpArray = array(); #------------------------------------------------------------------------------- $Names = array('Name', 'IsActive', 'IsEvent', 'Valute', 'Course', 'Measure', 'IsCourseUpdate', 'MinimumPayment', 'MaximumPayment'); #------------------------------------------------------------------------------- foreach ($Names as $Name) { #------------------------------------------------------------------------------- if (isset($Array[$Name])) { #------------------------------------------------------------------------------- $TmpArray[$Name] = $Array[$Name]; #------------------------------------------------------------------------------- unset($Array[$Name]); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Array = $TmpArray + $Array; #------------------------------------------------------------------------------- #----------------------------------------------------------------------------- static $Index = 1; #----------------------------------------------------------------------------- $Links =& Links(); #----------------------------------------------------------------------------- $ConfigNames =& $Links['ConfigNames']; #----------------------------------------------------------------------------- $Node = new Tag('DIV', array('class' => 'Node')); #----------------------------------------------------------------------------- foreach (Array_Keys($Array) as $ElementID) { #--------------------------------------------------------------------------- $Element = $Array[$ElementID]; #--------------------------------------------------------------------------- $ID = SPrintF('ID%06u', $Index++); #--------------------------------------------------------------------------- $StringPath = Implode('/', $CurrentPath = Array_Merge($Path, array($ElementID))); #--------------------------------------------------------------------------- if (isset($ConfigNames[$ElementID])) { #------------------------------------------------------------------------- $Item = Explode('|', $ConfigNames[$ElementID]); #------------------------------------------------------------------------- if (isset($ConfigNames[SPrintF('Prompt.%s', $ElementID)])) { $ElementPrompt = $ConfigNames[SPrintF('Prompt.%s', $ElementID)]; } #------------------------------------------------------------------------- } else { #------------------------------------------------------------------------- if (!isset($ConfigNames[$StringPath])) { continue; } #------------------------------------------------------------------------- $Item = Explode('|', $ConfigNames[$StringPath]); #------------------------------------------------------------------------- if (isset($ConfigNames[SPrintF('Prompt.%s', $StringPath)])) { $ElementPrompt = $ConfigNames[SPrintF('Prompt.%s', $StringPath)]; } #------------------------------------------------------------------------- } #--------------------------------------------------------------------------- $ElementName = Current($Item); #--------------------------------------------------------------------------- if (Count($Item) > 1) { #------------------------------------------------------------------------- $Type = Next($Item); #------------------------------------------------------------------------- switch ($Type) { case 'select': #--------------------------------------------------------------------- $Select = array(); #--------------------------------------------------------------------- $Options = Explode(',', Next($Item)); #--------------------------------------------------------------------- foreach ($Options as $Option) { #------------------------------------------------------------------- $Option = Explode('=', $Option); #------------------------------------------------------------------- $Select[Next($Option)] = Prev($Option); } #--------------------------------------------------------------------- $Comp = Comp_Load('Form/Select', array('onchange' => SPrintF("ConfigChange('%s',this.value);", $StringPath)), $Select, $Element); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } break; default: return ERROR | @Trigger_Error(101); } } else { $Comp = new Tag('SPAN', array('class' => 'NodeParam', 'onclick' => SPrintF("Value = prompt('Значение1:',this.innerHTML.XMLUnEscape());if(Value != null){ ConfigChange('%s',Value); this.innerHTML = Value; }", $StringPath)), Is_Array($Element) ? '[EMPTY]' : ($Element == '' ? '[EMPTY]' : $Element)); } #--------------------------------------------------------------------------- if (Is_Array($Element) && Count($Element)) { #------------------------------------------------------------------------- $Result = Config_Read($Element, $CurrentPath, $Level + 1); #------------------------------------------------------------------------- if ($Result) { #----------------------------------------------------------------------- $NodeName = new Tag('P', array('class' => 'NodeName'), new Tag('IMG', array('align' => 'left', 'src' => 'SRC:{Images/Icons/Node.gif}'))); #----------------------------------------------------------------------- $NodeName->AddChild(new Tag('A', array('href' => SPrintF("javascript:ConfigSwitch('%s');", $ID)), $ElementName)); #----------------------------------------------------------------------- $Node->AddChild($NodeName); #----------------------------------------------------------------------- $Node->AddChild(new Tag('DIV', array('id' => $ID, 'style' => 'display:none;'), $Result)); } } else { #----------------------------------------------------------------------- $Params = isset($ElementPrompt) ? array('onMouseOver' => SPrintF('PromptShow(event,\'%s\',this);', $ElementPrompt)) : array(); #----------------------------------------------------------------------- $Node->AddChild(new Tag('P', array('class' => 'NodeParam'), new Tag('SPAN', $Params, SPrintF('%s: ', $ElementName)), $Comp)); #----------------------------------------------------------------------- unset($ElementPrompt); #----------------------------------------------------------------------- } #----------------------------------------------------------------------- } #----------------------------------------------------------------------------- return Count($Node->Childs) ? $Node : FALSE; }
#------------------------------------------------------------------------------- if (In_Array('ByQuarter', $Details)) { #----------------------------------------------------------------------------- $VPSOrders = DB_Select(array('Orders', 'VPSOrders'), array('OrderID', 'COUNT(*) as `Count`', 'GET_QUARTER_FROM_TIMESTAMP(`OrderDate`) as `Quarter`', 'OrderDate', 'YEAR(FROM_UNIXTIME(`OrderDate`)) as Year'), array('Where' => '`VPSOrders`.`OrderID` = `Orders`.`ID` AND ' . $Where, 'GroupBy' => array('Quarter', 'Year'), 'SortOn' => 'OrderDate')); #----------------------------------------------------------------------------- switch (ValueOf($VPSOrders)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': # No more... break; case 'array': #-------------------------------------------------------------------------- $Table = array(array(new Tag('TD', array('class' => 'Head'), 'Квартал'), new Tag('TD', array('class' => 'Head'), 'Кол-во'))); #------------------------------------------------------------------------- $Order = Current($VPSOrders); $sQuarter = $Order['Quarter'] + $Order['Year'] * 4; #------------------------------------------------------------------------- $Order = End($VPSOrders); $eQuarter = $Order['Quarter'] + $Order['Year'] * 4; #------------------------------------------------------------------------- $Quarters = array(); #------------------------------------------------------------------------- foreach ($VPSOrders as $Order) { $Quarters[$Order['Quarter'] + $Order['Year'] * 4] = $Order; } #------------------------------------------------------------------------- $Labels = $Line = array(); #------------------------------------------------------------------------- $CurrentYear = 0; #-------------------------------------------------------------------------
case 'array': #------------------------------------------------------------------------------- switch ($ServiceField['TypeID']) { case 'Select': #------------------------------------------------------------------------------- $Options = Explode("\n", $ServiceField['Options']); #------------------------------------------------------------------------------- if (Count($Options)) { #------------------------------------------------------------------------------- $Alternatives = array(); #------------------------------------------------------------------------------- foreach ($Options as $Option) { #------------------------------------------------------------------------------- $Option = Explode("=", $Option); #------------------------------------------------------------------------------- $Alternatives[Current($Option)] = Next($Option); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (isset($Alternatives[$Value])) { $Value = $Alternatives[$Value]; } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Value = 'Список выбора поля'; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- break; #-------------------------------------------------------------------------------
function randomChar() { $letters = array(1 => "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"); $index = Key($letters); $element = Current($letters); $index = rand(1, 62); $random_letter = $letters[$index]; return $random_letter; }
} #--------------------------------------------------------------------------- $Replace = Array_ToLine($Replace, '%'); #--------------------------------------------------------------------------- foreach (Array_Keys($Replace) as $Key) { $Text = Str_Replace($Key, $Replace[$Key], $Text); } #--------------------------------------------------------------------------- if ($Clause['IsDOM']) { #------------------------------------------------------------------------- $DOM = String_XML_Parse($Text); if (Is_Exception($DOM)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------- $DOM = Current($DOM->Childs); } else { $DOM = new Tag('DIV', array('force-escape' => 'yes'), $Text); } #--------------------------------------------------------------------------- $Result['DOM'] = $DOM; #--------------------------------------------------------------------------- if ($IsEdit) { #------------------------------------------------------------------------- if (isset($GLOBALS['__USER'])) { #----------------------------------------------------------------------- $Permission = Permission_Check('ClauseEdit', (int) $GLOBALS['__USER']['ID'], (int) $Clause['AuthorID']); #----------------------------------------------------------------------- switch (ValueOf($Permission)) { case 'error': return ERROR | @Trigger_Error(500);
if ($Tidy) { $Text = $Tidy; } } #----------------------------------------------------------------------------- if ($IsDOM) { #--------------------------------------------------------------------------- $Text = SPrintF('<NOBODY>%s</NOBODY>', $Text); #--------------------------------------------------------------------------- $XML = String_XML_Parse($Text); #--------------------------------------------------------------------------- if (Is_Exception($XML)) { return $XML; } else { #------------------------------------------------------------------------- $XML = Current($XML->Childs); #------------------------------------------------------------------------- $XML->NamesToUpper(); #------------------------------------------------------------------------- $Text = $XML->ToXMLString(); } } } #------------------------------------------------------------------------------- $__USER = $GLOBALS['__USER']; #------------------------------------------------------------------------------- $Answer = array('Status' => 'Ok'); #------------------------------------------------------------------------------ #------------------------------------------------------------------------------- $Clause = array('GroupID' => $GroupID, 'PublicDate' => $PublicDate, 'Partition' => $Partition, 'Title' => $Title, 'IsXML' => $IsXML, 'IsDOM' => $IsDOM, 'IsPublish' => $IsPublish, 'Text' => $Text); #-------------------------------------------------------------------------------
return ERROR | @Trigger_Error(400); case 'array': #--------------------------------------------------------- if ($ServiceField['TypeID'] != 'Select') { continue; } #--------------------------------------------------------- $Options = Explode("\n", $ServiceField['Options']); #--------------------------------------------------------- if (Count($Options)) { #------------------------------------------------------- foreach ($Options as $Option) { #----------------------------------------------------- $Option = Explode("=", $Option); #----------------------------------------------------- if (Current($Option) == $Value) { $Cost += (double) End($Option); } } } break; default: return ERROR | @Trigger_Error(101); } } break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------- $CostPay = $Cost * $AmountPay;
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); }
function Started_Contract_Register($Settings, $PepsonID, $Person, $DomainZone) { /****************************************************************************/ $__args_types = array('array', 'string', 'array', 'string'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ $HTTP = array('Protocol' => $Settings['Protocol'], 'Port' => $Settings['Port'], 'Address' => $Settings['Address'], 'Host' => $Settings['Address'], 'IsLogging' => $Settings['Params']['IsLogging']); #----------------------------------------------------------------------------- $Reseller = new Tag('reseller'); $Reseller->AddChild(new Tag('login', $Settings['Login'])); $Reseller->AddChild(new Tag('password', $Settings['Password'])); #----------------------------------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $pCountry = isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry']; #----------------------------------------------------------------------------- $Path = SPrintF('%s/started/states[%s].json', $Tmp, $pCountry); #----------------------------------------------------------------------------- if (File_Exists($Path)) { #--------------------------------------------------------------------------- $States = IO_Read($Path); if (Is_Error($States)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------------- $States = JSON_Decode($States, TRUE); if (!$States) { return ERROR | @Trigger_Error(500); } } else { #--------------------------------------------------------------------------- $Request = new Tag('RequestBody', $Reseller); #--------------------------------------------------------------------------- $objCountry = new Tag('objCountry'); $objCountry->AddChild(new Tag('method', 'getRegions')); $objCountry->AddChild(new Tag('country', $pCountry)); #--------------------------------------------------------------------------- $Request->AddChild($objCountry); #--------------------------------------------------------------------------- $Post = SprintF("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n%s", $Request->ToXMLString()); #--------------------------------------------------------------------------- $Responce = HTTP_Send('/', $HTTP, array(), $Post, array('Content-type: text/xml')); if (Is_Error($Responce)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------------- $Response = Trim($Responce['Body']); #--------------------------------------------------------------------------- $Answer = String_XML_Parse($Response); if (Is_Exception($Answer)) { return new gException('WRONG_ANSWER', $Response, $Answer); } #--------------------------------------------------------------------------- $States = Current($States->ToArray('item')); #--------------------------------------------------------------------------- $IsWrite = IO_Write($Path, JSON_Encode($States), TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } } #----------------------------------------------------------------------------- $objUser = new Tag('objUser'); $objUser->AddChild(new Tag('method', 'create')); #----------------------------------------------------------------------------- $objUser->AddChild(new Tag('email', $Person['Email'])); $objUser->AddChild(new Tag('password', SubStr(Md5(UniqID()), -8))); #----------------------------------------------------------------------------- $IsRussian = In_Array(isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry'], array('RU', 'BY', 'UA')); #----------------------------------------------------------------------------- switch ($PepsonID) { case 'Natural': #------------------------------------------------------------------------- $pStateID = 0; #------------------------------------------------------------------------- $pState = $Person['pState']; #------------------------------------------------------------------------- foreach ($States as $State) { #----------------------------------------------------------------------- if (Preg_Match(SPrintF('/%s/', StrToLower($State['title'])), StrToLower($pState))) { #--------------------------------------------------------------------- $pStateID = $State['id']; #--------------------------------------------------------------------- Debug(SPrintF('Найдена область: %s', $pStateID)); #--------------------------------------------------------------------- break; } } #------------------------------------------------------------------------- if (!$pStateID) { #----------------------------------------------------------------------- Debug(SPrintF('Область не найдена, проверьте название области (%s)', $pState)); #----------------------------------------------------------------------- return new gException('POST_REGION_NOT_FOUND', 'Область почтового адреса не найдена'); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('type', 'person')); #------------------------------------------------------------------------- if ($IsRussian) { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('fname', $Person['Name'])); $objUser->AddChild(new Tag('lname', $Person['Lastname'])); $objUser->AddChild(new Tag('mname', $Person['Sourname'])); $objUser->AddChild(new Tag('doc_issued', $Person['PasportWhom'])); } else { $objUser->AddChild(new Tag('fname', Translit($Person['Name']))); $objUser->AddChild(new Tag('lname', Translit($Person['Lastname']))); $objUser->AddChild(new Tag('mname', Translit($Person['Sourname']))); $objUser->AddChild(new Tag('doc_issued', Translit($Person['PasportWhom']))); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('p_inn', '')); $objUser->AddChild(new Tag('doc_serial', $Person['PasportLine'])); $objUser->AddChild(new Tag('doc_number', $Person['PasportNum'])); $objUser->AddChild(new Tag('doc_date', $Person['PasportDate'])); $objUser->AddChild(new Tag('birth_date', $Person['BornDate'])); #------------------------------------------------------------------------- $objUser->AddChild(new Tag('country', StrToLower(isset($Person['PasportCountry']) ? $Person['PasportCountry'] : $Person['pCountry']))); #------------------------------------------------------------------------- $objUser->AddChild(new Tag('zip', $Person['pIndex'])); $objUser->AddChild(new Tag('state', $pStateID)); $objUser->AddChild(new Tag('city_type', 'city')); $objUser->AddChild(new Tag('addr_type', StrToLower($Person['pType']))); #------------------------------------------------------------------------- if ($IsRussian) { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('city', $Person['pCity'])); $objUser->AddChild(new Tag('addr', SPrintF('%s %s', $Person['pType'], $Person['pAddress']))); } else { $objUser->AddChild(new Tag('city', Translit($Person['pCity']))); $objUser->AddChild(new Tag('addr', Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress'])))); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('pzip', $Person['pIndex'])); $objUser->AddChild(new Tag('pstate', $pStateID)); $objUser->AddChild(new Tag('pcity_type', 'city')); $objUser->AddChild(new Tag('paddr_type', StrToLower($Person['pType']))); #------------------------------------------------------------------------- if ($IsRussian) { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('pcity', $Person['pCity'])); $objUser->AddChild(new Tag('paddr', SPrintF('%s %s', $Person['pType'], $Person['pAddress']))); $objUser->AddChild(new Tag('pto', $Person['pRecipient'])); } else { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('pcity', Translit($Person['pCity']))); $objUser->AddChild(new Tag('paddr', Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress'])))); $objUser->AddChild(new Tag('pto', Translit($Person['pRecipient']))); } break; case 'Juridical': #------------------------------------------------------------------------- $objUser->AddChild(new Tag('type', 'organization')); #------------------------------------------------------------------------- if ($IsRussian) { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('fname', $Person['dName'])); $objUser->AddChild(new Tag('lname', $Person['dLastname'])); $objUser->AddChild(new Tag('mname', $Person['dSourname'])); $objUser->AddChild(new Tag('org', SPrintF('%s "%s"', $Person['CompanyFormFull'], $Person['CompanyName']))); } else { $objUser->AddChild(new Tag('fname', Translit($Person['dName']))); $objUser->AddChild(new Tag('lname', Translit($Person['dLastname']))); $objUser->AddChild(new Tag('mname', Translit($Person['dSourname']))); $objUser->AddChild(new Tag('org', SPrintF('%s %s', Translit($Person['CompanyName']), Translit($Person['CompanyFormFull'])))); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('o_inn', $Person['Inn'])); $objUser->AddChild(new Tag('kpp', $Person['Kpp'])); #------------------------------------------------------------------------- $objUser->AddChild(new Tag('country', StrToLower($Person['jCountry']))); #------------------------------------------------------------------------- $objUser->AddChild(new Tag('zip', $Person['jIndex'])); #------------------------------------------------------------------------- $jStateID = 0; #------------------------------------------------------------------------- $jState = $Person['jState']; #------------------------------------------------------------------------- foreach ($States as $State) { #----------------------------------------------------------------------- if (Preg_Match(SPrintF('/%s/', StrToLower($State['title'])), StrToLower($jState))) { #--------------------------------------------------------------------- $jStateID = $State['id']; #--------------------------------------------------------------------- Debug(SPrintF('Найдена область: %s', $jStateID)); #--------------------------------------------------------------------- break; } } #------------------------------------------------------------------------- if (!$jStateID) { #----------------------------------------------------------------------- Debug(SPrintF('Область не найдена, проверьте название области (%s)', $jState)); #----------------------------------------------------------------------- return new gException('JURIDICAL_REGION_NOT_FOUND', 'Область юридического адреса не найдена'); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('state', $jStateID)); $objUser->AddChild(new Tag('city_type', 'city')); $objUser->AddChild(new Tag('addr_type', StrToLower($Person['jType']))); #------------------------------------------------------------------------- if ($IsRussian) { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('city', $Person['jCity'])); $objUser->AddChild(new Tag('addr', SPrintF('%s %s', $Person['jType'], $Person['jAddress']))); } else { $objUser->AddChild(new Tag('city', Translit($Person['jCity']))); $objUser->AddChild(new Tag('addr', Translit(SPrintF('%s %s', $Person['jType'], $Person['jAddress'])))); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('pzip', $Person['pIndex'])); #------------------------------------------------------------------------- $pStateID = 0; #------------------------------------------------------------------------- $pState = $Person['pState']; #------------------------------------------------------------------------- foreach ($States as $State) { #----------------------------------------------------------------------- if (Preg_Match(SPrintF('/%s/', StrToLower($State['title'])), StrToLower($pState))) { #--------------------------------------------------------------------- $pStateID = $State['id']; #--------------------------------------------------------------------- Debug(SPrintF('Найдена область: %s', $pStateID)); #--------------------------------------------------------------------- break; } } #------------------------------------------------------------------------- if (!$pStateID) { #----------------------------------------------------------------------- Debug(SPrintF('Область не найдена, проверьте название области (%s)', $pState)); #----------------------------------------------------------------------- return new gException('POST_REGION_NOT_FOUND', 'Область почтового адреса не найдена'); } #------------------------------------------------------------------------- $objUser->AddChild(new Tag('pstate', $pStateID)); $objUser->AddChild(new Tag('pcity_type', 'city')); $objUser->AddChild(new Tag('paddr_type', StrToLower($Person['pType']))); #------------------------------------------------------------------------- if ($IsRussian) { #----------------------------------------------------------------------- $objUser->AddChild(new Tag('pcity', $Person['pCity'])); $objUser->AddChild(new Tag('paddr', SPrintF('%s %s', $Person['pType'], $Person['pAddress']))); $objUser->AddChild(new Tag('pto', SPrintF('%s "%s"', $Person['CompanyFormFull'], $Person['CompanyName']))); } else { $objUser->AddChild(new Tag('pcity', Translit($Person['pCity']))); $objUser->AddChild(new Tag('paddr', Translit(SPrintF('%s %s', $Person['pType'], $Person['pAddress'])))); $objUser->AddChild(new Tag('pto', SPrintF('%s %s', Translit($Person['CompanyName']), Translit($Person['CompanyFormFull'])))); } break; default: return ERROR | @Trigger_Error(101); } #----------------------------------------------------------------------------- $Phone = $Person['Phone']; #----------------------------------------------------------------------------- if ($Phone) { #--------------------------------------------------------------------------- $Phone = StrPBrk($Phone, ' '); #--------------------------------------------------------------------------- $objUser->AddChild(new Tag('tel', Trim($Phone))); } else { $objUser->AddChild(new Tag('tel')); } #----------------------------------------------------------------------------- $Fax = $Person['Fax']; #----------------------------------------------------------------------------- if ($Fax) { #--------------------------------------------------------------------------- $Fax = StrPBrk($Fax, ' '); #--------------------------------------------------------------------------- $objUser->AddChild(new Tag('fax', Trim($Fax))); } else { $objUser->AddChild(new Tag('fax')); } #----------------------------------------------------------------------------- $Request = new Tag('RequestBody', $Reseller); #----------------------------------------------------------------------------- $Request->AddChild($objUser); #----------------------------------------------------------------------------- $Post = SprintF("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n%s", $Request->ToXMLString()); #----------------------------------------------------------------------------- $Responce = HTTP_Send('/', $HTTP, array(), $Post, array('Content-type: text/xml; charset=utf-8')); if (Is_Error($Responce)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $Response = Trim($Responce['Body']); #----------------------------------------------------------------------------- $Answer = String_XML_Parse($Response); if (Is_Exception($Answer)) { return new gException('WRONG_ANSWER', $Response, $Answer); } #----------------------------------------------------------------------------- $Answer = $Answer->ToArray(); #----------------------------------------------------------------------------- $Answer = $Answer['AnswerBody']; #----------------------------------------------------------------------------- if (isset($Answer['statusCode'])) { return new gException('REGISTRATOR_ERROR', SPrintF('[%s]=(%s)', $Answer['statusCode'], $Answer['statusMessage'])); } #----------------------------------------------------------------------------- return array('TicketID' => $Answer['user_id']); }
#------------------------------------------------------------------------------- $Lock = DB_Query(SPrintF("SELECT GET_LOCK('%s',10) as `IsLocked`", $LockID)); if (Is_Error($Lock)) { return ERROR | @Trigger_Error('[Demon]: не удалось установить блокировку'); } #------------------------------------------------------------------------------- $Rows = MySQL::Result($Lock); if (Is_Error($Rows)) { return ERROR | @Trigger_Error('[Demon]: не удалось получить данные из запроса'); } #------------------------------------------------------------------------------- if (Count($Rows) < 1) { return ERROR | @Trigger_Error('[Demon]: неверный результат запроса'); } #------------------------------------------------------------------------------- $Row = Current($Rows); #------------------------------------------------------------------------------- if (!$Row['IsLocked']) { return 'Cron already executing (can not set lock)...'; } #------------------------------------------------------------------------------- $Comp = Comp_Load('Users/Init', 100); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Config = Config(); #------------------------------------------------------------------------------- while (TRUE) { #------------------------------------------------------------------------------- for ($i = 1; $i <= $Config['Tasks']['PerIteration']; $i++) {
function Styles_Url($Element) { /****************************************************************************/ $__args_types = array('string'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ $HostsIDs = Styles_HostsIDs($Element); if (Is_Error($HostsIDs)) { return ERROR | @Trigger_Error('[Styles_Url]: список хостов содержащих элемент не найдены'); } #----------------------------------------------------------------------------- $HostID = Current($HostsIDs); #----------------------------------------------------------------------------- return SPrintF('%s://%s/styles/%s/%s', Url_Scheme(), @$_SERVER['HTTP_HOST'], $HostID, $Element); #return SPrintF('/styles/%s/%s',$HostID,$Element); }
#------------------------------------------------------------------------------- $Orders = DB_Select(SPrintF('%sOrdersOwners', $Server['Code']), array('ID', 'Login'), array('Where' => $Where)); #------------------------------------------------------------------------------- switch (ValueOf($Orders)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': # No more... break; case 'array': #------------------------------------------------------------------------------- foreach ($Orders as $Order) { #------------------------------------------------------------------------------- $Parked = $Users[$Order['Login']]; #------------------------------------------------------------------------------- $IsUpdate = DB_Update(SPrintF('%sOrders', $Server['Code']), array('Domain' => Count($Parked) ? Current($Parked) : 'not-found', 'Parked' => Implode(',', $Parked)), array('ID' => $Order['ID'])); if (Is_Error($IsUpdate)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- } #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- if (!In_Array($__URI, array('/Update', '/Patches'))) { #----------------------------------------------------------------------------- $Session = new Session((string) @$_COOKIE['SessionID']); #----------------------------------------------------------------------------- $IsLoad = $Session->Load(); if (!Is_Error($IsLoad)) { #--------------------------------------------------------------------------- if (isset($Session->Data['UsersIDs'])) { #------------------------------------------------------------------------- $UsersIDs = (array) $Session->Data['UsersIDs']; if (Count($UsersIDs) > 0) { #----------------------------------------------------------------------- $UsersIDs = $Session->Data['UsersIDs']; #----------------------------------------------------------------------- $UserID = Current($UsersIDs); #----------------------------------------------------------------------- $IsUpdate = TRUE; /*($UserID == @$Session->Data['RootID'])*/ #----------------------------------------------------------------------- $Comp = Comp_Load('Users/Init', $UserID, $IsUpdate); if (Is_Error($Comp)) { return ERROR | @Trigger_Error('[system/modules/Main]: не удалось инициализировать пользователя'); } } } } } #------------------------------------------------------------------------------- $Result = Comp_Load(SPrintF('www%s', $__URI)); #-------------------------------------------------------------------------------
$IDomainScheme['RegistratorID'] = $dRegistrator['ID']; break; default: return ERROR | @Trigger_Error(101); } #--------------------------------------------------------------- $DomainSchemeID = DB_Insert('DomainsSchemes', $IDomainScheme); if (Is_Error($DomainSchemeID)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------- $IDomainOrder['SchemeID'] = $DomainSchemeID; break; case 'array': #--------------------------------------------------------------- $dDomainScheme = Current($dDomainScheme); #--------------------------------------------------------------- $IDomainOrder['SchemeID'] = $dDomainScheme['ID']; break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------- $OrderID = DB_Insert('Orders', array('OrderDate' => GetTime($DomainOrder['OrderDate']), 'ContractID' => $ContractID, 'ServiceID' => 20000)); if (Is_Error($OrderID)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------- $IDomainOrder['OrderID'] = $OrderID; #------------------------------------------------------------------- $DomainOrderID = DB_Insert('DomainsOrders', $IDomainOrder);
#--------------------------------------------------------------------- switch (ValueOf($IsSet)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'true': # No more... break; default: return ERROR | @Trigger_Error(101); } break; case 'array': #--------------------------------------------------------------------- $Profile = Current($Profiles); #--------------------------------------------------------------------- $ProfileID = $Profile['ID']; #--------------------------------------------------------------------- $ProfileName = $Profile['Name']; break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------- $IsUpdate = DB_Update('Contracts', array('Customer' => $ProfileName, 'StatusID' => 'Waiting', 'TypeID' => 'Natural', 'ProfileID' => $ProfileID), array('ID' => $Contract['ID'])); if (Is_Error($IsUpdate)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------- $Comp = Comp_Load('Contracts/Build', $Contract['ID']);
public function Load($TemplateID) { /****************************************************************************/ $__args_types = array('string'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ foreach ($__args__ as $__arg__) { #--------------------------------------------------------------------------- $this->TemplateID = $__arg__; #--------------------------------------------------------------------------- $Path = System_Element(SPrintF('templates/%s.xml', $__arg__)); if (!Is_Error($Path)) { #------------------------------------------------------------------------- $Source = IO_Read($Path); if (Is_Error($Source)) { return ERROR | @Trigger_Error('[DOM->Load]: не удалось загрузить файл шаблона'); } #------------------------------------------------------------------------- $this->Object = String_XML_Parse($Source); if (Is_Exception($this->Object)) { return ERROR | @Trigger_Error('[DOM->Load]: не удалось преобразовать XML'); } #------------------------------------------------------------------------- $this->Object = Current($this->Object->Childs); #------------------------------------------------------------------------- $this->Linking(); #------------------------------------------------------------------------- break; } } #----------------------------------------------------------------------------- $Trigger = SPrintF('Triggers/DOM/Before/%s', $this->TemplateID); #----------------------------------------------------------------------------- if ($this->TemplateID) { #--------------------------------------------------------------------------- if (!Is_Error(System_Element(SPrintF('comp/%s.comp.php', $Trigger)))) { #------------------------------------------------------------------------- $LinkID = UniqID('DOM-'); #------------------------------------------------------------------------- $Links =& Links(); # Коллекция ссылок $Links[$LinkID] =& $this; #------------------------------------------------------------------------- $Comp = Comp_Load($Trigger, $LinkID, COMP_ALL_HOSTS); if (Is_Error($Comp)) { return ERROR | @Trigger_Error('[DOM->Load]: ошибка загрузки предобработчика'); } #------------------------------------------------------------------------- unset($Links[$LinkID]); } } #----------------------------------------------------------------------------- return TRUE; }
case 'false': return ERROR | @Trigger_Error(700); case 'true': #------------------------------------------------------------------- $Where = $ServerID ? SPrintF('`ID` = %u', $ServerID) : SPrintF("`ServersGroupID` = %u AND `IsDefault` = 'yes'", $VPSScheme['ServersGroupID']); #------------------------------------------------------------------- $Server = DB_Select('Servers', array('ID', 'Params'), array('Where' => $Where)); #------------------------------------------------------------------- switch (ValueOf($Server)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return new gException('SERVER_NOT_DEFINED', 'Сервер размещения не определён'); case 'array': #--------------------------------------------------------------- $Server = Current($Server); #--------------------------------------------------------------- $Password = Comp_Load('Passwords/Generator'); if (Is_Error($Password)) { return ERROR | @Trigger_Error(500); } #-------------------------TRANSACTION--------------------------- if (Is_Error(DB_Transaction($TransactionID = UniqID('VPSOrder')))) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------- $Where = SPrintF("`ContractID` = %u AND `TypeID` = 'VPSRules'", $Contract['ID']); #--------------------------------------------------------------- $Count = DB_Count('ContractsEnclosures', array('Where' => $Where)); if (Is_Error($Count)) { return ERROR | @Trigger_Error(500);