public static function __BuildTree($arPath, &$arTree, &$arComponent, $level = 1) { $arBXTopComponentCatalogLevel = array("content", "service", "communication", "e-store", "utility"); $arBXTopComponentCatalogLevelSort = array(600, 700, 800, 900, 1000); if (!is_array($arTree["#"])) { $arTree["#"] = array(); } if (!array_key_exists($arPath["ID"], $arTree["#"])) { $arTree["#"][$arPath["ID"]] = array(); $arTree["#"][$arPath["ID"]]["@"] = array(); $arTree["#"][$arPath["ID"]]["@"]["NAME"] = ""; $arTree["#"][$arPath["ID"]]["@"]["SORT"] = IntVal($arPath["SORT"]); if ($level == 1 && in_array($arPath["ID"], $arBXTopComponentCatalogLevel)) { $arTree["#"][$arPath["ID"]]["@"]["NAME"] = GetMessage("VRT_COMP_CAT_" . StrToUpper($arPath["ID"])); $arTree["#"][$arPath["ID"]]["@"]["SORT"] = IntVal($arBXTopComponentCatalogLevelSort[array_search($arPath["ID"], $arBXTopComponentCatalogLevel)]); } if (strlen($arTree["#"][$arPath["ID"]]["@"]["NAME"]) <= 0) { $arTree["#"][$arPath["ID"]]["@"]["NAME"] = $arPath["NAME"]; } if ($arTree["#"][$arPath["ID"]]["@"]["SORT"] <= 0) { $arTree["#"][$arPath["ID"]]["@"]["SORT"] = 100; } } if (array_key_exists("CHILD", $arPath)) { CComponentUtil::__BuildTree($arPath["CHILD"], $arTree["#"][$arPath["ID"]], $arComponent, $level + 1); } else { if (!is_array($arTree["#"][$arPath["ID"]]["*"])) { $arTree["#"][$arPath["ID"]]["*"] = array(); } $arTree["#"][$arPath["ID"]]["*"][$arComponent["NAME"]] = $arComponent; } }
function CleanUpElem(&$elem_name, &$cfg_file, &$template) { // Fixes HEX strings to look like 0xABCDEF12345 rather than 0Xabc or 0xaf if (Preg_Match("/(0x)([a-fA-F0-9]+)/i", $elem_name, $matches)) { $elem_name = Preg_Replace("/(0x)([a-fA-F0-9]+)/i", "0x" . StrToUpper($matches[2]), $elem_name); } print " Cleaning up elem '{$elem_name}'\n"; $cfg_elem = FindConfigElem($cfg_file, $elem_name); $cfg_elem = array_change_key_case($cfg_elem, CASE_LOWER); $new_elem = array(); $last_label = 0; foreach ($template as $indice => $line) { if (Preg_Match('/\\[Label=([[:alnum:][:space:][:punct:]]+)\\]/', $line, $matches)) { if ($last_label) { unset($new_elem[$last_label]); } $matches[1] = Preg_Replace("/%s/i", " ", $matches[1]); $line = "//{$matches[1]}"; if ($indice > 1) { $line = "\n\t{$line}"; } $last_label = $line; $new_elem[$line] = array(""); continue; } else { $property = StrToLower($line); if ($cfg_elem[$property]) { $new_elem[$line] = $cfg_elem[$property]; unset($cfg_elem[$property]); $last_label = 0; } } } if (Count($cfg_elem) > 0) { $new_elem["\n\t//Custom Values"] = array(""); // Lines not in the template go at the end as custom values foreach ($cfg_elem as $key => $value) { $new_elem[$key] = $value; } } if ($last_label) { unset($new_elem[$last_label]); } return $new_elem; }
function text_to_morse($msg) { global $fwd_morse; $msg = StrToUpper($msg); $words = preg_split("/\\s+/", $msg); $words_out = array(); foreach ($words as $word) { $bits = array(); for ($i = 0; $i < strlen($word); $i++) { $temp = $fwd_morse[substr($word, $i, 1)]; if ($temp) { $bits[] = $temp; } } $words_out[] = implode(' ', $bits); } return implode(' / ', $words_out); }
function HexToRGB($color) { // Delete the # symbol $input = Trim(Str_Replace("#", "", StrToUpper($color))); // Get every single number-letter $a = $this->_convertToDecimal($input[0]); $b = $this->_convertToDecimal($input[1]); $c = $this->_convertToDecimal($input[2]); $d = $this->_convertToDecimal($input[3]); $e = $this->_convertToDecimal($input[4]); $f = $this->_convertToDecimal($input[5]); // Build the RGB code $r = $a * 16 + $b; $g = $c * 16 + $d; $b = $e * 16 + $f; // Put R, G and B in an array for separate use $RGB = array($r, $g, $b); return $RGB; }
function simple_row($img_key, $shorts, $props) { $vars = $GLOBALS['catalog_vars'][$img_key]; if (!is_array($vars)) { $vars = array(); } foreach ($vars as $k => $v) { $vars[$k] = StrToUpper($v); } if (!is_array($shorts)) { $shorts = array(); } $short = count($shorts) ? $shorts[0] : null; $ret = array('name' => null, 'unified' => null, 'variations' => $vars, 'docomo' => null, 'au' => null, 'softbank' => null, 'google' => null, 'image' => $img_key . '.png', 'sheet_x' => 0, 'sheet_y' => 0, 'short_name' => $short, 'short_names' => $shorts, 'text' => $GLOBALS['text'][$short], 'apple_img' => file_exists("{$GLOBALS['dir']}/../gemoji/images/emoji/unicode/{$img_key}.png"), 'hangouts_img' => file_exists("{$GLOBALS['dir']}/../img-hangouts-64/{$img_key}.png"), 'twitter_img' => file_exists("{$GLOBALS['dir']}/../img-twitter-72/{$img_key}.png")); foreach ($props as $k => $v) { $ret[$k] = $v; } return $ret; }
function find_flags($path) { $files = glob($path); $cps = array(); foreach ($files as $file) { $bits = explode('/', $file); $bits = explode('.', array_pop($bits)); $cp = StrToUpper(array_shift($bits)); $cps[] = $cp; } $out = array(); foreach ($cps as $cp) { if (!strlen($cp)) { continue; } list($a, $b) = explode('-', $cp); $a = hexdec($a) - 0x1f1e6; $b = hexdec($b) - 0x1f1e6; $a = chr(ord('a') + $a); $b = chr(ord('a') + $b); $out[] = "{$cp};flag-{$a}{$b}\n"; } return $out; }
} $arParams["PATH_TO_SMILE"] = trim($arParams["PATH_TO_SMILE"]); $arParams["USER_ID"] = IntVal($arParams["USER_ID"]); if ($arParams["USER_ID"] <= 0) { ShowError(GetMessage("SONET_ACTIVITY_NO_USER")); return; } $arParams["NAME_TEMPLATE"] = $arParams["NAME_TEMPLATE"] ? $arParams["NAME_TEMPLATE"] : CSite::GetNameFormat(); $arParams["NAME_TEMPLATE_WO_NOBR"] = str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]); $bUseLogin = $arParams["SHOW_LOGIN"] != "N" ? true : false; $arSocNetFeaturesSettings = CSocNetAllowed::GetAllowedFeatures(); $arParams["LOG_DATE_DAYS"] = IntVal($arParams["LOG_DATE_DAYS"]); if ($arParams["LOG_DATE_DAYS"] <= 0) { $arParams["LOG_DATE_DAYS"] = 7; } $arParams["AUTH"] = StrToUpper($arParams["AUTH"]) == "Y" ? "Y" : "N"; $arParams["EVENT_ID"] = array_key_exists("EVENT_ID", $arParams) && strlen($arParams["EVENT_ID"]) > 0 ? $arParams["EVENT_ID"] : false; $arParams["LOG_CNT"] = array_key_exists("LOG_CNT", $arParams) && intval($arParams["LOG_CNT"]) > 0 ? $arParams["LOG_CNT"] : 0; if ($arParams["USER_ID"] <= 0) { ShowError(GetMessage("SONET_ACTIVITY_NO_USER")); return; } $bCurrentUserIsAdmin = CSocNetUser::IsCurrentUserModuleAdmin(); $dbUser = CUser::GetByID($arParams["USER_ID"]); if ($arUser = $dbUser->Fetch()) { $canViewProfile = CSocNetUserPerms::CanPerformOperation($GLOBALS["USER"]->GetID(), $arUser["ID"], "viewprofile", $bCurrentUserIsAdmin); if ($canViewProfile) { $arResult["Features"] = array("all", "system", "system_groups"); if (CSocnetUser::IsFriendsAllowed()) { $arResult["Features"][] = "system_friends"; }
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']) {
function GetUserLogEvents($userID, $arFilter = array()) { global $DB; $userID = IntVal($userID); if ($userID <= 0) { return false; } $strWhere = ""; if (is_array($arFilter) && count($arFilter) > 0) { foreach ($arFilter as $key => $value) { switch ($key) { case "ENTITY_TYPE": $strWhere .= " AND L.ENTITY_TYPE = '" . $DB->ForSql($value, 1) . "' "; break; case "ENTITY_ID": $strWhere .= " AND L.ENTITY_ID = " . IntVal($value) . " "; break; case "EVENT_ID": if (!is_array($value)) { $strWhere .= " AND L.EVENT_ID = '" . $DB->ForSql($value, 50) . "' "; } else { if (!function_exists('__tmp_str_apos')) { function __tmp_str_apos(&$tmpval, $tmpind) { if (strlen($tmpval) > 0) { $tmpval = "'" . $GLOBALS["DB"]->ForSql($tmpval, 50) . "'"; } } } array_walk($value, '__tmp_str_apos'); $strWhere .= " AND L.EVENT_ID IN (" . implode(", ", $value) . ") "; } break; case "LOG_DATE_DAYS": $strWhere .= " AND L.LOG_DATE >= DATE_SUB(NOW(), INTERVAL " . IntVal($value) . " DAY) "; break; case "SITE_ID": if (!is_array($value)) { $strWhere .= " AND L.SITE_ID = '" . $DB->ForSql($value, 2) . "' "; } else { $counter = 0; $strWhere .= " AND ("; foreach ($value as $site_id) { if ($site_id === false) { $strWhere .= ($counter > 0 ? " OR" : "") . " L.SITE_ID IS NULL "; } else { $strWhere .= ($counter > 0 ? " OR" : "") . " L.SITE_ID = '" . $DB->ForSql($site_id, 2) . "' "; } $counter++; } $strWhere .= ") "; } break; } } } $strSql = "SELECT L.ID, L.ENTITY_TYPE, L.ENTITY_ID, L.EVENT_ID, L.LOG_DATE, L.SITE_ID as SITE_ID, " . "\t" . $DB->DateToCharFunction("L.LOG_DATE", "FULL") . " as LOG_DATE_FORMAT, " . "\tL.TITLE_TEMPLATE, L.TITLE, L.MESSAGE, L.URL, L.MODULE_ID, L.CALLBACK_FUNC, " . "\tG.NAME as GROUP_NAME, G.OWNER_ID as GROUP_OWNER_ID, G.INITIATE_PERMS as GROUP_INITIATE_PERMS, " . "\tG.VISIBLE as GROUP_VISIBLE, G.OPENED as GROUP_OPENED, " . "\tU.NAME as USER_NAME, U.LAST_NAME as USER_LAST_NAME, U.SECOND_NAME as USER_SECOND_NAME, U.LOGIN as USER_LOGIN " . "FROM b_sonet_log L "; if (!Array_Key_Exists("ALL", $arFilter) || StrToUpper($arFilter["ALL"]) != "Y") { $strSql .= "\tINNER JOIN b_sonet_log_events LE " . "\t\tON (L.ENTITY_TYPE = LE.ENTITY_TYPE AND L.ENTITY_ID = LE.ENTITY_ID AND (L.EVENT_ID = LE.EVENT_ID OR ((L.EVENT_ID = 'blog_post' OR L.EVENT_ID = 'blog_comment' OR L.EVENT_ID = 'blog_post_micro') AND LE.EVENT_ID = 'blog'))) "; } $strSql .= "\tLEFT JOIN b_sonet_group G " . "\t\tON (L.ENTITY_TYPE = 'G' AND L.ENTITY_ID = G.ID) " . "\tLEFT JOIN b_user U " . "\t\tON (L.ENTITY_TYPE = 'U' AND L.ENTITY_ID = U.ID) " . "WHERE 1 = 1 "; if (!Array_Key_Exists("ALL", $arFilter) || StrToUpper($arFilter["ALL"]) != "Y") { $strSql .= "\tAND LE.USER_ID = " . $userID . " "; } $strSql .= $strWhere . "ORDER BY L.LOG_DATE DESC"; $dbRes = $DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__); return $dbRes; }
$value1 = $value; $value = array(); foreach ($value1 as $val) { if (Is_Array($val) && Count($val) > 0 || !Is_Array($val) && StrLen($val) > 0) { $value[] = $val; } } if (Count($value) <= 0) { continue; } } else { if (StrLen($value) <= 0) { continue; } } $keyTmp = StrToUpper(SubStr($key, 4)); if ($keyTmp == "FIO") { $arFilter["NAME"] = $value; $arResult["ShowResults"] = true; $bFilter = true; } elseif (array_key_exists($keyTmp, $arUserProps)) { if (in_array($keyTmp, $arParams["USER_FIELDS_SEARCHABLE"])) { if ($keyTmp == "PERSONAL_BIRTHDAY") { $arFilter["PERSONAL_BIRTHDAY_1"] = $value; $arFilter["PERSONAL_BIRTHDAY_2"] = $value; } elseif ($keyTmp == "PERSONAL_BIRTHDAY_YEAR") { $arFilter["PERSONAL_BIRTHDAY_1"] = ConvertTimeStamp(mktime(0, 0, 0, 0, 0, $value), "SHORT", SITE_ID); $arFilter["PERSONAL_BIRTHDAY_2"] = ConvertTimeStamp(mktime(0, 0, 0, 12, 31, $value), "SHORT", SITE_ID); } elseif ($keyTmp == "PERSONAL_BIRTHDAY_DAY") { $arFilter["PERSONAL_BIRTHDAY_DATE"] = $value; } else {
<?php $data = "1507EUREWTI TICKETS GROBKHAN INC3518660http://127.0.0.1:8001/reg/invoice_buy/hobex_paid/"; $key = "a86zx39tk24bn51dc07go19ps5"; print "'" . $data . $key . "'\n"; $hash = StrToUpper(SHA1($data . $key)); print $hash . "\n"; $hash = StrToUpper(SHA1(StrToUpper($data . $key))); print $hash . "\n";
#------------------------------------------------------------------------------- $ArgsIDs = array('requestDatetime', 'action', 'md5', 'shopId', 'orderNumber', 'customerNumber', 'orderCreatedDatetime', 'orderSumAmount', 'orderSumCurrencyPaycash', 'orderSumBankPaycash', 'shopSumAmount', 'shopSumCurrencyPaycash', 'shopSumBankPaycash', 'orderIsPaid'); #------------------------------------------------------------------------------- foreach ($ArgsIDs as $ArgID) { $Args[$ArgID] = @$Args[$ArgID]; } #------------------------------------------------------------------------------- $OrderID = $Args['orderNumber']; #------------------------------------------------------------------------------- $Config = Config(); #------------------------------------------------------------------------------- $Settings = $Config['Invoices']['PaymentSystems']['Yandex']; #------------------------------------------------------------------------------- $Md5 = array($Args['orderIsPaid'], $Args['orderSumAmount'], $Args['shopSumCurrencyPaycash'], $Args['orderSumBankPaycash'], $Args['shopId'], $Args['invoiceId'], $Args['customerNumber'], $Settings['Hash']); #------------------------------------------------------------------------------- if (StrToUpper(Md5(Implode(';', $Md5))) != $Args['md5']) { return ERROR | @Trigger_Error('[comp/www/Merchant/Yandex]: проверка подлинности завершилась не удачей'); } #------------------------------------------------------------------------------- $Date = Date('c', Time()); #------------------------------------------------------------------------------- $ShopID = $Settings['Send']['ShopID']; #------------------------------------------------------------------------------- $Invoice = DB_Select('Invoices', array('ID', 'Summ'), array('UNIQ', 'ID' => $OrderID)); #------------------------------------------------------------------------------- switch (ValueOf($Invoice)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception': return ERROR | @Trigger_Error(400); case 'array':
function simple_row($img_key, $shorts, $props) { $vars = $GLOBALS['catalog_vars'][$img_key]; if (!is_array($vars)) { $vars = array(); } foreach ($vars as $k => $v) { $vars[$k] = StrToUpper($v); } if (!is_array($shorts)) { $shorts = array(); } $short = count($shorts) ? $shorts[0] : null; $category = $GLOBALS['category_map'][$props['unified']]; if (!is_array($category)) { foreach ($vars as $v) { if (is_array($GLOBALS['category_map'][$v])) { $category = $GLOBALS['category_map'][$v]; } } } $ret = array('name' => null, 'unified' => null, 'variations' => $vars, 'docomo' => null, 'au' => null, 'softbank' => null, 'google' => null, 'image' => $img_key . '.png', 'sheet_x' => 0, 'sheet_y' => 0, 'short_name' => $short, 'short_names' => $shorts, 'text' => $GLOBALS['text'][$short], 'texts' => $GLOBALS['texts'][$short], 'category' => is_array($category) ? $category[0] : null, 'sort_order' => is_array($category) ? $category[1] : null); $ret['has_img_apple'] = file_exists("{$GLOBALS['dir']}/../img-apple-64/{$ret['image']}"); $ret['has_img_google'] = file_exists("{$GLOBALS['dir']}/../img-google-64/{$ret['image']}"); $ret['has_img_twitter'] = file_exists("{$GLOBALS['dir']}/../img-twitter-64/{$ret['image']}"); $ret['has_img_emojione'] = file_exists("{$GLOBALS['dir']}/../img-emojione-64/{$ret['image']}"); foreach ($props as $k => $v) { $ret[$k] = $v; } if (file_exists("../img-apple-64/{$img_key}-1f3fb.png")) { $ret['skin_variations'] = array(); foreach ($GLOBALS['skin_variation_suffixes'] as $suffix) { $var_uni = $props['unified'] . '-' . $suffix; $var_img = $img_key . '-' . StrToLower($suffix) . '.png'; $variation = array('unified' => $var_uni, 'image' => $var_img, 'sheet_x' => 0, 'sheet_y' => 0, 'has_img_apple' => file_exists("{$GLOBALS['dir']}/../img-apple-64/{$var_img}"), 'has_img_google' => file_exists("{$GLOBALS['dir']}/../img-google-64/{$var_img}"), 'has_img_twitter' => file_exists("{$GLOBALS['dir']}/../img-twitter-64/{$var_img}"), 'has_img_emojione' => file_exists("{$GLOBALS['dir']}/../img-emojione-64/{$var_img}")); $ret['skin_variations'][$var_uni] = $variation; } } return $ret; }
function __InTaskCompare($arTask1, $arTask2, $arOrder) { foreach ($arOrder as $ord) { if (Array_Key_Exists($ord["ORDER"], $arTask1["FIELDS"])) { $v1 = $arTask1["FIELDS"][$ord["ORDER"]]; $v2 = $arTask2["FIELDS"][$ord["ORDER"]]; if ($ord["TYPE"] == "datetime") { $v1 = CDatabase::FormatDate($v1, CLang::GetDateFormat("FULL"), "YYYY-MM-DD HH:MI:SS"); $v2 = CDatabase::FormatDate($v2, CLang::GetDateFormat("FULL"), "YYYY-MM-DD HH:MI:SS"); } if ($ord["NULLS"]) { if (StrLen($v1) <= 0 && StrLen($v2) > 0) { return $ord["DIRECTION"] == "ASC" ? true : false; } elseif (StrLen($v1) > 0 && StrLen($v2) <= 0) { return $ord["DIRECTION"] == "ASC" ? false : true; } } if ($v1 > $v2) { return $ord["DIRECTION"] == "ASC" ? true : false; } elseif ($v1 < $v2) { return $ord["DIRECTION"] == "ASC" ? false : true; } } else { foreach ($arTask1["PROPS"] as $key => $value) { if (StrToUpper($key) == $ord["ORDER"]) { $v1 = $value["VALUE"]; $v2 = $arTask2["PROPS"][$key]["VALUE"]; if ($ord["TYPE"] == "datetime") { $v1 = CDatabase::FormatDate($v1, CLang::GetDateFormat("FULL"), "YYYY-MM-DD HH:MI:SS"); $v2 = CDatabase::FormatDate($v2, CLang::GetDateFormat("FULL"), "YYYY-MM-DD HH:MI:SS"); } if ($ord["NULLS"]) { if (StrLen($v1) <= 0 && StrLen($v2) > 0) { return $ord["DIRECTION"] == "ASC" ? true : false; } elseif (StrLen($v1) > 0 && StrLen($v2) <= 0) { return $ord["DIRECTION"] == "ASC" ? false : true; } } if ($v1 > $v2) { return $ord["DIRECTION"] == "ASC" ? true : false; } elseif ($v1 < $v2) { return $ord["DIRECTION"] == "ASC" ? false : true; } break; } } } } return true; }
#------------------------------------------------------------------------------- # одна рандомная буква в верхнем регистре $Password = SPrintF('%s%s', StrToUpper($Letters[Mt_Rand(0, StrLen($Letters) - 1)]), $Password); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # число символов по которым строим пароль $Size = StrLen($Chars) - 1; #------------------------------------------------------------------------------- #Debug(SPrintF('[comp/Passwords/Generator]: Chars = %s',$Chars)); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # длинна пароля, необходимая длинна минус то что уже построено $Length = $Length - StrLen($Password); #------------------------------------------------------------------------------- while ($Length--) { #------------------------------------------------------------------------------- $Char = $Chars[Mt_Rand(0, $Size)]; #------------------------------------------------------------------------------- # рандомно, символ переводим в верхний регистр $Char = Mt_Rand(0, 2) % 3 ? $Char : StrToUpper($Char); #------------------------------------------------------------------------------- $Password = SPrintF('%s%s', $Password, $Char); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- return Str_Shuffle($Password); #------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } if (!CModule::IncludeModule("iblock")) { return; } $arIBlockType = array(); $rsIBlockType = CIBlockType::GetList(array("sort" => "asc"), array("ACTIVE" => "Y")); while ($arr = $rsIBlockType->Fetch()) { if ($ar = CIBlockType::GetByIDLang($arr["ID"], LANGUAGE_ID)) { $arIBlockType[$arr["ID"]] = "[" . $arr["ID"] . "] " . $ar["NAME"]; } } $arIBlock = array(); $rsIBlock = CIBlock::GetList(array("sort" => "asc"), array("TYPE" => $arCurrentValues["IBLOCK_TYPE"], "ACTIVE" => "Y")); while ($arr = $rsIBlock->Fetch()) { $arIBlock[$arr["ID"]] = "[" . $arr["ID"] . "] " . $arr["NAME"]; } $arTasksFields = array("ID" => "[ID] " . GetMessage("INTL_TF_ID"), "NAME" => "[NAME] " . GetMessage("INTL_TF_NAME"), "CODE" => "[CODE] " . GetMessage("INTL_TF_CODE"), "XML_ID" => "[XML_ID] " . GetMessage("INTL_TF_XML_ID"), "MODIFIED_BY" => "[MODIFIED_BY] " . GetMessage("INTL_TF_MODIFIED_BY"), "DATE_CREATE" => "[DATE_CREATE] " . GetMessage("INTL_TF_DATE_CREATE"), "CREATED_BY" => "[CREATED_BY] " . GetMessage("INTL_TF_CREATED_BY"), "DATE_ACTIVE_FROM" => "[DATE_ACTIVE_FROM] " . GetMessage("INTL_TF_DATE_ACTIVE_FROM"), "DATE_ACTIVE_TO" => "[DATE_ACTIVE_TO] " . GetMessage("INTL_TF_DATE_ACTIVE_TO"), "IBLOCK_SECTION" => "[IBLOCK_SECTION] " . GetMessage("INTL_TF_IBLOCK_SECTION"), "DETAIL_TEXT" => "[DETAIL_TEXT] " . GetMessage("INTL_TF_DETAIL_TEXT")); $dbTasksCustomProps = CIBlockProperty::GetList(array("sort" => "asc", "name" => "asc"), array("ACTIVE" => "Y", "IBLOCK_ID" => $arCurrentValues["IBLOCK_ID"])); while ($arTasksCustomProp = $dbTasksCustomProps->Fetch()) { $ind = StrLen($arTasksCustomProp["CODE"]) > 0 ? $arTasksCustomProp["CODE"] : $arTasksCustomProp["ID"]; $arTasksFields[StrToUpper($ind)] = "[" . $ind . "] " . $arTasksCustomProp["NAME"]; } $arComponentParameters = array("GROUPS" => array("VARIABLE_ALIASES" => array("NAME" => GetMessage("INTL_VARIABLE_ALIASES"))), "PARAMETERS" => array("IBLOCK_TYPE" => array("PARENT" => "BASE", "NAME" => GetMessage("INTL_IBLOCK_TYPE"), "TYPE" => "LIST", "VALUES" => $arIBlockType, "REFRESH" => "Y"), "IBLOCK_ID" => array("PARENT" => "BASE", "NAME" => GetMessage("INTL_IBLOCK"), "TYPE" => "LIST", "VALUES" => $arIBlock, "REFRESH" => "Y"), "TASKS_FIELDS_SHOW" => array("PARENT" => "BASE", "NAME" => GetMessage("INTL_TASKS_FIELDS_SHOW"), "MULTIPLE" => "Y", "TYPE" => "LIST", "VALUES" => $arTasksFields), "TASK_TYPE" => array("PARENT" => "BASE", "NAME" => GetMessage("INTL_TASK_TYPE"), "TYPE" => "LIST", "VALUES" => array("group" => GetMessage("INTL_TASK_TYPE_GROUP"), "user" => GetMessage("INTL_TASK_TYPE_USER"))), "OWNER_ID" => array("NAME" => GetMessage("INTL_OWNER_ID"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "BASE"), "TASK_VAR" => array("NAME" => GetMessage("INTL_TASK_VAR"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "VARIABLE_ALIASES"), "USER_VAR" => array("NAME" => GetMessage("INTL_USER_VAR"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "VARIABLE_ALIASES"), "GROUP_VAR" => array("NAME" => GetMessage("INTL_GROUP_VAR"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "VARIABLE_ALIASES"), "VIEW_VAR" => array("NAME" => GetMessage("INTL_VIEW_VAR"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "VARIABLE_ALIASES"), "ACTION_VAR" => array("NAME" => GetMessage("INTL_ACTION_VAR"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "VARIABLE_ALIASES"), "PAGE_VAR" => array("NAME" => GetMessage("INTL_PAGE_VAR"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "VARIABLE_ALIASES"), "PATH_TO_GROUP_TASKS" => array("NAME" => GetMessage("INTL_PATH_TO_GROUP_TASKS"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "URL_TEMPLATES"), "PATH_TO_GROUP_TASKS_TASK" => array("NAME" => GetMessage("INTL_PATH_TO_GROUP_TASKS_TASK"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "URL_TEMPLATES"), "PATH_TO_GROUP_TASKS_VIEW" => array("NAME" => GetMessage("INTL_PATH_TO_GROUP_TASKS_VIEW"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "", "COLS" => 25, "PARENT" => "URL_TEMPLATES"), "SET_NAVCHAIN" => array("PARENT" => "ADDITIONAL_SETTINGS", "NAME" => GetMessage("INTL_SET_NAVCHAIN"), "TYPE" => "CHECKBOX", "DEFAULT" => "Y"), "SET_TITLE" => array(), "ITEMS_COUNT" => array("NAME" => GetMessage("INTL_ITEM_COUNT"), "TYPE" => "STRING", "MULTIPLE" => "N", "DEFAULT" => "20", "COLS" => 3, "PARENT" => "ADDITIONAL_SETTINGS"), "NAME_TEMPLATE" => array("TYPE" => "LIST", "NAME" => GetMessage("INTL_NAME_TEMPLATE"), "VALUES" => CComponentUtil::GetDefaultNameTemplates(), "MULTIPLE" => "N", "ADDITIONAL_VALUES" => "Y", "DEFAULT" => "", "PARENT" => "ADDITIONAL_SETTINGS")));
$arResponce = CXMPPUtility::_SendToServer($arMessage, $errorNo, $errorStr); $data = ""; if ($arResponce && is_array($arResponce)) { $data = CUtil::PhpToJSObject($arResponce); } else { global $APPLICATION; if (defined("BX_UTF") && BX_UTF) { $errorStr = $APPLICATION->ConvertCharset($errorStr, "Windows-1251", "UTF-8"); } $data = CUtil::PhpToJSObject(array("error" => array("errorNo" => $errorNo, "errorStr" => $errorStr))); } echo $data; } elseif ($_REQUEST["server_action"] == "start") { $bWindowsHosting = false; $strCurrentOS = PHP_OS; if (StrToUpper(substr($strCurrentOS, 0, 3)) === "WIN") { $bWindowsHosting = true; } $phpPath = COption::GetOptionString("xmpp", "php_path", $bWindowsHosting ? "../apache/php.exe -c ../apache/php.ini" : "php -c /etc/php.ini"); $serverPath = COption::GetOptionString("xmpp", "server_path", "./bitrix/modules/xmpp/xmppd.php"); //$serverLogPath = COption::GetOptionString("xmpp", "server_log_path", "xmppd.log"); chdir($_SERVER["DOCUMENT_ROOT"]); if ($phpPath == "../apache/php.exe -c ../apache/php.ini" && !file_exists($_SERVER['DOCUMENT_ROOT'] . "/../apache/php.exe") && file_exists($_SERVER['DOCUMENT_ROOT'] . "/../apache2/zendserver/bin/php.exe")) { $phpPath = "../Apache2/zendserver/bin/php.exe -c ../Apache2/zendserver/etc/php.ini"; } if (trim($phpPath) == "../Apache2/zendserver/bin/php.exe -c ../Apache2/zendserver/etc/php.ini") { $phpPath = "./Apache2/zendserver/bin/php.exe -c ./Apache2/zendserver/etc/php.ini"; $serverPath = '"' . rel2abs($_SERVER['DOCUMENT_ROOT'], $serverPath) . '"'; chdir(".."); } $startErrorMessage = "";
return 'No args...'; } #------------------------------------------------------------------------------- $ArgsIDs = array('ik_shop_id', 'ik_payment_amount', 'ik_payment_id', 'ik_payment_desc', 'ik_paysystem_alias', 'ik_baggage_fields', 'ik_payment_timestamp', 'ik_payment_state', 'ik_trans_id', 'ik_currency_exch', 'ik_fees_payer', 'ik_sign_hash'); #------------------------------------------------------------------------------- foreach ($ArgsIDs as $ArgID) { $Args[$ArgID] = @$Args[$ArgID]; } #------------------------------------------------------------------------------- $Config = Config(); #------------------------------------------------------------------------------- $Settings = $Config['Invoices']['PaymentSystems']['InterKassa']; #------------------------------------------------------------------------------- $Hash = array($Args['ik_shop_id'], $Args['ik_payment_amount'], $Args['ik_payment_id'], $Args['ik_paysystem_alias'], $Args['ik_baggage_fields'], $Args['ik_payment_state'], $Args['ik_trans_id'], $Args['ik_currency_exch'], $Args['ik_fees_payer'], $Settings['Hash']); #------------------------------------------------------------------------------- if (StrToUpper(MD5(Implode(':', $Hash))) != $Args['ik_sign_hash']) { return ERROR | @Trigger_Error('[comp/Merchant/InterKassa]: проверка подлинности завершилась не удачей'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if ($Args['ik_payment_state'] != 'success') { return ERROR | @Trigger_Error('[comp/Merchant/InterKassa]: платёж не был осуществлён'); } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- $Invoice = DB_Select('Invoices', array('ID', 'Summ'), array('UNIQ', 'ID' => $Args['ik_payment_id'])); #------------------------------------------------------------------------------- switch (ValueOf($Invoice)) { case 'error': return ERROR | @Trigger_Error(500); case 'exception':
function __InTaskTaskReject($taskRejectId, $iblockId, $taskType, $ownerId, $arParams) { $errorMessage = ""; $taskRejectId = IntVal($taskRejectId); if ($taskRejectId <= 0) { return ""; } $arTask = __InTaskGetTask($taskRejectId, $iblockId, $taskType, $ownerId); if (!$arTask) { $errorMessage .= GetMessage("INTL_TASK_NOT_FOUND") . "."; } if (StrLen($errorMessage) <= 0) { if ($arTask["PROPS"]["TASKASSIGNEDTO"]["VALUE"] != $GLOBALS["USER"]->GetID() || StrToUpper($arTask["PROPS"]["TASKSTATUS"]["VALUE_XML_ID"]) != "NOTACCEPTED") { $errorMessage .= GetMessage("INTL_CAN_NOT_REJECT") . "."; } } if (StrLen($errorMessage) <= 0) { if ($arTask["PROPS"]["TASKASSIGNEDTO"]["VALUE"] == $arTask["FIELDS"]["CREATED_BY"]) { $errorMessage .= GetMessage("INTL_CAN_NOT_REJECT_OWN") . "."; } } if (StrLen($arResult["ErrorMessage"]) <= 0) { CIBlockElement::SetPropertyValueCode($taskRejectId, $arTask["PROPS"]["TASKASSIGNEDTO"]["ID"], $arTask["FIELDS"]["CREATED_BY"]); $arMessageFields = array("=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM, "FROM_USER_ID" => $GLOBALS["USER"]->GetID(), "TO_USER_ID" => $arTask["FIELDS"]["CREATED_BY"]); if ($arMessageFields["FROM_USER_ID"] != $arMessageFields["TO_USER_ID"]) { $path2view = ($GLOBALS["APPLICATION"]->IsHTTPS() ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS_TASK"], array("owner_id" => $arTask["PROPS"]["TASKASSIGNEDTO"]["VALUE"], "task_id" => $taskRejectId, "action" => "view")); $arMessageFields["MESSAGE"] = str_replace(array("#URL_VIEW#", "#NAME#"), array($path2view, $arTask["FIELDS"]["NAME"]), GetMessage("INTL_REJECT_MESSAGE")); CSocNetMessages::Add($arMessageFields); } } return $errorMessage; }
"><?php echo htmlspecialcharsbx($val); ?> </textarea> <?php } ?> </td> </tr> <?php } $tabControl->BeginNextTab(); ?> <?php $val = COption::GetOptionString("mail", "php_path", StrToUpper(SubStr(PHP_OS, 0, 3)) === "WIN" ? "../apache/php.exe -c ../apache/php.ini" : "authbind php -c /etc/php.ini"); ?> <script> var ss = false; function StartSMTPD() { if(BX('php_path').value!='<?php echo AddSlashes($val); ?> ' && !confirm("<?php echo GetMessage("MAIL_OPT_CONFIRM"); ?> ")) return false; BX.showWait();
} } else { $arParams["FILTER"][$op . $key] = $value; } } } } if (StrLen($arResult["FatalError"]) <= 0) { $arOrderBy = array(); for ($i = 0; $i < 3; $i++) { if (StrLen($arParams["ORDER_BY_" . $i]) <= 0) { continue; } $orderBy = $arParams["ORDER_BY_" . $i]; if (Array_Key_Exists($orderBy, $arResult["ALLOWED_FIELDS"]) && $arResult["ALLOWED_FIELDS"][$orderBy]["ORDERABLE"]) { $arParams["ORDER_DIR_" . $i] = StrToUpper($arParams["ORDER_DIR_" . $i]) == "ASC" ? "ASC" : "DESC"; $arOrderBy[$orderBy] = $arParams["ORDER_DIR_" . $i]; } } if (Count($arOrderBy) <= 0) { $arOrderBy["NAME"] = "ASC"; $arOrderBy["ID"] = "DESC"; } $arFilter = array("IBLOCK_ID" => $iblockId, "ACTIVE" => "Y"); if (Is_Array($arParams["FILTER"])) { foreach ($arParams["FILTER"] as $key => $value) { $op = ""; $opTmp = SubStr($key, 0, 1); if (In_Array($opTmp, array("!", "<", ">"))) { $op = $opTmp; $key = SubStr($key, 1);
public function getParams() { #------------------------------------------------------------------------------- # Достаем registrar и его префикс if (Preg_Match('/registrar:\\s+((\\w+|-)+)/', $this->params['WhoIs'], $String)) { #------------------------------------------------------------------------------- $Registrar = Next($String); #------------------------------------------------------------------------------- if (Preg_Match('/((\\w+|-)+)-(REG|RU)/', $Registrar, $String)) { $PrefixRegistrar = Next($String); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- # Получаем параметры для формирования Event $Where = SPrintF('`OrderID` = %s', $this->params['OrderID']); $UserID = DB_Select('DomainOrdersOwners', 'UserID as ID', array('UNIQ', 'Where' => $Where)); $SchemeName = DB_Select('DomainSchemes', 'Name as SchemeName', array('UNIQ', 'ID' => $this->params['SchemeID'])); #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (In_Array($SchemeName['SchemeName'], array('ru', 'su', 'рф'))) { #------------------------------------------------------------------------------- if (isset($Registrar) && isset($PrefixRegistrar)) { #------------------------------------------------------------------------------- $this->params['registrar'] = $Registrar; $this->params['prefixRegistrar'] = $PrefixRegistrar; #------------------------------------------------------------------------------- # Получаем параметры регистратора к которому осуществляется трансфер $ServerID = DB_Select('DomainSchemes', '`ServerID` AS `ID`', array('UNIQ', 'ID' => $this->params['SchemeID'])); $Settings = DB_Select('Servers', '*', array('UNIQ', 'ID' => $ServerID['ID'])); #------------------------------------------------------------------------------- Debug("[system/classes/DomainOrdersForTransferMsg.class.php]: Servers[SystemID] - " . $Settings['Params']['SystemID']); Debug("[system/classes/DomainOrdersForTransferMsg.class.php]: Settings[PrefixNic] - " . $Settings['Params']['PrefixNic']); Debug("[system/classes/DomainOrdersForTransferMsg.class.php]: Registrar - " . $Registrar); Debug("[system/classes/DomainOrdersForTransferMsg.class.php]: PrefixRegistrar - " . $PrefixRegistrar); #------------------------------------------------------------------------------- # Проверяем является ли регистрар нашим регистратором if ($PrefixRegistrar == $Settings['Params']['PrefixNic']) { #------------------------------------------------------------------------------- $this->params['internalRegister'] = true; #--------------------------------------------------------------------------- Debug("[system/classes/DomainOrdersForTransferMsg.class.php]: IsOurRegistrar - TRUE"); Debug("[system/classes/DomainOrdersForTransferMsg.class.php]: Инструкция по трансферу в пределах регистратора"); #--------------------------------------------------------------------------- $this->params['registratorID'] = $Settings['Params']['SystemID']; $this->params['partnerLogin'] = $Settings['Params']['PartnerLogin']; $this->params['partnerContract'] = $Settings['Params']['PartnerContract']; #------------------------------------------------------------------------------- # Достаем статью с информацией о шаблонах документов и контактами регистратора $Where = SPrintF('`Partition` = "Registrators/%s/internal"', $PrefixRegistrar); $Clause = DB_Select('Clauses', '*', array('UNIQ', 'Where' => $Where)); switch (ValueOf($Clause)) { case 'array': #------------------------------------------------------------------------------- $TransferDoc = trim(Strip_Tags($Clause['Text'])); break; #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- default: #------------------------------------------------------------------------------- Debug(SPrintF('[system/classes/DomainOrdersForTransferMsg.class.php]: Статья не найдена. Ожидалась Registrators/%s/internal', $PrefixRegistrar)); #------------------------------------------------------------------------------- $TransferDoc = "Для получения информации об оформлении писем Вашему текущему регистратору и его контактах перейдите на его сайт."; #------------------------------------------------------------------------------- # Уведомление об ошибке статьи $Event = array('UserID' => $UserID['ID'], 'PriorityID' => 'Error', 'Text' => SPrintF('Статья по переносу домена не найдена. Ожидалась Registrators/%s/internal', $PrefixRegistrar), 'IsReaded' => FALSE); #------------------------------------------------------------------------------- $Event = Comp_Load('Events/EventInsert', $Event); if (!$Event) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $this->params['transferDoc'] = $TransferDoc; #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- $this->params['internalRegister'] = false; #------------------------------------------------------------------------------- Debug("[system/classes/DomainOrdersForTransferMsg.class.php]: Инструкция по трансферу от стороннего регистратора"); #------------------------------------------------------------------------------- # Формируем постфикс идентификатора switch ($SchemeName['SchemeName']) { case 'su': $PostfixNic = 'FID'; break; case 'рф': $PostfixNic = 'RF'; break; default: $PostfixNic = 'RU'; } #------------------------------------------------------------------------------- $this->params['registrar'] = $Registrar; $this->params['registratorID'] = $Settings['Params']['SystemID']; $this->params['jurName'] = $Settings['Params']['JurName']; $this->params['prefixNic'] = $Settings['Params']['PrefixNic']; $this->params['postfixNic'] = $PostfixNic; $this->params['schemeName'] = StrToUpper($SchemeName['SchemeName']); #------------------------------------------------------------------------------- # Достаем статью с информацией о шаблонах документов и контактами регистратора $Where = SPrintF('`Partition` = "Registrators/%s/external"', $PrefixRegistrar); $Clause = DB_Select('Clauses', '*', array('UNIQ', 'Where' => $Where)); switch (ValueOf($Clause)) { case 'array': $TransferDoc = trim(Strip_Tags($Clause['Text'])); break; default: #------------------------------------------------------------------------------- Debug(SPrintF('[system/classes/DomainOrdersForTransferMsg.class.php]: Статья не найдена. Ожидалась Registrators/%s/external', $PrefixRegistrar)); #------------------------------------------------------------------------------- $TransferDoc = "\n\nДля получения информации об оформлении писем Вашему текущему регистратору и его контактах перейдите на его сайт."; #------------------------------------------------------------------------------- # Уведомление об ошибке статьи $Event = array('UserID' => $UserID['ID'], 'PriorityID' => 'Error', 'Text' => SPrintF('Статья по переносу домена не найдена. Ожидалась Registrators/%s/external', $PrefixRegistrar), 'IsReaded' => FALSE); $Event = Comp_Load('Events/EventInsert', $Event); if (!$Event) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $this->params['transferDoc'] = $TransferDoc; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- Debug("[system/classes/DomainOrdersForTransferMsg.class.php]: Registrar или PrefixRegistrar не был определён."); # Уведомление об ошибке формирования инструкции $Event = array('UserID' => $UserID['ID'], 'PriorityID' => 'Error', 'Text' => SPrintF('Ошибка автоматического формирования инструкции по переносу домена (%s.%s) к нам.', $this->params['DomainName'], $SchemeName['SchemeName']), 'IsReaded' => FALSE); $Event = Comp_Load('Events/EventInsert', $Event); if (!$Event) { return ERROR | @Trigger_Error(500); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- } else { #------------------------------------------------------------------------------- // буржуйские домены, пеерносятся через AuthInfo $this->params['notUSSR'] = TRUE; $this->params['schemeName'] = StrToUpper($SchemeName['SchemeName']); #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- return $this->params; #------------------------------------------------------------------------------- }
function __SetTimeMark($text, $startStop = "") { global $bCmlDebug; global $cmlTimeMarkTo, $cmlTimeMarkFrom, $cmlTimeMarkGlobalFrom; global $cmlMemoryMarkTo, $cmlMemoryMarkFrom, $cmlMemoryMarkGlobalFrom; //echo " "; //flush(); if (!$bCmlDebug) { return; } if (StrToUpper($startStop) == "START") { $hFile = fopen($_SERVER["DOCUMENT_ROOT"] . CML_DEBUG_FILE_NAME, "w"); fwrite($hFile, date("H:i:s") . " - " . __getMemoryUsage() . " - " . $text . "\n"); fclose($hFile); $cmlMemoryMarkGlobalFrom = __getMemoryUsage(); $cmlMemoryMarkFrom = __getMemoryUsage(); $cmlTimeMarkGlobalFrom = __getMicroTime(); $cmlTimeMarkFrom = __getMicroTime(); } elseif (StrToUpper($startStop) == "STOP") { $cmlTimeMarkTo = __getMicroTime(); $cmlMemoryMarkTo = __getMemoryUsage(); $hFile = fopen($_SERVER["DOCUMENT_ROOT"] . CML_DEBUG_FILE_NAME, "a"); fwrite($hFile, date("H:i:s") . " - " . Round($cmlTimeMarkTo - $cmlTimeMarkFrom, 3) . " s - " . ($cmlMemoryMarkTo - $cmlMemoryMarkFrom) . " - " . $text . "\n"); fwrite($hFile, date("H:i:s") . " - " . Round($cmlTimeMarkTo - $cmlTimeMarkGlobalFrom, 3) . " s - " . ($cmlMemoryMarkTo - $cmlMemoryMarkGlobalFrom) . "\n"); fclose($hFile); } else { $cmlTimeMarkTo = __getMicroTime(); $cmlMemoryMarkTo = __getMemoryUsage(); $hFile = fopen($_SERVER["DOCUMENT_ROOT"] . CML_DEBUG_FILE_NAME, "a"); fwrite($hFile, date("H:i:s") . " - " . Round($cmlTimeMarkTo - $cmlTimeMarkFrom, 3) . " s - " . ($cmlMemoryMarkTo - $cmlMemoryMarkFrom) . " - " . ($cmlMemoryMarkTo - $cmlMemoryMarkGlobalFrom) . " - " . $text . "\n"); fclose($hFile); $cmlMemoryMarkFrom = __getMemoryUsage(); $cmlTimeMarkFrom = __getMicroTime(); } }
function __CatalogSetTimeMark($text, $startStop = "") { global $__catalogTimeMarkTo, $__catalogTimeMarkFrom, $__catalogTimeMarkGlobalFrom; if (StrToUpper($startStop) == "START") { $hFile = fopen($_SERVER["DOCUMENT_ROOT"] . "/__catalog_debug.txt", "a"); fwrite($hFile, date("H:i:s") . " - " . $text . "\n"); fclose($hFile); $__catalogTimeMarkGlobalFrom = __CatalogGetMicroTime(); $__catalogTimeMarkFrom = __CatalogGetMicroTime(); } elseif (StrToUpper($startStop) == "STOP") { $__catalogTimeMarkTo = __CatalogGetMicroTime(); $hFile = fopen($_SERVER["DOCUMENT_ROOT"] . "/__catalog_debug.txt", "a"); fwrite($hFile, date("H:i:s") . " - " . Round($__catalogTimeMarkTo - $__catalogTimeMarkFrom, 3) . " s - " . $text . "\n"); fwrite($hFile, date("H:i:s") . " - " . Round($__catalogTimeMarkTo - $__catalogTimeMarkGlobalFrom, 3) . " s\n\n"); fclose($hFile); } else { $__catalogTimeMarkTo = __CatalogGetMicroTime(); $hFile = fopen($_SERVER["DOCUMENT_ROOT"] . "/__catalog_debug.txt", "a"); fwrite($hFile, date("H:i:s") . " - " . Round($__catalogTimeMarkTo - $__catalogTimeMarkFrom, 3) . " s - " . $text . "\n"); fclose($hFile); $__catalogTimeMarkFrom = __CatalogGetMicroTime(); } }
$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 QueryBatch($queryPath, $tableName = "") { if (!in_array("DATABASE", $this->callType)) return False; CUpdateSystem::AddMessage2Log("Run updater '".$this->updater."': QueryBatch(".$queryPath.", ".$tableName.")", "CRUPDCDF3"); $bCanUpdate = True; if (strlen($tableName) > 0) if (!$this->TableExists($tableName)) $bCanUpdate = False; $result = False; if ($bCanUpdate) { $strQueryPath = ""; if (is_array($queryPath)) { foreach ($queryPath as $key => $value) { if ($this->dbType == StrToUpper($key)) { $strQueryPath = $value; break; } } } else { $strQueryPath = $queryPath; } if (strlen($strQueryPath) <= 0) $bCanUpdate = False; } if ($bCanUpdate) { if (substr($strQueryPath, 0, 1) != "/") $strQueryPath = $this->curPath."/".$strQueryPath; $queryPathFull = $_SERVER["DOCUMENT_ROOT"].$strQueryPath; $arError = False; if (file_exists($queryPathFull)) $arError = $GLOBALS["DB"]->RunSQLBatch($queryPathFull); if ($arError) { foreach ($arError as $key => $value) $this->errorMessage[] = $value; } } return ($arError ? False : True); }
function GetList($arFilter = array(), $arOrder = array()) { global $APPLICATION; if (!array_key_exists("SITE_ID", $arFilter)) { $arFilter["SITE_ID"] = SITE_ID; } if (array_key_exists("QUERY", $arFilter) && $arFilter["QUERY"] === false) { $arFilter["QUERY"] = $APPLICATION->GetCurPage(); } $docRoot = CSite::GetSiteDocRoot($arFilter["SITE_ID"]); $arUrlRewrite = array(); if (file_exists($docRoot . "/urlrewrite.php")) { include $docRoot . "/urlrewrite.php"; } if (!is_array(self::$arRules[$docRoot])) { self::$arRules[$docRoot] = array(); } foreach ($arUrlRewrite as $arRule) { self::$arRules[$docRoot][self::GetKey($arRule)] = $arRule; } $bFilterQuery = array_key_exists("QUERY", $arFilter); $bFilterCondition = array_key_exists("CONDITION", $arFilter); $bFilterID = array_key_exists("ID", $arFilter); $bFilterPath = array_key_exists("PATH", $arFilter); $arResult = array(); foreach ($arUrlRewrite as $arRule) { $bMatch = true; if ($bFilterQuery && !preg_match($arRule["CONDITION"], $arFilter["QUERY"])) { $bMatch = false; } if ($bMatch && $bFilterCondition && $arRule["CONDITION"] != $arFilter["CONDITION"]) { $bMatch = false; } if ($bMatch && $bFilterID && $arRule["ID"] != $arFilter["ID"]) { $bMatch = false; } if ($bMatch && $bFilterPath && $arRule["PATH"] != $arFilter["PATH"]) { $bMatch = false; } if ($bMatch) { $arResult[] = array("CONDITION" => $arRule["CONDITION"], "ID" => $arRule["ID"], "PATH" => $arRule["PATH"], "RULE" => $arRule["RULE"]); } } if (count($arOrder) > 0 && count($arResult) > 0) { $arCondition = array(); $arID = array(); $arPath = array(); $arRule = array(); foreach ($arResult as $key => $row) { $arCondition[$key] = $row['CONDITION']; $arID[$key] = $row['ID']; $arPath[$key] = $row['PATH']; $arRule[$key] = $row['RULE']; } $arOrderKeys = array_keys($arOrder); $orderBy = $arOrderKeys[0]; $orderDir = $arOrder[$orderBy]; $orderBy = StrToUpper($orderBy); $orderDir = StrToUpper($orderDir); $orderDir = $orderDir == "DESC" ? SORT_DESC : SORT_ASC; if ($orderBy == "CONDITION") { array_multisort($arCondition, $orderDir, $arID, $arPath, $arRule); } elseif ($orderBy == "ID") { array_multisort($arID, $orderDir, $arCondition, $arPath, $arRule); } elseif ($orderBy == "PATH") { array_multisort($arPath, $orderDir, $arCondition, $arID, $arRule); } elseif ($orderBy == "RULE") { array_multisort($arRule, $orderDir, $arCondition, $arPath, $arID); } $arResult = array(); foreach ($arCondition as $key => $value) { $arResult[] = array("CONDITION" => $arCondition[$key], "ID" => $arID[$key], "PATH" => $arPath[$key], "RULE" => $arRule[$key]); } } return $arResult; }
} #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (Count($Errors)) { #------------------------------------------------------------------------------- $Attribs = $Template['Attribs']; #------------------------------------------------------------------------------- $Parent = NULL; #------------------------------------------------------------------------------- $Errors = Array_Reverse($Errors); #------------------------------------------------------------------------------- foreach ($Errors as $AttribID) { #------------------------------------------------------------------------------- $Attrib = $Attribs[$AttribID]; #------------------------------------------------------------------------------- $Exception = new gException(StrToUpper($AttribID), $Attrib['Comment'], $Parent); #------------------------------------------------------------------------------- $Parent = $Exception; #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- #------------------------------------------------------------------------------- if (isset($Exception)) { return new gException('FIELDS_WRONG_FILLED', 'Не верно заполнены поля', $Exception); } #------------------------------------------------------------------------------- } #------------------------------------------------------------------------------- $Replace = Array_ToLine($Attribs, '%'); #------------------------------------------------------------------------------- #-----------------------------TRANSACTION---------------------------------------
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);
function GetEventSite($userID, $event, $defSiteID) { global $arSocNetUserEvents; $userID = IntVal($userID); if ($userID <= 0) { return false; } $event = StrToUpper(Trim($event)); if (!in_array($event, $arSocNetUserEvents)) { return false; } $arUserEvents = array(); if (isset($GLOBALS["SONET_USER_EVENTS_" . $userID]) && is_array($GLOBALS["SONET_USER_EVENTS_" . $userID]) && !in_array("SONET_USER_EVENTS_" . $userID, $_REQUEST)) { $arUserEvents = $GLOBALS["SONET_USER_EVENTS_" . $userID]; } else { $dbResult = CSocNetUserEvents::GetList(array(), array("USER_ID" => $userID)); while ($arResult = $dbResult->Fetch()) { $arUserEvents[$arResult["EVENT_ID"]] = $arResult["ACTIVE"] == "Y" ? $arResult["SITE_ID"] : false; } $GLOBALS["SONET_USER_EVENTS_" . $userID] = $arUserEvents; } if (!array_key_exists($event, $arUserEvents)) { return $defSiteID; } return $arUserEvents[$event]; }