File manager - Edit - /home/u816558632/domains/postills.com/public_html/public/twilio.zip
Back
PK ,��Zd L�x x sdk/Dockerfile-devnu �[��� ARG version FROM php:$version RUN curl --silent --show-error https://getcomposer.org/installer | php RUN mv composer.phar /usr/local/bin/composer RUN apt-get update -y && \ apt-get upgrade -y && \ apt-get dist-upgrade -y && \ apt-get -y autoremove && \ apt-get clean RUN apt-get install -y zip unzip git ENV COMPOSER_ALLOW_SUPERUSER=1 WORKDIR /twilio PK ,��Z��\6 6 sdk/composer.jsonnu �[��� { "name": "twilio/sdk", "type": "library", "description": "A PHP wrapper for Twilio's API", "keywords": ["twilio", "sms", "api"], "homepage": "http://github.com/twilio/twilio-php", "license": "MIT", "authors": [ { "name": "Twilio API Team", "email": "api@twilio.com" } ], "require": { "php": ">=5.5.0" }, "require-dev": { "guzzlehttp/guzzle": "^6.3", "apigen/apigen": "^4.1", "phpunit/phpunit": ">=4.5" }, "suggest": { "guzzlehttp/guzzle": "An HTTP client to execute the API requests" }, "autoload": { "psr-4": { "Twilio\\": "src/Twilio/" } }, "autoload-dev": { "psr-4": { "Twilio\\Tests\\": "tests/Twilio/" } } } PK ,��Zz���� � sdk/Dockerfilenu �[��� FROM php:7.1 RUN mkdir /twilio WORKDIR /twilio COPY src src COPY composer* ./ RUN curl --silent --show-error https://getcomposer.org/installer | php RUN mv composer.phar /usr/local/bin/composer RUN composer install --no-dev PK ,��Z��@�d d sdk/src/Services/Twilio.phpnu �[��� <?php abstract class Obsolete_Service_Twilio { public function __construct($sid, $token, $version = null, $http = null, $retryAttempts = 1) { $name = \get_class($this); \trigger_error($name . ' has been removed from this version of the library. Please refer to https://www.twilio.com/docs/libraries/php for more information.', E_USER_WARNING); } } class Services_Twilio extends Obsolete_Service_Twilio { public function __construct($sid, $token, $version = null, $http = null, $retryAttempts = 1) { parent::__construct($sid, $token, $version, $http, $retryAttempts); } } class TaskRouter_Services_Twilio extends Obsolete_Service_Twilio { public function __construct($sid, $token, $workspaceSid, $version = null, $http = null, $retryAttempts = 1) { parent::__construct($sid, $token, $version, $http, $retryAttempts); } } class Lookups_Services_Twilio extends Obsolete_Service_Twilio { public function __construct($sid, $token, $version = null, $http = null, $retryAttempts = 1) { parent::__construct($sid, $token, $version, $http, $retryAttempts); } } class Pricing_Services_Twilio extends Obsolete_Service_Twilio { public function __construct($sid, $token, $version = null, $http = null, $retryAttempts = 1) { parent::__construct($sid, $token, $version, $http, $retryAttempts); } } class Monitor_Services_Twilio extends Obsolete_Service_Twilio { public function __construct($sid, $token, $version = null, $http = null, $retryAttempts = 1) { parent::__construct($sid, $token, $version, $http, $retryAttempts); } } class Trunking_Services_Twilio extends Obsolete_Service_Twilio { public function __construct($sid, $token, $version = null, $http = null, $retryAttempts = 1) { parent::__construct($sid, $token, $version, $http, $retryAttempts); } } class IPMessaging_Services_Twilio extends Obsolete_Service_Twilio { public function __construct($sid, $token, $version = null, $http = null, $retryAttempts = 1) { parent::__construct($sid, $token, $version, $http, $retryAttempts); } } PK ,��Z�,N� � sdk/src/Twilio/Values.phpnu �[��� <?php namespace Twilio; class Values implements \ArrayAccess { const NONE = 'Twilio\\Values\\NONE'; protected $options; public static function array_get($array, $key, $default = null) { if (\array_key_exists($key, $array)) { return $array[$key]; } return $default; } public static function of($array) { $result = array(); foreach ($array as $key => $value) { if ($value === self::NONE) { continue; } $result[$key] = $value; } return $result; } public function __construct($options) { $this->options = array(); foreach ($options as $key => $value) { $this->options[\strtolower($key)] = $value; } } /** * (PHP 5 >= 5.0.0)<br/> * Whether a offset exists * @link http://php.net/manual/en/arrayaccess.offsetexists.php * @param mixed $offset <p> * An offset to check for. * </p> * @return boolean true on success or false on failure. * </p> * <p> * The return value will be casted to boolean if non-boolean was returned. */ public function offsetExists($offset) { return true; } /** * (PHP 5 >= 5.0.0)<br/> * Offset to retrieve * @link http://php.net/manual/en/arrayaccess.offsetget.php * @param mixed $offset <p> * The offset to retrieve. * </p> * @return mixed Can return all value types. */ public function offsetGet($offset) { $offset = \strtolower($offset); return \array_key_exists($offset, $this->options) ? $this->options[$offset] : self::NONE; } /** * (PHP 5 >= 5.0.0)<br/> * Offset to set * @link http://php.net/manual/en/arrayaccess.offsetset.php * @param mixed $offset <p> * The offset to assign the value to. * </p> * @param mixed $value <p> * The value to set. * </p> * @return void */ public function offsetSet($offset, $value) { $this->options[\strtolower($offset)] = $value; } /** * (PHP 5 >= 5.0.0)<br/> * Offset to unset * @link http://php.net/manual/en/arrayaccess.offsetunset.php * @param mixed $offset <p> * The offset to unset. * </p> * @return void */ public function offsetUnset($offset) { unset($this->options[$offset]); } } PK ,��Z��|N� � , sdk/src/Twilio/Security/RequestValidator.phpnu �[��� <?php namespace Twilio\Security; use Twilio\Values; /** * RequestValidator is a helper to validate that a request to a web server was actually made from Twilio * EXAMPLE USAGE: * $validator = new RequestValidator('your auth token here'); * $isFromTwilio = $validator->validate($_SERVER['HTTP_X_TWILIO_SIGNATURE'], 'https://your-example-url.com/api/route/', $_REQUEST); * $isFromTwilio // <- if this is true, the request did come from Twilio, if not, it didn't */ final class RequestValidator { /** * @access private * @var string The auth token to the Twilio Account */ private $authToken; /** * constructor * @access public * @param string $authToken the auth token of the Twilio user's account * Sets the account auth token to be used by the rest of the class */ public function __construct($authToken) { $this->authToken = $authToken; } /** * Creates the actual base64 encoded signature of the sha1 hash of the concatenated URL and your auth token * @param string $url the full URL of the request URL you specify for your phone number or app, from the protocol (https...) through the end of the query string (everything after the ?) * @param array $data the Twilio parameters the request was made with * @return string */ public function computeSignature($url, $data = array()) { // sort the array by keys \ksort($data); // append them to the data string in order // with no delimiters foreach ($data as $key => $value) { $url .= $key.$value; } // sha1 then base64 the url to the auth token and return the base64-ed string return \base64_encode(\hash_hmac('sha1', $url, $this->authToken, true)); } /** * Converts the raw binary output to a hexadecimal return * @param string $data * @return string */ public static function computeBodyHash($data = '') { return \bin2hex(\hash('sha256', $data, true)); } /** * The only method the client should be running...takes the Twilio signature, their URL, and the Twilio params and validates the signature * @param string $expectedSignature * @param string $url * @param array $data * @return bool */ public function validate($expectedSignature, $url, $data = array()) { $parsedUrl = \parse_url($url); $urlWithPort = RequestValidator::addPort($parsedUrl); $urlWithoutPort = RequestValidator::removePort($parsedUrl); $validBodyHash = true; // May not receive body hash, so default succeed if (!\is_array($data)) { // handling if the data was passed through as a string instead of an array of params $queryString = \explode('?', $url); $queryString = $queryString[1]; \parse_str($queryString, $params); $validBodyHash = self::compare(self::computeBodyHash($data), Values::array_get($params, 'bodySHA256')); $data = array(); } /* * Check signature of the URL with and without port information * since sig generation on the back end is inconsistent. */ $validSignatureWithPort = self::compare( $this->computeSignature($urlWithPort, $data), $expectedSignature ); $validSignatureWithoutPort = self::compare( $this->computeSignature($urlWithoutPort, $data), $expectedSignature ); return $validBodyHash && ($validSignatureWithPort || $validSignatureWithoutPort); } /** * Time insensitive compare, function's runtime is governed by the length * of the first argument, not the difference between the arguments. * @param $a string First part of the comparison pair * @param $b string Second part of the comparison pair * @return bool True if $a === $b, false otherwise. */ public static function compare($a, $b) { // if the strings are different lengths, obviously they're invalid if (\strlen($a) !== \strlen($b)) { return false; } if (!$a && !$b) { return true; } $limit = \strlen($a); // checking every character for an exact difference, if you find one, return false for ($i = 0; $i < $limit; ++$i) { if ($a[$i] !== $b[$i]) { return false; } } // there have been no differences found return true; } /* * Removes the port from the URL * @param $parsedURL array * @returns string Full URL without the port number */ private static function removePort($parsedUrl) { unset($parsedUrl['port']); return RequestValidator::buildUrl($parsedUrl); } /* * Adds the port to the URL * @param $parsedURL array * @returns string Full URL with the port number */ private static function addPort($parsedUrl) { if (!isset($parsedUrl['port'])) { $port = ($parsedUrl['scheme'] === 'https') ? 443 : 80; $parsedUrl['port'] = $port; } return RequestValidator::buildUrl($parsedUrl); } /* * Builds the URL from its parsed component pieces * @param $parsedURL array * @returns string Full URL */ private static function buildUrl($parsedUrl) { $url = ''; $parts = array(); $parts['scheme'] = isset($parsedUrl['scheme']) ? $parsedUrl['scheme'] . '://' : ''; $parts['user'] = isset($parsedUrl['user']) ? $parsedUrl['user'] : ''; $parts['pass'] = isset($parsedUrl['pass']) ? ':' . $parsedUrl['pass'] : ''; $parts['pass'] = ($parts['user'] || $parts['pass']) ? $parts['pass'] . '@' : ''; $parts['host'] = isset($parsedUrl['host']) ? $parsedUrl['host'] : ''; $parts['port'] = isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : ''; $parts['path'] = isset($parsedUrl['path']) ? $parsedUrl['path'] : ''; $parts['query'] = isset($parsedUrl['query']) ? '?' . $parsedUrl['query'] : ''; $parts['fragment'] = isset($parsedUrl['fragment']) ? '#' . $parsedUrl['fragment'] : ''; return \implode('', $parts); } } PK ,��Z�`��� � sdk/src/Twilio/Options.phpnu �[��� <?php namespace Twilio; abstract class Options implements \IteratorAggregate { protected $options = array(); public function getIterator() { return new \ArrayIterator($this->options); } }PK ,��Z�a�.W W + sdk/src/Twilio/Exceptions/HttpException.phpnu �[��� <?php namespace Twilio\Exceptions; class HttpException extends TwilioException { }PK ,��Z�DpL^ ^ 2 sdk/src/Twilio/Exceptions/DeserializeException.phpnu �[��� <?php namespace Twilio\Exceptions; class DeserializeException extends TwilioException { }PK ,��Z /�X X , sdk/src/Twilio/Exceptions/TwimlException.phpnu �[��� <?php namespace Twilio\Exceptions; class TwimlException extends TwilioException { }PK ,��Z�4;T T - sdk/src/Twilio/Exceptions/TwilioException.phpnu �[��� <?php namespace Twilio\Exceptions; class TwilioException extends \Exception { }PK ,��Z� �` ` 4 sdk/src/Twilio/Exceptions/ConfigurationException.phpnu �[��� <?php namespace Twilio\Exceptions; class ConfigurationException extends TwilioException { }PK ,��Z?�C�^ ^ 2 sdk/src/Twilio/Exceptions/EnvironmentException.phpnu �[��� <?php namespace Twilio\Exceptions; class EnvironmentException extends TwilioException { }PK ,��Z�V�0 0 + sdk/src/Twilio/Exceptions/RestException.phpnu �[��� <?php namespace Twilio\Exceptions; class RestException extends TwilioException { protected $statusCode; /** * Construct the exception. Note: The message is NOT binary safe. * @link http://php.net/manual/en/exception.construct.php * @param string $message [optional] The Exception message to throw. * @param int $code [optional] The Exception code. * @param int $statusCode [optional] The HTTP Status code. * @since 5.1.0 */ public function __construct($message, $code, $statusCode) { $this->statusCode = $statusCode; parent::__construct($message, $code); } /** * Get the HTTP Status Code of the RestException * @return int HTTP Status Code */ public function getStatusCode() { return $this->statusCode; } }PK ,��Z |J\� � # sdk/src/Twilio/InstanceResource.phpnu �[��� <?php namespace Twilio; class InstanceResource { protected $version; protected $context = null; protected $properties = array(); protected $solution = array(); public function __construct(Version $version) { $this->version = $version; } public function toArray() { return $this->properties; } public function __toString() { return '[InstanceResource]'; } }PK ,��Zw�L� � sdk/src/Twilio/Stream.phpnu �[��� <?php namespace Twilio; class Stream implements \Iterator { public $page; public $firstPage; public $limit; public $currentRecord; public $pageLimit; public $currentPage; function __construct(Page $page, $limit, $pageLimit) { $this->page = $page; $this->firstPage = $page; $this->limit = $limit; $this->currentRecord = 1; $this->pageLimit = $pageLimit; $this->currentPage = 1; } /** * (PHP 5 >= 5.0.0)<br/> * Return the current element * @link http://php.net/manual/en/iterator.current.php * @return mixed Can return any type. */ public function current() { return $this->page->current(); } /** * (PHP 5 >= 5.0.0)<br/> * Move forward to next element * @link http://php.net/manual/en/iterator.next.php * @return void Any returned value is ignored. */ public function next() { $this->page->next(); $this->currentRecord++; if ($this->overLimit()) { return; } if (!$this->page->valid()) { if ($this->overPageLimit()) { return; } $this->page = $this->page->nextPage(); $this->currentPage++; } } /** * (PHP 5 >= 5.0.0)<br/> * Return the key of the current element * @link http://php.net/manual/en/iterator.key.php * @return mixed scalar on success, or null on failure. */ public function key() { return $this->currentRecord; } /** * (PHP 5 >= 5.0.0)<br/> * Checks if current position is valid * @link http://php.net/manual/en/iterator.valid.php * @return boolean The return value will be casted to boolean and then evaluated. * Returns true on success or false on failure. */ public function valid() { return $this->page && $this->page->valid() && !$this->overLimit() && !$this->overPageLimit(); } /** * (PHP 5 >= 5.0.0)<br/> * Rewind the Iterator to the first element * @link http://php.net/manual/en/iterator.rewind.php * @return void Any returned value is ignored. */ public function rewind() { $this->page = $this->firstPage; $this->page->rewind(); $this->currentPage = 1; $this->currentRecord = 1; } protected function overLimit() { return ($this->limit !== null && $this->limit !== Values::NONE && $this->limit < $this->currentRecord); } protected function overPageLimit() { return ($this->pageLimit !== null && $this->pageLimit !== Values::NONE && $this->pageLimit < $this->currentPage); } }PK ,��Zd��w w sdk/src/Twilio/Page.phpnu �[��� <?php namespace Twilio; use Twilio\Exceptions\DeserializeException; use Twilio\Exceptions\RestException; use Twilio\Http\Response; abstract class Page implements \Iterator { protected static $metaKeys = array( 'end', 'first_page_uri', 'next_page_uri', 'last_page_uri', 'page', 'page_size', 'previous_page_uri', 'total', 'num_pages', 'start', 'uri', ); protected $version; protected $payload; protected $solution; protected $records; abstract public function buildInstance(array $payload); public function __construct(Version $version, Response $response) { $payload = $this->processResponse($response); $this->version = $version; $this->payload = $payload; $this->solution = array(); $this->records = new \ArrayIterator($this->loadPage()); } protected function processResponse(Response $response) { if ($response->getStatusCode() != 200 && !$this->isPagingEol($response->getContent())) { $message = '[HTTP ' . $response->getStatusCode() . '] Unable to fetch page'; $code = $response->getStatusCode(); $content = $response->getContent(); if (\is_array($content)) { $message .= isset($content['message']) ? ': ' . $content['message'] : ''; $code = isset($content['code']) ? $content['code'] : $code; } throw new RestException($message, $code, $response->getStatusCode()); } return $response->getContent(); } protected function isPagingEol($content) { return !\is_null($content) && \array_key_exists('code', $content) && $content['code'] == 20006; } protected function hasMeta($key) { return \array_key_exists('meta', $this->payload) && \array_key_exists($key, $this->payload['meta']); } protected function getMeta($key, $default=null) { return $this->hasMeta($key) ? $this->payload['meta'][$key] : $default; } protected function loadPage() { $key = $this->getMeta('key'); if ($key) { return $this->payload[$key]; } else { $keys = \array_keys($this->payload); $key = \array_diff($keys, self::$metaKeys); $key = \array_values($key); if (\count($key) == 1) { return $this->payload[$key[0]]; } } // handle end of results error code if ($this->isPagingEol($this->payload)) { return array(); } throw new DeserializeException('Page Records can not be deserialized'); } public function getPreviousPageUrl() { if ($this->hasMeta('previous_page_url')) { return $this->getMeta('previous_page_url'); } else if (\array_key_exists('previous_page_uri', $this->payload) && $this->payload['previous_page_uri']) { return $this->getVersion()->getDomain()->absoluteUrl($this->payload['previous_page_uri']); } return null; } public function getNextPageUrl() { if ($this->hasMeta('next_page_url')) { return $this->getMeta('next_page_url'); } else if (\array_key_exists('next_page_uri', $this->payload) && $this->payload['next_page_uri']) { return $this->getVersion()->getDomain()->absoluteUrl($this->payload['next_page_uri']); } return null; } public function nextPage() { if (!$this->getNextPageUrl()) { return null; } $response = $this->getVersion()->getDomain()->getClient()->request('GET', $this->getNextPageUrl()); return new static($this->getVersion(), $response, $this->solution); } public function previousPage() { if (!$this->getPreviousPageUrl()) { return null; } $response = $this->getVersion()->getDomain()->getClient()->request('GET', $this->getPreviousPageUrl()); return new static($this->getVersion(), $response, $this->solution); } /** * (PHP 5 >= 5.0.0)<br/> * Return the current element * @link http://php.net/manual/en/iterator.current.php * @return mixed Can return any type. */ public function current() { return $this->buildInstance($this->records->current()); } /** * (PHP 5 >= 5.0.0)<br/> * Move forward to next element * @link http://php.net/manual/en/iterator.next.php * @return void Any returned value is ignored. */ public function next() { $this->records->next(); } /** * (PHP 5 >= 5.0.0)<br/> * Return the key of the current element * @link http://php.net/manual/en/iterator.key.php * @return mixed scalar on success, or null on failure. */ public function key() { return $this->records->key(); } /** * (PHP 5 >= 5.0.0)<br/> * Checks if current position is valid * @link http://php.net/manual/en/iterator.valid.php * @return boolean The return value will be casted to boolean and then evaluated. * Returns true on success or false on failure. */ public function valid() { return $this->records->valid(); } /** * (PHP 5 >= 5.0.0)<br/> * Rewind the Iterator to the first element * @link http://php.net/manual/en/iterator.rewind.php * @return void Any returned value is ignored. */ public function rewind() { $this->records->rewind(); } /** * @return Version */ public function getVersion() { return $this->version; } public function __toString() { return '[Page]'; } } PK ,��Z(�F� � sdk/src/Twilio/Serialize.phpnu �[��� <?php namespace Twilio; class Serialize { private static function flatten($map, $result = array(), $previous = array()) { foreach ($map as $key => $value) { if (\is_array($value)) { $result = self::flatten($value, $result, \array_merge($previous, array($key))); } else { $result[\join(".", \array_merge($previous, array($key)))] = $value; } } return $result; } public static function prefixedCollapsibleMap($map, $prefix) { if (\is_null($map) || $map == \Twilio\Values::NONE) { return array(); } $flattened = self::flatten($map); $result = array(); foreach ($flattened as $key => $value) { $result[$prefix . '.' . $key] = $value; } return $result; } public static function iso8601Date($dateTime) { if (\is_null($dateTime) || $dateTime == \Twilio\Values::NONE) { return \Twilio\Values::NONE; } if (\is_string($dateTime)) { return $dateTime; } $utcDate = clone $dateTime; $utcDate->setTimezone(new \DateTimeZone('UTC')); return $utcDate->format('Y-m-d'); } public static function iso8601DateTime($dateTime) { if (\is_null($dateTime) || $dateTime == \Twilio\Values::NONE) { return \Twilio\Values::NONE; } if (\is_string($dateTime)) { return $dateTime; } $utcDate = clone $dateTime; $utcDate->setTimezone(new \DateTimeZone('UTC')); return $utcDate->format('Y-m-d\TH:i:s\Z'); } public static function booleanToString($boolOrStr) { if (\is_null($boolOrStr) || \is_string($boolOrStr)) { return $boolOrStr; } return $boolOrStr ? 'True' : 'False'; } public static function json_object($object) { \trigger_error("Serialize::json_object has been deprecated in favor of Serialize::jsonObject", E_USER_NOTICE); return Serialize::jsonObject($object); } public static function jsonObject($object) { if (\is_array($object)) { return \json_encode($object); } return $object; } public static function map($values, $map_func) { if (!\is_array($values)) { return $values; } return \array_map($map_func, $values); } } PK ,��Zh���0 0 "