3if (!empty($_GET[
'ts']) && $_GET[
'ts'] ===
'bxviewer')
8if (!empty($_GET[
'_gen']))
19if (str_starts_with(
$_SERVER[
'SCRIPT_NAME'],
'/mobile/ajax.php'))
28 $settingsPath =
$_SERVER[
'DOCUMENT_ROOT'] .
'/bitrix/.settings.php';
29 $settingsExtraPath =
$_SERVER[
'DOCUMENT_ROOT'] .
'/bitrix/.settings_extra.php';
37 if (file_exists($settingsExtraPath))
39 $settingsExtra = include($settingsExtraPath);
40 if (is_array($settingsExtra) && !empty($settingsExtra))
42 foreach ($settingsExtra as
$k => $v)
51 if (empty(
$settings[
'main.token_service'][
'value'][
'storage']))
56 if (!is_array(
$settings[
'main.token_service'][
'value'][
'storage']))
61 if (empty(
$settings[
'main.token_service'][
'value'][
'key']))
66 return $settings[
'main.token_service'][
'value'];
78 if (
count($parts) !== 2)
84 if (empty(
$message) || empty($signature))
90 $expectedSignature = bin2hex(hash_hmac(
'sha256',
$message,
$key,
true));
92 return hash_equals($expectedSignature, $signature);
97 if (!extension_loaded(
'memcache'))
110 if (!extension_loaded(
'redis'))
130 if (isset(
$config[
'compression']) || defined(
'\Redis::COMPRESSION_LZ4'))
132 $connection->setOption(\Redis::OPT_COMPRESSION,
$config[
'compression'] ?? \Redis::COMPRESSION_LZ4);
133 $connection->setOption(\Redis::OPT_COMPRESSION_LEVEL,
$config[
'compression_level'] ?? \Redis::COMPRESSION_ZSTD_MAX);
136 if (isset(
$config[
'serializer']) || defined(
'\Redis::SERIALIZER_IGBINARY'))
138 $connection->setOption(\Redis::OPT_SERIALIZER,
$config[
'serializer'] ?? \Redis::SERIALIZER_IGBINARY);
147 if (
$config[
'type'] ===
'redis')
152 if (
$config[
'type'] ===
'memcache')
175 $key =
"{$prefix}userScopes:{$userToken}";
194 if (empty($storedScopes) || !is_string($storedScopes))
199 if ($storedScopes[$scope] < time())
210 return json_decode(
$data,
true, 64) ?: [];
221 $cipherAlgorithm =
'aes-256-ctr';
222 $hashAlgorithm =
'sha256';
224 $ivLength = openssl_cipher_iv_length($cipherAlgorithm);
225 $iv = substr(
$data, 0, $ivLength);
226 $raw = substr(
$data, $ivLength);
228 $keyHash = openssl_digest($iv .
$key, $hashAlgorithm,
true);
229 $decrypted = openssl_decrypt($raw, $cipherAlgorithm, $keyHash, OPENSSL_RAW_DATA, $iv);
231 if ($decrypted ===
false)
236 $hashPart = substr($decrypted, 0, strlen($keyHash));
237 $result = substr($decrypted, strlen($keyHash));
238 $checkHash = openssl_digest(
$result, $hashAlgorithm,
true);
240 if ($hashPart !== $checkHash)
284$fileInfoKey =
"{$config['storage']['keyPrefix']}file:{$decryptedData['fileId']}";
295catch (\JsonException $e)
324 $exact = $_GET[
'exact'] ===
'Y' ? 2 : 1;
328 $resizeDir =
"{$requestedWidth}_{$requestedHeight}_{$exact}";
333 $encodedDir = rawurlencode(
$dir);
335 if ($delimiterPosition ===
false)
342 $defaultResizeFilter = [
347 [0 => [
'name' =>
'sharpen',
'precision' => 15]],
350 $resizeDir = md5(serialize($defaultResizeFilter));
352 $accelRedirectPath = $partBeforeDir . rawurlencode(
"resize_cache/{$bFileId}/{$resizeDir}/") . $dirAndRest;
357header(
'X-Accel-Buffering: no');
363 header(
"X-CD-Info: attachment; filename*=utf-8''{$urlEncodedName}");
365header(
'X-Gen-Src: ' .
$_SERVER[
'REQUEST_URI'] .
'&_gen=1');
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
$_SERVER["DOCUMENT_ROOT"]
getStorage(array $config)
hasScope(string $prefix, string $userToken, string $scope, \Redis|\Memcache $storage)
decryptData(string $data, string $key)
if(! $config) isValidSign(string $key, string $signedUserToken)
if(isValidSign($key, $signedUserToken)===false) $decryptedData
getRedisStorage(array $config)
if(time() > $expirationTime) $requestedWidth
if(empty($signedUserToken)) $key
if(! $storage) $userToken
if(!hasScope($config['storage']['keyPrefix'], $userToken, $decryptedData['scope'], $storage)) $fileInfoKey
catch(\JsonException $e) $accelRedirectPath
if(!empty( $_GET[ 'ts']) &&$_GET[ 'ts']==='bxviewer') if(!empty($_GET['_gen'])) $encryptedData
if(empty($decryptedData)) $storage
if(empty($encryptedData)) if(str_starts_with( $_SERVER[ 'SCRIPT_NAME'], '/mobile/ajax.php')) readConfig()
getMemcacheStorage(array $config)
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']