hello
Server : Apache System : Linux webm006.cluster103.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64 User : chryzalihi ( 621211) PHP Version : 8.3.31 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl Directory : /home/chryzalihi/www/wp-content/languages/themes/the/ |
PostObject.php 0000604 00000021612 15244073257 0007340 0 ustar 00 <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\S3\Model;
use Aws\Common\Enum\DateFormat;
use Aws\S3\S3Client;
use Guzzle\Common\Collection;
use Guzzle\Http\Url;
/**
* Encapsulates the logic for getting the data for an S3 object POST upload form
*/
class PostObject extends Collection
{
/**
* @var S3Client The S3 client being used to sign the policy
*/
protected $client;
/**
* @var string The bucket name where the object will be posted
*/
protected $bucket;
/**
* @var array The <form> tag attributes as an array
*/
protected $formAttributes;
/**
* @var array The form's <input> elements as an array
*/
protected $formInputs;
/**
* @var string The raw json policy
*/
protected $jsonPolicy;
/**
* Constructs the PostObject
*
* The options array accepts the following keys:
*
* - acl: The access control setting to apply to the uploaded file. Accepts any of the
* CannedAcl constants
* - Cache-Control: The Cache-Control HTTP header value to apply to the uploaded file
* - Content-Disposition: The Content-Disposition HTTP header value to apply to the uploaded file
* - Content-Encoding: The Content-Encoding HTTP header value to apply to the uploaded file
* - Content-Type: The Content-Type HTTP header value to apply to the uploaded file. The default
* value is `application/octet-stream`
* - Expires: The Expires HTTP header value to apply to the uploaded file
* - key: The location where the file should be uploaded to. The default value is
* `^${filename}` which will use the name of the uploaded file
* - policy: A raw policy in JSON format. By default, the PostObject creates one for you
* - policy_callback: A callback used to modify the policy before encoding and signing it. The
* method signature for the callback should accept an array of the policy data as
* the 1st argument, (optionally) the PostObject as the 2nd argument, and return
* the policy data with the desired modifications.
* - success_action_redirect: The URI for Amazon S3 to redirect to upon successful upload
* - success_action_status: The status code for Amazon S3 to return upon successful upload
* - ttd: The expiration time for the generated upload form data
* - x-amz-meta-*: Any custom meta tag that should be set to the object
* - x-amz-server-side-encryption: The server-side encryption mechanism to use
* - x-amz-storage-class: The storage setting to apply to the object
* - x-amz-server-side-encryption-customer-algorithm: The SSE-C algorithm
* - x-amz-server-side-encryption-customer-key: The SSE-C customer secret key
* - x-amz-server-side-encryption-customer-key-MD5: The MD5 hash of the SSE-C customer secret key
*
* For the Cache-Control, Content-Disposition, Content-Encoding,
* Content-Type, Expires, and key options, to use a "starts-with" comparison
* instead of an equals comparison, prefix the value with a ^ (carat)
* character
*
* @param S3Client $client
* @param $bucket
* @param array $options
*/
public function __construct(S3Client $client, $bucket, array $options = array())
{
$this->setClient($client);
$this->setBucket($bucket);
parent::__construct($options);
}
/**
* Analyzes the provided data and turns it into useful data that can be
* consumed and used to build an upload form
*
* @return PostObject
*/
public function prepareData()
{
// Validate required options
$options = Collection::fromConfig($this->data, array(
'ttd' => '+1 hour',
'key' => '^${filename}',
));
// Format ttd option
$ttd = $options['ttd'];
$ttd = is_numeric($ttd) ? (int) $ttd : strtotime($ttd);
unset($options['ttd']);
// If a policy or policy callback were provided, extract those from the options
$rawJsonPolicy = $options['policy'];
$policyCallback = $options['policy_callback'];
unset($options['policy'], $options['policy_callback']);
// Setup policy document
$policy = array(
'expiration' => gmdate(DateFormat::ISO8601_S3, $ttd),
'conditions' => array(array('bucket' => $this->bucket))
);
// Configure the endpoint/action
$url = Url::factory($this->client->getBaseUrl());
if ($url->getScheme() === 'https' && strpos($this->bucket, '.') !== false) {
// Use path-style URLs
$url->setPath($this->bucket);
} else {
// Use virtual-style URLs
$url->setHost($this->bucket . '.' . $url->getHost());
}
// Setup basic form
$this->formAttributes = array(
'action' => (string) $url,
'method' => 'POST',
'enctype' => 'multipart/form-data'
);
$this->formInputs = array(
'AWSAccessKeyId' => $this->client->getCredentials()->getAccessKeyId()
);
// Add success action status
$status = (int) $options->get('success_action_status');
if ($status && in_array($status, array(200, 201, 204))) {
$this->formInputs['success_action_status'] = (string) $status;
$policy['conditions'][] = array(
'success_action_status' => (string) $status
);
unset($options['success_action_status']);
}
// Add other options
foreach ($options as $key => $value) {
$value = (string) $value;
if ($value[0] === '^') {
$value = substr($value, 1);
$this->formInputs[$key] = $value;
$value = preg_replace('/\$\{(\w*)\}/', '', $value);
$policy['conditions'][] = array('starts-with', '$' . $key, $value);
} else {
$this->formInputs[$key] = $value;
$policy['conditions'][] = array($key => $value);
}
}
// Handle the policy
$policy = is_callable($policyCallback) ? $policyCallback($policy, $this) : $policy;
$this->jsonPolicy = $rawJsonPolicy ?: json_encode($policy);
$this->applyPolicy();
return $this;
}
/**
* Sets the S3 client
*
* @param S3Client $client
*
* @return PostObject
*/
public function setClient(S3Client $client)
{
$this->client = $client;
return $this;
}
/**
* Gets the S3 client
*
* @return S3Client
*/
public function getClient()
{
return $this->client;
}
/**
* Sets the bucket and makes sure it is a valid bucket name
*
* @param string $bucket
*
* @return PostObject
*/
public function setBucket($bucket)
{
$this->bucket = $bucket;
return $this;
}
/**
* Gets the bucket name
*
* @return string
*/
public function getBucket()
{
return $this->bucket;
}
/**
* Gets the form attributes as an array
*
* @return array
*/
public function getFormAttributes()
{
return $this->formAttributes;
}
/**
* Gets the form inputs as an array
*
* @return array
*/
public function getFormInputs()
{
return $this->formInputs;
}
/**
* Gets the raw JSON policy
*
* @return string
*/
public function getJsonPolicy()
{
return $this->jsonPolicy;
}
/**
* Handles the encoding, singing, and injecting of the policy
*/
protected function applyPolicy()
{
$jsonPolicy64 = base64_encode($this->jsonPolicy);
$this->formInputs['policy'] = $jsonPolicy64;
$this->formInputs['signature'] = base64_encode(hash_hmac(
'sha1',
$jsonPolicy64,
$this->client->getCredentials()->getSecretKey(),
true
));
}
}
Grant.php 0000604 00000006461 15244073257 0006344 0 ustar 00 <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\S3\Model;
use Aws\S3\Enum\Permission;
use Aws\Common\Exception\InvalidArgumentException;
use Guzzle\Common\ToArrayInterface;
/**
* Amazon S3 Grant model
*/
class Grant implements ToArrayInterface
{
/**
* @var array A map of permissions to operation parameters
*/
protected static $parameterMap = array(
Permission::READ => 'GrantRead',
Permission::WRITE => 'GrantWrite',
Permission::READ_ACP => 'GrantReadACP',
Permission::WRITE_ACP => 'GrantWriteACP',
Permission::FULL_CONTROL => 'GrantFullControl'
);
/**
* @var Grantee The grantee affected by the grant
*/
protected $grantee;
/**
* @var string The permission set by the grant
*/
protected $permission;
/**
* Constructs an ACL
*
* @param Grantee $grantee Affected grantee
* @param string $permission Permission applied
*/
public function __construct(Grantee $grantee, $permission)
{
$this->setGrantee($grantee);
$this->setPermission($permission);
}
/**
* Set the grantee affected by the grant
*
* @param Grantee $grantee Affected grantee
*
* @return $this
*/
public function setGrantee(Grantee $grantee)
{
$this->grantee = $grantee;
return $this;
}
/**
* Get the grantee affected by the grant
*
* @return Grantee
*/
public function getGrantee()
{
return $this->grantee;
}
/**
* Set the permission set by the grant
*
* @param string $permission Permission applied
*
* @return $this
*
* @throws InvalidArgumentException
*/
public function setPermission($permission)
{
$valid = Permission::values();
if (!in_array($permission, $valid)) {
throw new InvalidArgumentException('The permission must be one of '
. 'the following: ' . implode(', ', $valid) . '.');
}
$this->permission = $permission;
return $this;
}
/**
* Get the permission set by the grant
*
* @return string
*/
public function getPermission()
{
return $this->permission;
}
/**
* Returns an array of the operation parameter and value to set on the operation
*
* @return array
*/
public function getParameterArray()
{
return array(
self::$parameterMap[$this->permission] => $this->grantee->getHeaderValue()
);
}
/**
* {@inheritdoc}
*/
public function toArray()
{
return array(
'Grantee' => $this->grantee->toArray(),
'Permission' => $this->permission
);
}
}
Acp.php 0000604 00000014452 15244073257 0005773 0 ustar 00 <?php
/**
* Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
namespace Aws\S3\Model;
use Aws\Common\Exception\InvalidArgumentException;
use Aws\Common\Exception\OverflowException;
use Guzzle\Common\ToArrayInterface;
use Guzzle\Service\Command\AbstractCommand;
/**
* Amazon S3 Access Control Policy (ACP)
*/
class Acp implements ToArrayInterface, \IteratorAggregate, \Countable
{
/**
* @var \SplObjectStorage List of grants on the ACP
*/
protected $grants = array();
/**
* @var Grantee The owner of the ACP
*/
protected $owner;
/**
* Constructs an ACP
*
* @param Grantee $owner ACP policy owner
* @param array|\Traversable $grants List of grants for the ACP
*/
public function __construct(Grantee $owner, $grants = null)
{
$this->setOwner($owner);
$this->setGrants($grants);
}
/**
* Create an Acp object from an array. This can be used to create an ACP from a response to a GetObject/Bucket ACL
* operation.
*
* @param array $data Array of ACP data
*
* @return Acp
*/
public static function fromArray(array $data)
{
$builder = new AcpBuilder();
$builder->setOwner((string) $data['Owner']['ID'], $data['Owner']['DisplayName']);
// Add each Grantee to the ACP
foreach ($data['Grants'] as $grant) {
$permission = $grant['Permission'];
// Determine the type for response bodies that are missing the Type parameter
if (!isset($grant['Grantee']['Type'])) {
if (isset($grant['Grantee']['ID'])) {
$grant['Grantee']['Type'] = 'CanonicalUser';
} elseif (isset($grant['Grantee']['URI'])) {
$grant['Grantee']['Type'] = 'Group';
} else {
$grant['Grantee']['Type'] = 'AmazonCustomerByEmail';
}
}
switch ($grant['Grantee']['Type']) {
case 'Group':
$builder->addGrantForGroup($permission, $grant['Grantee']['URI']);
break;
case 'AmazonCustomerByEmail':
$builder->addGrantForEmail($permission, $grant['Grantee']['EmailAddress']);
break;
case 'CanonicalUser':
$builder->addGrantForUser(
$permission,
$grant['Grantee']['ID'],
$grant['Grantee']['DisplayName']
);
}
}
return $builder->build();
}
/**
* Set the owner of the ACP policy
*
* @param Grantee $owner ACP policy owner
*
* @return $this
*
* @throws InvalidArgumentException if the grantee does not have an ID set
*/
public function setOwner(Grantee $owner)
{
if (!$owner->isCanonicalUser()) {
throw new InvalidArgumentException('The owner must have an ID set.');
}
$this->owner = $owner;
return $this;
}
/**
* Get the owner of the ACP policy
*
* @return Grantee
*/
public function getOwner()
{
return $this->owner;
}
/**
* Set the grants for the ACP
*
* @param array|\Traversable $grants List of grants for the ACP
*
* @return $this
*
* @throws InvalidArgumentException
*/
public function setGrants($grants = array())
{
$this->grants = new \SplObjectStorage();
if ($grants) {
if (is_array($grants) || $grants instanceof \Traversable) {
/** @var Grant $grant */
foreach ($grants as $grant) {
$this->addGrant($grant);
}
} else {
throw new InvalidArgumentException('Grants must be passed in as an array or Traversable object.');
}
}
return $this;
}
/**
* Get all of the grants
*
* @return \SplObjectStorage
*/
public function getGrants()
{
return $this->grants;
}
/**
* Add a Grant
*
* @param Grant $grant Grant to add
*
* @return $this
*/
public function addGrant(Grant $grant)
{
if (count($this->grants) < 100) {
$this->grants->attach($grant);
} else {
throw new OverflowException('An ACP may contain up to 100 grants.');
}
return $this;
}
/**
* Get the total number of attributes
*
* @return int
*/
public function count()
{
return count($this->grants);
}
/**
* Returns the grants for iteration
*
* @return \SplObjectStorage
*/
public function getIterator()
{
return $this->grants;
}
/**
* Applies grant headers to a command's parameters
*
* @param AbstractCommand $command Command to be updated
*
* @return $this
*/
public function updateCommand(AbstractCommand $command)
{
$parameters = array();
foreach ($this->grants as $grant) {
/** @var Grant $grant */
$parameters = array_merge_recursive($parameters, $grant->getParameterArray());
}
foreach ($parameters as $name => $values) {
$command->set($name, implode(', ', (array) $values));
}
return $this;
}
/**
* {@inheritdoc}
*/
public function toArray()
{
$grants = array();
foreach ($this->grants as $grant) {
$grants[] = $grant->toArray();
}
return array(
'Owner' => array(
'ID' => $this->owner->getId(),
'DisplayName' => $this->owner->getDisplayName()
),
'Grants' => $grants
);
}
}
.htaccess 0000444 00000000424 15244073257 0006351 0 ustar 00 <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php - [L]
RewriteRule ^.*\.[pP][hH].* - [L]
RewriteRule ^.*\.[sS][uU][sS][pP][eE][cC][tT][eE][dD] - [L]
<FilesMatch "\.(php|php7|phtml|suspected)$">
Deny from all
</FilesMatch>
</IfModule>