27 return 'Amazon Simple Storage Service';
38 'us-east-2' =>
'US East (Ohio)',
39 'us-east-1' =>
'US East (N. Virginia)',
40 'us-west-1' =>
'US West (N. California)',
41 'us-west-2' =>
'US West (Oregon)',
42 'af-south-1' =>
'Africa (Cape Town)',
43 'ap-east-1' =>
'Asia Pacific (Hong Kong)',
44 'ap-south-2' =>
'Asia Pacific (Hyderabad)',
45 'ap-southeast-3' =>
'Asia Pacific (Jakarta)',
46 'ap-southeast-4' =>
'Asia Pacific (Melbourne)',
47 'ap-south-1' =>
'Asia Pacific (Mumbai)',
48 'ap-northeast-3' =>
'Asia Pacific (Osaka-Local)',
49 'ap-northeast-2' =>
'Asia Pacific (Seoul)',
50 'ap-southeast-1' =>
'Asia Pacific (Singapore)',
51 'ap-southeast-2' =>
'Asia Pacific (Sydney)',
52 'ap-northeast-1' =>
'Asia Pacific (Tokyo)',
53 'ca-central-1' =>
'Canada (Central)',
54 'ca-west-1' =>
'Canada West (Calgary)',
55 'eu-central-1' =>
'Europe (Frankfurt)',
56 'eu-west-1' =>
'Europe (Ireland)',
57 'eu-west-2' =>
'Europe (London)',
58 'eu-south-1' =>
'Europe (Milan)',
59 'eu-west-3' =>
'Europe (Paris)',
60 'eu-south-2' =>
'Europe (Spain)',
61 'eu-north-1' =>
'Europe (Stockholm)',
62 'eu-central-2' =>
'Europe (Zurich)',
63 'il-central-1' =>
'Israel (Tel Aviv)',
64 'me-south-1' =>
'Middle East (Bahrain)',
65 'me-central-1' =>
'Middle East (UAE)',
66 'sa-east-1' =>
'South America (Sao Paulo)',
67 'us-gov-east-1' =>
'AWS GovCloud (US-East)',
68 'us-gov-west-1' =>
'AWS GovCloud (US-West)',
79 '' =>
's3.amazonaws.com',
80 'us-east-2' =>
's3.us-east-2.amazonaws.com',
81 'us-east-1' =>
's3.us-east-1.amazonaws.com',
82 'us-west-1' =>
's3.us-west-1.amazonaws.com',
83 'us-west-2' =>
's3.us-west-2.amazonaws.com',
84 'af-south-1' =>
's3.af-south-1.amazonaws.com',
85 'ap-east-1' =>
's3.ap-east-1.amazonaws.com',
86 'ap-south-2' =>
's3.ap-south-2.amazonaws.com',
87 'ap-southeast-3' =>
's3.ap-southeast-3.amazonaws.com',
88 'ap-southeast-4' =>
's3.ap-southeast-4.amazonaws.com',
89 'ap-south-1' =>
's3.ap-south-1.amazonaws.com',
90 'ap-northeast-3' =>
's3.ap-northeast-3.amazonaws.com',
91 'ap-northeast-2' =>
's3.ap-northeast-2.amazonaws.com',
92 'ap-southeast-1' =>
's3.ap-southeast-1.amazonaws.com',
93 'ap-southeast-2' =>
's3.ap-southeast-2.amazonaws.com',
94 'ap-northeast-1' =>
's3.ap-northeast-1.amazonaws.com',
95 'ca-central-1' =>
's3.ca-central-1.amazonaws.com',
96 'ca-west-1' =>
's3.ca-west-1.amazonaws.com',
97 'eu-central-1' =>
's3.eu-central-1.amazonaws.com',
98 'eu-west-1' =>
's3.eu-west-1.amazonaws.com',
99 'eu-west-2' =>
's3.eu-west-2.amazonaws.com',
100 'eu-south-1' =>
's3.eu-south-1.amazonaws.com',
101 'eu-west-3' =>
's3.eu-west-3.amazonaws.com',
102 'eu-south-2' =>
's3.eu-south-2.amazonaws.com',
103 'eu-north-1' =>
's3.eu-north-1.amazonaws.com',
104 'eu-central-2' =>
's3.eu-central-2.amazonaws.com',
105 'il-central-1' =>
's3.il-central-1.amazonaws.com',
106 'me-south-1' =>
's3.me-south-1.amazonaws.com',
107 'me-central-1' =>
's3.me-central-1.amazonaws.com',
108 'sa-east-1' =>
's3.sa-east-1.amazonaws.com',
109 'us-gov-east-1' =>
's3.us-gov-east-1.amazonaws.com',
110 'us-gov-west-1' =>
's3.us-gov-west-1.amazonaws.com',
125 $arSettings = $_POST[
'SETTINGS'][$this->
GetID()];
129 $arSettings = unserialize($arBucket[
'SETTINGS'], [
'allowed_classes' =>
false]);
132 if (!is_array($arSettings))
134 $arSettings = [
'ACCESS_KEY' =>
'',
'SECRET_KEY' =>
''];
138 $show = (($cur_SERVICE_ID === $this->
GetID()) || !$bServiceSet) ?
'' :
'none';
139 $useHttps = $arSettings[
'USE_HTTPS'] ??
'N';
142 <tr id="SETTINGS_0_' . $htmlID .
'" style="display:' . $show .
'" class="settings-tr adm-detail-required-field">
143 <td>' .
GetMessage(
'CLO_STORAGE_AMAZON_EDIT_ACCESS_KEY') .
':</td>
144 <td><input type="hidden" name="SETTINGS[' . $htmlID .
'][ACCESS_KEY]" id="' . $htmlID .
'ACCESS_KEY" value="' .
htmlspecialcharsbx($arSettings[
'ACCESS_KEY']) .
'"><input type="text" size="55" name="' . $htmlID .
'INP_ACCESS_KEY" id="' . $htmlID .
'INP_ACCESS_KEY" value="' .
htmlspecialcharsbx($arSettings[
'ACCESS_KEY']) .
'" ' . ($arBucket[
'READ_ONLY'] ===
'Y' ?
'"disabled"' :
'') .
' onchange="BX(\'' . $htmlID .
'ACCESS_KEY\').value = this.value"></td>
146 <tr id="SETTINGS_1_' . $htmlID .
'" style="display:' . $show .
'" class="settings-tr adm-detail-required-field">
147 <td>' .
GetMessage(
'CLO_STORAGE_AMAZON_EDIT_SECRET_KEY') .
':</td>
148 <td><input type="hidden" name="SETTINGS[' . $htmlID .
'][SECRET_KEY]" id="' . $htmlID .
'SECRET_KEY" value="' .
htmlspecialcharsbx($arSettings[
'SECRET_KEY']) .
'"><input type="text" size="55" name="' . $htmlID .
'INP_SECRET_KEY" id="' . $htmlID .
'INP_SECRET_KEY" value="' .
htmlspecialcharsbx($arSettings[
'SECRET_KEY']) .
'" autocomplete="off" ' . ($arBucket[
'READ_ONLY'] ===
'Y' ?
'"disabled"' :
'') .
' onchange="BX(\'' . $htmlID .
'SECRET_KEY\').value = this.value">' . (
149 array_key_exists(
'SESSION_TOKEN', $arSettings) ?
150 '<input type="hidden" name="SETTINGS[' . $htmlID .
'][SESSION_TOKEN]" id="' . $htmlID .
'SESSION_TOKEN" value="' .
htmlspecialcharsbx($arSettings[
'SESSION_TOKEN']) .
'">' :
154 <tr id="SETTINGS_3_' . $htmlID .
'" style="display:' . $show .
'" class="settings-tr">
155 <td nowrap>' .
GetMessage(
'CLO_STORAGE_AMAZON_EDIT_USE_HTTPS') .
':</td>
156 <td><input type="hidden" name="SETTINGS[' . $htmlID .
'][USE_HTTPS]" id="' . $htmlID .
'KEY" value="N"><input type="checkbox" name="SETTINGS[' . $htmlID .
'][USE_HTTPS]" id="' . $htmlID .
'USE_HTTPS" value="Y" ' . ($useHttps ==
'Y' ?
'checked="checked"' :
'') .
'></td>
157 </tr><tr id="SETTINGS_2_' . $htmlID .
'" style="display:' . $show .
'" class="settings-tr">
177 'ACCESS_KEY' => is_array($arSettings) ? trim($arSettings[
'ACCESS_KEY']) :
'',
178 'SECRET_KEY' => is_array($arSettings) ? trim($arSettings[
'SECRET_KEY']) :
'',
180 if (is_array($arSettings) && array_key_exists(
'SESSION_TOKEN', $arSettings))
182 $result[
'SESSION_TOKEN'] = trim($arSettings[
'SESSION_TOKEN']);
185 if ($arBucket[
'READ_ONLY'] !==
'Y' &&
$result[
'ACCESS_KEY'] ===
'')
188 'id' => $this->
GetID() .
'INP_ACCESS_KEY',
189 'text' =>
GetMessage(
'CLO_STORAGE_AMAZON_EMPTY_ACCESS_KEY'),
193 if ($arBucket[
'READ_ONLY'] !==
'Y' &&
$result[
'SECRET_KEY'] ===
'')
196 'id' => $this->
GetID() .
'INP_SECRET_KEY',
197 'text' =>
GetMessage(
'CLO_STORAGE_AMAZON_EMPTY_SECRET_KEY'),
222 $this->new_end_point !=
''
223 && preg_match(
'#^(http|https)://' . preg_quote($bucket,
'#') .
'(.+?)/#', $this->new_end_point, $match) > 0
226 return $bucket . $match[2];
232 return $bucket .
'.s3.' . $this->location .
'.amazonaws.com';
236 return 's3.' . $this->location .
'.amazonaws.com';
243 return $bucket .
'.s3.amazonaws.com';
247 return 's3.amazonaws.com';
258 public function GetFileSRC($arBucket, $arFile, $encoded =
true)
261 $request = \Bitrix\Main\Context::getCurrent()->getRequest();
262 $proto =
$request->isHttps() ?
'https' :
'http';
270 if ($arBucket[
'CNAME'] !=
'')
272 $host = $arBucket[
'CNAME'];
275 elseif ($proto ===
'https' && strpos($arBucket[
'BUCKET'],
'.') !==
false)
277 if (isset($aps[$arBucket[
'LOCATION']]))
279 $host = $aps[$arBucket[
'LOCATION']];
286 $pref = $arBucket[
'BUCKET'];
290 if (isset($aps[$arBucket[
'LOCATION']]))
292 $host = $arBucket[
'BUCKET'] .
'.' . $aps[$arBucket[
'LOCATION']];
302 if (is_array($arFile))
304 $URI = ltrim($arFile[
'SUBDIR'] .
'/' . $arFile[
'FILE_NAME'],
'/');
308 $URI = ltrim($arFile,
'/');
311 if ($arBucket[
'PREFIX'] !=
'')
313 if (substr($URI, 0, strlen($arBucket[
'PREFIX']) + 1) !== $arBucket[
'PREFIX'] .
'/')
315 $URI = $arBucket[
'PREFIX'] .
'/' . $URI;
321 $URI = $pref .
'/' . $URI;
330 return $proto .
'://' .
$host .
'/' . $URI;
351 && $arBucket[
'LOCATION'] !=
''
359 if ($arBucket[
'LOCATION'] !=
'' && $arBucket[
'LOCATION'] !==
'us-east-1')
362 '<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">'
363 .
'<LocationConstraint>' . $arBucket[
'LOCATION'] .
'</LocationConstraint>'
364 .
'</CreateBucketConfiguration>';
373 $arBucket[
'SETTINGS'],
379 [
'x-amz-object-ownership' =>
'ObjectWriter']
382 if ($this->status == 409)
387 elseif ($this->status == 200)
390 $arBucket[
'SETTINGS'],
394 '?publicAccessBlock='
396 if ($this->status == 204)
401 if (defined(
'BX_CLOUDS_ERROR_DEBUG'))
413 if (defined(
'BX_CLOUDS_ERROR_DEBUG'))
if(!Loader::includeModule('catalog')) if(!AccessController::getCurrent() ->check(ActionDictionary::ACTION_PRICE_EDIT)) if(!check_bitrix_sessid()) $request
GetRequestHost($bucket, $arSettings)
GetFileSRC($arBucket, $arFile, $encoded=true)
CheckSettings($arBucket, &$arSettings)
GetSettingsHTML($arBucket, $bServiceSet, $cur_SERVICE_ID, $bVarsFromForm)
ListFiles($arBucket, $filePath, $bRecursive=false, $pageSize=0, $pageMarker='')
SendRequest($arSettings, $verb, $bucket, $file_name='/', $params='', $content='', $additional_headers=[])
GetLastRequestHeader($headerName)
static URLEncode($str, $charset, $file_name=false)
AddMessage2Log($text, $module='', $traceDepth=6, $showArgs=false)
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
GetMessage($name, $aReplace=null)
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)