function HTTP_Send($Target, $Settings, $Get = array(), $Post = array(), $Addins = array()) { /******************************************************************************/ $__args_types = array('string', 'array', 'array', 'string,array', 'array'); #------------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /******************************************************************************/ $Default = array('Protocol' => 'tcp', 'Address' => 'localhost', 'Port' => 8080, 'Host' => 'localhost', 'Basic' => '', 'Charset' => 'UTF-8', 'Hidden' => '', 'IsLogging' => TRUE); #------------------------------------------------------------------------------- Array_Union($Default, $Settings); #------------------------------------------------------------------------------- $IsLogging = (bool) $Default['IsLogging']; #------------------------------------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error('[HTTP_Send]: не удалось определить путь временной директории'); } #------------------------------------------------------------------------------- $Config = Config(); #------------------------------------------------------------------------------- $Address = $Default['Address']; #------------------------------------------------------------------------------- Debug(SPrintF('[HTTP_Send]: соединяемся с (%s:%u)', $Address, $Default['Port'])); #------------------------------------------------------------------------------- # https://bugs.php.net/bug.php?id=52913 # пришлось заменить: $Address -> $Default['Host'] $Socket = @FsockOpen(SPrintF('%s://%s', $Protocol = $Default['Protocol'], $Default['Host']), $Port = $Default['Port'], $nError, $sError, $Config['Other']['Libs']['HTTP']['SocketTimeout']); if (!Is_Resource($Socket)) { #------------------------------------------------------------------------------- $IsWrite = IO_Write(SPrintF('%s/logs/http-send.log', $Tmp), SPrintF("%s://%s:%u ошибка соединения\n\n", $Protocol, $Address, $Port)); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error('[HTTP_Send]: не удалось записать данные в лог файл'); } #------------------------------------------------------------------------------- return ERROR | @Trigger_Error('[HTTP_Send]: не удалось соединиться с удаленным хостом'); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- # added by lissyara, 2012-01-04 in 08:42:54 MSK, for JBS-130 Stream_Set_TimeOut($Socket, $Config['Other']['Libs']['HTTP']['StreamTimeout']); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Charset = $Default['Charset']; #------------------------------------------------------------------------------- $Method = Count($Post) > 0 ? 'POST' : 'GET'; #------------------------------------------------------------------------------- $Hidden = $Default['Hidden']; #------------------------------------------------------------------------------- if (Count($Get)) { $Target .= SPrintF('?%s', HTTP_Query($Get, $Charset, $Hidden, $IsLogging)); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Headers[] = SPrintF('%s %s HTTP/1.0', $Method, $Target); #------------------------------------------------------------------------------- $Headers[] = SPrintF('Host: %s', $Default['Host']); #------------------------------------------------------------------------------- $Headers[] = 'Connection: close'; #------------------------------------------------------------------------------- $Headers = Array_Merge($Headers, $Addins); #------------------------------------------------------------------------------- if ($Basic = $Default['Basic']) { #------------------------------------------------------------------------------- $Basic = Base64_Encode($Basic); #------------------------------------------------------------------------------- $Headers[] = SPrintF('Authorization: Basic %s', $Basic); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Body = ''; #------------------------------------------------------------------------------- if ($Post) { #------------------------------------------------------------------------------- if (Is_Array($Post)) { #------------------------------------------------------------------------------- if (Count($Post) > 0) { #------------------------------------------------------------------------------- $Headers[] = 'Content-Type: application/x-www-form-urlencoded'; #------------------------------------------------------------------------------- $Body = HTTP_Query($Post, $Charset, $Hidden, $IsLogging); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Body = Mb_Convert_Encoding($Post, $Charset); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if ($Length = MB_StrLen($Body, 'ASCII')) { $Headers[] = SPrintF('Content-Length: %u', $Length); } #------------------------------------------------------------------------------- $Query = SPrintF("%s\r\n\r\n%s", Implode("\r\n", $Headers), $Body); #------------------------------------------------------------------------------- Debug(SPrintF("[HTTP_Send]: делаем запрос:\n%s", $Query)); #------------------------------------------------------------------------------- if (!@Fwrite($Socket, $Query)) { return ERROR | @Trigger_Error('[HTTP_Send]: не удалось записать в сокет'); } #------------------------------------------------------------------------------- # added by lissyara, 2014-01-28 in 14:19:08 MSK, for JBS-130 Stream_Set_TimeOut($Socket, $Config['Other']['Libs']['HTTP']['StreamTimeout']); #------------------------------------------------------------------------------- $Receive = ''; #------------------------------------------------------------------------------- do { #------------------------------------------------------------------------------- $Bytes = @FGets($Socket); #------------------------------------------------------------------------------- $Receive .= $Bytes; #------------------------------------------------------------------------------- } while ($Bytes); #------------------------------------------------------------------------------- @Fclose($Socket); #------------------------------------------------------------------------------- if (Preg_Match('/Content-Type:[\\sa-zA-Z0-9\\/\\-\\;]+charset\\=([a-zA-Z0-9\\-]+)/i', $Receive, $Matches)) { #------------------------------------------------------------------------------- $Receive = Mb_Convert_Encoding($Receive, 'UTF-8', Next($Matches)); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Receive = Mb_Convert_Encoding($Receive, 'UTF-8', $Default['Charset']); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- Debug(SPrintF("[HTTP_Send]: получили ответ:\n%s", $Receive)); #------------------------------------------------------------------------------- $Log = SPrintF("%s://%s:%u [%s]\n%s\n%s\n\n", $Protocol, $Address, $Port, Date('r'), $Query, $Receive); #------------------------------------------------------------------------------- if ($Hidden) { #------------------------------------------------------------------------------- if (!Is_Array($Hidden)) { $Hidden = array($Hidden); } #------------------------------------------------------------------------------- foreach ($Hidden as $Pattern) { #------------------------------------------------------------------------------- $Pattern = UrlEncode(Mb_Convert_Encoding($Pattern, $Charset)); #------------------------------------------------------------------------------- $Log = Str_Replace($Pattern, SPrintF('[HIDDEN=(%u)]', StrLen($Pattern)), $Log); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if ($Default['IsLogging']) { #------------------------------------------------------------------------------- $IsWrite = IO_Write(SPrintF('%s/logs/http-send.log', $Tmp), $Log); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error('[HTTP_Send]: не удалось записать данные в лог файл'); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Heads = $Body = array(); #------------------------------------------------------------------------------- foreach (Explode("\r\n\r\n", $Receive) as $Chunk) { #------------------------------------------------------------------------------- if (Preg_Match('#^HTTP/1\\.*#', $Chunk)) { #------------------------------------------------------------------------------- $Heads[] = $Chunk; #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Body[] = $Chunk; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (SizeOf($Body) < 1) { return ERROR | @Trigger_Error('[HTTP_Send]: ответ от сервера не верен'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return array('Heads' => Implode("\r\n\r\n", $Heads), 'Body' => Implode("\r\n\r\n", $Body)); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- #$Receive = Preg_Split('/\r\n\r\n/',$Receive,PREG_SPLIT_DELIM_CAPTURE); #------------------------------------------------------------------------------- #if(Count($Receive) < 2) # return ERROR | @Trigger_Error('[HTTP_Send]: ответ от сервера не верен'); #------------------------------------------------------------------------------- #$Receive = Array_Combine(Array('Heads','Body'),$Receive); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- #return $Receive; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- }
public function Save() { #----------------------------------------------------------------------------- $SessionID = $this->SessionID; #----------------------------------------------------------------------------- if (!$SessionID) { return ERROR | @Trigger_Error('[Session->Save]: пустой идентификатор сессии'); } #----------------------------------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error('[Session->Save]: не удалось найти временную папку'); } #----------------------------------------------------------------------------- #$IsWrited = IO_Write(SPrintF('%s/sessions/%s',$Tmp,$SessionID),Serialize($this->Data),TRUE); $IsWrited = IO_Write(SPrintF('%s/sessions/%s', $Tmp, $SessionID), JSON_Encode($this->Data), TRUE); if (Is_Error($IsWrited)) { return ERROR | @Trigger_Error('[Session->Save]: не удалось сохранить сессию'); } #----------------------------------------------------------------------------- return TRUE; }
#------------------------------------------------------------------------------- echo "Ошибка применения патча\n"; #------------------------------------------------------------------------------- $__SYSLOG =& $GLOBALS['__SYSLOG']; #------------------------------------------------------------------------------- echo SPrintF("---\n%s\n---\n", Implode("\n", Array_Slice($__SYSLOG, Count($__SYSLOG) - 20))); #------------------------------------------------------------------------------- if (!$Force) { return; } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $IsWrite = IO_Write($File, (string) $PatchInt, TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- echo "\n\n-- Перезагрузка базы данных\n\n"; #-------------------------------------------------------------------------------
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']); }
<?php #------------------------------------------------------------------------------- $Folder = $_SERVER['DOCUMENT_ROOT']; #------------------------------------------------------------------------------- $Link = SPrintF('%s/styles', $Folder); #------------------------------------------------------------------------------- if (!File_Exists($Link)) { #----------------------------------------------------------------------------- if (!SymLink(SPrintF('%s/styles', SYSTEM_PATH), $Link)) { return ERROR | @Trigger_Error(500); } } #------------------------------------------------------------------------------- $HtAccess = IO_Read(SPrintF('%s/.htaccess', $Folder)); if (Is_Error($HtAccess)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $HtAccess = Str_Replace('Styles', 'styles', $HtAccess); #------------------------------------------------------------------------------- $IsWrite = IO_Write(SPrintF('%s/.htaccess', $Folder), $HtAccess, TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- @UnLink(SPrintF('%s/Styles', $Folder)); #------------------------------------------------------------------------------- return TRUE; #-------------------------------------------------------------------------------
<?php #------------------------------------------------------------------------------- $Config = IO_Read($Path = SPrintF('%s/hosts/%s/config/Config.xml', SYSTEM_PATH, HOST_ID)); if (Is_Error($Config)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Config = Str_Replace('Account', 'Invoice', $Config); #------------------------------------------------------------------------------- $IsWrite = IO_Write($Path, $Config, TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- return TRUE; #-------------------------------------------------------------------------------
#------------------------------------------------------------------------------- if (!$IsExists) { $Codes[UniqID('ID')] = array('IP' => $_SERVER['REMOTE_ADDR'], 'Secret' => $Secret = Rand(100000, 900000), 'Date' => Time()); } #------------------------------------------------------------------------------- $XML = To_XML_String($Codes); if (Is_Error($XML)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $IsWrite = IO_Write(SPrintF('%s/protect.xml', $Tmp), $XML, TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Path = Styles_Element('Images/ProtectBg.png'); if (Is_Error($Path)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Im = ImageCreateFromPng($Path); #------------------------------------------------------------------------------- $Color = ImageColorAllocate($Im, 0, 0, 0); #------------------------------------------------------------------------------- $Px = (ImageSx($Im) - 8.5 * StrLen($Secret)) / 2; #-------------------------------------------------------------------------------
return ERROR | @Trigger_Error(400); case 'string': #--------------------------------------------------- $Comp = Comp_Load('Formats/WorkComplite/Report/Number', $ContractID, $Month); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------- $File = SPrintF('Report%s.pdf', Md5($_SERVER['REMOTE_ADDR'])); #--------------------------------------------------- $IsWrite = IO_Write(SPrintF('%s/files/%s', $Tmp, $File), $PDF, TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #--------------------------------------------------- $Location = SPrintF('/GetTemp?File=%s&Name=Report%s.pdf&Mime=application/pdf', $File, $Comp); #--------------------------------------------------- if (!XML_HTTP_REQUEST) { #------------------------------------------------- Header(SPrintF('Location: %s', $Location)); #------------------------------------------------- return TRUE; } #--------------------------------------------------- return array('Status' => 'Ok', 'Location' => $Location); default:
break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return SPrintF("---\n%s\n---\n", Implode("\n", Array_Slice($__SYSLOG, Count($__SYSLOG) - 20))); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if ($Commit) { #------------------------------------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return SPrintF("---\n%s\n---\n", Implode("\n", Array_Slice($__SYSLOG, Count($__SYSLOG) - 20))); } #------------------------------------------------------------------------------- $IsWrite = IO_Write(SPrintF('%s/LastUpdate.stamp', $Tmp), (string) Time(), TRUE); if (Is_Error($IsWrite)) { return SPrintF("---\n%s\n---\n", Implode("\n", Array_Slice($__SYSLOG, Count($__SYSLOG) - 20))); } #------------------------------------------------------------------------------- $Event = array('UserID' => $UserID ? $UserID : 10, 'PriorityID' => 'System', 'Text' => 'Обновление биллинга: заменён файловый набор'); $Event = Comp_Load('Events/EventInsert', $Event); if (!$Event) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return '[OK]'; #-------------------------------------------------------------------------------
} #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Upload = Upload_Get('aSign'); #------------------------------------------------------------------------------- switch (ValueOf($Upload)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': # No more... break; case 'array': #------------------------------------------------------------------------------- $File = SPrintF('styles/%s/Images/aSign.bmp', HOST_ID); #------------------------------------------------------------------------------- $IsWrite = IO_Write(SPrintF('%s/%s', SYSTEM_PATH, $File), $Upload['Data'], TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return array('Status' => 'Ok'); #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $Replace = <<<EOD <TD id="Context"> <TABLE cellspacing="0" cellpadding="0" width="100%" height="100%"> <TR> <COMP id="MenuLeft" path="Menus/Left" /> <TD valign="top"> <DIV class="Title" id="Title" /> <TABLE width="100%" cellspacing="5" cellpadding="0"> <TR> <TD id="Into" /> </TR> </TABLE> </TD> </TR> </TABLE> </TD> EOD; #----------------------------------------------------------------------------- $Source = Str_Replace('<TD id="Main" />', $Replace, $Source); #----------------------------------------------------------------------------- $IsWrite = IO_Write($Real, $Source, TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } } #------------------------------------------------------------------------------- return TRUE; #-------------------------------------------------------------------------------
</TD> </TR> </TABLE> </FORM> </TD> <TD> <IFRAME name="Main" src="FileList.html" style="width:100%;height:100%;s" /> </TD> </TR> </TABLE> EOD; #------------------------------------------------------------------------------- $DOM->AddHTML('Into', $Parse); #------------------------------------------------------------------------------- $Out = $DOM->Build(); #------------------------------------------------------------------------------- $IsWrite = IO_Write(SPrintF('%s/Index.html', $JBsDocPath), $Out, TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $File = IO_Read(SPrintF('%s/styles/root/Css/Standard.css', SYSTEM_PATH)); if (Is_Error($File)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $IsWrite = IO_Write(SPrintF('%s/Standard.css', $JBsDocPath), $File, TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #-------------------------------------------------------------------------------
$Ticket->AddChild($Messages); #--------------------------------------------------------------------------- $Tickets->AddChild($Ticket); } #----------------------------------------------------------------------------- $User->AddChild($Tickets); #----------------------------------------------------------------------------- $Users->AddChild($User); } #------------------------------------------------------------------------------- $Dump = $Users->ToXMLString(); #------------------------------------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $File = SPrintF('Bpanel[%s%s].xml.gz', Md5($_SERVER['REMOTE_ADDR']), Date('d.m.Y')); #------------------------------------------------------------------------------- $IsWrite = IO_Write(SPrintF('%s/files/%s', $Tmp, $File), GzEncode($Dump), TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- echo SPrintF('<A href="/GetTemp?File=%s&Name=Bpanel.xml.gz&Mime=application/gzip">[Сохранить файл базы данных]</A>', $File); #------------------------------------------------------------------------------- echo <<<EOD </BODY> </HTML> EOD; #-------------------------------------------------------------------------------
foreach ($Files as $File) { #------------------------------------------------------------------------------- if ($File == 'names.txt') { continue; } #------------------------------------------------------------------------------- $Path = SPrintF('%s/%s', $Uploads, $File); #------------------------------------------------------------------------------- if (Time() - FileMTime($Path) > 600) { #------------------------------------------------------------------------------- if (isset($Names[$File])) { unset($Names[$File]); } #------------------------------------------------------------------------------- if (!UnLink($Path)) { return ERROR | @Trigger_Error(SPrintF('Не удалось удалить файл (%s)', $Path)); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $IsWrite = IO_Write($NamesPath, JSON_Encode($Names), TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return $Hash; #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
function HTMLDoc_CreatePDF($ModeID, $HTML, $Prefix = '/') { /****************************************************************************/ $__args_types = array('string', 'string,object', 'string'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ if (Is_Object($HTML)) { #--------------------------------------------------------------------------- $Tables = $HTML->GetByTagName('TABLE'); #--------------------------------------------------------------------------- for ($i = 0; $i < Count($Tables); $i++) { #------------------------------------------------------------------------- $Table =& $Tables[$i]; #------------------------------------------------------------------------- switch (@$Table->Attribs['class']) { case 'Standard': $Table->AddAttribs(array('border' => 2, 'cellspacing' => 0, 'cellpadding' => 5), TRUE); break; default: # No more... } } #--------------------------------------------------------------------------- $Tds = $HTML->GetByTagName('TD'); #--------------------------------------------------------------------------- for ($i = 0; $i < Count($Tds); $i++) { #------------------------------------------------------------------------- $Td =& $Tds[$i]; #------------------------------------------------------------------------- switch (@$Td->Attribs['class']) { case 'Head': $Td->AddAttribs(array('bgcolor' => '#ADC1F0'), TRUE); break; case 'Separator': $Td->AddAttribs(array('bgcolor' => '#EAEAEA'), TRUE); break; default: # No more... } } #--------------------------------------------------------------------------- $Imgs = $HTML->GetByTagName('IMG'); #--------------------------------------------------------------------------- for ($i = 0; $i < Count($Imgs); $i++) { #------------------------------------------------------------------------- $Img =& $Imgs[$i]; #------------------------------------------------------------------------- $Img->AddAttribs(array('src' => SPrintF('%s/%s', $Prefix, $Img->Attribs['src'])), TRUE); } #--------------------------------------------------------------------------- $HTML = $HTML->Build(); } #----------------------------------------------------------------------------- $Config = Config(); #----------------------------------------------------------------------------- $Settings = $Config['HTMLDOC']; #----------------------------------------------------------------------------- $Modes = $Settings['Modes']; #----------------------------------------------------------------------------- $Mode = isset($Modes[$ModeID]) ? $Modes[$ModeID] : $ModeID; #----------------------------------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: временная папка не найдена'); } #----------------------------------------------------------------------------- $Logs = SPrintF('%s/logs', $Tmp); #----------------------------------------------------------------------------- if (!File_Exists($Logs)) { #--------------------------------------------------------------------------- if (!@MkDir($Logs, 0777, TRUE)) { return ERROR | @Trigger_Error(500); } } #----------------------------------------------------------------------------- $HTML = @Mb_Convert_Encoding($HTML, $Settings['ConvertToCharset']); if (!$HTML) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось преобразовать кодировку'); } #----------------------------------------------------------------------------- $UniqID = UniqID('HTMLDOC'); #----------------------------------------------------------------------------- $File = IO_Write($Path = SPrintF('%s/%s', $Tmp, $UniqID), $HTML); Debug($File); if (Is_Error($File)) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось создать временный файл'); } #----------------------------------------------------------------------------- $Command = SPrintF('htmldoc %s %s', $Mode, $Path); #----------------------------------------------------------------------------- Debug($Command); #----------------------------------------------------------------------------- if (!PutENV('HTMLDOC_NOCGI=1')) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось установить переменную окружения HTMLDOC_NOCGI'); } #----------------------------------------------------------------------------- $HTMLDOC = @Proc_Open($Command, array(array('pipe', 'r'), array('pipe', 'w'), array('file', $Log = SPrintF('%s/HTMLDOC.log', $Logs), 'a')), $Pipes); if (!Is_Resource($HTMLDOC)) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось открыть процесс'); } #----------------------------------------------------------------------------- $StdOut =& $Pipes[1]; #----------------------------------------------------------------------------- $Result = ''; #----------------------------------------------------------------------------- while (!Feof($StdOut)) { $Result .= FRead($StdOut, 1024); } #----------------------------------------------------------------------------- Proc_Close($HTMLDOC); #----------------------------------------------------------------------------- if (!UnLink($Path)) { return ERROR | @Trigger_Error('[HTMLDoc_CreatePDF]: не удалось удалить временный файл'); } #----------------------------------------------------------------------------- if (!$Result) { return ERROR | @Trigger_Error(SPrintF('[HTMLDoc_CreatePDF]: ошибка формирования PDF, смотрите (%s)', $Log)); } #----------------------------------------------------------------------------- return $Result; }
#----------------------------------------------------------------------------- $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); } #------------------------------------------------------------------------------- return 'Ok'; #-------------------------------------------------------------------------------
$Folder = SPrintF('%s/hosts/%s', SYSTEM_PATH, HOST_ID); #------------------------------------------------------------------------------- $Files = IO_Files($Folder); if (Is_Error($Files)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- foreach ($Files as $File) { #----------------------------------------------------------------------------- if (!Preg_Match('/\\.xml/', $File)) { continue; } #----------------------------------------------------------------------------- $Sourse = IO_Read($File); if (Is_Error($Sourse)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $Out = Str_Replace('path="MenuLeft"', 'path="Menus/Left"', $Sourse); #----------------------------------------------------------------------------- if ($Out != $Sourse) { #--------------------------------------------------------------------------- $IsWrite = IO_Write($File, $Out, TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } } } #------------------------------------------------------------------------------- return TRUE; #-------------------------------------------------------------------------------
case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'string': #------------------------------------------------------------------- if ($IsTIFF) { #----------------------------------------------------------------- $Tmp = System_Element('tmp'); if (Is_Error($Tmp)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------- $UniqID = UniqID('ImageMagick'); #----------------------------------------------------------------- $File = IO_Write($PDF = SPrintF('%s/%s.pdf', $Tmp, $UniqID), $File); if (Is_Error($File)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------- $Command = SPrintF('convert -density 120 -compress group4 %s %s', $PDF, $Tiff = SPrintF('%s/%s.tiff', $Tmp, $UniqID)); #----------------------------------------------------------------- Debug($Command); #----------------------------------------------------------------- $ImageMagick = @Proc_Open($Command, array(array('pipe', 'r'), array('pipe', 'w'), array('file', SPrintF('%s/logs/ImageMagic.log', $Tmp), 'a')), $Pipes); if (!Is_Resource($ImageMagick)) { return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------- Proc_Close($ImageMagick); #-----------------------------------------------------------------
$Server = array('TemplateID' => 'EmailClient', 'IsActive' => TRUE, 'IsDefault' => TRUE, 'Protocol' => isset($CheckEmail['UseSSL']) ? $CheckEmail['UseSSL'] ? 'ssl' : 'tcp' : 'ssl', 'Address' => isset($CheckEmail['CheckEmailServer']) ? $CheckEmail['CheckEmailServer'] : 'pop.yandex.ru', 'Port' => 110, 'Login' => isset($CheckEmail['CheckEmailLogin']) ? $CheckEmail['CheckEmailLogin'] : '', 'Password' => isset($CheckEmail['CheckEmailPassword']) ? $CheckEmail['CheckEmailPassword'] : '', 'Params' => array('Method' => isset($CheckEmail['CheckEmailProtocol']) ? $CheckEmail['CheckEmailProtocol'] : 'pop3'), 'AdminNotice' => 'Используется учётная запись от которой шлёт сообщения биллинг (пользователь с идентификатором 100)', 'SortID' => 100000, 'Monitoring' => "POP3=110\nPOP3S=995\nIMAP4=143\nIMAP4S=993"); #------------------------------------------------------------------------------- $IsInsert = DB_Insert('Servers', $Server); if (Is_Error($IsInsert)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- unset($Config['Tasks']['Types']['CheckEmail']['UseSSL']); unset($Config['Tasks']['Types']['CheckEmail']['CheckEmailServer']); unset($Config['Tasks']['Types']['CheckEmail']['CheckEmailLogin']); unset($Config['Tasks']['Types']['CheckEmail']['CheckEmailPassword']); unset($Config['Tasks']['Types']['CheckEmail']['CheckEmailProtocol']); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $File = IO_Write($ConfigPath, To_XML_String($Config), TRUE); if (Is_Error($File)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $IsFlush = CacheManager::flush(); if (!$IsFlush) { @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return TRUE; #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
foreach ($Courses as $Course) { #------------------------------------------------------------------------------- if (isset($PaymentSystems[$PaymentSystemID]) && @$Course['CharCode'] == $PaymentSystem['Valute'] && $PaymentSystem['IsCourseUpdate']) { #------------------------------------------------------------------------------- $Current = (string) SPrintF('%01.6g', FloatVal(Str_Replace(',', '.', @$Course['Value'])) / @$Course['Nominal']); #------------------------------------------------------------------------------- $PaymentSystems[$PaymentSystemID]['Course'] = $Current; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Path = System_Element('config/Config.xml'); if (Is_Error($Path)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $IsWrite = IO_Write($Path, To_XML_String($Config), TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $IsFlush = CacheManager::flush(); if (!$IsFlush) { @Trigger_Error(500); } #------------------------------------------------------------------------------- return TRUE; #-------------------------------------------------------------------------------
} #----------------------------------------------------------------------------- echo '<P style="color:#6F9006;">Статистика сформирована</P>'; #----------------------------------------------------------------------------- $PDF = HTMLDoc_CreatePDF('Statistics', $DOM, $Folder); #----------------------------------------------------------------------------- switch (ValueOf($PDF)) { case 'error': # No more... # No more... case 'exception': echo '<P style="color:#990000;">Ошибка формирования PDF</P>'; break; case 'string': #------------------------------------------------------------------------- $IsWrite = IO_Write(SPrintF('%s/Statistics.pdf', $Folder), $PDF, TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------- echo '<P style="color:#6F9006;">PDF документ сформирован</P>'; break; default: return ERROR | @Trigger_Error(101); } #----------------------------------------------------------------------------- $Parse = <<<EOD <P>Просмотр статистики в <A target="blank" href="/public/%s/index.html">HTML</A> <B>|</B> <A target="blank" href="/public/%s/Statistics.pdf">PDF</A>
$WhatsAppClient = new WhatsProt($Settings['Login'], $Settings['Params']['Sender'], FALSE, TRUE, $DataFolder); if (Is_Error($WhatsAppClient)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $WhatsAppClient->connect(); #------------------------------------------------------------------------------- $WhatsAppClient->loginWithPassword($Settings['Password']); #------------------------------------------------------------------------------- if (!File_Exists(SPrintF('%s/info.update.txt', $DataFolder))) { #------------------------------------------------------------------------------- $WhatsAppClient->sendStatusUpdate($Settings['Params']['StatusMessage']); #------------------------------------------------------------------------------- $WhatsAppClient->sendSetProfilePicture($Settings['Params']['ProfileImage']); #------------------------------------------------------------------------------- $IsWrite = IO_Write(SPrintF('%s/info.update.txt', $DataFolder), 'user info updated', TRUE); if (Is_Error($IsWrite)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $IsMessage = $WhatsAppClient->sendMessage($Mobile, $Message); if (Is_Error($IsMessage)) { #------------------------------------------------------------------------------- Debug(SPrintF('[comp/Tasks/WhatsApp]: error sending message, see error file: %s', $LogFile)); #------------------------------------------------------------------------------- return 3600; #------------------------------------------------------------------------------- }