#------------------------------------------------------------------------------- $Path = SPrintF('%s/%s', SYSTEM_PATH, $File); #------------------------------------------------------------------------------- if (File_Exists($Path)) { #------------------------------------------------------------------------------- SPrintF('Проверка прав на запись файла (%s)', $Path); #------------------------------------------------------------------------------- if (!Is_Writable($Path)) { return SPrintF("ERROR: недостаточно прав на запись файла (%s)\n", $Path); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if ($Commit) { #------------------------------------------------------------------------------- $IsWrite = IO_Write($Path, Base64_Decode($Added['Source']), TRUE); if (Is_Error($IsWrite)) { return SPrintF("ERROR: не возможно обновить файл (%s)\n", $Path); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return SPrintF("---\n%s\n---\n", Implode("\n", Array_Slice($__SYSLOG, Count($__SYSLOG) - 20)));
function Crypt_Decode($String, $Key = HOST_ID) { /****************************************************************************/ $__args_types = array('string', 'string'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ $String = Base64_Decode($String); #----------------------------------------------------------------------------- if (empty($String)) { return $String; } #----------------------------------------------------------------------------- if (Extension_Loaded('mcrypt')) { #--------------------------------------------------------------------------- $Module =& Link_Get('Crypt'); #--------------------------------------------------------------------------- if (!Is_Resource($Module)) { #------------------------------------------------------------------------- $Module = @MCrypt_Module_Open(MCRYPT_DES, '', MCRYPT_MODE_ECB, ''); if (!Is_Resource($Module)) { return ERROR | @Trigger_Error('[Crypt_Decode]: не удалось открыть дескриптор'); } #------------------------------------------------------------------------- $Iv = @MCrypt_Create_Iv(MCrypt_Enc_Get_Iv_Size($Module), MCRYPT_RAND); if (!$Iv) { return ERROR | @Trigger_Error('[Crypt_Decode]: не удалось создать IV'); } #------------------------------------------------------------------------- $Key = SubStr($Key, 0, MCrypt_Enc_Get_Key_Size($Module)); #Debug(SPrintF("[system/libs/auto/Crypt]: Decode Key = %s",$Key)); #------------------------------------------------------------------------- $IsInit = @MCrypt_Generic_Init($Module, $Key, $Iv); if (!Is_Integer($IsInit)) { return ERROR | @Trigger_Error('[Crypt_Decode]: не удалось инициализовать модуль дешифрования'); } } #--------------------------------------------------------------------------- $String = @MDecrypt_Generic($Module, $String); if (!Is_String($String)) { return ERROR | @Trigger_Error('[Crypt_Decode]: не удалось дешифровать данные'); } #--------------------------------------------------------------------------- $String = Trim($String); #--------------------------------------------------------------------------- } #----------------------------------------------------------------------------- return $String; }
$Tickets = Is_Array($Tickets) ? $Tickets : array(); #----------------------------------------------------------------------- foreach ($Tickets as $Ticket) { #--------------------------------------------------------------------- $ITicket = array('CreateDate' => GetTime($Ticket['CreateDate']), 'UserID' => $UserID, 'TargetGroupID' => 3100000, 'TargetUserID' => 100, 'PriorityID' => $Ticket['PriorityID'], 'Theme' => $Ticket['Theme'], 'UpdateDate' => GetTime($Ticket['CreateDate']), 'StatusID' => $Ticket['StatusID'], 'StatusDate' => GetTime($Ticket['CreateDate'])); #--------------------------------------------------------------------- $TicketID = DB_Insert('Edesks', $ITicket); if (Is_Error($TicketID)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------------------------- $Messages = $Ticket['Messages']; #--------------------------------------------------------------------- foreach ($Messages as $Message) { #------------------------------------------------------------------- $IMessage = array('CreateDate' => GetTime($Message['CreateDate']), 'UserID' => $Message['IsSupport'] ? 100 : $UserID, 'EdeskID' => $TicketID, 'Content' => Base64_Decode($Message['Content'])); #------------------------------------------------------------------- $MessageID = DB_Insert('EdesksMessages', $IMessage); if (Is_Error($MessageID)) { return ERROR | @Trigger_Error(500); } } } } #------------------------------------------------------------------------- if (isset($User['Profiles'])) { #----------------------------------------------------------------------- $Profiles = $User['Profiles']; #----------------------------------------------------------------------- $Profiles = Is_Array($Profiles) ? $Profiles : array(); #-----------------------------------------------------------------------
} else { #------------------------------------------------------------------------------- $CollationID = DB_Insert('PaymentSystemsCollation', $UCollation); if (Is_Error($CollationID)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Answer['CollationID'] = $CollationID; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (Is_Error(DB_Commit($TransactionID))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if ($Window) { #------------------------------------------------------------------------------- $Window = JSON_Decode(Base64_Decode($Window), TRUE); #------------------------------------------------------------------------------- $Window['Args']['CollationID'] = $CollationID; #------------------------------------------------------------------------------- $Answer = array('Status' => 'Window', 'Window' => $Window); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return $Answer; #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
if (!Define('HOST_ID', $HostID)) { exit('[JBs core]: не удалось определить константу (HOST_ID)'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (!Define('UNIQ_ID', Md5(HOST_ID))) { exit('[JBs core]: не удалось определить константу (UNIQ_ID)'); } #------------------------------------------------------------------------------- if (!Define('ERROR', 0xabcdef)) { exit('[JBs core]: не удалось определить константу (ERROR)'); } #------------------------------------------------------------------------------- unset($HostID, $Mathces); #------------------------------------------------------------------------------- if (!Define('FUNCTION_INIT', Base64_Decode('aWYoSXNTZXQoJF9fYXJnc190eXBlcykpew0KICBmb3IoJGk9MDskaTxDb3VudCgkX19hcmdzX18pOyRpKyspew0KICAgICRfX2FyZ190eXBlID0gKCRpIDwgQ291bnQoJF9fYXJnc190eXBlcyk/JF9fYXJnc190eXBlc1skaV06JF9fYXJnc190eXBlc1tDb3VudCgkX19hcmdzX3R5cGVzKS0xXSk7DQogICAgaWYoJF9fYXJnX3R5cGUgPT0gJyonKQ0KICAgICAgY29udGludWU7DQogICAgJF9fdHlwZSA9IEdldFR5cGUoJF9fYXJnc19fWyRpXSk7DQogICAgaWYoIUluX0FycmF5KCRfX3R5cGUsRXhwbG9kZSgnLCcsJF9fYXJnX3R5cGUpKSl7DQogICAgICBEZWJ1ZyhQcmludF9SKCRfX2FyZ3NfXyxUUlVFKSk7DQogICAgICBUcmlnZ2VyX0Vycm9yKFNQcmludEYoJ1tGVU5DVElPTl9JTklUXTog0L/QsNGA0LDQvNC10YLRgCAoJXMpINC/0YDQuNC90Y/RgiAoJXMpINC+0LbQuNC00LDQu9GB0Y8gKCVzKScsJGksJF9fdHlwZSwkX19hcmdfdHlwZSkpOw0KICAgIH0NCiAgfQ0KfQ=='))) { exit('[JBs core]: не удалось определить константу (FUNCTION_INIT)'); } #------------------------------------------------------------------------------- #******************************************************************************# # УСТАНОВКА ПАРАМЕТРОВ PHP #******************************************************************************# if (Mb_Internal_Encoding('UTF-8') === FALSE) { $GLOBALS['__MESSAGES'][] = 'Не удалось установить кодировку UTF-8 (mb_internal_encoding)'; } #------------------------------------------------------------------------------- if ($Inis = @Parse_Ini_File(SPrintF('%s/core/php.ini', SYSTEM_PATH), TRUE)) { #------------------------------------------------------------------------------- foreach (Array_Keys($Inis) as $IniID) { #------------------------------------------------------------------------------- $Ini = $Inis[$IniID];
<?php #------------------------------------------------------------------------------- /** @author Великодный В.В. (Joonte Ltd.) */ #------------------------------------------------------------------------------- //if(!Define('COMP_INIT',Base64_Decode('DQokX19hcmdzX18gPSBBcnJheV9TbGljZShGdW5jX0dldF9BcmdzKCksMik7DQppZihJc1NldCgkX19hcmdzX2xpc3QpKXsNCiAgZm9yKCRpPTA7JGk8Q291bnQoJF9fYXJnc19saXN0KTskaSsrKQ0KICAgICR7JF9fYXJnc19saXN0WyRpXX0gPSAoSXNTZXQoJF9fYXJnc19fWyRpXSk/JF9fYXJnc19fWyRpXTpOVUxMKTsNCn0='))) if (!Define('COMP_INIT', Base64_Decode('aWYoSXNTZXQoJF9fYXJnc19saXN0KSl7DQogIGZvcigkaT0wOyRpPENvdW50KCRfX2FyZ3NfbGlzdCk7JGkrKykNCiAgICAkeyRfX2FyZ3NfbGlzdFskaV19ID0gKElzU2V0KCRfX2FyZ3NfX1skaV0pPyRfX2FyZ3NfX1skaV06TlVMTCk7DQp9'))) { exit('Не удалось определить константу инициализации компонентов'); } #------------------------------------------------------------------------------- if (!Define('COMP_ALL_HOSTS', UniqID('ID'))) { exit('Не удалось определить константу загрузки всех хостов'); } /*------------------------------------------------------------------------------ Задача: Создать возможность использования компонентов. Все компоненты расположены в папке "HOST_NAME/comp". Компонент - это PHP файл, принимающий параметры и выполняющий определённые действия. ------------------------------------------------------------------------------*/ function Comp_Load($Element) { /****************************************************************************/ $__args_types = array('string', '*'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ $HostsIDs = System_HostsIDs(SPrintF('comp/%s.comp.php', $Element)); if (Is_Error($HostsIDs)) { return ERROR | @Trigger_Error('[Comp_Load]: не возможно найти компонент');
$Value = 'Список выбора поля'; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- case 'File': #------------------------------------------------------------------------------- $FileName = $ServiceOrderField['FileName']; #------------------------------------------------------------------------------- if (Mb_StrLen($FileName) > 15) { $FileName = SPrintF('%s...', Mb_SubStr($FileName, 0, 15)); } #------------------------------------------------------------------------------- $Value = new Tag('TD', array('class' => 'Standard'), new Tag('A', array('href' => SPrintF('/OrderFileDownload?OrderFieldID=%u', $ServiceOrderField['ID'])), SPrintF('%s (%01.2f Кб.)', $FileName, StrLen(Base64_Decode($Value)) / 1024))); #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- case 'Hidden': continue 2; default: # No more... } #------------------------------------------------------------------------------- $Fields[] = array($ServiceField['Name'], $Value); #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
$Template = System_XML(SPrintF('profiles/%s.xml', $TemplateID)); if (Is_Error($Template)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if ($Simple) { #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('name' => 'Simple', 'type' => 'hidden', 'value' => $Simple)); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Form->AddChild($Comp); #------------------------------------------------------------------------------- $Simple = @JSON_Decode(Base64_Decode($Simple), TRUE); if (!$Simple) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Simple = array(); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Attribs = $Template['Attribs']; #------------------------------------------------------------------------------- $Replace = Array_ToLine($__USER, '%'); #------------------------------------------------------------------------------- foreach (Array_Keys($Attribs) as $AttribID) {
case 'exception': return new gException('ACCOUNT_NOT_FOUND', 'Счет не найден'); case 'array': #------------------------------------------------------------------------------- $Permission = Permission_Check('OrdersFieldsRead', (int) $GLOBALS['__USER']['ID'], (int) $OrderField['UserID']); #------------------------------------------------------------------------------- switch (ValueOf($Permission)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'false': return ERROR | @Trigger_Error(700); case 'true': #------------------------------------------------------------------------------- $File = Base64_Decode($OrderField['Value']); #------------------------------------------------------------------------------- $Length = MB_StrLen($File, 'ASCII'); #------------------------------------------------------------------------------- Header('Content-Type: application; charset=utf-8'); Header(SPrintF('Content-Length: %u', $Length)); Header(SPrintF('Content-Disposition: attachment; filename="%s";', $OrderField['FileName'])); Header('Pragma: nocache'); #------------------------------------------------------------------------------- return $File; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- case 'Hidden': #------------------------------------------------------------------------------- $Comp = Comp_Load('Form/Input', array('name' => $FieldID, 'type' => 'hidden', 'value' => $ServiceOrderField['Value'])); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Form->AddChild($Comp); #------------------------------------------------------------------------------- continue 2; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- case 'File': #------------------------------------------------------------------------------- $File = $ServiceOrderField['Value'] ? StrLen(Base64_Decode($ServiceOrderField['Value'])) : 0; #------------------------------------------------------------------------------- $Comp = Comp_Load('Upload', $FieldID, $File ? SPrintF('%01.2f Кб.', $File / 1024) : '-'); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $SizeText = ' (не более 12Mb)'; #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #-------------------------------------------------------------------------------