function XML_Read($Object, $Level = 1) { #----------------------------------------------------------------------------- static $Index = 1; #----------------------------------------------------------------------------- $Md5 = Md5($Index++); #----------------------------------------------------------------------------- $Attribs = $Object->Attribs; #----------------------------------------------------------------------------- $Name = isset($Attribs['comment']) ? $Attribs['comment'] : $Object->Name; #----------------------------------------------------------------------------- $P = new Tag('P', array('class' => 'NodeName', 'onclick' => SPrintF("TreeSwitch('%s');", $Md5)), new Tag('IMG', array('align' => 'left', 'src' => 'SRC:{Images/Icons/Node.gif}')), new Tag('SPAN', $Name)); #----------------------------------------------------------------------------- $Node = new Tag('DIV', array('class' => 'Node'), $P); #----------------------------------------------------------------------------- if (Count($Attribs)) { #--------------------------------------------------------------------------- foreach (Array_Keys($Attribs) as $AttribID) { $Node->AddChild(new Tag('P', array('class' => 'NodeParam'), new Tag('SPAN', SPrintF('%s: ', $AttribID)), new Tag('SPAN', array('class' => 'NodeParam'), $Attribs[$AttribID]))); } } #----------------------------------------------------------------------------- if (Count($Childs = $Object->Childs)) { #--------------------------------------------------------------------------- $Content = new Tag('DIV', array('style' => 'display:none;'), array('id' => $Md5)); #--------------------------------------------------------------------------- foreach ($Childs as $Child) { $Content->AddChild(XML_Read($Child, $Level + 1)); } #--------------------------------------------------------------------------- $Node->AddChild($Content); } #----------------------------------------------------------------------------- return $Node; }
function &Links() { #----------------------------------------------------------------------------- $Name = Md5('Links'); #----------------------------------------------------------------------------- if (!isset($GLOBALS[$Name])) { $GLOBALS[$Name] = array(); } #----------------------------------------------------------------------------- return $GLOBALS[$Name]; }
function Styles_XML($Element) { /****************************************************************************/ $__args_types = array('string'); #----------------------------------------------------------------------------- $__args__ = Func_Get_Args(); eval(FUNCTION_INIT); /****************************************************************************/ $CacheID = SPrintF('Styles_XML[%s]', Md5($Element)); #----------------------------------------------------------------------------- $Result = CacheManager::get($CacheID); if ($Result) { return $Result; } #----------------------------------------------------------------------------- $HostsIDs = Styles_HostsIDs($Element); if (Is_Error($HostsIDs)) { return ERROR | @Trigger_Error('[Styles_XML]: список хостов содержащих элемент не найдены'); } #----------------------------------------------------------------------------- $Result = array(); #----------------------------------------------------------------------------- foreach (Array_Reverse($HostsIDs) as $HostID) { #--------------------------------------------------------------------------- $Path = SPrintF('%s/styles/%s/%s', SYSTEM_PATH, $HostID, $Element); #--------------------------------------------------------------------------- $File = IO_Read($Path); if (Is_Error($File)) { return ERROR | @Trigger_Error('[Styles_XML]: не удалось прочитать XML-файл'); } #--------------------------------------------------------------------------- $XML = String_XML_Parse($File); if (Is_Exception($XML)) { return ERROR | @Trigger_Error('[Styles_XML]: не удалось разобрать XML-строку'); } #--------------------------------------------------------------------------- $Child = Current($XML->Childs); #--------------------------------------------------------------------------- if (isset($Child->Attribs['recursive'])) { $Result = array(); } #--------------------------------------------------------------------------- $Adding = $XML->ToArray(); #--------------------------------------------------------------------------- $Adding = $Adding['XML']; #--------------------------------------------------------------------------- Array_Union($Result, $Adding); } #----------------------------------------------------------------------------- CacheManager::add($CacheID, $Result); #----------------------------------------------------------------------------- return $Result; }
/** * 数据加密 * @param Array 被加密的源数据值 * @return Array 数据加上加完密的值 */ function encode($vars) { if (constant('DEBUG_API')) { $vars['api_debug'] = 1; } ksort($vars); $verify = ''; foreach ($vars as $key => $v) { $verify .= $v; } $vars['ac'] = Md5($verify . $this->tolken); return $vars; }
function &Args() { #----------------------------------------------------------------------------- $Name = Md5('Args'); #----------------------------------------------------------------------------- if (!isset($GLOBALS[$Name])) { #--------------------------------------------------------------------------- $GLOBALS[$Name] = $_GET; #--------------------------------------------------------------------------- Array_Union($GLOBALS[$Name], $_POST); } #----------------------------------------------------------------------------- return $GLOBALS[$Name]; }
function &Regulars() { #----------------------------------------------------------------------------- $Name = Md5('Regulars'); #----------------------------------------------------------------------------- if (!isset($GLOBALS[$Name])) { #--------------------------------------------------------------------------- $GLOBALS[$Name] = System_XML('config/Regulars.xml'); if (Is_Error($GLOBALS[$Name])) { return ERROR | Trigger_Error('[Regulars]: не удалось загрузить файл регулярных выражений'); } } #----------------------------------------------------------------------------- return $GLOBALS[$Name]; }
function &Messages() { #----------------------------------------------------------------------------- $Name = Md5('Messages'); #----------------------------------------------------------------------------- if (!isset($GLOBALS[$Name])) { #--------------------------------------------------------------------------- $GLOBALS[$Name] = System_XML('config/Messages.xml'); if (Is_Error($GLOBALS[$Name])) { return ERROR | Trigger_Error('[Messages]: не удалось загрузить файл сообщений'); } } #----------------------------------------------------------------------------- return $GLOBALS[$Name]; }
function &Config() { #------------------------------------------------------------------------------- $Name = Md5('Config'); #------------------------------------------------------------------------------- if (!isset($GLOBALS[$Name])) { #------------------------------------------------------------------------------- $GLOBALS[$Name] = System_XML('config/Config.xml'); if (Is_Error($GLOBALS[$Name])) { return ERROR | Trigger_Error('[Config]: не удалось загрузить основную конфигурацию'); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return $GLOBALS[$Name]; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- }
return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $Lines[] = $Comp; #----------------------------------------------------------------------------- $Line[] = SPrintF('%01.2f', $Total); } #------------------------------------------------------------------------------- Array_Splice($Table, 1, 0, array($Lines)); #------------------------------------------------------------------------------- $Comp = Comp_Load('Tables/Extended', $Table); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $NoBody->AddChild($Comp); #------------------------------------------------------------------------------- $File = SPrintF('%s.jpg', Md5('VPSOrdersPlaning1')); #------------------------------------------------------------------------------- Artichow_Line('Планирование поступлений по VPS', SPrintF('%s/%s', $Folder, $File), array($Line), $Labels, array(0x233454)); #------------------------------------------------------------------------------- $NoBody->AddChild(new Tag('BR')); #------------------------------------------------------------------------------- $NoBody->AddChild(new Tag('IMG', array('src' => $File))); #------------------------------------------------------------------------------- $Lines = array(new Tag('TD', array('colspan' => 3), 'Общие поступления')); #------------------------------------------------------------------------------- $Result['DOM'] = $NoBody; #------------------------------------------------------------------------------- return $Result; #-------------------------------------------------------------------------------
return ERROR | @Trigger_Error(500); case 'exception': return new gException('DOMAIN_ORDER_NOT_FOUND', 'Заказ домена не найден'); case 'array': break; default: return ERROR | @Trigger_Error(101); } #------------------------------------------------------------------------------- $WhoIs = WhoIs_Check($DomainOrder['DomainName'], $DomainOrder['SchemeName']); #------------------------------------------------------------------------------- switch (ValueOf($WhoIs)) { case 'error': #------------------------------------------------------------------------------- # JBS-1150 - сохраняем информацию о домене и ошибке в кэше, при повторе - тупо меняем дату обновления данных whois $CacheID = Md5(SPrintF('WhoIs-error-%s.%s', $DomainOrder['DomainName'], $DomainOrder['SchemeName'])); #------------------------------------------------------------------------------- $IsCheck = CacheManager::get($CacheID); #------------------------------------------------------------------------------- if ($IsCheck) { #------------------------------------------------------------------------------- $IsUpdate = DB_Update('DomainOrders', array('UpdateDate' => Time()), array('ID' => $DomainOrder['ID'])); if (Is_Error($IsUpdate)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Event = array('UserID' => $DomainOrder['UserID'], 'PriorityID' => 'Warning', 'Text' => SPrintF('Повторная ошибка получения данных WhoIs для домена %s.%s, проверка пропущена', $DomainOrder['DomainName'], $DomainOrder['SchemeName'])); #------------------------------------------------------------------------------- $Event = Comp_Load('Events/EventInsert', $Event); if (!$Event) { return ERROR | @Trigger_Error(500);
<?php #------------------------------------------------------------------------------- /** @author Alex Keda, for www.host-food.ru */ /******************************************************************************/ /******************************************************************************/ $__args_list = array('Code', 'ID'); /******************************************************************************/ eval(COMP_INIT); /******************************************************************************/ /******************************************************************************/ #Debug("[comp/Services/Orders/ExpirationDateWrapper]: Code = $Code, ID = $ID"); #------------------------------------------------------------------------------- $CacheID = Md5(SPrintF('%s-%s-%s', $__FILE__, $Code, $ID)); #------------------------------------------------------------------------------- $Result = CacheManager::get($CacheID); #------------------------------------------------------------------------------- if ($Result) { return $Result; } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if ($Code == 'Default') { #------------------------------------------------------------------------------- $Table = "OrdersOwners"; #------------------------------------------------------------------------------- $Where = SPrintF('`ID` = %u', $ID); #------------------------------------------------------------------------------- $CompName = "Formats/Order/ExpirationDate"; #------------------------------------------------------------------------------- $ColumnName = 'ExpirationDate';
public function get_sign($parameter) { ksort($parameter); $sign = ""; foreach ($parameter as $key => $value) { $sign .= empty($sign) ? $key . "=" . $value : "&" . $key . "=" . $value; } $sign .= "&appKey=" . $this->app_key; return Md5(Md5($sign)); }
return ERROR | @Trigger_Error(500); case 'exception': 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 'No args...'; } #------------------------------------------------------------------------------- $ArgsIDs = array('PAYMENT_ID', 'PAYEE_ACCOUNT', 'PAYMENT_AMOUNT', 'PAYMENT_UNITS', 'PAYMENT_METAL_ID', 'PAYMENT_BATCH_NUM', 'PAYER_ACCOUNT', 'ACTUAL_PAYMENT_OUNCES', 'USD_PER_OUNCE', 'FEEWEIGHT', 'TIMESTAMPGMT', 'V2_HASH'); #------------------------------------------------------------------------------- foreach ($ArgsIDs as $ArgID) { $Args[$ArgID] = @$Args[$ArgID]; } #------------------------------------------------------------------------------- $Config = Config(); #------------------------------------------------------------------------------- $Settings = $Config['Invoices']['PaymentSystems']['Egold']; #------------------------------------------------------------------------------- $Hash = array($Args['PAYMENT_ID'], $Args['PAYEE_ACCOUNT'], $Args['PAYMENT_AMOUNT'], $Args['PAYMENT_UNITS'], $Args['PAYMENT_METAL_ID'], $Args['PAYMENT_BATCH_NUM'], $Args['PAYER_ACCOUNT'], StrToUpper(Md5($Settings['Hash'])), $Args['ACTUAL_PAYMENT_OUNCES'], $Args['USD_PER_OUNCE'], $Args['FEEWEIGHT'], $Args['TIMESTAMPGMT']); #------------------------------------------------------------------------------- $Hash = StrToUpper(Md5(Implode(':', $Hash))); #------------------------------------------------------------------------------- if ($Hash != $Args['V2_HASH']) { return ERROR | @Trigger_Error('[comp/www/Merchant/Egold]: проверка подлинности завершилась не удачей'); } #------------------------------------------------------------------------------- $Invoice = DB_Select('Invoices', array('ID', 'Summ'), array('UNIQ', 'ID' => $Args['PAYMENT_ID'])); #------------------------------------------------------------------------------- switch (ValueOf($Invoice)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': #--------------------------------------------------------------------------- if (Round($Invoice['Summ'] / $Settings['Course'], 2) != $Args['PAYEE_ACCOUNT']) {
} #------------------------------------------------------------------------------- $Config = $XML->ToArray(); #------------------------------------------------------------------------------- $Config = $Config['XML']; #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Config = array(); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (!isset($Config['CSRFKey']) || !$Config['CSRFKey']) { #------------------------------------------------------------------------------- $Config['CSRFKey'] = Str_Shuffle(Md5(MicroTime() . Rand(0, 1000000))); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (isset($Config['Interface']['Notes'])) { unset($Config['Interface']['Notes']); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (isset($Config['Other']['Libs']['Http'])) { unset($Config['Other']['Libs']['Http']); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (isset($Config['Users']['Register'])) {
/******************************************************************************/ /******************************************************************************/ eval(COMP_INIT); /******************************************************************************/ /******************************************************************************/ $Args = Args(); #------------------------------------------------------------------------------- $IsCreate = (bool) @$Args['IsCreate']; $StartDate = (int) @$Args['StartDate']; $FinishDate = (int) @$Args['FinishDate']; $StatisticsIDs = (array) @$Args['StatisticsIDs']; $Details = (array) @$Args['Details']; $ShowFired = (bool) @$Args['ShowFired']; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $CacheID = Md5($__FILE__); #------------------------------------------------------------------------------- $Result = CacheManager::get($CacheID); if ($Result) { return $Result; } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (Is_Error(System_Load('modules/Authorisation.mod', 'classes/DOM.class.php', 'libs/HTMLDoc.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (!$GLOBALS['__USER']['IsAdmin']) { return ERROR | @Trigger_Error(700); }
#------------------------------------------------------------------------------- $NoBody->AddChild(new Tag('SPAN', SPrintF('Число активных аккаунтов: %s', $Accounts))); $NoBody->AddChild(new Tag('BR')); #------------------------------------------------------------------------------- $NoBody->AddChild(new Tag('SPAN', SPrintF('Число активных платных аккаунтов: %s', $NumPaid))); $NoBody->AddChild(new Tag('BR')); $NoBody->AddChild(new Tag('BR')); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- foreach ($ServersGroups as $ServersGroup) { #------------------------------------------------------------------------------- if (isset($Graphs[$ServersGroup['ID']])) { #------------------------------------------------------------------------------- if (Count($Graphs[$ServersGroup['ID']]['Params']) > 1) { #------------------------------------------------------------------------- $File = SPrintF('%s.jpg', Md5('Income_fin' . $ServersGroup['ID'])); #------------------------------------------------------------------------- Artichow_Pie(SPrintF('Доходы группы %s', $Graphs[$ServersGroup['ID']]['Name']), SPrintF('%s/%s', $Folder, $File), $Graphs[$ServersGroup['ID']]['Params'], $Graphs[$ServersGroup['ID']]['Labels']); #------------------------------------------------------------------------- #$NoBody->AddChild(new Tag('BR')); #------------------------------------------------------------------------- $NoBody->AddChild(new Tag('IMG', array('src' => $File))); #------------------------------------------------------------------------- #$NoBody->AddChild(new Tag('BR')); #------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #-------------------------------------------------------------------------------
#----------------------------------------------------------------------------- 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; }
function String_Xml_Parse($String, $IsUseCache = TRUE) { #------------------------------------------------------------------------------- # костыль для удаления не-UTF8 символов $String = iconv('UTF-8', 'UTF-8//IGNORE', $String); #------------------------------------------------------------------------------- $Length = Mb_StrLen($String); #------------------------------------------------------------------------------- $IsUseCache = $IsUseCache && $Length > 1024; #------------------------------------------------------------------------------- if ($IsUseCache) { #------------------------------------------------------------------------------- $CacheID = SPrintF('String_XML_Parse[%s]', Md5(Crc32($String))); #------------------------------------------------------------------------------- $Result = CacheManager::get($CacheID); if ($Result) { return $Result; } } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- Debug(SPrintF('[String_XML_Parse]: парсирование строки (%u bytes)', $Length)); #------------------------------------------------------------------------------- $XmlParser = Xml_Parser_Create('UTF-8'); #------------------------------------------------------------------------------- if (!Xml_Parser_Set_Option($XmlParser, XML_OPTION_CASE_FOLDING, FALSE)) { return ERROR | Trigger_Error('[String_Xml_Parse]: не удалось установить опцию парсирования (XML_OPTION_CASE_FOLDING)'); } #------------------------------------------------------------------------------- if (!Xml_Parser_Set_Option($XmlParser, XML_OPTION_SKIP_WHITE, FALSE)) { return ERROR | Trigger_Error('[String_Xml_Parse]: не удалось установить опцию парсирования (XML_OPTION_SKIP_WHITE)'); } #------------------------------------------------------------------------------- if (!Xml_Parse_Into_Struct($XmlParser, $String, $Nodes)) { #------------------------------------------------------------------------------- $ByteIndex = Xml_Get_Current_Byte_Index($XmlParser); #------------------------------------------------------------------------------- Debug(SPrintF('[system/libs/auto/String.php]: xml_error_string = %s', Xml_Error_String(Xml_Get_Error_Code($XmlParser)))); #------------------------------------------------------------------------------- Debug(SPrintF('[system/libs/auto/String.php]: %s', Mb_SubStr($String, $ByteIndex - 100, $ByteIndex + 100))); #------------------------------------------------------------------------------- $Buffer = Mb_SubStr($String, 0, $ByteIndex); #------------------------------------------------------------------------------- $Line = Preg_Match_All("/(\r\n|\n)/sU", $Buffer, $Matches) + 1; #------------------------------------------------------------------------------- return new gException('XML_PARSE_ERROR', SPrintF('%s в линии %u', Xml_Error_String($XmlParser), $Line)); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- #----------------------------------------------------------------------------- Xml_Parser_Free($XmlParser); #----------------------------------------------------------------------------- $Root = new Tag('__ROOT__'); #----------------------------------------------------------------------------- $Links = array(&$Root); #----------------------------------------------------------------------------- foreach ($Nodes as $Node) { #--------------------------------------------------------------------------- $Current = $Links[Count($Links) - 1]; #--------------------------------------------------------------------------- switch ($Node['type']) { case 'open': #----------------------------------------------------------------------- $Tag = new Tag($Node['tag']); #----------------------------------------------------------------------- if (isset($Node['attributes'])) { $Tag->AddAttribs($Node['attributes']); } #----------------------------------------------------------------------- if (isset($Node['value'])) { #--------------------------------------------------------------------- $Value = $Node['value']; #--------------------------------------------------------------------- if (Trim($Value)) { $Tag->AddChild(new Tag('CDATA', $Value)); } } #----------------------------------------------------------------------- $Current->Childs[] = $Tag; #----------------------------------------------------------------------- $Links[] =& $Current->Childs[Count($Current->Childs) - 1]; break; case 'cdata': #----------------------------------------------------------------------- $Value = $Node['value']; #----------------------------------------------------------------------- if (Trim($Value)) { #--------------------------------------------------------------------- $Tag = new Tag('CDATA', $Value); #--------------------------------------------------------------------- $Current->Childs[] = $Tag; } break; case 'complete': #----------------------------------------------------------------------- $Tag = new Tag($Node['tag']); #----------------------------------------------------------------------- if (isset($Node['attributes'])) { $Tag->AddAttribs($Node['attributes']); } #----------------------------------------------------------------------- if (isset($Node['value'])) { $Tag->AddText($Node['value']); } #----------------------------------------------------------------------- $Current->Childs[] = $Tag; break; case 'close': Array_Pop($Links); break; default: # No more... } } #----------------------------------------------------------------------------- if ($IsUseCache) { CacheManager::add($CacheID, $Root); } #----------------------------------------------------------------------------- return $Root; }
$Notes = $Result; #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Notes = Comp_Load($Path); if (Is_Error($Notes)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- CacheManager::add($CacheID, $Notes, 60); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- foreach ($Notes as $Note) { #------------------------------------------------------------------------------- $MessageID = SPrintF('note_%s_%s', $GLOBALS['__USER']['ID'], SubStr(Md5(JSON_Encode($Note)), 0, 6)); #------------------------------------------------------------------------------- if (isset($_COOKIE[$MessageID])) { continue; } #------------------------------------------------------------------------------- $Comp = Comp_Load('Information', $Note, 'Warning', $MessageID); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Table->AddChild(new Tag('TR', new Tag('TD', $Comp))); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- }
function QueryForAccBalance($cfg, $user_id, $post_url) { $merchant_id = $cfg['merchant_id']; $terminal_id = $cfg['terminal_id']; $key = $cfg['key']; $iv = $cfg['iv']; /* 请求参数 */ $strxml = "<?xml version='1.0' encoding='UTF-8'?>" . "<custody_req>" . "<merchant_id>" . $merchant_id . "</merchant_id>" . "<user_id>" . $user_id . "</user_id>" . "</custody_req>"; $strxml = preg_replace("/[\\s]{2,}/", "", $strxml); //去除空格、回车、换行等空白符 $requestParams = str_replace('\\', '', $strxml); //去除转义反斜杠\ $sign = md5($requestParams . "~|~" . $key); //$aes=new MyAES(); //$requestParams=$aes->encrypt($requestParams,$key,$iv); //加密 //PHP提交POST $post_data = array("merchant_id" => $merchant_id, "terminal_id" => $terminal_id, "sign" => $sign, "requestParams" => $requestParams); /* $baofoo_log = array(); $baofoo_log['code'] = 'accountBalance'; $baofoo_log['create_date'] = to_date(TIME_UTC,'Y-m-d H:i:s'); $baofoo_log['strxml'] =$requestParams; $baofoo_log['html'] = print_r($post_data,true); $GLOBALS['db']->autoExecute(DB_PREFIX."baofoo_log",$baofoo_log); */ $resultStr = httpRequestPOST($post_url . "custody/accountBalance.do", $post_data); //print($result); if (empty($resultStr)) { $result = array(); $result['pErrCode'] = 9999; $result['pErrMsg'] = '返回出错'; $result['pIpsAcctNo'] = ''; $result['pBalance'] = 0; $result['pLock'] = 0; $result['pNeedstl'] = 0; } else { require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php'; $str3ParaInfo = @XML_unserialize($resultStr); //print_r($str3ParaInfo); $str3Req = $str3ParaInfo['crs']; $sign = $str3Req["sign"]; $Md5sign = Md5($str3Req["code"] . '~|~' . $str3Req["balance"] . '~|~' . $key); if ($sign == $Md5sign) { $result = array(); $result['pErrCode'] = '0000'; $result['pErrMsg'] = $str3Req["msg"]; $result['pIpsAcctNo'] = $user_id; $result['pBalance'] = $str3Req["balance"]; $result['pLock'] = 0; $result['pNeedstl'] = 0; // $str3Req["availableAmount"]; } else { $result = array(); $result['pErrCode'] = $str3Req["code"]; $result['pErrMsg'] = '签名验证失败'; $result['pIpsAcctNo'] = ''; $result['pBalance'] = 0; $result['pLock'] = 0; $result['pNeedstl'] = 0; } } return $result; /* * <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <response platformNo="10040011137"> <code>1</code> <description>操作成功</description> <memberType>PERSONAL</memberType> <activeStatus>ACTIVATED</activeStatus> <balance>9980.98</balance> <availableAmount>9980.98</availableAmount> <freezeAmount>0.00</freezeAmount> <cardNo>********5512</cardNo> <cardStatus>VERIFIED</cardStatus> <bank>CCB</bank> <autoTender>false</autoTender> </response> */ }
#------------------------------------------------------------------------------- foreach ($PaymentSystems as $PaymentSystem) { $SystemCode = $PaymentSystem['PaymentSystemID']; $Comp = Comp_Load('Formats/String', $Settings[$SystemCode]['Name'], 6); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } $Tr->AddChild(new Tag('TD', array('class' => 'Head', 'align' => 'center', 'style' => 'white-space: nowrap;'), $Comp)); } $Table[] = $Tr; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Months = array('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'); foreach ($Months as $Month) { #------------------------------------------------------------------------------- $CacheID1 = Md5($__FILE__ . $Year . $Month); #------------------------------------------------------------------------------- $Result = CacheManager::get($CacheID1); if ($Result && $Year != Date('Y', Time()) && $Month != Date('m', Time())) { $Table[] = $Result; } else { Debug("[comp/www/Administrator/PaymentsSystemsStatistics]: period is {$Year} {$Month}"); $TimeBegin = MkTime(0, 0, 0, $Month, 1, $Year); $LastDayOfMonth = date('d', mktime(0, 0, 0, $Month + 1, 0, $Year)); $TimeEnd = MkTime(23, 59, 59, $Month, $LastDayOfMonth, $Year); #------------------------------------------------------------------------------- $Tr = new Tag('TR'); #------------------------------------------------------------------------------- # ячейка с датой $Tr->AddChild(new Tag('TD', array('align' => 'center', 'class' => 'Standard'), $Year . "-" . $Month . "-" . $LastDayOfMonth)); #-------------------------------------------------------------------------------
$Send['URL_RETURN'] = SPrintF('%s://%s/Invoices', $Protocol, HOST_ID); $Send['URL_RETURN_OK'] = SPrintF('%s://%s/Invoices', $Protocol, HOST_ID); $Send['URL_RETURN_NO'] = SPrintF('%s://%s/Invoices?Error=yes', $Protocol, HOST_ID); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # а ещё в люобй форме есть CSRF #$Send['CSRF'] = $GLOBALS['CSRF']; #------------------------------------------------------------------------------- # мыло юзера $Send['Email'] = $__USER['Email']; #------------------------------------------------------------------------------- # и телефон, если есть if ($__USER['Params']['NotificationMethods']['SMS']['Address']) { $Send['Phone'] = $__USER['Params']['NotificationMethods']['SMS']['Address']; } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Array = array($Send['Shop_IDP'], $Send['Order_IDP'], $Send['Subtotal_P'], '', '', '', '', '', '', '', $Settings['Hash']); #------------------------------------------------------------------------------- $Hash = array(); #------------------------------------------------------------------------------- foreach ($Array as $Value) { $Hash[] = Md5($Value); } #------------------------------------------------------------------------------- $Send['Signature'] = StrToUpper(Md5(Implode("&", $Hash))); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return $Send; #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
function notify($request, $class_act) { //print_r($_POST); //print_r($_GET); //print_r($_REQUEST); //print_r($request); /* if ($class_act == 'DoLoans'){ require_once(APP_ROOT_PATH.'system/collocation/baofoo/DoLoans.php'); $str3Req = array(); $str3Req['order_id'] = 17022; $str3Req['code'] = 'CSD000'; print_r(DoLoansCallBack($str3Req)); exit; }*/ $merchant_id = $this->cfg['merchant_id']; $terminal_id = $this->cfg['terminal_id']; $key = $this->cfg['key']; $iv = $this->cfg['iv']; $baofoo_log = array(); $baofoo_log['code'] = 'notify'; $baofoo_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s'); $baofoo_log['strxml'] = $class_act; $baofoo_log['html'] = print_r($_POST, true); $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_log", $baofoo_log); //exit; $Md5sign = ""; if ($class_act == 'CreateNewAcct' || $class_act == 'DoDpTrade' || $class_act == 'DoDwTrade') { //Md5sign = Md5(result + ~|~ + "商户密钥") $result = $_POST["result"]; $sign = $_POST["sign"]; $Md5sign = Md5($result . '~|~' . $key); require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php'; $str3ParaInfo = @XML_unserialize($result); $str3Req = $str3ParaInfo['crs']; } else { if ($class_act == 'RegisterCreditor' || $class_act == 'DoBids' || $class_act == 'DoLoans') { require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php'; $result = $_POST["result"]; $str3ParaInfo = @XML_unserialize($result); $str3Req = $str3ParaInfo['crs']; //print_r($str3ParaInfo);exit; //Sign = MD5 ( code + ~|~ + msg + ~|~ + orderId + ~|~+商户秘钥 ); $Md5sign = Md5($str3Req['code'] . '~|~' . $str3Req['msg'] . '~|~' . $str3Req['order_id'] . '~|~' . $key); $sign = $str3Req["sign"]; } } if ($Md5sign == $sign) { //echo "<br/>验签通过";exit; // $pErrMsg = $str3Req['msg']; if ($class_act == 'CreateNewAcct') { require_once APP_ROOT_PATH . 'system/collocation/baofoo/CreateNewAcct.php'; $user_type = CreateNewAcctCallBack($str3Req); } else { if ($class_act == 'DoDpTrade') { require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoDpTrade.php'; DoDpTradeCallBack($str3Req); } else { if ($class_act == 'DoDwTrade') { require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoDwTrade.php'; DoDwTradeCallBack($str3Req); } else { if ($class_act == 'RegisterCreditor') { //投资,登记债权人 require_once APP_ROOT_PATH . 'system/collocation/baofoo/RegisterCreditor.php'; $ipsdata = RegisterCreditorCallBack($str3Req); } else { if ($class_act == 'DoLoans') { //满标放款 require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoLoans.php'; DoLoansCallBack($str3Req); } else { if ($class_act == 'DoBids') { //流标 require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoBids.php'; DoBidsCallBack($str3Req); } } } } } } } else { echo "<br/>验签不通过"; exit; } }
/******************************************************************************/ if (Is_Error(System_Load('modules/Authorisation.mod', 'classes/Session.class.php'))) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Session = new Session((string) @$_COOKIE['SessionID']); #------------------------------------------------------------------------------- if (Is_Error($Session->Delete())) { return ERROR | @Trigger_Error(400); } #------------------------------------------------------------------------------- if (!SetCookie('SessionID', 'closed', Time(), '/')) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Event = array('UserID' => $GLOBALS['__USER']['ID'], 'Text' => 'Пользователь вышел из системы'); #------------------------------------------------------------------------------- $Event = Comp_Load('Events/EventInsert', $Event); if (!$Event) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- CacheManager::add(Md5(SPrintF('LastLogon_%s', $GLOBALS['__USER']['Email'])), FALSE, 1); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return array('Status' => 'Ok'); #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
return ERROR | @Trigger_Error(500); } #----------------------------------------------------------------------------- $Lines[] = $Comp; #----------------------------------------------------------------------------- $Line[] = SPrintF('%01.2f', $Total); } #------------------------------------------------------------------------------- Array_Splice($Table, 1, 0, array($Lines)); #------------------------------------------------------------------------------- $Comp = Comp_Load('Tables/Extended', $Table); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $NoBody->AddChild($Comp); #------------------------------------------------------------------------------- $File = SPrintF('%s.jpg', Md5('ExtraIPOrdersPlaning1')); #------------------------------------------------------------------------------- Artichow_Line('Планирование поступлений по ExtraIP', SPrintF('%s/%s', $Folder, $File), array($Line), $Labels, array(0x233454)); #------------------------------------------------------------------------------- $NoBody->AddChild(new Tag('BR')); #------------------------------------------------------------------------------- $NoBody->AddChild(new Tag('IMG', array('src' => $File))); #------------------------------------------------------------------------------- $Lines = array(new Tag('TD', array('colspan' => 3), 'Общие поступления')); #------------------------------------------------------------------------------- $Result['DOM'] = $NoBody; #------------------------------------------------------------------------------- return $Result; #-------------------------------------------------------------------------------
/** @author Великодный В.В. (Joonte Ltd.) */ /******************************************************************************/ /******************************************************************************/ $__args_list = array('PaymentSystemID', 'InvoiceID', 'Summ'); /******************************************************************************/ eval(COMP_INIT); /******************************************************************************/ /******************************************************************************/ $Config = Config(); #------------------------------------------------------------------------------- $Settings = $Config['Invoices']['PaymentSystems']['Yandex']; #------------------------------------------------------------------------------- $Send = $Settings['Send']; #------------------------------------------------------------------------------- $Send['Sum'] = Round($Summ / $Settings['Course'], 2); #------------------------------------------------------------------------------- $Send['customerNumber'] = $GLOBALS['__USER']['ID']; #------------------------------------------------------------------------------- $Send['orderNumber'] = $InvoiceID; #------------------------------------------------------------------------------- $Comp = Comp_Load('Formats/Invoice/Number', $InvoiceID); if (Is_Error($Comp)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- $Md5 = array($Send['Sum'], $Send['CurrencyID'], $Send['BankID'], $Send['ShopID'], $Send['orderNumber'], $Send['customerNumber'], $Settings['Hash']); #------------------------------------------------------------------------------- $Send['md5'] = Md5(Implode(';', $Md5)); #------------------------------------------------------------------------------- return $Send; #-------------------------------------------------------------------------------
function __Error_Handler__($Number, $Error, $File, $Line) { #------------------------------------------------------------------------------- $Message = SPrintF('[!!%s]-%s в линии %s файла %s', $Number, $Error, $Line, $File); #------------------------------------------------------------------------------- $__ERR_CODE =& $GLOBALS['__ERR_CODE']; #------------------------------------------------------------------------------- if ((int) $Error && $__ERR_CODE == 100) { $__ERR_CODE = $Error; } #------------------------------------------------------------------------------- Debug(SPrintF('[!] %s', $Message)); //Debug(SPrintF('[!] %s',debug_print_backtrace())); #------------------------------------------------------------------------------- //Error_Reporting(E_ALL); #------------------------------------------------------------------------------- if (Error_Reporting()) { #------------------------------------------------------------------------------- $JBsErrorID = SPrintF('%s[%s]', HOST_ID, Md5(Implode(':', array($Number, $Error, $Line, $File)))); #------------------------------------------------------------------------------- $__SYSLOG =& $GLOBALS['__SYSLOG']; #------------------------------------------------------------------------------- $Log = Implode("\n", $__SYSLOG); #------------------------------------------------------------------------------- Report($JBsErrorID, $JBsErrorID); #------------------------------------------------------------------------------- foreach (array(SYSTEM_PATH, '/tmp') as $Folder) { #------------------------------------------------------------------------------- $Path = SPrintF('%s/jbs-errors.log', $Folder); #------------------------------------------------------------------------------- if (File_Exists($Path)) { if (FileSize($Path) > 1024 * 1024) { UnLink($Path); } } #------------------------------------------------------------------------------- umask(077); #------------------------------------------------------------------------------- if (!@File_Put_Contents($Path, SPrintF("%s\n\n%s\n\n", $JBsErrorID, $Log), FILE_APPEND)) { #------------------------------------------------------------------------------- Debug(SPrintF('[__Error_Handler__]: не удалось осуществить запись ошибки в системный лог (%s)', $Path)); #------------------------------------------------------------------------------- continue; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- break; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- if (File_Exists(SPrintF('%s/DEBUG.OUT', SYSTEM_PATH)) || !isset($_SERVER["REMOTE_PORT"])) { #------------------------------------------------------------------------------- exit($Log); } else { #------------------------------------------------------------------------------- $Errors = array(100 => 'Ошибка выполнения', 101 => 'Неизвестный результат', 201 => 'Неверные параметры', 400 => 'Ошибка данных', 500 => 'Системная ошибка', 600 => 'Ошибка политики безопасности', 601 => 'Неверный реферер', 602 => 'Отсутствует реферер', 603 => 'Неверный ключ CSRF', 700 => 'Нарушение политики прав'); #------------------------------------------------------------------------------- $FilePath = SPrintF('%s/hosts/root/templates/modules/Trigger.Error.html', SYSTEM_PATH); #------------------------------------------------------------------------------- if (Is_Readable($FilePath)) { #------------------------------------------------------------------------------- $Result = @File_Get_Contents($FilePath); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $Result = SPrintF("Cannot read error file: %s<BR />\nError: %%s<BR />\n<!--%%s-->\nErrorID: %%s\n<!--%%s-->", $FilePath); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $String = SPrintF('%s (%s)', $Errors[$__ERR_CODE], $__ERR_CODE); #------------------------------------------------------------------------------- @Header(SPrintF('JBs-ErrorID: %s', $JBsErrorID)); #------------------------------------------------------------------------------- if (isset($_POST['XMLHttpRequest'])) { #------------------------------------------------------------------------------- $Answer = array('Error' => array('CodeID' => $__ERR_CODE, 'String' => $String), 'Status' => 'Error'); #------------------------------------------------------------------------------- exit(JSON_Encode($Answer)); #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- exit(SPrintF($Result, $String, $String, $JBsErrorID, Date('Y', Time()))); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- }
return "No args...\n"; } #------------------------------------------------------------------------------- $ArgsIDs = array('Order_ID', 'Status', 'Signature'); #------------------------------------------------------------------------------- foreach ($ArgsIDs as $ArgID) { $Args[$ArgID] = @$Args[$ArgID]; } #------------------------------------------------------------------------------- $OrderID = $Args['Order_ID']; #------------------------------------------------------------------------------- $Config = Config(); #------------------------------------------------------------------------------- $Settings = $Config['Invoices']['PaymentSystems']['Uniteller']; #------------------------------------------------------------------------------- if ($Args['Signature'] != StrToUpper(Md5($Args['Order_ID'] . $Args['Status'] . $Settings['Hash']))) { return ERROR | @Trigger_Error('[comp/www/Merchant/Uniteller]: проверка подлинности завершилась не удачей'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Invoice = DB_Select('InvoicesOwners', array('ID', 'UserID', 'Summ', 'ContractID'), array('UNIQ', 'ID' => $OrderID)); #------------------------------------------------------------------------------- switch (ValueOf($Invoice)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array': break; default: return ERROR | @Trigger_Error(101);
#------------------------------------------------------------------------------- $Rows = DB_Select($Table, array('ID', 'Password')); #------------------------------------------------------------------------------- switch (ValueOf($Rows)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': # No more... break; case 'array': #------------------------------------------------------------------------------- foreach ($Rows as $Row) { #------------------------------------------------------------------------- $Password = Crypt_Decode1($Row['Password'], isset($OldEncryptionKey) ? $OldEncryptionKey : HOST_ID); if (Is_Error($Password)) { $Password = SubStr(Md5(MicroTime()), 0, 5); } Debug(SPrintF("[patches/hosting/files/1000011.php]: Password Decoded = %s", $Password)); #------------------------------------------------------------------------- $Password = Crypt_Encode1($Password, $Config['EncryptionKey']); if (Is_Error($Password)) { return ERROR | @Trigger_Error(500); } Debug(SPrintF("[patches/hosting/files/1000011.php]: Password Encoded = %s", $Password)); #------------------------------------------------------------------------- $IsUpdate = DB_Update($Table, array('Password' => $Password), array('ID' => $Row['ID'])); if (Is_Error($IsUpdate)) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- }