Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libs/Zend
diff options
context:
space:
mode:
authorsgiehl <stefan@piwik.org>2013-10-02 23:30:49 +0400
committersgiehl <stefan@piwik.org>2013-10-02 23:30:49 +0400
commit876f9d8697f0bf880e7b18e30de69dba93af8f16 (patch)
tree241b4e03bd11310a140cefac40fa15a960b154bb /libs/Zend
parentf97b1346c40787083eafe2f09728bf45fda5d12f (diff)
removed Zend_Http as it isn't used anymore
Diffstat (limited to 'libs/Zend')
-rw-r--r--libs/Zend/Http/Client.php1573
-rw-r--r--libs/Zend/Http/Client/Adapter/Curl.php510
-rw-r--r--libs/Zend/Http/Client/Adapter/Exception.php38
-rw-r--r--libs/Zend/Http/Client/Adapter/Interface.php78
-rw-r--r--libs/Zend/Http/Client/Adapter/Proxy.php284
-rw-r--r--libs/Zend/Http/Client/Adapter/Socket.php545
-rw-r--r--libs/Zend/Http/Client/Adapter/Stream.php46
-rw-r--r--libs/Zend/Http/Client/Adapter/Test.php248
-rw-r--r--libs/Zend/Http/Client/Exception.php36
-rw-r--r--libs/Zend/Http/Cookie.php424
-rw-r--r--libs/Zend/Http/CookieJar.php405
-rw-r--r--libs/Zend/Http/Exception.php36
-rw-r--r--libs/Zend/Http/Response.php667
-rw-r--r--libs/Zend/Http/Response/Stream.php235
-rw-r--r--libs/Zend/Http/UserAgent.php853
-rw-r--r--libs/Zend/Http/UserAgent/AbstractDevice.php985
-rw-r--r--libs/Zend/Http/UserAgent/Bot.php129
-rw-r--r--libs/Zend/Http/UserAgent/Checker.php76
-rw-r--r--libs/Zend/Http/UserAgent/Console.php67
-rw-r--r--libs/Zend/Http/UserAgent/Desktop.php56
-rw-r--r--libs/Zend/Http/UserAgent/Device.php200
-rw-r--r--libs/Zend/Http/UserAgent/Email.php65
-rw-r--r--libs/Zend/Http/UserAgent/Exception.php36
-rw-r--r--libs/Zend/Http/UserAgent/Features/Adapter.php39
-rw-r--r--libs/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php78
-rw-r--r--libs/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php102
-rw-r--r--libs/Zend/Http/UserAgent/Features/Adapter/WurflApi.php103
-rw-r--r--libs/Zend/Http/UserAgent/Features/Exception.php36
-rw-r--r--libs/Zend/Http/UserAgent/Feed.php81
-rw-r--r--libs/Zend/Http/UserAgent/Mobile.php536
-rw-r--r--libs/Zend/Http/UserAgent/Offline.php70
-rw-r--r--libs/Zend/Http/UserAgent/Probe.php81
-rw-r--r--libs/Zend/Http/UserAgent/Spam.php79
-rw-r--r--libs/Zend/Http/UserAgent/Storage.php65
-rw-r--r--libs/Zend/Http/UserAgent/Storage/Exception.php37
-rw-r--r--libs/Zend/Http/UserAgent/Storage/NonPersistent.php97
-rw-r--r--libs/Zend/Http/UserAgent/Storage/Session.php166
-rw-r--r--libs/Zend/Http/UserAgent/Text.php132
-rw-r--r--libs/Zend/Http/UserAgent/Validator.php73
39 files changed, 0 insertions, 9367 deletions
diff --git a/libs/Zend/Http/Client.php b/libs/Zend/Http/Client.php
deleted file mode 100644
index 8db4c66dd5..0000000000
--- a/libs/Zend/Http/Client.php
+++ /dev/null
@@ -1,1573 +0,0 @@
-<?php
-
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client
- * @version $Id: Client.php 24461 2011-09-11 19:25:08Z padraic $
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @see Zend_Loader
- */
-// require_once 'Zend/Loader.php';
-
-
-/**
- * @see Zend_Uri
- */
-// require_once 'Zend/Uri.php';
-
-
-/**
- * @see Zend_Http_Client_Adapter_Interface
- */
-// require_once 'Zend/Http/Client/Adapter/Interface.php';
-
-
-/**
- * @see Zend_Http_Response
- */
-// require_once 'Zend/Http/Response.php';
-
-/**
- * @see Zend_Http_Response_Stream
- */
-// require_once 'Zend/Http/Response/Stream.php';
-
-/**
- * Zend_Http_Client is an implementation of an HTTP client in PHP. The client
- * supports basic features like sending different HTTP requests and handling
- * redirections, as well as more advanced features like proxy settings, HTTP
- * authentication and cookie persistence (using a Zend_Http_CookieJar object)
- *
- * @todo Implement proxy settings
- * @category Zend
- * @package Zend_Http
- * @subpackage Client
- * @throws Zend_Http_Client_Exception
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_Client
-{
- /**
- * HTTP request methods
- */
- const GET = 'GET';
- const POST = 'POST';
- const PUT = 'PUT';
- const HEAD = 'HEAD';
- const DELETE = 'DELETE';
- const TRACE = 'TRACE';
- const OPTIONS = 'OPTIONS';
- const CONNECT = 'CONNECT';
- const MERGE = 'MERGE';
-
- /**
- * Supported HTTP Authentication methods
- */
- const AUTH_BASIC = 'basic';
- //const AUTH_DIGEST = 'digest'; <-- not implemented yet
-
- /**
- * HTTP protocol versions
- */
- const HTTP_1 = '1.1';
- const HTTP_0 = '1.0';
-
- /**
- * Content attributes
- */
- const CONTENT_TYPE = 'Content-Type';
- const CONTENT_LENGTH = 'Content-Length';
-
- /**
- * POST data encoding methods
- */
- const ENC_URLENCODED = 'application/x-www-form-urlencoded';
- const ENC_FORMDATA = 'multipart/form-data';
-
- /**
- * Value types for Body key/value pairs
- */
- const VTYPE_SCALAR = 'SCALAR';
- const VTYPE_FILE = 'FILE';
-
- /**
- * Configuration array, set using the constructor or using ::setConfig()
- *
- * @var array
- */
- protected $config = array(
- 'maxredirects' => 5,
- 'strictredirects' => false,
- 'useragent' => 'Zend_Http_Client',
- 'timeout' => 10,
- 'adapter' => 'Zend_Http_Client_Adapter_Socket',
- 'httpversion' => self::HTTP_1,
- 'keepalive' => false,
- 'storeresponse' => true,
- 'strict' => true,
- 'output_stream' => false,
- 'encodecookies' => true,
- 'rfc3986_strict' => false
- );
-
- /**
- * The adapter used to perform the actual connection to the server
- *
- * @var Zend_Http_Client_Adapter_Interface
- */
- protected $adapter = null;
-
- /**
- * Request URI
- *
- * @var Zend_Uri_Http
- */
- protected $uri = null;
-
- /**
- * Associative array of request headers
- *
- * @var array
- */
- protected $headers = array();
-
- /**
- * HTTP request method
- *
- * @var string
- */
- protected $method = self::GET;
-
- /**
- * Associative array of GET parameters
- *
- * @var array
- */
- protected $paramsGet = array();
-
- /**
- * Associative array of POST parameters
- *
- * @var array
- */
- protected $paramsPost = array();
-
- /**
- * Request body content type (for POST requests)
- *
- * @var string
- */
- protected $enctype = null;
-
- /**
- * The raw post data to send. Could be set by setRawData($data, $enctype).
- *
- * @var string
- */
- protected $raw_post_data = null;
-
- /**
- * HTTP Authentication settings
- *
- * Expected to be an associative array with this structure:
- * $this->auth = array('user' => 'username', 'password' => 'password', 'type' => 'basic')
- * Where 'type' should be one of the supported authentication types (see the AUTH_*
- * constants), for example 'basic' or 'digest'.
- *
- * If null, no authentication will be used.
- *
- * @var array|null
- */
- protected $auth;
-
- /**
- * File upload arrays (used in POST requests)
- *
- * An associative array, where each element is of the format:
- * 'name' => array('filename.txt', 'text/plain', 'This is the actual file contents')
- *
- * @var array
- */
- protected $files = array();
-
- /**
- * Ordered list of keys from key/value pair data to include in body
- *
- * An associative array, where each element is of the format:
- * '<field name>' => VTYPE_SCALAR | VTYPE_FILE
- *
- * @var array
- */
- protected $body_field_order = array();
-
- /**
- * The client's cookie jar
- *
- * @var Zend_Http_CookieJar
- */
- protected $cookiejar = null;
-
- /**
- * The last HTTP request sent by the client, as string
- *
- * @var string
- */
- protected $last_request = null;
-
- /**
- * The last HTTP response received by the client
- *
- * @var Zend_Http_Response
- */
- protected $last_response = null;
-
- /**
- * Redirection counter
- *
- * @var int
- */
- protected $redirectCounter = 0;
-
- /**
- * Status for unmasking GET array params
- *
- * @var boolean
- */
- protected $_unmaskStatus = false;
-
- /**
- * Status if the http_build_query function escapes brackets
- *
- * @var boolean
- */
- protected $_queryBracketsEscaped = true;
-
- /**
- * Fileinfo magic database resource
- *
- * This variable is populated the first time _detectFileMimeType is called
- * and is then reused on every call to this method
- *
- * @var resource
- */
- static protected $_fileInfoDb = null;
-
- /**
- * Constructor method. Will create a new HTTP client. Accepts the target
- * URL and optionally configuration array.
- *
- * @param Zend_Uri_Http|string $uri
- * @param array $config Configuration key-value pairs.
- */
- public function __construct($uri = null, $config = null)
- {
- if ($uri !== null) {
- $this->setUri($uri);
- }
- if ($config !== null) {
- $this->setConfig($config);
- }
-
- $this->_queryBracketsEscaped = version_compare(phpversion(), '5.1.3', '>=');
- }
-
- /**
- * Set the URI for the next request
- *
- * @param Zend_Uri_Http|string $uri
- * @return Zend_Http_Client
- * @throws Zend_Http_Client_Exception
- */
- public function setUri($uri)
- {
- if ($uri instanceof Zend_Uri_Http) {
- // clone the URI in order to keep the passed parameter constant
- $uri = clone $uri;
- } elseif (is_string($uri)) {
- $uri = Zend_Uri::factory($uri);
- }
-
- if (!$uri instanceof Zend_Uri_Http) {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception('Passed parameter is not a valid HTTP URI.');
- }
-
- // Set auth if username and password has been specified in the uri
- if ($uri->getUsername() && $uri->getPassword()) {
- $this->setAuth($uri->getUsername(), $uri->getPassword());
- }
-
- // We have no ports, set the defaults
- if (! $uri->getPort()) {
- $uri->setPort(($uri->getScheme() == 'https' ? 443 : 80));
- }
-
- $this->uri = $uri;
-
- return $this;
- }
-
- /**
- * Get the URI for the next request
- *
- * @param boolean $as_string If true, will return the URI as a string
- * @return Zend_Uri_Http|string
- */
- public function getUri($as_string = false)
- {
- if ($as_string && $this->uri instanceof Zend_Uri_Http) {
- return $this->uri->__toString();
- } else {
- return $this->uri;
- }
- }
-
- /**
- * Set configuration parameters for this HTTP client
- *
- * @param Zend_Config | array $config
- * @return Zend_Http_Client
- * @throws Zend_Http_Client_Exception
- */
- public function setConfig($config = array())
- {
- if ($config instanceof Zend_Config) {
- $config = $config->toArray();
-
- } elseif (! is_array($config)) {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception('Array or Zend_Config object expected, got ' . gettype($config));
- }
-
- foreach ($config as $k => $v) {
- $this->config[strtolower($k)] = $v;
- }
-
- // Pass configuration options to the adapter if it exists
- if ($this->adapter instanceof Zend_Http_Client_Adapter_Interface) {
- $this->adapter->setConfig($config);
- }
-
- return $this;
- }
-
- /**
- * Set the next request's method
- *
- * Validated the passed method and sets it. If we have files set for
- * POST requests, and the new method is not POST, the files are silently
- * dropped.
- *
- * @param string $method
- * @return Zend_Http_Client
- * @throws Zend_Http_Client_Exception
- */
- public function setMethod($method = self::GET)
- {
- if (! preg_match('/^[^\x00-\x1f\x7f-\xff\(\)<>@,;:\\\\"\/\[\]\?={}\s]+$/', $method)) {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception("'{$method}' is not a valid HTTP request method.");
- }
-
- if (($method == self::POST || $method == self::PUT || $method == self::DELETE) && $this->enctype === null) {
- $this->setEncType(self::ENC_URLENCODED);
- }
-
- $this->method = $method;
-
- return $this;
- }
-
- /**
- * Set one or more request headers
- *
- * This function can be used in several ways to set the client's request
- * headers:
- * 1. By providing two parameters: $name as the header to set (e.g. 'Host')
- * and $value as it's value (e.g. 'www.example.com').
- * 2. By providing a single header string as the only parameter
- * e.g. 'Host: www.example.com'
- * 3. By providing an array of headers as the first parameter
- * e.g. array('host' => 'www.example.com', 'x-foo: bar'). In This case
- * the function will call itself recursively for each array item.
- *
- * @param string|array $name Header name, full header string ('Header: value')
- * or an array of headers
- * @param mixed $value Header value or null
- * @return Zend_Http_Client
- * @throws Zend_Http_Client_Exception
- */
- public function setHeaders($name, $value = null)
- {
- // If we got an array, go recursive!
- if (is_array($name)) {
- foreach ($name as $k => $v) {
- if (is_string($k)) {
- $this->setHeaders($k, $v);
- } else {
- $this->setHeaders($v, null);
- }
- }
- } else {
- // Check if $name needs to be split
- if ($value === null && (strpos($name, ':') > 0)) {
- list($name, $value) = explode(':', $name, 2);
- }
-
- // Make sure the name is valid if we are in strict mode
- if ($this->config['strict'] && (! preg_match('/^[a-zA-Z0-9-]+$/', $name))) {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception("{$name} is not a valid HTTP header name");
- }
-
- $normalized_name = strtolower($name);
-
- // If $value is null or false, unset the header
- if ($value === null || $value === false) {
- unset($this->headers[$normalized_name]);
-
- // Else, set the header
- } else {
- // Header names are stored lowercase internally.
- if (is_string($value)) {
- $value = trim($value);
- }
- $this->headers[$normalized_name] = array($name, $value);
- }
- }
-
- return $this;
- }
-
- /**
- * Get the value of a specific header
- *
- * Note that if the header has more than one value, an array
- * will be returned.
- *
- * @param string $key
- * @return string|array|null The header value or null if it is not set
- */
- public function getHeader($key)
- {
- $key = strtolower($key);
- if (isset($this->headers[$key])) {
- return $this->headers[$key][1];
- } else {
- return null;
- }
- }
-
- /**
- * Set a GET parameter for the request. Wrapper around _setParameter
- *
- * @param string|array $name
- * @param string $value
- * @return Zend_Http_Client
- */
- public function setParameterGet($name, $value = null)
- {
- if (is_array($name)) {
- foreach ($name as $k => $v)
- $this->_setParameter('GET', $k, $v);
- } else {
- $this->_setParameter('GET', $name, $value);
- }
-
- return $this;
- }
-
- /**
- * Set a POST parameter for the request. Wrapper around _setParameter
- *
- * @param string|array $name
- * @param string $value
- * @return Zend_Http_Client
- */
- public function setParameterPost($name, $value = null)
- {
- if (is_array($name)) {
- foreach ($name as $k => $v)
- $this->_setParameter('POST', $k, $v);
- } else {
- $this->_setParameter('POST', $name, $value);
- }
-
- return $this;
- }
-
- /**
- * Set a GET or POST parameter - used by SetParameterGet and SetParameterPost
- *
- * @param string $type GET or POST
- * @param string $name
- * @param string $value
- * @return null
- */
- protected function _setParameter($type, $name, $value)
- {
- $parray = array();
- $type = strtolower($type);
- switch ($type) {
- case 'get':
- $parray = &$this->paramsGet;
- break;
- case 'post':
- $parray = &$this->paramsPost;
- if ( $value === null ) {
- if (isset($this->body_field_order[$name]))
- unset($this->body_field_order[$name]);
- } else {
- $this->body_field_order[$name] = self::VTYPE_SCALAR;
- }
- break;
- }
-
- if ($value === null) {
- if (isset($parray[$name])) unset($parray[$name]);
- } else {
- $parray[$name] = $value;
- }
- }
-
- /**
- * Get the number of redirections done on the last request
- *
- * @return int
- */
- public function getRedirectionsCount()
- {
- return $this->redirectCounter;
- }
-
- /**
- * Set HTTP authentication parameters
- *
- * $type should be one of the supported types - see the self::AUTH_*
- * constants.
- *
- * To enable authentication:
- * <code>
- * $this->setAuth('shahar', 'secret', Zend_Http_Client::AUTH_BASIC);
- * </code>
- *
- * To disable authentication:
- * <code>
- * $this->setAuth(false);
- * </code>
- *
- * @see http://www.faqs.org/rfcs/rfc2617.html
- * @param string|false $user User name or false disable authentication
- * @param string $password Password
- * @param string $type Authentication type
- * @return Zend_Http_Client
- * @throws Zend_Http_Client_Exception
- */
- public function setAuth($user, $password = '', $type = self::AUTH_BASIC)
- {
- // If we got false or null, disable authentication
- if ($user === false || $user === null) {
- $this->auth = null;
-
- // Clear the auth information in the uri instance as well
- if ($this->uri instanceof Zend_Uri_Http) {
- $this->getUri()->setUsername('');
- $this->getUri()->setPassword('');
- }
- // Else, set up authentication
- } else {
- // Check we got a proper authentication type
- if (! defined('self::AUTH_' . strtoupper($type))) {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception("Invalid or not supported authentication type: '$type'");
- }
-
- $this->auth = array(
- 'user' => (string) $user,
- 'password' => (string) $password,
- 'type' => $type
- );
- }
-
- return $this;
- }
-
- /**
- * Set the HTTP client's cookie jar.
- *
- * A cookie jar is an object that holds and maintains cookies across HTTP requests
- * and responses.
- *
- * @param Zend_Http_CookieJar|boolean $cookiejar Existing cookiejar object, true to create a new one, false to disable
- * @return Zend_Http_Client
- * @throws Zend_Http_Client_Exception
- */
- public function setCookieJar($cookiejar = true)
- {
- if (!class_exists('Zend_Http_CookieJar')) {
- // require_once 'Zend/Loader.php';
- Zend_Loader::loadClass('Zend_Http_CookieJar');
- }
-
- if ($cookiejar instanceof Zend_Http_CookieJar) {
- $this->cookiejar = $cookiejar;
- } elseif ($cookiejar === true) {
- $this->cookiejar = new Zend_Http_CookieJar();
- } elseif (! $cookiejar) {
- $this->cookiejar = null;
- } else {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception('Invalid parameter type passed as CookieJar');
- }
-
- return $this;
- }
-
- /**
- * Return the current cookie jar or null if none.
- *
- * @return Zend_Http_CookieJar|null
- */
- public function getCookieJar()
- {
- return $this->cookiejar;
- }
-
- /**
- * Add a cookie to the request. If the client has no Cookie Jar, the cookies
- * will be added directly to the headers array as "Cookie" headers.
- *
- * @param Zend_Http_Cookie|string $cookie
- * @param string|null $value If "cookie" is a string, this is the cookie value.
- * @return Zend_Http_Client
- * @throws Zend_Http_Client_Exception
- */
- public function setCookie($cookie, $value = null)
- {
- if (!class_exists('Zend_Http_Cookie')) {
- // require_once 'Zend/Loader.php';
- Zend_Loader::loadClass('Zend_Http_Cookie');
- }
-
- if (is_array($cookie)) {
- foreach ($cookie as $c => $v) {
- if (is_string($c)) {
- $this->setCookie($c, $v);
- } else {
- $this->setCookie($v);
- }
- }
-
- return $this;
- }
-
- if ($value !== null && $this->config['encodecookies']) {
- $value = urlencode($value);
- }
-
- if (isset($this->cookiejar)) {
- if ($cookie instanceof Zend_Http_Cookie) {
- $this->cookiejar->addCookie($cookie);
- } elseif (is_string($cookie) && $value !== null) {
- $cookie = Zend_Http_Cookie::fromString("{$cookie}={$value}",
- $this->uri,
- $this->config['encodecookies']);
- $this->cookiejar->addCookie($cookie);
- }
- } else {
- if ($cookie instanceof Zend_Http_Cookie) {
- $name = $cookie->getName();
- $value = $cookie->getValue();
- $cookie = $name;
- }
-
- if (preg_match("/[=,; \t\r\n\013\014]/", $cookie)) {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception("Cookie name cannot contain these characters: =,; \t\r\n\013\014 ({$cookie})");
- }
-
- $value = addslashes($value);
-
- if (! isset($this->headers['cookie'])) {
- $this->headers['cookie'] = array('Cookie', '');
- }
- $this->headers['cookie'][1] .= $cookie . '=' . $value . '; ';
- }
-
- return $this;
- }
-
- /**
- * Set a file to upload (using a POST request)
- *
- * Can be used in two ways:
- *
- * 1. $data is null (default): $filename is treated as the name if a local file which
- * will be read and sent. Will try to guess the content type using mime_content_type().
- * 2. $data is set - $filename is sent as the file name, but $data is sent as the file
- * contents and no file is read from the file system. In this case, you need to
- * manually set the Content-Type ($ctype) or it will default to
- * application/octet-stream.
- *
- * @param string $filename Name of file to upload, or name to save as
- * @param string $formname Name of form element to send as
- * @param string $data Data to send (if null, $filename is read and sent)
- * @param string $ctype Content type to use (if $data is set and $ctype is
- * null, will be application/octet-stream)
- * @return Zend_Http_Client
- * @throws Zend_Http_Client_Exception
- */
- public function setFileUpload($filename, $formname, $data = null, $ctype = null)
- {
- if ($data === null) {
- if (($data = @file_get_contents($filename)) === false) {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception("Unable to read file '{$filename}' for upload");
- }
-
- if (! $ctype) {
- $ctype = $this->_detectFileMimeType($filename);
- }
- }
-
- // Force enctype to multipart/form-data
- $this->setEncType(self::ENC_FORMDATA);
-
- $this->files[] = array(
- 'formname' => $formname,
- 'filename' => basename($filename),
- 'ctype' => $ctype,
- 'data' => $data
- );
-
- $this->body_field_order[$formname] = self::VTYPE_FILE;
-
- return $this;
- }
-
- /**
- * Set the encoding type for POST data
- *
- * @param string $enctype
- * @return Zend_Http_Client
- */
- public function setEncType($enctype = self::ENC_URLENCODED)
- {
- $this->enctype = $enctype;
-
- return $this;
- }
-
- /**
- * Set the raw (already encoded) POST data.
- *
- * This function is here for two reasons:
- * 1. For advanced user who would like to set their own data, already encoded
- * 2. For backwards compatibilty: If someone uses the old post($data) method.
- * this method will be used to set the encoded data.
- *
- * $data can also be stream (such as file) from which the data will be read.
- *
- * @param string|resource $data
- * @param string $enctype
- * @return Zend_Http_Client
- */
- public function setRawData($data, $enctype = null)
- {
- $this->raw_post_data = $data;
- $this->setEncType($enctype);
- if (is_resource($data)) {
- // We've got stream data
- $stat = @fstat($data);
- if($stat) {
- $this->setHeaders(self::CONTENT_LENGTH, $stat['size']);
- }
- }
- return $this;
- }
-
- /**
- * Set the unmask feature for GET parameters as array
- *
- * Example:
- * foo%5B0%5D=a&foo%5B1%5D=b
- * becomes
- * foo=a&foo=b
- *
- * This is usefull for some services
- *
- * @param boolean $status
- * @return Zend_Http_Client
- */
- public function setUnmaskStatus($status = true)
- {
- $this->_unmaskStatus = (BOOL)$status;
- return $this;
- }
-
- /**
- * Returns the currently configured unmask status
- *
- * @return boolean
- */
- public function getUnmaskStatus()
- {
- return $this->_unmaskStatus;
- }
-
- /**
- * Clear all GET and POST parameters
- *
- * Should be used to reset the request parameters if the client is
- * used for several concurrent requests.
- *
- * clearAll parameter controls if we clean just parameters or also
- * headers and last_*
- *
- * @param bool $clearAll Should all data be cleared?
- * @return Zend_Http_Client
- */
- public function resetParameters($clearAll = false)
- {
- // Reset parameter data
- $this->paramsGet = array();
- $this->paramsPost = array();
- $this->files = array();
- $this->raw_post_data = null;
- $this->enctype = null;
-
- if($clearAll) {
- $this->headers = array();
- $this->last_request = null;
- $this->last_response = null;
- } else {
- // Clear outdated headers
- if (isset($this->headers[strtolower(self::CONTENT_TYPE)])) {
- unset($this->headers[strtolower(self::CONTENT_TYPE)]);
- }
- if (isset($this->headers[strtolower(self::CONTENT_LENGTH)])) {
- unset($this->headers[strtolower(self::CONTENT_LENGTH)]);
- }
- }
-
- return $this;
- }
-
- /**
- * Get the last HTTP request as string
- *
- * @return string
- */
- public function getLastRequest()
- {
- return $this->last_request;
- }
-
- /**
- * Get the last HTTP response received by this client
- *
- * If $config['storeresponse'] is set to false, or no response was
- * stored yet, will return null
- *
- * @return Zend_Http_Response or null if none
- */
- public function getLastResponse()
- {
- return $this->last_response;
- }
-
- /**
- * Load the connection adapter
- *
- * While this method is not called more than one for a client, it is
- * seperated from ->request() to preserve logic and readability
- *
- * @param Zend_Http_Client_Adapter_Interface|string $adapter
- * @return null
- * @throws Zend_Http_Client_Exception
- */
- public function setAdapter($adapter)
- {
- if (is_string($adapter)) {
- if (!class_exists($adapter)) {
- // require_once 'Zend/Loader.php';
- try {
- Zend_Loader::loadClass($adapter);
- } catch (Zend_Exception $e) {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception("Unable to load adapter '$adapter': {$e->getMessage()}", 0, $e);
- }
- }
-
- $adapter = new $adapter;
- }
-
- if (! $adapter instanceof Zend_Http_Client_Adapter_Interface) {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception('Passed adapter is not a HTTP connection adapter');
- }
-
- $this->adapter = $adapter;
- $config = $this->config;
- unset($config['adapter']);
- $this->adapter->setConfig($config);
- }
-
- /**
- * Load the connection adapter
- *
- * @return Zend_Http_Client_Adapter_Interface $adapter
- */
- public function getAdapter()
- {
- if (null === $this->adapter) {
- $this->setAdapter($this->config['adapter']);
- }
-
- return $this->adapter;
- }
-
- /**
- * Set streaming for received data
- *
- * @param string|boolean $streamfile Stream file, true for temp file, false/null for no streaming
- * @return Zend_Http_Client
- */
- public function setStream($streamfile = true)
- {
- $this->setConfig(array("output_stream" => $streamfile));
- return $this;
- }
-
- /**
- * Get status of streaming for received data
- * @return boolean|string
- */
- public function getStream()
- {
- return $this->config["output_stream"];
- }
-
- /**
- * Create temporary stream
- *
- * @return resource
- */
- protected function _openTempStream()
- {
- $this->_stream_name = $this->config['output_stream'];
- if(!is_string($this->_stream_name)) {
- // If name is not given, create temp name
- $this->_stream_name = tempnam(isset($this->config['stream_tmp_dir'])?$this->config['stream_tmp_dir']:sys_get_temp_dir(),
- 'Zend_Http_Client');
- }
-
- if (false === ($fp = @fopen($this->_stream_name, "w+b"))) {
- if ($this->adapter instanceof Zend_Http_Client_Adapter_Interface) {
- $this->adapter->close();
- }
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception("Could not open temp file {$this->_stream_name}");
- }
-
- return $fp;
- }
-
- /**
- * Send the HTTP request and return an HTTP response object
- *
- * @param string $method
- * @return Zend_Http_Response
- * @throws Zend_Http_Client_Exception
- */
- public function request($method = null)
- {
- if (! $this->uri instanceof Zend_Uri_Http) {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception('No valid URI has been passed to the client');
- }
-
- if ($method) {
- $this->setMethod($method);
- }
- $this->redirectCounter = 0;
- $response = null;
-
- // Make sure the adapter is loaded
- if ($this->adapter == null) {
- $this->setAdapter($this->config['adapter']);
- }
-
- // Send the first request. If redirected, continue.
- do {
- // Clone the URI and add the additional GET parameters to it
- $uri = clone $this->uri;
- if (! empty($this->paramsGet)) {
- $query = $uri->getQuery();
- if (! empty($query)) {
- $query .= '&';
- }
- $query .= http_build_query($this->paramsGet, null, '&');
- if ($this->config['rfc3986_strict']) {
- $query = str_replace('+', '%20', $query);
- }
-
- // @see ZF-11671 to unmask for some services to foo=val1&foo=val2
- if ($this->getUnmaskStatus()) {
- if ($this->_queryBracketsEscaped) {
- $query = preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', $query);
- } else {
- $query = preg_replace('/\\[(?:[0-9]|[1-9][0-9]+)\\]=/', '=', $query);
- }
- }
-
- $uri->setQuery($query);
- }
-
- $body = $this->_prepareBody();
- $headers = $this->_prepareHeaders();
-
- // check that adapter supports streaming before using it
- if(is_resource($body) && !($this->adapter instanceof Zend_Http_Client_Adapter_Stream)) {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception('Adapter does not support streaming');
- }
-
- // Open the connection, send the request and read the response
- $this->adapter->connect($uri->getHost(), $uri->getPort(),
- ($uri->getScheme() == 'https' ? true : false));
-
- if($this->config['output_stream']) {
- if($this->adapter instanceof Zend_Http_Client_Adapter_Stream) {
- $stream = $this->_openTempStream();
- $this->adapter->setOutputStream($stream);
- } else {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception('Adapter does not support streaming');
- }
- }
-
- $this->last_request = $this->adapter->write($this->method,
- $uri, $this->config['httpversion'], $headers, $body);
-
- $response = $this->adapter->read();
- if (! $response) {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception('Unable to read response, or response is empty');
- }
-
- if($this->config['output_stream']) {
- $streamMetaData = stream_get_meta_data($stream);
- if ($streamMetaData['seekable']) {
- rewind($stream);
- }
- // cleanup the adapter
- $this->adapter->setOutputStream(null);
- $response = Zend_Http_Response_Stream::fromStream($response, $stream);
- $response->setStreamName($this->_stream_name);
- if(!is_string($this->config['output_stream'])) {
- // we used temp name, will need to clean up
- $response->setCleanup(true);
- }
- } else {
- $response = Zend_Http_Response::fromString($response);
- }
-
- if ($this->config['storeresponse']) {
- $this->last_response = $response;
- }
-
- // Load cookies into cookie jar
- if (isset($this->cookiejar)) {
- $this->cookiejar->addCookiesFromResponse($response, $uri, $this->config['encodecookies']);
- }
-
- // If we got redirected, look for the Location header
- if ($response->isRedirect() && ($location = $response->getHeader('location'))) {
-
- // Avoid problems with buggy servers that add whitespace at the
- // end of some headers (See ZF-11283)
- $location = trim($location);
-
- // Check whether we send the exact same request again, or drop the parameters
- // and send a GET request
- if ($response->getStatus() == 303 ||
- ((! $this->config['strictredirects']) && ($response->getStatus() == 302 ||
- $response->getStatus() == 301))) {
-
- $this->resetParameters();
- $this->setMethod(self::GET);
- }
-
- // If we got a well formed absolute URI
- if (($scheme = substr($location, 0, 6)) && ($scheme == 'http:/' || $scheme == 'https:')) {
- $this->setHeaders('host', null);
- $this->setUri($location);
-
- } else {
-
- // Split into path and query and set the query
- if (strpos($location, '?') !== false) {
- list($location, $query) = explode('?', $location, 2);
- } else {
- $query = '';
- }
- $this->uri->setQuery($query);
-
- // Else, if we got just an absolute path, set it
- if(strpos($location, '/') === 0) {
- $this->uri->setPath($location);
-
- // Else, assume we have a relative path
- } else {
- // Get the current path directory, removing any trailing slashes
- $path = $this->uri->getPath();
- $path = rtrim(substr($path, 0, strrpos($path, '/')), "/");
- $this->uri->setPath($path . '/' . $location);
- }
- }
- ++$this->redirectCounter;
-
- } else {
- // If we didn't get any location, stop redirecting
- break;
- }
-
- } while ($this->redirectCounter < $this->config['maxredirects']);
-
- return $response;
- }
-
- /**
- * Prepare the request headers
- *
- * @return array
- */
- protected function _prepareHeaders()
- {
- $headers = array();
-
- // Set the host header
- if (! isset($this->headers['host'])) {
- $host = $this->uri->getHost();
-
- // If the port is not default, add it
- if (! (($this->uri->getScheme() == 'http' && $this->uri->getPort() == 80) ||
- ($this->uri->getScheme() == 'https' && $this->uri->getPort() == 443))) {
- $host .= ':' . $this->uri->getPort();
- }
-
- $headers[] = "Host: {$host}";
- }
-
- // Set the connection header
- if (! isset($this->headers['connection'])) {
- if (! $this->config['keepalive']) {
- $headers[] = "Connection: close";
- }
- }
-
- // Set the Accept-encoding header if not set - depending on whether
- // zlib is available or not.
- if (! isset($this->headers['accept-encoding'])) {
- if (function_exists('gzinflate')) {
- $headers[] = 'Accept-encoding: gzip, deflate';
- } else {
- $headers[] = 'Accept-encoding: identity';
- }
- }
-
- // Set the Content-Type header
- if (($this->method == self::POST || $this->method == self::PUT) &&
- (! isset($this->headers[strtolower(self::CONTENT_TYPE)]) && isset($this->enctype))) {
-
- $headers[] = self::CONTENT_TYPE . ': ' . $this->enctype;
- }
-
- // Set the user agent header
- if (! isset($this->headers['user-agent']) && isset($this->config['useragent'])) {
- $headers[] = "User-Agent: {$this->config['useragent']}";
- }
-
- // Set HTTP authentication if needed
- if (is_array($this->auth)) {
- $auth = self::encodeAuthHeader($this->auth['user'], $this->auth['password'], $this->auth['type']);
- $headers[] = "Authorization: {$auth}";
- }
-
- // Load cookies from cookie jar
- if (isset($this->cookiejar)) {
- $cookstr = $this->cookiejar->getMatchingCookies($this->uri,
- true, Zend_Http_CookieJar::COOKIE_STRING_CONCAT);
-
- if ($cookstr) {
- $headers[] = "Cookie: {$cookstr}";
- }
- }
-
- // Add all other user defined headers
- foreach ($this->headers as $header) {
- list($name, $value) = $header;
- if (is_array($value)) {
- $value = implode(', ', $value);
- }
-
- $headers[] = "$name: $value";
- }
-
- return $headers;
- }
-
- /**
- * Prepare the request body (for POST and PUT requests)
- *
- * @return string
- * @throws Zend_Http_Client_Exception
- */
- protected function _prepareBody()
- {
- // According to RFC2616, a TRACE request should not have a body.
- if ($this->method == self::TRACE) {
- return '';
- }
-
- if (isset($this->raw_post_data) && is_resource($this->raw_post_data)) {
- return $this->raw_post_data;
- }
- // If mbstring overloads substr and strlen functions, we have to
- // override it's internal encoding
- if (function_exists('mb_internal_encoding') &&
- ((int) ini_get('mbstring.func_overload')) & 2) {
-
- $mbIntEnc = mb_internal_encoding();
- mb_internal_encoding('ASCII');
- }
-
- // If we have raw_post_data set, just use it as the body.
- if (isset($this->raw_post_data)) {
- $this->setHeaders(self::CONTENT_LENGTH, strlen($this->raw_post_data));
- if (isset($mbIntEnc)) {
- mb_internal_encoding($mbIntEnc);
- }
-
- return $this->raw_post_data;
- }
-
- $body = '';
-
- // If we have files to upload, force enctype to multipart/form-data
- if (count ($this->files) > 0) {
- $this->setEncType(self::ENC_FORMDATA);
- }
-
- // If we have POST parameters or files, encode and add them to the body
- if (count($this->paramsPost) > 0 || count($this->files) > 0) {
- switch($this->enctype) {
- case self::ENC_FORMDATA:
- // Encode body as multipart/form-data
- $boundary = '---ZENDHTTPCLIENT-' . md5(microtime());
- $this->setHeaders(self::CONTENT_TYPE, self::ENC_FORMDATA . "; boundary={$boundary}");
-
- // Encode all files and POST vars in the order they were given
- foreach ($this->body_field_order as $fieldName=>$fieldType) {
- switch ($fieldType) {
- case self::VTYPE_FILE:
- foreach ($this->files as $file) {
- if ($file['formname']===$fieldName) {
- $fhead = array(self::CONTENT_TYPE => $file['ctype']);
- $body .= self::encodeFormData($boundary, $file['formname'], $file['data'], $file['filename'], $fhead);
- }
- }
- break;
- case self::VTYPE_SCALAR:
- if (isset($this->paramsPost[$fieldName])) {
- if (is_array($this->paramsPost[$fieldName])) {
- $flattened = self::_flattenParametersArray($this->paramsPost[$fieldName], $fieldName);
- foreach ($flattened as $pp) {
- $body .= self::encodeFormData($boundary, $pp[0], $pp[1]);
- }
- } else {
- $body .= self::encodeFormData($boundary, $fieldName, $this->paramsPost[$fieldName]);
- }
- }
- break;
- }
- }
-
- $body .= "--{$boundary}--\r\n";
- break;
-
- case self::ENC_URLENCODED:
- // Encode body as application/x-www-form-urlencoded
- $this->setHeaders(self::CONTENT_TYPE, self::ENC_URLENCODED);
- $body = http_build_query($this->paramsPost, '', '&');
- break;
-
- default:
- if (isset($mbIntEnc)) {
- mb_internal_encoding($mbIntEnc);
- }
-
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception("Cannot handle content type '{$this->enctype}' automatically." .
- " Please use Zend_Http_Client::setRawData to send this kind of content.");
- break;
- }
- }
-
- // Set the Content-Length if we have a body or if request is POST/PUT
- if ($body || $this->method == self::POST || $this->method == self::PUT) {
- $this->setHeaders(self::CONTENT_LENGTH, strlen($body));
- }
-
- if (isset($mbIntEnc)) {
- mb_internal_encoding($mbIntEnc);
- }
-
- return $body;
- }
-
- /**
- * Helper method that gets a possibly multi-level parameters array (get or
- * post) and flattens it.
- *
- * The method returns an array of (key, value) pairs (because keys are not
- * necessarily unique. If one of the parameters in as array, it will also
- * add a [] suffix to the key.
- *
- * This method is deprecated since Zend Framework 1.9 in favour of
- * self::_flattenParametersArray() and will be dropped in 2.0
- *
- * @deprecated since 1.9
- *
- * @param array $parray The parameters array
- * @param bool $urlencode Whether to urlencode the name and value
- * @return array
- */
- protected function _getParametersRecursive($parray, $urlencode = false)
- {
- // Issue a deprecated notice
- trigger_error("The " . __METHOD__ . " method is deprecated and will be dropped in 2.0.",
- E_USER_NOTICE);
-
- if (! is_array($parray)) {
- return $parray;
- }
- $parameters = array();
-
- foreach ($parray as $name => $value) {
- if ($urlencode) {
- $name = urlencode($name);
- }
-
- // If $value is an array, iterate over it
- if (is_array($value)) {
- $name .= ($urlencode ? '%5B%5D' : '[]');
- foreach ($value as $subval) {
- if ($urlencode) {
- $subval = urlencode($subval);
- }
- $parameters[] = array($name, $subval);
- }
- } else {
- if ($urlencode) {
- $value = urlencode($value);
- }
- $parameters[] = array($name, $value);
- }
- }
-
- return $parameters;
- }
-
- /**
- * Attempt to detect the MIME type of a file using available extensions
- *
- * This method will try to detect the MIME type of a file. If the fileinfo
- * extension is available, it will be used. If not, the mime_magic
- * extension which is deprected but is still available in many PHP setups
- * will be tried.
- *
- * If neither extension is available, the default application/octet-stream
- * MIME type will be returned
- *
- * @param string $file File path
- * @return string MIME type
- */
- protected function _detectFileMimeType($file)
- {
- $type = null;
-
- // First try with fileinfo functions
- if (function_exists('finfo_open')) {
- if (self::$_fileInfoDb === null) {
- self::$_fileInfoDb = @finfo_open(FILEINFO_MIME);
- }
-
- if (self::$_fileInfoDb) {
- $type = finfo_file(self::$_fileInfoDb, $file);
- }
-
- } elseif (function_exists('mime_content_type')) {
- $type = mime_content_type($file);
- }
-
- // Fallback to the default application/octet-stream
- if (! $type) {
- $type = 'application/octet-stream';
- }
-
- return $type;
- }
-
- /**
- * Encode data to a multipart/form-data part suitable for a POST request.
- *
- * @param string $boundary
- * @param string $name
- * @param mixed $value
- * @param string $filename
- * @param array $headers Associative array of optional headers @example ("Content-Transfer-Encoding" => "binary")
- * @return string
- */
- public static function encodeFormData($boundary, $name, $value, $filename = null, $headers = array()) {
- $ret = "--{$boundary}\r\n" .
- 'Content-Disposition: form-data; name="' . $name .'"';
-
- if ($filename) {
- $ret .= '; filename="' . $filename . '"';
- }
- $ret .= "\r\n";
-
- foreach ($headers as $hname => $hvalue) {
- $ret .= "{$hname}: {$hvalue}\r\n";
- }
- $ret .= "\r\n";
-
- $ret .= "{$value}\r\n";
-
- return $ret;
- }
-
- /**
- * Create a HTTP authentication "Authorization:" header according to the
- * specified user, password and authentication method.
- *
- * @see http://www.faqs.org/rfcs/rfc2617.html
- * @param string $user
- * @param string $password
- * @param string $type
- * @return string
- * @throws Zend_Http_Client_Exception
- */
- public static function encodeAuthHeader($user, $password, $type = self::AUTH_BASIC)
- {
- $authHeader = null;
-
- switch ($type) {
- case self::AUTH_BASIC:
- // In basic authentication, the user name cannot contain ":"
- if (strpos($user, ':') !== false) {
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception("The user name cannot contain ':' in 'Basic' HTTP authentication");
- }
-
- $authHeader = 'Basic ' . base64_encode($user . ':' . $password);
- break;
-
- //case self::AUTH_DIGEST:
- /**
- * @todo Implement digest authentication
- */
- // break;
-
- default:
- /** @see Zend_Http_Client_Exception */
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception("Not a supported HTTP authentication type: '$type'");
- }
-
- return $authHeader;
- }
-
- /**
- * Convert an array of parameters into a flat array of (key, value) pairs
- *
- * Will flatten a potentially multi-dimentional array of parameters (such
- * as POST parameters) into a flat array of (key, value) paris. In case
- * of multi-dimentional arrays, square brackets ([]) will be added to the
- * key to indicate an array.
- *
- * @since 1.9
- *
- * @param array $parray
- * @param string $prefix
- * @return array
- */
- static protected function _flattenParametersArray($parray, $prefix = null)
- {
- if (! is_array($parray)) {
- return $parray;
- }
-
- $parameters = array();
-
- foreach($parray as $name => $value) {
-
- // Calculate array key
- if ($prefix) {
- if (is_int($name)) {
- $key = $prefix . '[]';
- } else {
- $key = $prefix . "[$name]";
- }
- } else {
- $key = $name;
- }
-
- if (is_array($value)) {
- $parameters = array_merge($parameters, self::_flattenParametersArray($value, $key));
-
- } else {
- $parameters[] = array($key, $value);
- }
- }
-
- return $parameters;
- }
-
-}
diff --git a/libs/Zend/Http/Client/Adapter/Curl.php b/libs/Zend/Http/Client/Adapter/Curl.php
deleted file mode 100644
index 81c1e40be6..0000000000
--- a/libs/Zend/Http/Client/Adapter/Curl.php
+++ /dev/null
@@ -1,510 +0,0 @@
-<?php
-
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter
- * @version $Id: Curl.php 24272 2011-07-27 21:12:08Z mcleod@spaceweb.nl $
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @see Zend_Uri_Http
- */
-// require_once 'Zend/Uri/Http.php';
-
-/**
- * @see Zend_Http_Client_Adapter_Interface
- */
-// require_once 'Zend/Http/Client/Adapter/Interface.php';
-/**
- * @see Zend_Http_Client_Adapter_Stream
- */
-// require_once 'Zend/Http/Client/Adapter/Stream.php';
-
-/**
- * An adapter class for Zend_Http_Client based on the curl extension.
- * Curl requires libcurl. See for full requirements the PHP manual: http://php.net/curl
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_Client_Adapter_Curl implements Zend_Http_Client_Adapter_Interface, Zend_Http_Client_Adapter_Stream
-{
- /**
- * Parameters array
- *
- * @var array
- */
- protected $_config = array();
-
- /**
- * What host/port are we connected to?
- *
- * @var array
- */
- protected $_connected_to = array(null, null);
-
- /**
- * The curl session handle
- *
- * @var resource|null
- */
- protected $_curl = null;
-
- /**
- * List of cURL options that should never be overwritten
- *
- * @var array
- */
- protected $_invalidOverwritableCurlOptions;
-
- /**
- * Response gotten from server
- *
- * @var string
- */
- protected $_response = null;
-
- /**
- * Stream for storing output
- *
- * @var resource
- */
- protected $out_stream;
-
- /**
- * Adapter constructor
- *
- * Config is set using setConfig()
- *
- * @return void
- * @throws Zend_Http_Client_Adapter_Exception
- */
- public function __construct()
- {
- if (!extension_loaded('curl')) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception('cURL extension has to be loaded to use this Zend_Http_Client adapter.');
- }
- $this->_invalidOverwritableCurlOptions = array(
- CURLOPT_HTTPGET,
- CURLOPT_POST,
- CURLOPT_PUT,
- CURLOPT_CUSTOMREQUEST,
- CURLOPT_HEADER,
- CURLOPT_RETURNTRANSFER,
- CURLOPT_HTTPHEADER,
- CURLOPT_POSTFIELDS,
- CURLOPT_INFILE,
- CURLOPT_INFILESIZE,
- CURLOPT_PORT,
- CURLOPT_MAXREDIRS,
- CURLOPT_CONNECTTIMEOUT,
- CURL_HTTP_VERSION_1_1,
- CURL_HTTP_VERSION_1_0,
- );
- }
-
- /**
- * Set the configuration array for the adapter
- *
- * @throws Zend_Http_Client_Adapter_Exception
- * @param Zend_Config | array $config
- * @return Zend_Http_Client_Adapter_Curl
- */
- public function setConfig($config = array())
- {
- if ($config instanceof Zend_Config) {
- $config = $config->toArray();
-
- } elseif (! is_array($config)) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception(
- 'Array or Zend_Config object expected, got ' . gettype($config)
- );
- }
-
- if(isset($config['proxy_user']) && isset($config['proxy_pass'])) {
- $this->setCurlOption(CURLOPT_PROXYUSERPWD, $config['proxy_user'].":".$config['proxy_pass']);
- unset($config['proxy_user'], $config['proxy_pass']);
- }
-
- foreach ($config as $k => $v) {
- $option = strtolower($k);
- switch($option) {
- case 'proxy_host':
- $this->setCurlOption(CURLOPT_PROXY, $v);
- break;
- case 'proxy_port':
- $this->setCurlOption(CURLOPT_PROXYPORT, $v);
- break;
- default:
- $this->_config[$option] = $v;
- break;
- }
- }
-
- return $this;
- }
-
- /**
- * Retrieve the array of all configuration options
- *
- * @return array
- */
- public function getConfig()
- {
- return $this->_config;
- }
-
- /**
- * Direct setter for cURL adapter related options.
- *
- * @param string|int $option
- * @param mixed $value
- * @return Zend_Http_Adapter_Curl
- */
- public function setCurlOption($option, $value)
- {
- if (!isset($this->_config['curloptions'])) {
- $this->_config['curloptions'] = array();
- }
- $this->_config['curloptions'][$option] = $value;
- return $this;
- }
-
- /**
- * Initialize curl
- *
- * @param string $host
- * @param int $port
- * @param boolean $secure
- * @return void
- * @throws Zend_Http_Client_Adapter_Exception if unable to connect
- */
- public function connect($host, $port = 80, $secure = false)
- {
- // If we're already connected, disconnect first
- if ($this->_curl) {
- $this->close();
- }
-
- // If we are connected to a different server or port, disconnect first
- if ($this->_curl
- && is_array($this->_connected_to)
- && ($this->_connected_to[0] != $host
- || $this->_connected_to[1] != $port)
- ) {
- $this->close();
- }
-
- // Do the actual connection
- $this->_curl = curl_init();
- if ($port != 80) {
- curl_setopt($this->_curl, CURLOPT_PORT, intval($port));
- }
-
- // Set timeout
- curl_setopt($this->_curl, CURLOPT_CONNECTTIMEOUT, $this->_config['timeout']);
-
- // Set Max redirects
- curl_setopt($this->_curl, CURLOPT_MAXREDIRS, $this->_config['maxredirects']);
-
- if (!$this->_curl) {
- $this->close();
-
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception('Unable to Connect to ' . $host . ':' . $port);
- }
-
- if ($secure !== false) {
- // Behave the same like Zend_Http_Adapter_Socket on SSL options.
- if (isset($this->_config['sslcert'])) {
- curl_setopt($this->_curl, CURLOPT_SSLCERT, $this->_config['sslcert']);
- }
- if (isset($this->_config['sslpassphrase'])) {
- curl_setopt($this->_curl, CURLOPT_SSLCERTPASSWD, $this->_config['sslpassphrase']);
- }
- }
-
- // Update connected_to
- $this->_connected_to = array($host, $port);
- }
-
- /**
- * Send request to the remote server
- *
- * @param string $method
- * @param Zend_Uri_Http $uri
- * @param float $http_ver
- * @param array $headers
- * @param string $body
- * @return string $request
- * @throws Zend_Http_Client_Adapter_Exception If connection fails, connected to wrong host, no PUT file defined, unsupported method, or unsupported cURL option
- */
- public function write($method, $uri, $httpVersion = 1.1, $headers = array(), $body = '')
- {
- // Make sure we're properly connected
- if (!$this->_curl) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception("Trying to write but we are not connected");
- }
-
- if ($this->_connected_to[0] != $uri->getHost() || $this->_connected_to[1] != $uri->getPort()) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception("Trying to write but we are connected to the wrong host");
- }
-
- // set URL
- curl_setopt($this->_curl, CURLOPT_URL, $uri->__toString());
-
- // ensure correct curl call
- $curlValue = true;
- switch ($method) {
- case Zend_Http_Client::GET:
- $curlMethod = CURLOPT_HTTPGET;
- break;
-
- case Zend_Http_Client::POST:
- $curlMethod = CURLOPT_POST;
- break;
-
- case Zend_Http_Client::PUT:
- // There are two different types of PUT request, either a Raw Data string has been set
- // or CURLOPT_INFILE and CURLOPT_INFILESIZE are used.
- if(is_resource($body)) {
- $this->_config['curloptions'][CURLOPT_INFILE] = $body;
- }
- if (isset($this->_config['curloptions'][CURLOPT_INFILE])) {
- // Now we will probably already have Content-Length set, so that we have to delete it
- // from $headers at this point:
- foreach ($headers AS $k => $header) {
- if (preg_match('/Content-Length:\s*(\d+)/i', $header, $m)) {
- if(is_resource($body)) {
- $this->_config['curloptions'][CURLOPT_INFILESIZE] = (int)$m[1];
- }
- unset($headers[$k]);
- }
- }
-
- if (!isset($this->_config['curloptions'][CURLOPT_INFILESIZE])) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception("Cannot set a file-handle for cURL option CURLOPT_INFILE without also setting its size in CURLOPT_INFILESIZE.");
- }
-
- if(is_resource($body)) {
- $body = '';
- }
-
- $curlMethod = CURLOPT_PUT;
- } else {
- $curlMethod = CURLOPT_CUSTOMREQUEST;
- $curlValue = "PUT";
- }
- break;
-
- case Zend_Http_Client::DELETE:
- $curlMethod = CURLOPT_CUSTOMREQUEST;
- $curlValue = "DELETE";
- break;
-
- case Zend_Http_Client::OPTIONS:
- $curlMethod = CURLOPT_CUSTOMREQUEST;
- $curlValue = "OPTIONS";
- break;
-
- case Zend_Http_Client::TRACE:
- $curlMethod = CURLOPT_CUSTOMREQUEST;
- $curlValue = "TRACE";
- break;
-
- case Zend_Http_Client::HEAD:
- $curlMethod = CURLOPT_CUSTOMREQUEST;
- $curlValue = "HEAD";
- break;
-
- default:
- // For now, through an exception for unsupported request methods
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception("Method currently not supported");
- }
-
- if(is_resource($body) && $curlMethod != CURLOPT_PUT) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception("Streaming requests are allowed only with PUT");
- }
-
- // get http version to use
- $curlHttp = ($httpVersion == 1.1) ? CURL_HTTP_VERSION_1_1 : CURL_HTTP_VERSION_1_0;
-
- // mark as HTTP request and set HTTP method
- curl_setopt($this->_curl, $curlHttp, true);
- curl_setopt($this->_curl, $curlMethod, $curlValue);
-
- if($this->out_stream) {
- // headers will be read into the response
- curl_setopt($this->_curl, CURLOPT_HEADER, false);
- curl_setopt($this->_curl, CURLOPT_HEADERFUNCTION, array($this, "readHeader"));
- // and data will be written into the file
- curl_setopt($this->_curl, CURLOPT_FILE, $this->out_stream);
- } else {
- // ensure headers are also returned
- curl_setopt($this->_curl, CURLOPT_HEADER, true);
-
- // ensure actual response is returned
- curl_setopt($this->_curl, CURLOPT_RETURNTRANSFER, true);
- }
-
- // set additional headers
- $headers['Accept'] = '';
- curl_setopt($this->_curl, CURLOPT_HTTPHEADER, $headers);
-
- /**
- * Make sure POSTFIELDS is set after $curlMethod is set:
- * @link http://de2.php.net/manual/en/function.curl-setopt.php#81161
- */
- if ($method == Zend_Http_Client::POST) {
- curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body);
- } elseif ($curlMethod == CURLOPT_PUT) {
- // this covers a PUT by file-handle:
- // Make the setting of this options explicit (rather than setting it through the loop following a bit lower)
- // to group common functionality together.
- curl_setopt($this->_curl, CURLOPT_INFILE, $this->_config['curloptions'][CURLOPT_INFILE]);
- curl_setopt($this->_curl, CURLOPT_INFILESIZE, $this->_config['curloptions'][CURLOPT_INFILESIZE]);
- unset($this->_config['curloptions'][CURLOPT_INFILE]);
- unset($this->_config['curloptions'][CURLOPT_INFILESIZE]);
- } elseif ($method == Zend_Http_Client::PUT) {
- // This is a PUT by a setRawData string, not by file-handle
- curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body);
- } elseif ($method == Zend_Http_Client::DELETE) {
- // This is a DELETE by a setRawData string
- curl_setopt($this->_curl, CURLOPT_POSTFIELDS, $body);
- }
-
- // set additional curl options
- if (isset($this->_config['curloptions'])) {
- foreach ((array)$this->_config['curloptions'] as $k => $v) {
- if (!in_array($k, $this->_invalidOverwritableCurlOptions)) {
- if (curl_setopt($this->_curl, $k, $v) == false) {
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception(sprintf("Unknown or erroreous cURL option '%s' set", $k));
- }
- }
- }
- }
-
- // send the request
- $response = curl_exec($this->_curl);
-
- // if we used streaming, headers are already there
- if(!is_resource($this->out_stream)) {
- $this->_response = $response;
- }
-
- $request = curl_getinfo($this->_curl, CURLINFO_HEADER_OUT);
- $request .= $body;
-
- if (empty($this->_response)) {
- // require_once 'Zend/Http/Client/Exception.php';
- throw new Zend_Http_Client_Exception("Error in cURL request: " . curl_error($this->_curl));
- }
-
- // cURL automatically decodes chunked-messages, this means we have to disallow the Zend_Http_Response to do it again
- if (stripos($this->_response, "Transfer-Encoding: chunked\r\n")) {
- $this->_response = str_ireplace("Transfer-Encoding: chunked\r\n", '', $this->_response);
- }
-
- // Eliminate multiple HTTP responses.
- do {
- $parts = preg_split('|(?:\r?\n){2}|m', $this->_response, 2);
- $again = false;
-
- if (isset($parts[1]) && preg_match("|^HTTP/1\.[01](.*?)\r\n|mi", $parts[1])) {
- $this->_response = $parts[1];
- $again = true;
- }
- } while ($again);
-
- // cURL automatically handles Proxy rewrites, remove the "HTTP/1.0 200 Connection established" string:
- if (stripos($this->_response, "HTTP/1.0 200 Connection established\r\n\r\n") !== false) {
- $this->_response = str_ireplace("HTTP/1.0 200 Connection established\r\n\r\n", '', $this->_response);
- }
-
- return $request;
- }
-
- /**
- * Return read response from server
- *
- * @return string
- */
- public function read()
- {
- return $this->_response;
- }
-
- /**
- * Close the connection to the server
- *
- */
- public function close()
- {
- if(is_resource($this->_curl)) {
- curl_close($this->_curl);
- }
- $this->_curl = null;
- $this->_connected_to = array(null, null);
- }
-
- /**
- * Get cUrl Handle
- *
- * @return resource
- */
- public function getHandle()
- {
- return $this->_curl;
- }
-
- /**
- * Set output stream for the response
- *
- * @param resource $stream
- * @return Zend_Http_Client_Adapter_Socket
- */
- public function setOutputStream($stream)
- {
- $this->out_stream = $stream;
- return $this;
- }
-
- /**
- * Header reader function for CURL
- *
- * @param resource $curl
- * @param string $header
- * @return int
- */
- public function readHeader($curl, $header)
- {
- $this->_response .= $header;
- return strlen($header);
- }
-}
diff --git a/libs/Zend/Http/Client/Adapter/Exception.php b/libs/Zend/Http/Client/Adapter/Exception.php
deleted file mode 100644
index b7e836a055..0000000000
--- a/libs/Zend/Http/Client/Adapter/Exception.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter_Exception
- * @version $Id: Exception.php 23775 2011-03-01 17:25:24Z ralph $
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @see Zend_Http_Client_Exception
- */
-// require_once 'Zend/Http/Client/Exception.php';
-
-/**
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_Client_Adapter_Exception extends Zend_Http_Client_Exception
-{
- const READ_TIMEOUT = 1000;
-}
diff --git a/libs/Zend/Http/Client/Adapter/Interface.php b/libs/Zend/Http/Client/Adapter/Interface.php
deleted file mode 100644
index 9c667ec3b2..0000000000
--- a/libs/Zend/Http/Client/Adapter/Interface.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter
- * @version $Id: Interface.php 23775 2011-03-01 17:25:24Z ralph $
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * An interface description for Zend_Http_Client_Adapter classes.
- *
- * These classes are used as connectors for Zend_Http_Client, performing the
- * tasks of connecting, writing, reading and closing connection to the server.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-interface Zend_Http_Client_Adapter_Interface
-{
- /**
- * Set the configuration array for the adapter
- *
- * @param array $config
- */
- public function setConfig($config = array());
-
- /**
- * Connect to the remote server
- *
- * @param string $host
- * @param int $port
- * @param boolean $secure
- */
- public function connect($host, $port = 80, $secure = false);
-
- /**
- * Send request to the remote server
- *
- * @param string $method
- * @param Zend_Uri_Http $url
- * @param string $http_ver
- * @param array $headers
- * @param string $body
- * @return string Request as text
- */
- public function write($method, $url, $http_ver = '1.1', $headers = array(), $body = '');
-
- /**
- * Read response from server
- *
- * @return string
- */
- public function read();
-
- /**
- * Close the connection to the server
- *
- */
- public function close();
-}
diff --git a/libs/Zend/Http/Client/Adapter/Proxy.php b/libs/Zend/Http/Client/Adapter/Proxy.php
deleted file mode 100644
index 32ca4fdef8..0000000000
--- a/libs/Zend/Http/Client/Adapter/Proxy.php
+++ /dev/null
@@ -1,284 +0,0 @@
-<?php
-
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter
- * @version $Id: Proxy.php 23775 2011-03-01 17:25:24Z ralph $
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @see Zend_Uri_Http
- */
-// require_once 'Zend/Uri/Http.php';
-/**
- * @see Zend_Http_Client
- */
-// require_once 'Zend/Http/Client.php';
-/**
- * @see Zend_Http_Client_Adapter_Socket
- */
-// require_once 'Zend/Http/Client/Adapter/Socket.php';
-
-/**
- * HTTP Proxy-supporting Zend_Http_Client adapter class, based on the default
- * socket based adapter.
- *
- * Should be used if proxy HTTP access is required. If no proxy is set, will
- * fall back to Zend_Http_Client_Adapter_Socket behavior. Just like the
- * default Socket adapter, this adapter does not require any special extensions
- * installed.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_Client_Adapter_Proxy extends Zend_Http_Client_Adapter_Socket
-{
- /**
- * Parameters array
- *
- * @var array
- */
- protected $config = array(
- 'ssltransport' => 'ssl',
- 'sslcert' => null,
- 'sslpassphrase' => null,
- 'sslusecontext' => false,
- 'proxy_host' => '',
- 'proxy_port' => 8080,
- 'proxy_user' => '',
- 'proxy_pass' => '',
- 'proxy_auth' => Zend_Http_Client::AUTH_BASIC,
- 'persistent' => false
- );
-
- /**
- * Whether HTTPS CONNECT was already negotiated with the proxy or not
- *
- * @var boolean
- */
- protected $negotiated = false;
-
- /**
- * Connect to the remote server
- *
- * Will try to connect to the proxy server. If no proxy was set, will
- * fall back to the target server (behave like regular Socket adapter)
- *
- * @param string $host
- * @param int $port
- * @param boolean $secure
- */
- public function connect($host, $port = 80, $secure = false)
- {
- // If no proxy is set, fall back to Socket adapter
- if (! $this->config['proxy_host']) {
- return parent::connect($host, $port, $secure);
- }
-
- /* Url might require stream context even if proxy connection doesn't */
- if ($secure) {
- $this->config['sslusecontext'] = true;
- }
-
- // Connect (a non-secure connection) to the proxy server
- return parent::connect(
- $this->config['proxy_host'],
- $this->config['proxy_port'],
- false
- );
- }
-
- /**
- * Send request to the proxy server
- *
- * @param string $method
- * @param Zend_Uri_Http $uri
- * @param string $http_ver
- * @param array $headers
- * @param string $body
- * @return string Request as string
- */
- public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '')
- {
- // If no proxy is set, fall back to default Socket adapter
- if (! $this->config['proxy_host']) return parent::write($method, $uri, $http_ver, $headers, $body);
-
- // Make sure we're properly connected
- if (! $this->socket) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception("Trying to write but we are not connected");
- }
-
- $host = $this->config['proxy_host'];
- $port = $this->config['proxy_port'];
-
- if ($this->connected_to[0] != "tcp://$host" || $this->connected_to[1] != $port) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception("Trying to write but we are connected to the wrong proxy server");
- }
-
- // Add Proxy-Authorization header
- if ($this->config['proxy_user'] && ! isset($headers['proxy-authorization'])) {
- $headers['proxy-authorization'] = Zend_Http_Client::encodeAuthHeader(
- $this->config['proxy_user'], $this->config['proxy_pass'], $this->config['proxy_auth']
- );
- }
-
- // if we are proxying HTTPS, preform CONNECT handshake with the proxy
- if ($uri->getScheme() == 'https' && (! $this->negotiated)) {
- $this->connectHandshake($uri->getHost(), $uri->getPort(), $http_ver, $headers);
- $this->negotiated = true;
- }
-
- // Save request method for later
- $this->method = $method;
-
- // Build request headers
- if ($this->negotiated) {
- $path = $uri->getPath();
- if ($uri->getQuery()) {
- $path .= '?' . $uri->getQuery();
- }
- $request = "$method $path HTTP/$http_ver\r\n";
- } else {
- $request = "$method $uri HTTP/$http_ver\r\n";
- }
-
- // Add all headers to the request string
- foreach ($headers as $k => $v) {
- if (is_string($k)) $v = "$k: $v";
- $request .= "$v\r\n";
- }
-
- if(is_resource($body)) {
- $request .= "\r\n";
- } else {
- // Add the request body
- $request .= "\r\n" . $body;
- }
-
- // Send the request
- if (! @fwrite($this->socket, $request)) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception("Error writing request to proxy server");
- }
-
- if(is_resource($body)) {
- if(stream_copy_to_stream($body, $this->socket) == 0) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception('Error writing request to server');
- }
- }
-
- return $request;
- }
-
- /**
- * Preform handshaking with HTTPS proxy using CONNECT method
- *
- * @param string $host
- * @param integer $port
- * @param string $http_ver
- * @param array $headers
- */
- protected function connectHandshake($host, $port = 443, $http_ver = '1.1', array &$headers = array())
- {
- $request = "CONNECT $host:$port HTTP/$http_ver\r\n" .
- "Host: " . $this->config['proxy_host'] . "\r\n";
-
- // Add the user-agent header
- if (isset($this->config['useragent'])) {
- $request .= "User-agent: " . $this->config['useragent'] . "\r\n";
- }
-
- // If the proxy-authorization header is set, send it to proxy but remove
- // it from headers sent to target host
- if (isset($headers['proxy-authorization'])) {
- $request .= "Proxy-authorization: " . $headers['proxy-authorization'] . "\r\n";
- unset($headers['proxy-authorization']);
- }
-
- $request .= "\r\n";
-
- // Send the request
- if (! @fwrite($this->socket, $request)) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception("Error writing request to proxy server");
- }
-
- // Read response headers only
- $response = '';
- $gotStatus = false;
- while ($line = @fgets($this->socket)) {
- $gotStatus = $gotStatus || (strpos($line, 'HTTP') !== false);
- if ($gotStatus) {
- $response .= $line;
- if (!chop($line)) break;
- }
- }
-
- // Check that the response from the proxy is 200
- if (Zend_Http_Response::extractCode($response) != 200) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception("Unable to connect to HTTPS proxy. Server response: " . $response);
- }
-
- // If all is good, switch socket to secure mode. We have to fall back
- // through the different modes
- $modes = array(
- STREAM_CRYPTO_METHOD_TLS_CLIENT,
- STREAM_CRYPTO_METHOD_SSLv3_CLIENT,
- STREAM_CRYPTO_METHOD_SSLv23_CLIENT,
- STREAM_CRYPTO_METHOD_SSLv2_CLIENT
- );
-
- $success = false;
- foreach($modes as $mode) {
- $success = stream_socket_enable_crypto($this->socket, true, $mode);
- if ($success) break;
- }
-
- if (! $success) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception("Unable to connect to" .
- " HTTPS server through proxy: could not negotiate secure connection.");
- }
- }
-
- /**
- * Close the connection to the server
- *
- */
- public function close()
- {
- parent::close();
- $this->negotiated = false;
- }
-
- /**
- * Destructor: make sure the socket is disconnected
- *
- */
- public function __destruct()
- {
- if ($this->socket) $this->close();
- }
-}
diff --git a/libs/Zend/Http/Client/Adapter/Socket.php b/libs/Zend/Http/Client/Adapter/Socket.php
deleted file mode 100644
index d77e9619b3..0000000000
--- a/libs/Zend/Http/Client/Adapter/Socket.php
+++ /dev/null
@@ -1,545 +0,0 @@
-<?php
-
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter
- * @version $Id: Socket.php 23775 2011-03-01 17:25:24Z ralph $
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @see Zend_Uri_Http
- */
-// require_once 'Zend/Uri/Http.php';
-/**
- * @see Zend_Http_Client_Adapter_Interface
- */
-// require_once 'Zend/Http/Client/Adapter/Interface.php';
-/**
- * @see Zend_Http_Client_Adapter_Stream
- */
-// require_once 'Zend/Http/Client/Adapter/Stream.php';
-
-/**
- * A sockets based (stream_socket_client) adapter class for Zend_Http_Client. Can be used
- * on almost every PHP environment, and does not require any special extensions.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_Client_Adapter_Socket implements Zend_Http_Client_Adapter_Interface, Zend_Http_Client_Adapter_Stream
-{
- /**
- * The socket for server connection
- *
- * @var resource|null
- */
- protected $socket = null;
-
- /**
- * What host/port are we connected to?
- *
- * @var array
- */
- protected $connected_to = array(null, null);
-
- /**
- * Stream for storing output
- *
- * @var resource
- */
- protected $out_stream = null;
-
- /**
- * Parameters array
- *
- * @var array
- */
- protected $config = array(
- 'persistent' => false,
- 'ssltransport' => 'ssl',
- 'sslcert' => null,
- 'sslpassphrase' => null,
- 'sslusecontext' => false
- );
-
- /**
- * Request method - will be set by write() and might be used by read()
- *
- * @var string
- */
- protected $method = null;
-
- /**
- * Stream context
- *
- * @var resource
- */
- protected $_context = null;
-
- /**
- * Adapter constructor, currently empty. Config is set using setConfig()
- *
- */
- public function __construct()
- {
- }
-
- /**
- * Set the configuration array for the adapter
- *
- * @param Zend_Config | array $config
- */
- public function setConfig($config = array())
- {
- if ($config instanceof Zend_Config) {
- $config = $config->toArray();
-
- } elseif (! is_array($config)) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception(
- 'Array or Zend_Config object expected, got ' . gettype($config)
- );
- }
-
- foreach ($config as $k => $v) {
- $this->config[strtolower($k)] = $v;
- }
- }
-
- /**
- * Retrieve the array of all configuration options
- *
- * @return array
- */
- public function getConfig()
- {
- return $this->config;
- }
-
- /**
- * Set the stream context for the TCP connection to the server
- *
- * Can accept either a pre-existing stream context resource, or an array
- * of stream options, similar to the options array passed to the
- * stream_context_create() PHP function. In such case a new stream context
- * will be created using the passed options.
- *
- * @since Zend Framework 1.9
- *
- * @param mixed $context Stream context or array of context options
- * @return Zend_Http_Client_Adapter_Socket
- */
- public function setStreamContext($context)
- {
- if (is_resource($context) && get_resource_type($context) == 'stream-context') {
- $this->_context = $context;
-
- } elseif (is_array($context)) {
- $this->_context = stream_context_create($context);
-
- } else {
- // Invalid parameter
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception(
- "Expecting either a stream context resource or array, got " . gettype($context)
- );
- }
-
- return $this;
- }
-
- /**
- * Get the stream context for the TCP connection to the server.
- *
- * If no stream context is set, will create a default one.
- *
- * @return resource
- */
- public function getStreamContext()
- {
- if (! $this->_context) {
- $this->_context = stream_context_create();
- }
-
- return $this->_context;
- }
-
- /**
- * Connect to the remote server
- *
- * @param string $host
- * @param int $port
- * @param boolean $secure
- */
- public function connect($host, $port = 80, $secure = false)
- {
- // If the URI should be accessed via SSL, prepend the Hostname with ssl://
- $host = ($secure ? $this->config['ssltransport'] : 'tcp') . '://' . $host;
-
- // If we are connected to the wrong host, disconnect first
- if (($this->connected_to[0] != $host || $this->connected_to[1] != $port)) {
- if (is_resource($this->socket)) $this->close();
- }
-
- // Now, if we are not connected, connect
- if (! is_resource($this->socket) || ! $this->config['keepalive']) {
- $context = $this->getStreamContext();
- if ($secure || $this->config['sslusecontext']) {
- if ($this->config['sslcert'] !== null) {
- if (! stream_context_set_option($context, 'ssl', 'local_cert',
- $this->config['sslcert'])) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception('Unable to set sslcert option');
- }
- }
- if ($this->config['sslpassphrase'] !== null) {
- if (! stream_context_set_option($context, 'ssl', 'passphrase',
- $this->config['sslpassphrase'])) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception('Unable to set sslpassphrase option');
- }
- }
- }
-
- $flags = STREAM_CLIENT_CONNECT;
- if ($this->config['persistent']) $flags |= STREAM_CLIENT_PERSISTENT;
-
- $errno = $errstr = '';
- $this->socket = @stream_socket_client($host . ':' . $port,
- $errno,
- $errstr,
- (int) $this->config['timeout'],
- $flags,
- $context);
-
- if (! $this->socket) {
- $this->close();
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception(
- 'Unable to Connect to ' . $host . ':' . $port . '. Error #' . $errno . ': ' . $errstr);
- }
-
- // Set the stream timeout
- if (! stream_set_timeout($this->socket, (int) $this->config['timeout'])) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception('Unable to set the connection timeout');
- }
-
- // Update connected_to
- $this->connected_to = array($host, $port);
- }
- }
-
- /**
- * Send request to the remote server
- *
- * @param string $method
- * @param Zend_Uri_Http $uri
- * @param string $http_ver
- * @param array $headers
- * @param string $body
- * @return string Request as string
- */
- public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '')
- {
- // Make sure we're properly connected
- if (! $this->socket) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are not connected');
- }
-
- $host = $uri->getHost();
- $host = (strtolower($uri->getScheme()) == 'https' ? $this->config['ssltransport'] : 'tcp') . '://' . $host;
- if ($this->connected_to[0] != $host || $this->connected_to[1] != $uri->getPort()) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception('Trying to write but we are connected to the wrong host');
- }
-
- // Save request method for later
- $this->method = $method;
-
- // Build request headers
- $path = $uri->getPath();
- if ($uri->getQuery()) $path .= '?' . $uri->getQuery();
- $request = "{$method} {$path} HTTP/{$http_ver}\r\n";
- foreach ($headers as $k => $v) {
- if (is_string($k)) $v = ucfirst($k) . ": $v";
- $request .= "$v\r\n";
- }
-
- if(is_resource($body)) {
- $request .= "\r\n";
- } else {
- // Add the request body
- $request .= "\r\n" . $body;
- }
-
- // Send the request
- if (! @fwrite($this->socket, $request)) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception('Error writing request to server');
- }
-
- if(is_resource($body)) {
- if(stream_copy_to_stream($body, $this->socket) == 0) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception('Error writing request to server');
- }
- }
-
- return $request;
- }
-
- /**
- * Read response from server
- *
- * @return string
- */
- public function read()
- {
- // First, read headers only
- $response = '';
- $gotStatus = false;
- $stream = !empty($this->config['stream']);
-
- while (($line = @fgets($this->socket)) !== false) {
- $gotStatus = $gotStatus || (strpos($line, 'HTTP') !== false);
- if ($gotStatus) {
- $response .= $line;
- if (rtrim($line) === '') break;
- }
- }
-
- $this->_checkSocketReadTimeout();
-
- $statusCode = Zend_Http_Response::extractCode($response);
-
- // Handle 100 and 101 responses internally by restarting the read again
- if ($statusCode == 100 || $statusCode == 101) return $this->read();
-
- // Check headers to see what kind of connection / transfer encoding we have
- $headers = Zend_Http_Response::extractHeaders($response);
-
- /**
- * Responses to HEAD requests and 204 or 304 responses are not expected
- * to have a body - stop reading here
- */
- if ($statusCode == 304 || $statusCode == 204 ||
- $this->method == Zend_Http_Client::HEAD) {
-
- // Close the connection if requested to do so by the server
- if (isset($headers['connection']) && $headers['connection'] == 'close') {
- $this->close();
- }
- return $response;
- }
-
- // If we got a 'transfer-encoding: chunked' header
- if (isset($headers['transfer-encoding'])) {
-
- if (strtolower($headers['transfer-encoding']) == 'chunked') {
-
- do {
- $line = @fgets($this->socket);
- $this->_checkSocketReadTimeout();
-
- $chunk = $line;
-
- // Figure out the next chunk size
- $chunksize = trim($line);
- if (! ctype_xdigit($chunksize)) {
- $this->close();
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception('Invalid chunk size "' .
- $chunksize . '" unable to read chunked body');
- }
-
- // Convert the hexadecimal value to plain integer
- $chunksize = hexdec($chunksize);
-
- // Read next chunk
- $read_to = ftell($this->socket) + $chunksize;
-
- do {
- $current_pos = ftell($this->socket);
- if ($current_pos >= $read_to) break;
-
- if($this->out_stream) {
- if(stream_copy_to_stream($this->socket, $this->out_stream, $read_to - $current_pos) == 0) {
- $this->_checkSocketReadTimeout();
- break;
- }
- } else {
- $line = @fread($this->socket, $read_to - $current_pos);
- if ($line === false || strlen($line) === 0) {
- $this->_checkSocketReadTimeout();
- break;
- }
- $chunk .= $line;
- }
- } while (! feof($this->socket));
-
- $chunk .= @fgets($this->socket);
- $this->_checkSocketReadTimeout();
-
- if(!$this->out_stream) {
- $response .= $chunk;
- }
- } while ($chunksize > 0);
- } else {
- $this->close();
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception('Cannot handle "' .
- $headers['transfer-encoding'] . '" transfer encoding');
- }
-
- // We automatically decode chunked-messages when writing to a stream
- // this means we have to disallow the Zend_Http_Response to do it again
- if ($this->out_stream) {
- $response = str_ireplace("Transfer-Encoding: chunked\r\n", '', $response);
- }
- // Else, if we got the content-length header, read this number of bytes
- } elseif (isset($headers['content-length'])) {
-
- // If we got more than one Content-Length header (see ZF-9404) use
- // the last value sent
- if (is_array($headers['content-length'])) {
- $contentLength = $headers['content-length'][count($headers['content-length']) - 1];
- } else {
- $contentLength = $headers['content-length'];
- }
-
- $current_pos = ftell($this->socket);
- $chunk = '';
-
- for ($read_to = $current_pos + $contentLength;
- $read_to > $current_pos;
- $current_pos = ftell($this->socket)) {
-
- if($this->out_stream) {
- if(@stream_copy_to_stream($this->socket, $this->out_stream, $read_to - $current_pos) == 0) {
- $this->_checkSocketReadTimeout();
- break;
- }
- } else {
- $chunk = @fread($this->socket, $read_to - $current_pos);
- if ($chunk === false || strlen($chunk) === 0) {
- $this->_checkSocketReadTimeout();
- break;
- }
-
- $response .= $chunk;
- }
-
- // Break if the connection ended prematurely
- if (feof($this->socket)) break;
- }
-
- // Fallback: just read the response until EOF
- } else {
-
- do {
- if($this->out_stream) {
- if(@stream_copy_to_stream($this->socket, $this->out_stream) == 0) {
- $this->_checkSocketReadTimeout();
- break;
- }
- } else {
- $buff = @fread($this->socket, 8192);
- if ($buff === false || strlen($buff) === 0) {
- $this->_checkSocketReadTimeout();
- break;
- } else {
- $response .= $buff;
- }
- }
-
- } while (feof($this->socket) === false);
-
- $this->close();
- }
-
- // Close the connection if requested to do so by the server
- if (isset($headers['connection']) && $headers['connection'] == 'close') {
- $this->close();
- }
-
- return $response;
- }
-
- /**
- * Close the connection to the server
- *
- */
- public function close()
- {
- if (is_resource($this->socket)) @fclose($this->socket);
- $this->socket = null;
- $this->connected_to = array(null, null);
- }
-
- /**
- * Check if the socket has timed out - if so close connection and throw
- * an exception
- *
- * @throws Zend_Http_Client_Adapter_Exception with READ_TIMEOUT code
- */
- protected function _checkSocketReadTimeout()
- {
- if ($this->socket) {
- $info = stream_get_meta_data($this->socket);
- $timedout = $info['timed_out'];
- if ($timedout) {
- $this->close();
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception(
- "Read timed out after {$this->config['timeout']} seconds",
- Zend_Http_Client_Adapter_Exception::READ_TIMEOUT
- );
- }
- }
- }
-
- /**
- * Set output stream for the response
- *
- * @param resource $stream
- * @return Zend_Http_Client_Adapter_Socket
- */
- public function setOutputStream($stream)
- {
- $this->out_stream = $stream;
- return $this;
- }
-
- /**
- * Destructor: make sure the socket is disconnected
- *
- * If we are in persistent TCP mode, will not close the connection
- *
- */
- public function __destruct()
- {
- if (! $this->config['persistent']) {
- if ($this->socket) $this->close();
- }
- }
-}
diff --git a/libs/Zend/Http/Client/Adapter/Stream.php b/libs/Zend/Http/Client/Adapter/Stream.php
deleted file mode 100644
index 4e6dee3d77..0000000000
--- a/libs/Zend/Http/Client/Adapter/Stream.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter
- * @version $Id: Stream.php 23775 2011-03-01 17:25:24Z ralph $
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * An interface description for Zend_Http_Client_Adapter_Stream classes.
- *
- * This interface decribes Zend_Http_Client_Adapter which supports streaming.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-interface Zend_Http_Client_Adapter_Stream
-{
- /**
- * Set output stream
- *
- * This function sets output stream where the result will be stored.
- *
- * @param resource $stream Stream to write the output to
- *
- */
- public function setOutputStream($stream);
-}
diff --git a/libs/Zend/Http/Client/Adapter/Test.php b/libs/Zend/Http/Client/Adapter/Test.php
deleted file mode 100644
index 413a90b993..0000000000
--- a/libs/Zend/Http/Client/Adapter/Test.php
+++ /dev/null
@@ -1,248 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter
- * @version $Id: Test.php 24309 2011-07-30 02:52:32Z ramon $
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @see Zend_Uri_Http
- */
-// require_once 'Zend/Uri/Http.php';
-/**
- * @see Zend_Http_Response
- */
-// require_once 'Zend/Http/Response.php';
-/**
- * @see Zend_Http_Client_Adapter_Interface
- */
-// require_once 'Zend/Http/Client/Adapter/Interface.php';
-
-/**
- * A testing-purposes adapter.
- *
- * Should be used to test all components that rely on Zend_Http_Client,
- * without actually performing an HTTP request. You should instantiate this
- * object manually, and then set it as the client's adapter. Then, you can
- * set the expected response using the setResponse() method.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Adapter
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_Client_Adapter_Test implements Zend_Http_Client_Adapter_Interface
-{
- /**
- * Parameters array
- *
- * @var array
- */
- protected $config = array();
-
- /**
- * Buffer of responses to be returned by the read() method. Can be
- * set using setResponse() and addResponse().
- *
- * @var array
- */
- protected $responses = array("HTTP/1.1 400 Bad Request\r\n\r\n");
-
- /**
- * Current position in the response buffer
- *
- * @var integer
- */
- protected $responseIndex = 0;
-
- /**
- * Wether or not the next request will fail with an exception
- *
- * @var boolean
- */
- protected $_nextRequestWillFail = false;
-
- /**
- * Adapter constructor, currently empty. Config is set using setConfig()
- *
- */
- public function __construct()
- { }
-
- /**
- * Set the nextRequestWillFail flag
- *
- * @param boolean $flag
- * @return Zend_Http_Client_Adapter_Test
- */
- public function setNextRequestWillFail($flag)
- {
- $this->_nextRequestWillFail = (bool) $flag;
-
- return $this;
- }
-
- /**
- * Set the configuration array for the adapter
- *
- * @param Zend_Config | array $config
- */
- public function setConfig($config = array())
- {
- if ($config instanceof Zend_Config) {
- $config = $config->toArray();
-
- } elseif (! is_array($config)) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception(
- 'Array or Zend_Config object expected, got ' . gettype($config)
- );
- }
-
- foreach ($config as $k => $v) {
- $this->config[strtolower($k)] = $v;
- }
- }
-
-
- /**
- * Connect to the remote server
- *
- * @param string $host
- * @param int $port
- * @param boolean $secure
- * @param int $timeout
- * @throws Zend_Http_Client_Adapter_Exception
- */
- public function connect($host, $port = 80, $secure = false)
- {
- if ($this->_nextRequestWillFail) {
- $this->_nextRequestWillFail = false;
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception('Request failed');
- }
- }
-
- /**
- * Send request to the remote server
- *
- * @param string $method
- * @param Zend_Uri_Http $uri
- * @param string $http_ver
- * @param array $headers
- * @param string $body
- * @return string Request as string
- */
- public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '')
- {
- $host = $uri->getHost();
- $host = (strtolower($uri->getScheme()) == 'https' ? 'sslv2://' . $host : $host);
-
- // Build request headers
- $path = $uri->getPath();
- if ($uri->getQuery()) $path .= '?' . $uri->getQuery();
- $request = "{$method} {$path} HTTP/{$http_ver}\r\n";
- foreach ($headers as $k => $v) {
- if (is_string($k)) $v = ucfirst($k) . ": $v";
- $request .= "$v\r\n";
- }
-
- // Add the request body
- $request .= "\r\n" . $body;
-
- // Do nothing - just return the request as string
-
- return $request;
- }
-
- /**
- * Return the response set in $this->setResponse()
- *
- * @return string
- */
- public function read()
- {
- if ($this->responseIndex >= count($this->responses)) {
- $this->responseIndex = 0;
- }
- return $this->responses[$this->responseIndex++];
- }
-
- /**
- * Close the connection (dummy)
- *
- */
- public function close()
- { }
-
- /**
- * Set the HTTP response(s) to be returned by this adapter
- *
- * @param Zend_Http_Response|array|string $response
- */
- public function setResponse($response)
- {
- if ($response instanceof Zend_Http_Response) {
- $response = $response->asString("\r\n");
- }
-
- $this->responses = (array)$response;
- $this->responseIndex = 0;
- }
-
- /**
- * Add another response to the response buffer.
- *
- * @param string Zend_Http_Response|$response
- */
- public function addResponse($response)
- {
- if ($response instanceof Zend_Http_Response) {
- $response = $response->asString("\r\n");
- }
-
- $this->responses[] = $response;
- }
-
- /**
- * Sets the position of the response buffer. Selects which
- * response will be returned on the next call to read().
- *
- * @param integer $index
- */
- public function setResponseIndex($index)
- {
- if ($index < 0 || $index >= count($this->responses)) {
- // require_once 'Zend/Http/Client/Adapter/Exception.php';
- throw new Zend_Http_Client_Adapter_Exception(
- 'Index out of range of response buffer size');
- }
- $this->responseIndex = $index;
- }
-
- /**
- * Retrieve the array of all configuration options
- *
- * @return array
- */
- public function getConfig()
- {
- return $this->config;
- }
-}
diff --git a/libs/Zend/Http/Client/Exception.php b/libs/Zend/Http/Client/Exception.php
deleted file mode 100644
index 16d8701ad8..0000000000
--- a/libs/Zend/Http/Client/Exception.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Client_Exception
- * @version $Id: Exception.php 23775 2011-03-01 17:25:24Z ralph $
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @see Zend_Http_Exception
- */
-// require_once 'Zend/Http/Exception.php';
-
-/**
- * @category Zend
- * @package Zend_Http
- * @subpackage Client
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_Client_Exception extends Zend_Http_Exception
-{}
diff --git a/libs/Zend/Http/Cookie.php b/libs/Zend/Http/Cookie.php
deleted file mode 100644
index 751c2d788c..0000000000
--- a/libs/Zend/Http/Cookie.php
+++ /dev/null
@@ -1,424 +0,0 @@
-<?php
-
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Cookie
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @version $Id: Cookie.php 23775 2011-03-01 17:25:24Z ralph $
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @see Zend_Uri_Http
- */
-// require_once 'Zend/Uri/Http.php';
-
-
-/**
- * Zend_Http_Cookie is a class describing an HTTP cookie and all it's parameters.
- *
- * Zend_Http_Cookie is a class describing an HTTP cookie and all it's parameters. The
- * class also enables validating whether the cookie should be sent to the server in
- * a specified scenario according to the request URI, the expiry time and whether
- * session cookies should be used or not. Generally speaking cookies should be
- * contained in a Cookiejar object, or instantiated manually and added to an HTTP
- * request.
- *
- * See http://wp.netscape.com/newsref/std/cookie_spec.html for some specs.
- *
- * @category Zend
- * @package Zend_Http
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_Cookie
-{
- /**
- * Cookie name
- *
- * @var string
- */
- protected $name;
-
- /**
- * Cookie value
- *
- * @var string
- */
- protected $value;
-
- /**
- * Cookie expiry date
- *
- * @var int
- */
- protected $expires;
-
- /**
- * Cookie domain
- *
- * @var string
- */
- protected $domain;
-
- /**
- * Cookie path
- *
- * @var string
- */
- protected $path;
-
- /**
- * Whether the cookie is secure or not
- *
- * @var boolean
- */
- protected $secure;
-
- /**
- * Whether the cookie value has been encoded/decoded
- *
- * @var boolean
- */
- protected $encodeValue;
-
- /**
- * Cookie object constructor
- *
- * @todo Add validation of each one of the parameters (legal domain, etc.)
- *
- * @param string $name
- * @param string $value
- * @param string $domain
- * @param int $expires
- * @param string $path
- * @param bool $secure
- */
- public function __construct($name, $value, $domain, $expires = null, $path = null, $secure = false)
- {
- if (preg_match("/[=,; \t\r\n\013\014]/", $name)) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception("Cookie name cannot contain these characters: =,; \\t\\r\\n\\013\\014 ({$name})");
- }
-
- if (! $this->name = (string) $name) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception('Cookies must have a name');
- }
-
- if (! $this->domain = (string) $domain) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception('Cookies must have a domain');
- }
-
- $this->value = (string) $value;
- $this->expires = ($expires === null ? null : (int) $expires);
- $this->path = ($path ? $path : '/');
- $this->secure = $secure;
- }
-
- /**
- * Get Cookie name
- *
- * @return string
- */
- public function getName()
- {
- return $this->name;
- }
-
- /**
- * Get cookie value
- *
- * @return string
- */
- public function getValue()
- {
- return $this->value;
- }
-
- /**
- * Get cookie domain
- *
- * @return string
- */
- public function getDomain()
- {
- return $this->domain;
- }
-
- /**
- * Get the cookie path
- *
- * @return string
- */
- public function getPath()
- {
- return $this->path;
- }
-
- /**
- * Get the expiry time of the cookie, or null if no expiry time is set
- *
- * @return int|null
- */
- public function getExpiryTime()
- {
- return $this->expires;
- }
-
- /**
- * Check whether the cookie should only be sent over secure connections
- *
- * @return boolean
- */
- public function isSecure()
- {
- return $this->secure;
- }
-
- /**
- * Check whether the cookie has expired
- *
- * Always returns false if the cookie is a session cookie (has no expiry time)
- *
- * @param int $now Timestamp to consider as "now"
- * @return boolean
- */
- public function isExpired($now = null)
- {
- if ($now === null) $now = time();
- if (is_int($this->expires) && $this->expires < $now) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * Check whether the cookie is a session cookie (has no expiry time set)
- *
- * @return boolean
- */
- public function isSessionCookie()
- {
- return ($this->expires === null);
- }
-
- /**
- * Checks whether the cookie should be sent or not in a specific scenario
- *
- * @param string|Zend_Uri_Http $uri URI to check against (secure, domain, path)
- * @param boolean $matchSessionCookies Whether to send session cookies
- * @param int $now Override the current time when checking for expiry time
- * @return boolean
- */
- public function match($uri, $matchSessionCookies = true, $now = null)
- {
- if (is_string ($uri)) {
- $uri = Zend_Uri_Http::factory($uri);
- }
-
- // Make sure we have a valid Zend_Uri_Http object
- if (! ($uri->valid() && ($uri->getScheme() == 'http' || $uri->getScheme() =='https'))) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception('Passed URI is not a valid HTTP or HTTPS URI');
- }
-
- // Check that the cookie is secure (if required) and not expired
- if ($this->secure && $uri->getScheme() != 'https') return false;
- if ($this->isExpired($now)) return false;
- if ($this->isSessionCookie() && ! $matchSessionCookies) return false;
-
- // Check if the domain matches
- if (! self::matchCookieDomain($this->getDomain(), $uri->getHost())) {
- return false;
- }
-
- // Check that path matches using prefix match
- if (! self::matchCookiePath($this->getPath(), $uri->getPath())) {
- return false;
- }
-
- // If we didn't die until now, return true.
- return true;
- }
-
- /**
- * Get the cookie as a string, suitable for sending as a "Cookie" header in an
- * HTTP request
- *
- * @return string
- */
- public function __toString()
- {
- if ($this->encodeValue) {
- return $this->name . '=' . urlencode($this->value) . ';';
- }
- return $this->name . '=' . $this->value . ';';
- }
-
- /**
- * Generate a new Cookie object from a cookie string
- * (for example the value of the Set-Cookie HTTP header)
- *
- * @param string $cookieStr
- * @param Zend_Uri_Http|string $refUri Reference URI for default values (domain, path)
- * @param boolean $encodeValue Whether or not the cookie's value should be
- * passed through urlencode/urldecode
- * @return Zend_Http_Cookie A new Zend_Http_Cookie object or false on failure.
- */
- public static function fromString($cookieStr, $refUri = null, $encodeValue = true)
- {
- // Set default values
- if (is_string($refUri)) {
- $refUri = Zend_Uri_Http::factory($refUri);
- }
-
- $name = '';
- $value = '';
- $domain = '';
- $path = '';
- $expires = null;
- $secure = false;
- $parts = explode(';', $cookieStr);
-
- // If first part does not include '=', fail
- if (strpos($parts[0], '=') === false) return false;
-
- // Get the name and value of the cookie
- list($name, $value) = explode('=', trim(array_shift($parts)), 2);
- $name = trim($name);
- if ($encodeValue) {
- $value = urldecode(trim($value));
- }
-
- // Set default domain and path
- if ($refUri instanceof Zend_Uri_Http) {
- $domain = $refUri->getHost();
- $path = $refUri->getPath();
- $path = substr($path, 0, strrpos($path, '/'));
- }
-
- // Set other cookie parameters
- foreach ($parts as $part) {
- $part = trim($part);
- if (strtolower($part) == 'secure') {
- $secure = true;
- continue;
- }
-
- $keyValue = explode('=', $part, 2);
- if (count($keyValue) == 2) {
- list($k, $v) = $keyValue;
- switch (strtolower($k)) {
- case 'expires':
- if(($expires = strtotime($v)) === false) {
- /**
- * The expiration is past Tue, 19 Jan 2038 03:14:07 UTC
- * the maximum for 32-bit signed integer. Zend_Date
- * can get around that limit.
- *
- * @see Zend_Date
- */
- // require_once 'Zend/Date.php';
-
- $expireDate = new Zend_Date($v);
- $expires = $expireDate->getTimestamp();
- }
- break;
-
- case 'path':
- $path = $v;
- break;
-
- case 'domain':
- $domain = $v;
- break;
-
- default:
- break;
- }
- }
- }
-
- if ($name !== '') {
- $ret = new self($name, $value, $domain, $expires, $path, $secure);
- $ret->encodeValue = ($encodeValue) ? true : false;
- return $ret;
- } else {
- return false;
- }
- }
-
- /**
- * Check if a cookie's domain matches a host name.
- *
- * Used by Zend_Http_Cookie and Zend_Http_CookieJar for cookie matching
- *
- * @param string $cookieDomain
- * @param string $host
- *
- * @return boolean
- */
- public static function matchCookieDomain($cookieDomain, $host)
- {
- if (! $cookieDomain) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception("\$cookieDomain is expected to be a cookie domain");
- }
-
- if (! $host) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception("\$host is expected to be a host name");
- }
-
- $cookieDomain = strtolower($cookieDomain);
- $host = strtolower($host);
-
- if ($cookieDomain[0] == '.') {
- $cookieDomain = substr($cookieDomain, 1);
- }
-
- // Check for either exact match or suffix match
- return ($cookieDomain == $host ||
- preg_match('/\.' . preg_quote($cookieDomain) . '$/', $host));
- }
-
- /**
- * Check if a cookie's path matches a URL path
- *
- * Used by Zend_Http_Cookie and Zend_Http_CookieJar for cookie matching
- *
- * @param string $cookiePath
- * @param string $path
- * @return boolean
- */
- public static function matchCookiePath($cookiePath, $path)
- {
- if (! $cookiePath) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception("\$cookiePath is expected to be a cookie path");
- }
-
- if (! $path) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception("\$path is expected to be a host name");
- }
-
- return (strpos($path, $cookiePath) === 0);
- }
-}
diff --git a/libs/Zend/Http/CookieJar.php b/libs/Zend/Http/CookieJar.php
deleted file mode 100644
index 23aa2c1e71..0000000000
--- a/libs/Zend/Http/CookieJar.php
+++ /dev/null
@@ -1,405 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage CookieJar
- * @version $Id: CookieJar.php 23775 2011-03-01 17:25:24Z ralph $
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @see Zend_Uri
- */
-// require_once "Zend/Uri.php";
-/**
- * @see Zend_Http_Cookie
- */
-// require_once "Zend/Http/Cookie.php";
-/**
- * @see Zend_Http_Response
- */
-// require_once "Zend/Http/Response.php";
-
-/**
- * A Zend_Http_CookieJar object is designed to contain and maintain HTTP cookies, and should
- * be used along with Zend_Http_Client in order to manage cookies across HTTP requests and
- * responses.
- *
- * The class contains an array of Zend_Http_Cookie objects. Cookies can be added to the jar
- * automatically from a request or manually. Then, the jar can find and return the cookies
- * needed for a specific HTTP request.
- *
- * A special parameter can be passed to all methods of this class that return cookies: Cookies
- * can be returned either in their native form (as Zend_Http_Cookie objects) or as strings -
- * the later is suitable for sending as the value of the "Cookie" header in an HTTP request.
- * You can also choose, when returning more than one cookie, whether to get an array of strings
- * (by passing Zend_Http_CookieJar::COOKIE_STRING_ARRAY) or one unified string for all cookies
- * (by passing Zend_Http_CookieJar::COOKIE_STRING_CONCAT).
- *
- * @link http://wp.netscape.com/newsref/std/cookie_spec.html for some specs.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage CookieJar
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_CookieJar implements Countable, IteratorAggregate
-{
- /**
- * Return cookie(s) as a Zend_Http_Cookie object
- *
- */
- const COOKIE_OBJECT = 0;
-
- /**
- * Return cookie(s) as a string (suitable for sending in an HTTP request)
- *
- */
- const COOKIE_STRING_ARRAY = 1;
-
- /**
- * Return all cookies as one long string (suitable for sending in an HTTP request)
- *
- */
- const COOKIE_STRING_CONCAT = 2;
-
- /**
- * Array storing cookies
- *
- * Cookies are stored according to domain and path:
- * $cookies
- * + www.mydomain.com
- * + /
- * - cookie1
- * - cookie2
- * + /somepath
- * - othercookie
- * + www.otherdomain.net
- * + /
- * - alsocookie
- *
- * @var array
- */
- protected $cookies = array();
-
- /**
- * The Zend_Http_Cookie array
- *
- * @var array
- */
- protected $_rawCookies = array();
-
- /**
- * Construct a new CookieJar object
- *
- */
- public function __construct()
- { }
-
- /**
- * Add a cookie to the jar. Cookie should be passed either as a Zend_Http_Cookie object
- * or as a string - in which case an object is created from the string.
- *
- * @param Zend_Http_Cookie|string $cookie
- * @param Zend_Uri_Http|string $ref_uri Optional reference URI (for domain, path, secure)
- * @param boolean $encodeValue
- */
- public function addCookie($cookie, $ref_uri = null, $encodeValue = true)
- {
- if (is_string($cookie)) {
- $cookie = Zend_Http_Cookie::fromString($cookie, $ref_uri, $encodeValue);
- }
-
- if ($cookie instanceof Zend_Http_Cookie) {
- $domain = $cookie->getDomain();
- $path = $cookie->getPath();
- if (! isset($this->cookies[$domain])) $this->cookies[$domain] = array();
- if (! isset($this->cookies[$domain][$path])) $this->cookies[$domain][$path] = array();
- $this->cookies[$domain][$path][$cookie->getName()] = $cookie;
- $this->_rawCookies[] = $cookie;
- } else {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception('Supplient argument is not a valid cookie string or object');
- }
- }
-
- /**
- * Parse an HTTP response, adding all the cookies set in that response
- * to the cookie jar.
- *
- * @param Zend_Http_Response $response
- * @param Zend_Uri_Http|string $ref_uri Requested URI
- * @param boolean $encodeValue
- */
- public function addCookiesFromResponse($response, $ref_uri, $encodeValue = true)
- {
- if (! $response instanceof Zend_Http_Response) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception('$response is expected to be a Response object, ' .
- gettype($response) . ' was passed');
- }
-
- $cookie_hdrs = $response->getHeader('Set-Cookie');
-
- if (is_array($cookie_hdrs)) {
- foreach ($cookie_hdrs as $cookie) {
- $this->addCookie($cookie, $ref_uri, $encodeValue);
- }
- } elseif (is_string($cookie_hdrs)) {
- $this->addCookie($cookie_hdrs, $ref_uri, $encodeValue);
- }
- }
-
- /**
- * Get all cookies in the cookie jar as an array
- *
- * @param int $ret_as Whether to return cookies as objects of Zend_Http_Cookie or as strings
- * @return array|string
- */
- public function getAllCookies($ret_as = self::COOKIE_OBJECT)
- {
- $cookies = $this->_flattenCookiesArray($this->cookies, $ret_as);
- return $cookies;
- }
-
- /**
- * Return an array of all cookies matching a specific request according to the request URI,
- * whether session cookies should be sent or not, and the time to consider as "now" when
- * checking cookie expiry time.
- *
- * @param string|Zend_Uri_Http $uri URI to check against (secure, domain, path)
- * @param boolean $matchSessionCookies Whether to send session cookies
- * @param int $ret_as Whether to return cookies as objects of Zend_Http_Cookie or as strings
- * @param int $now Override the current time when checking for expiry time
- * @return array|string
- */
- public function getMatchingCookies($uri, $matchSessionCookies = true,
- $ret_as = self::COOKIE_OBJECT, $now = null)
- {
- if (is_string($uri)) $uri = Zend_Uri::factory($uri);
- if (! $uri instanceof Zend_Uri_Http) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception("Invalid URI string or object passed");
- }
-
- // First, reduce the array of cookies to only those matching domain and path
- $cookies = $this->_matchDomain($uri->getHost());
- $cookies = $this->_matchPath($cookies, $uri->getPath());
- $cookies = $this->_flattenCookiesArray($cookies, self::COOKIE_OBJECT);
-
- // Next, run Cookie->match on all cookies to check secure, time and session mathcing
- $ret = array();
- foreach ($cookies as $cookie)
- if ($cookie->match($uri, $matchSessionCookies, $now))
- $ret[] = $cookie;
-
- // Now, use self::_flattenCookiesArray again - only to convert to the return format ;)
- $ret = $this->_flattenCookiesArray($ret, $ret_as);
-
- return $ret;
- }
-
- /**
- * Get a specific cookie according to a URI and name
- *
- * @param Zend_Uri_Http|string $uri The uri (domain and path) to match
- * @param string $cookie_name The cookie's name
- * @param int $ret_as Whether to return cookies as objects of Zend_Http_Cookie or as strings
- * @return Zend_Http_Cookie|string
- */
- public function getCookie($uri, $cookie_name, $ret_as = self::COOKIE_OBJECT)
- {
- if (is_string($uri)) {
- $uri = Zend_Uri::factory($uri);
- }
-
- if (! $uri instanceof Zend_Uri_Http) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception('Invalid URI specified');
- }
-
- // Get correct cookie path
- $path = $uri->getPath();
- $path = substr($path, 0, strrpos($path, '/'));
- if (! $path) $path = '/';
-
- if (isset($this->cookies[$uri->getHost()][$path][$cookie_name])) {
- $cookie = $this->cookies[$uri->getHost()][$path][$cookie_name];
-
- switch ($ret_as) {
- case self::COOKIE_OBJECT:
- return $cookie;
- break;
-
- case self::COOKIE_STRING_ARRAY:
- case self::COOKIE_STRING_CONCAT:
- return $cookie->__toString();
- break;
-
- default:
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception("Invalid value passed for \$ret_as: {$ret_as}");
- break;
- }
- } else {
- return false;
- }
- }
-
- /**
- * Helper function to recursivly flatten an array. Shoud be used when exporting the
- * cookies array (or parts of it)
- *
- * @param Zend_Http_Cookie|array $ptr
- * @param int $ret_as What value to return
- * @return array|string
- */
- protected function _flattenCookiesArray($ptr, $ret_as = self::COOKIE_OBJECT) {
- if (is_array($ptr)) {
- $ret = ($ret_as == self::COOKIE_STRING_CONCAT ? '' : array());
- foreach ($ptr as $item) {
- if ($ret_as == self::COOKIE_STRING_CONCAT) {
- $ret .= $this->_flattenCookiesArray($item, $ret_as);
- } else {
- $ret = array_merge($ret, $this->_flattenCookiesArray($item, $ret_as));
- }
- }
- return $ret;
- } elseif ($ptr instanceof Zend_Http_Cookie) {
- switch ($ret_as) {
- case self::COOKIE_STRING_ARRAY:
- return array($ptr->__toString());
- break;
-
- case self::COOKIE_STRING_CONCAT:
- return $ptr->__toString();
- break;
-
- case self::COOKIE_OBJECT:
- default:
- return array($ptr);
- break;
- }
- }
-
- return null;
- }
-
- /**
- * Return a subset of the cookies array matching a specific domain
- *
- * @param string $domain
- * @return array
- */
- protected function _matchDomain($domain)
- {
- $ret = array();
-
- foreach (array_keys($this->cookies) as $cdom) {
- if (Zend_Http_Cookie::matchCookieDomain($cdom, $domain)) {
- $ret[$cdom] = $this->cookies[$cdom];
- }
- }
-
- return $ret;
- }
-
- /**
- * Return a subset of a domain-matching cookies that also match a specified path
- *
- * @param array $dom_array
- * @param string $path
- * @return array
- */
- protected function _matchPath($domains, $path)
- {
- $ret = array();
-
- foreach ($domains as $dom => $paths_array) {
- foreach (array_keys($paths_array) as $cpath) {
- if (Zend_Http_Cookie::matchCookiePath($cpath, $path)) {
- if (! isset($ret[$dom])) {
- $ret[$dom] = array();
- }
-
- $ret[$dom][$cpath] = $paths_array[$cpath];
- }
- }
- }
-
- return $ret;
- }
-
- /**
- * Create a new CookieJar object and automatically load into it all the
- * cookies set in an Http_Response object. If $uri is set, it will be
- * considered as the requested URI for setting default domain and path
- * of the cookie.
- *
- * @param Zend_Http_Response $response HTTP Response object
- * @param Zend_Uri_Http|string $uri The requested URI
- * @return Zend_Http_CookieJar
- * @todo Add the $uri functionality.
- */
- public static function fromResponse(Zend_Http_Response $response, $ref_uri)
- {
- $jar = new self();
- $jar->addCookiesFromResponse($response, $ref_uri);
- return $jar;
- }
-
- /**
- * Required by Countable interface
- *
- * @return int
- */
- public function count()
- {
- return count($this->_rawCookies);
- }
-
- /**
- * Required by IteratorAggregate interface
- *
- * @return ArrayIterator
- */
- public function getIterator()
- {
- return new ArrayIterator($this->_rawCookies);
- }
-
- /**
- * Tells if the jar is empty of any cookie
- *
- * @return bool
- */
- public function isEmpty()
- {
- return count($this) == 0;
- }
-
- /**
- * Empties the cookieJar of any cookie
- *
- * @return Zend_Http_CookieJar
- */
- public function reset()
- {
- $this->cookies = $this->_rawCookies = array();
- return $this;
- }
-}
diff --git a/libs/Zend/Http/Exception.php b/libs/Zend/Http/Exception.php
deleted file mode 100644
index 727eec585f..0000000000
--- a/libs/Zend/Http/Exception.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Exception
- * @version $Id: Exception.php 23775 2011-03-01 17:25:24Z ralph $
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @see Zend_Exception
- */
-// require_once 'Zend/Exception.php';
-
-/**
- * @category Zend
- * @package Zend_Http
- * @subpackage Client
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_Exception extends Zend_Exception
-{}
diff --git a/libs/Zend/Http/Response.php b/libs/Zend/Http/Response.php
deleted file mode 100644
index 313515cf31..0000000000
--- a/libs/Zend/Http/Response.php
+++ /dev/null
@@ -1,667 +0,0 @@
-<?php
-
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Response
- * @version $Id: Response.php 23775 2011-03-01 17:25:24Z ralph $
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_Http_Response represents an HTTP 1.0 / 1.1 response message. It
- * includes easy access to all the response's different elemts, as well as some
- * convenience methods for parsing and validating HTTP responses.
- *
- * @package Zend_Http
- * @subpackage Response
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_Response
-{
- /**
- * List of all known HTTP response codes - used by responseCodeAsText() to
- * translate numeric codes to messages.
- *
- * @var array
- */
- protected static $messages = array(
- // Informational 1xx
- 100 => 'Continue',
- 101 => 'Switching Protocols',
-
- // Success 2xx
- 200 => 'OK',
- 201 => 'Created',
- 202 => 'Accepted',
- 203 => 'Non-Authoritative Information',
- 204 => 'No Content',
- 205 => 'Reset Content',
- 206 => 'Partial Content',
-
- // Redirection 3xx
- 300 => 'Multiple Choices',
- 301 => 'Moved Permanently',
- 302 => 'Found', // 1.1
- 303 => 'See Other',
- 304 => 'Not Modified',
- 305 => 'Use Proxy',
- // 306 is deprecated but reserved
- 307 => 'Temporary Redirect',
-
- // Client Error 4xx
- 400 => 'Bad Request',
- 401 => 'Unauthorized',
- 402 => 'Payment Required',
- 403 => 'Forbidden',
- 404 => 'Not Found',
- 405 => 'Method Not Allowed',
- 406 => 'Not Acceptable',
- 407 => 'Proxy Authentication Required',
- 408 => 'Request Timeout',
- 409 => 'Conflict',
- 410 => 'Gone',
- 411 => 'Length Required',
- 412 => 'Precondition Failed',
- 413 => 'Request Entity Too Large',
- 414 => 'Request-URI Too Long',
- 415 => 'Unsupported Media Type',
- 416 => 'Requested Range Not Satisfiable',
- 417 => 'Expectation Failed',
-
- // Server Error 5xx
- 500 => 'Internal Server Error',
- 501 => 'Not Implemented',
- 502 => 'Bad Gateway',
- 503 => 'Service Unavailable',
- 504 => 'Gateway Timeout',
- 505 => 'HTTP Version Not Supported',
- 509 => 'Bandwidth Limit Exceeded'
- );
-
- /**
- * The HTTP version (1.0, 1.1)
- *
- * @var string
- */
- protected $version;
-
- /**
- * The HTTP response code
- *
- * @var int
- */
- protected $code;
-
- /**
- * The HTTP response code as string
- * (e.g. 'Not Found' for 404 or 'Internal Server Error' for 500)
- *
- * @var string
- */
- protected $message;
-
- /**
- * The HTTP response headers array
- *
- * @var array
- */
- protected $headers = array();
-
- /**
- * The HTTP response body
- *
- * @var string
- */
- protected $body;
-
- /**
- * HTTP response constructor
- *
- * In most cases, you would use Zend_Http_Response::fromString to parse an HTTP
- * response string and create a new Zend_Http_Response object.
- *
- * NOTE: The constructor no longer accepts nulls or empty values for the code and
- * headers and will throw an exception if the passed values do not form a valid HTTP
- * responses.
- *
- * If no message is passed, the message will be guessed according to the response code.
- *
- * @param int $code Response code (200, 404, ...)
- * @param array $headers Headers array
- * @param string $body Response body
- * @param string $version HTTP version
- * @param string $message Response code as text
- * @throws Zend_Http_Exception
- */
- public function __construct($code, array $headers, $body = null, $version = '1.1', $message = null)
- {
- // Make sure the response code is valid and set it
- if (self::responseCodeAsText($code) === null) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception("{$code} is not a valid HTTP response code");
- }
-
- $this->code = $code;
-
- foreach ($headers as $name => $value) {
- if (is_int($name)) {
- $header = explode(":", $value, 2);
- if (count($header) != 2) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception("'{$value}' is not a valid HTTP header");
- }
-
- $name = trim($header[0]);
- $value = trim($header[1]);
- }
-
- $this->headers[ucwords(strtolower($name))] = $value;
- }
-
- // Set the body
- $this->body = $body;
-
- // Set the HTTP version
- if (! preg_match('|^\d\.\d$|', $version)) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception("Invalid HTTP response version: $version");
- }
-
- $this->version = $version;
-
- // If we got the response message, set it. Else, set it according to
- // the response code
- if (is_string($message)) {
- $this->message = $message;
- } else {
- $this->message = self::responseCodeAsText($code);
- }
- }
-
- /**
- * Check whether the response is an error
- *
- * @return boolean
- */
- public function isError()
- {
- $restype = floor($this->code / 100);
- if ($restype == 4 || $restype == 5) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Check whether the response in successful
- *
- * @return boolean
- */
- public function isSuccessful()
- {
- $restype = floor($this->code / 100);
- if ($restype == 2 || $restype == 1) { // Shouldn't 3xx count as success as well ???
- return true;
- }
-
- return false;
- }
-
- /**
- * Check whether the response is a redirection
- *
- * @return boolean
- */
- public function isRedirect()
- {
- $restype = floor($this->code / 100);
- if ($restype == 3) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Get the response body as string
- *
- * This method returns the body of the HTTP response (the content), as it
- * should be in it's readable version - that is, after decoding it (if it
- * was decoded), deflating it (if it was gzip compressed), etc.
- *
- * If you want to get the raw body (as transfered on wire) use
- * $this->getRawBody() instead.
- *
- * @return string
- */
- public function getBody()
- {
- $body = '';
-
- // Decode the body if it was transfer-encoded
- switch (strtolower($this->getHeader('transfer-encoding'))) {
-
- // Handle chunked body
- case 'chunked':
- $body = self::decodeChunkedBody($this->body);
- break;
-
- // No transfer encoding, or unknown encoding extension:
- // return body as is
- default:
- $body = $this->body;
- break;
- }
-
- // Decode any content-encoding (gzip or deflate) if needed
- switch (strtolower($this->getHeader('content-encoding'))) {
-
- // Handle gzip encoding
- case 'gzip':
- $body = self::decodeGzip($body);
- break;
-
- // Handle deflate encoding
- case 'deflate':
- $body = self::decodeDeflate($body);
- break;
-
- default:
- break;
- }
-
- return $body;
- }
-
- /**
- * Get the raw response body (as transfered "on wire") as string
- *
- * If the body is encoded (with Transfer-Encoding, not content-encoding -
- * IE "chunked" body), gzip compressed, etc. it will not be decoded.
- *
- * @return string
- */
- public function getRawBody()
- {
- return $this->body;
- }
-
- /**
- * Get the HTTP version of the response
- *
- * @return string
- */
- public function getVersion()
- {
- return $this->version;
- }
-
- /**
- * Get the HTTP response status code
- *
- * @return int
- */
- public function getStatus()
- {
- return $this->code;
- }
-
- /**
- * Return a message describing the HTTP response code
- * (Eg. "OK", "Not Found", "Moved Permanently")
- *
- * @return string
- */
- public function getMessage()
- {
- return $this->message;
- }
-
- /**
- * Get the response headers
- *
- * @return array
- */
- public function getHeaders()
- {
- return $this->headers;
- }
-
- /**
- * Get a specific header as string, or null if it is not set
- *
- * @param string$header
- * @return string|array|null
- */
- public function getHeader($header)
- {
- $header = ucwords(strtolower($header));
- if (! is_string($header) || ! isset($this->headers[$header])) return null;
-
- return $this->headers[$header];
- }
-
- /**
- * Get all headers as string
- *
- * @param boolean $status_line Whether to return the first status line (IE "HTTP 200 OK")
- * @param string $br Line breaks (eg. "\n", "\r\n", "<br />")
- * @return string
- */
- public function getHeadersAsString($status_line = true, $br = "\n")
- {
- $str = '';
-
- if ($status_line) {
- $str = "HTTP/{$this->version} {$this->code} {$this->message}{$br}";
- }
-
- // Iterate over the headers and stringify them
- foreach ($this->headers as $name => $value)
- {
- if (is_string($value))
- $str .= "{$name}: {$value}{$br}";
-
- elseif (is_array($value)) {
- foreach ($value as $subval) {
- $str .= "{$name}: {$subval}{$br}";
- }
- }
- }
-
- return $str;
- }
-
- /**
- * Get the entire response as string
- *
- * @param string $br Line breaks (eg. "\n", "\r\n", "<br />")
- * @return string
- */
- public function asString($br = "\n")
- {
- return $this->getHeadersAsString(true, $br) . $br . $this->getRawBody();
- }
-
- /**
- * Implements magic __toString()
- *
- * @return string
- */
- public function __toString()
- {
- return $this->asString();
- }
-
- /**
- * A convenience function that returns a text representation of
- * HTTP response codes. Returns 'Unknown' for unknown codes.
- * Returns array of all codes, if $code is not specified.
- *
- * Conforms to HTTP/1.1 as defined in RFC 2616 (except for 'Unknown')
- * See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10 for reference
- *
- * @param int $code HTTP response code
- * @param boolean $http11 Use HTTP version 1.1
- * @return string
- */
- public static function responseCodeAsText($code = null, $http11 = true)
- {
- $messages = self::$messages;
- if (! $http11) $messages[302] = 'Moved Temporarily';
-
- if ($code === null) {
- return $messages;
- } elseif (isset($messages[$code])) {
- return $messages[$code];
- } else {
- return 'Unknown';
- }
- }
-
- /**
- * Extract the response code from a response string
- *
- * @param string $response_str
- * @return int
- */
- public static function extractCode($response_str)
- {
- preg_match("|^HTTP/[\d\.x]+ (\d+)|", $response_str, $m);
-
- if (isset($m[1])) {
- return (int) $m[1];
- } else {
- return false;
- }
- }
-
- /**
- * Extract the HTTP message from a response
- *
- * @param string $response_str
- * @return string
- */
- public static function extractMessage($response_str)
- {
- preg_match("|^HTTP/[\d\.x]+ \d+ ([^\r\n]+)|", $response_str, $m);
-
- if (isset($m[1])) {
- return $m[1];
- } else {
- return false;
- }
- }
-
- /**
- * Extract the HTTP version from a response
- *
- * @param string $response_str
- * @return string
- */
- public static function extractVersion($response_str)
- {
- preg_match("|^HTTP/([\d\.x]+) \d+|", $response_str, $m);
-
- if (isset($m[1])) {
- return $m[1];
- } else {
- return false;
- }
- }
-
- /**
- * Extract the headers from a response string
- *
- * @param string $response_str
- * @return array
- */
- public static function extractHeaders($response_str)
- {
- $headers = array();
-
- // First, split body and headers
- $parts = preg_split('|(?:\r?\n){2}|m', $response_str, 2);
- if (! $parts[0]) return $headers;
-
- // Split headers part to lines
- $lines = explode("\n", $parts[0]);
- unset($parts);
- $last_header = null;
-
- foreach($lines as $line) {
- $line = trim($line, "\r\n");
- if ($line == "") break;
-
- // Locate headers like 'Location: ...' and 'Location:...' (note the missing space)
- if (preg_match("|^([\w-]+):\s*(.+)|", $line, $m)) {
- unset($last_header);
- $h_name = strtolower($m[1]);
- $h_value = $m[2];
-
- if (isset($headers[$h_name])) {
- if (! is_array($headers[$h_name])) {
- $headers[$h_name] = array($headers[$h_name]);
- }
-
- $headers[$h_name][] = $h_value;
- } else {
- $headers[$h_name] = $h_value;
- }
- $last_header = $h_name;
- } elseif (preg_match("|^\s+(.+)$|", $line, $m) && $last_header !== null) {
- if (is_array($headers[$last_header])) {
- end($headers[$last_header]);
- $last_header_key = key($headers[$last_header]);
- $headers[$last_header][$last_header_key] .= $m[1];
- } else {
- $headers[$last_header] .= $m[1];
- }
- }
- }
-
- return $headers;
- }
-
- /**
- * Extract the body from a response string
- *
- * @param string $response_str
- * @return string
- */
- public static function extractBody($response_str)
- {
- $parts = preg_split('|(?:\r?\n){2}|m', $response_str, 2);
- if (isset($parts[1])) {
- return $parts[1];
- }
- return '';
- }
-
- /**
- * Decode a "chunked" transfer-encoded body and return the decoded text
- *
- * @param string $body
- * @return string
- */
- public static function decodeChunkedBody($body)
- {
- $decBody = '';
-
- // If mbstring overloads substr and strlen functions, we have to
- // override it's internal encoding
- if (function_exists('mb_internal_encoding') &&
- ((int) ini_get('mbstring.func_overload')) & 2) {
-
- $mbIntEnc = mb_internal_encoding();
- mb_internal_encoding('ASCII');
- }
-
- while (trim($body)) {
- if (! preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $body, $m)) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception("Error parsing body - doesn't seem to be a chunked message");
- }
-
- $length = hexdec(trim($m[1]));
- $cut = strlen($m[0]);
- $decBody .= substr($body, $cut, $length);
- $body = substr($body, $cut + $length + 2);
- }
-
- if (isset($mbIntEnc)) {
- mb_internal_encoding($mbIntEnc);
- }
-
- return $decBody;
- }
-
- /**
- * Decode a gzip encoded message (when Content-encoding = gzip)
- *
- * Currently requires PHP with zlib support
- *
- * @param string $body
- * @return string
- */
- public static function decodeGzip($body)
- {
- if (! function_exists('gzinflate')) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception(
- 'zlib extension is required in order to decode "gzip" encoding'
- );
- }
-
- return gzinflate(substr($body, 10));
- }
-
- /**
- * Decode a zlib deflated message (when Content-encoding = deflate)
- *
- * Currently requires PHP with zlib support
- *
- * @param string $body
- * @return string
- */
- public static function decodeDeflate($body)
- {
- if (! function_exists('gzuncompress')) {
- // require_once 'Zend/Http/Exception.php';
- throw new Zend_Http_Exception(
- 'zlib extension is required in order to decode "deflate" encoding'
- );
- }
-
- /**
- * Some servers (IIS ?) send a broken deflate response, without the
- * RFC-required zlib header.
- *
- * We try to detect the zlib header, and if it does not exsit we
- * teat the body is plain DEFLATE content.
- *
- * This method was adapted from PEAR HTTP_Request2 by (c) Alexey Borzov
- *
- * @link http://framework.zend.com/issues/browse/ZF-6040
- */
- $zlibHeader = unpack('n', substr($body, 0, 2));
- if ($zlibHeader[1] % 31 == 0) {
- return gzuncompress($body);
- } else {
- return gzinflate($body);
- }
- }
-
- /**
- * Create a new Zend_Http_Response object from a string
- *
- * @param string $response_str
- * @return Zend_Http_Response
- */
- public static function fromString($response_str)
- {
- $code = self::extractCode($response_str);
- $headers = self::extractHeaders($response_str);
- $body = self::extractBody($response_str);
- $version = self::extractVersion($response_str);
- $message = self::extractMessage($response_str);
-
- return new Zend_Http_Response($code, $headers, $body, $version, $message);
- }
-}
diff --git a/libs/Zend/Http/Response/Stream.php b/libs/Zend/Http/Response/Stream.php
deleted file mode 100644
index e15f84efd9..0000000000
--- a/libs/Zend/Http/Response/Stream.php
+++ /dev/null
@@ -1,235 +0,0 @@
-<?php
-
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage Response
- * @version $Id: Stream.php 23775 2011-03-01 17:25:24Z ralph $
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_Http_Response represents an HTTP 1.0 / 1.1 response message. It
- * includes easy access to all the response's different elemts, as well as some
- * convenience methods for parsing and validating HTTP responses.
- *
- * @package Zend_Http
- * @subpackage Response
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_Response_Stream extends Zend_Http_Response
-{
- /**
- * Response as stream
- *
- * @var resource
- */
- protected $stream;
-
- /**
- * The name of the file containing the stream
- *
- * Will be empty if stream is not file-based.
- *
- * @var string
- */
- protected $stream_name;
-
- /**
- * Should we clean up the stream file when this response is closed?
- *
- * @var boolean
- */
- protected $_cleanup;
-
- /**
- * Get the response as stream
- *
- * @return resourse
- */
- public function getStream()
- {
- return $this->stream;
- }
-
- /**
- * Set the response stream
- *
- * @param resourse $stream
- * @return Zend_Http_Response_Stream
- */
- public function setStream($stream)
- {
- $this->stream = $stream;
- return $this;
- }
-
- /**
- * Get the cleanup trigger
- *
- * @return boolean
- */
- public function getCleanup() {
- return $this->_cleanup;
- }
-
- /**
- * Set the cleanup trigger
- *
- * @param bool $cleanup Set cleanup trigger
- */
- public function setCleanup($cleanup = true) {
- $this->_cleanup = $cleanup;
- }
-
- /**
- * Get file name associated with the stream
- *
- * @return string
- */
- public function getStreamName() {
- return $this->stream_name;
- }
-
- /**
- * Set file name associated with the stream
- *
- * @param string $stream_name Name to set
- * @return Zend_Http_Response_Stream
- */
- public function setStreamName($stream_name) {
- $this->stream_name = $stream_name;
- return $this;
- }
-
-
- /**
- * HTTP response constructor
- *
- * In most cases, you would use Zend_Http_Response::fromString to parse an HTTP
- * response string and create a new Zend_Http_Response object.
- *
- * NOTE: The constructor no longer accepts nulls or empty values for the code and
- * headers and will throw an exception if the passed values do not form a valid HTTP
- * responses.
- *
- * If no message is passed, the message will be guessed according to the response code.
- *
- * @param int $code Response code (200, 404, ...)
- * @param array $headers Headers array
- * @param string $body Response body
- * @param string $version HTTP version
- * @param string $message Response code as text
- * @throws Zend_Http_Exception
- */
- public function __construct($code, $headers, $body = null, $version = '1.1', $message = null)
- {
-
- if(is_resource($body)) {
- $this->setStream($body);
- $body = '';
- }
- parent::__construct($code, $headers, $body, $version, $message);
- }
-
- /**
- * Create a new Zend_Http_Response_Stream object from a string
- *
- * @param string $response_str
- * @param resource $stream
- * @return Zend_Http_Response_Stream
- */
- public static function fromStream($response_str, $stream)
- {
- $code = self::extractCode($response_str);
- $headers = self::extractHeaders($response_str);
- $version = self::extractVersion($response_str);
- $message = self::extractMessage($response_str);
-
- return new self($code, $headers, $stream, $version, $message);
- }
-
- /**
- * Get the response body as string
- *
- * This method returns the body of the HTTP response (the content), as it
- * should be in it's readable version - that is, after decoding it (if it
- * was decoded), deflating it (if it was gzip compressed), etc.
- *
- * If you want to get the raw body (as transfered on wire) use
- * $this->getRawBody() instead.
- *
- * @return string
- */
- public function getBody()
- {
- if($this->stream != null) {
- $this->readStream();
- }
- return parent::getBody();
- }
-
- /**
- * Get the raw response body (as transfered "on wire") as string
- *
- * If the body is encoded (with Transfer-Encoding, not content-encoding -
- * IE "chunked" body), gzip compressed, etc. it will not be decoded.
- *
- * @return string
- */
- public function getRawBody()
- {
- if($this->stream) {
- $this->readStream();
- }
- return $this->body;
- }
-
- /**
- * Read stream content and return it as string
- *
- * Function reads the remainder of the body from the stream and closes the stream.
- *
- * @return string
- */
- protected function readStream()
- {
- if(!is_resource($this->stream)) {
- return '';
- }
-
- if(isset($headers['content-length'])) {
- $this->body = stream_get_contents($this->stream, $headers['content-length']);
- } else {
- $this->body = stream_get_contents($this->stream);
- }
- fclose($this->stream);
- $this->stream = null;
- }
-
- public function __destruct()
- {
- if(is_resource($this->stream)) {
- fclose($this->stream);
- $this->stream = null;
- }
- if($this->_cleanup) {
- @unlink($this->stream_name);
- }
- }
-
-}
diff --git a/libs/Zend/Http/UserAgent.php b/libs/Zend/Http/UserAgent.php
deleted file mode 100644
index 204b1117db..0000000000
--- a/libs/Zend/Http/UserAgent.php
+++ /dev/null
@@ -1,853 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http_UserAgent
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Lists of User Agent chains for testing :
- *
- * - http://www.useragentstring.com/layout/useragentstring.php
- * - http://user-agent-string.info/list-of-ua
- * - http://www.user-agents.org/allagents.xml
- * - http://en.wikipedia.org/wiki/List_of_user_agents_for_mobile_phones
- * - http://www.mobilemultimedia.be/fr/
- *
- * @category Zend
- * @package Zend_Http_UserAgent
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent implements Serializable
-{
- /**
- * 'desktop' by default if the sequence return false for each item or is empty
- */
- const DEFAULT_IDENTIFICATION_SEQUENCE = 'mobile,desktop';
-
- /**
- * Default persitent storage adapter : Session or NonPersitent
- */
- const DEFAULT_PERSISTENT_STORAGE_ADAPTER = 'Session';
-
- /**
- * 'desktop' by default if the sequence return false for each item
- */
- const DEFAULT_BROWSER_TYPE = 'desktop';
-
- /**
- * Default User Agent chain to prevent empty value
- */
- const DEFAULT_HTTP_USER_AGENT = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)';
-
- /**
- * Default Http Accept param to prevent empty value
- */
- const DEFAULT_HTTP_ACCEPT = "application/xhtml+xml";
-
- /**
- * Default markup language
- */
- const DEFAULT_MARKUP_LANGUAGE = "xhtml";
-
- /**
- * Browser type
- *
- * @var string
- */
- protected $_browserType;
-
- /**
- * Browser type class
- *
- * Map of browser types to classes.
- *
- * @var array
- */
- protected $_browserTypeClass = array();
-
- /**
- * Array to store config
- *
- * Default values are provided to ensure specific keys are present at
- * instantiation.
- *
- * @var array
- */
- protected $_config = array(
- 'identification_sequence' => self::DEFAULT_IDENTIFICATION_SEQUENCE,
- 'storage' => array(
- 'adapter' => self::DEFAULT_PERSISTENT_STORAGE_ADAPTER,
- ),
- );
-
- /**
- * Identified device
- *
- * @var Zend_Http_UserAgent_Device
- */
- protected $_device;
-
- /**
- * Whether or not this instance is immutable.
- *
- * If true, none of the following may be modified:
- * - $_server
- * - $_browserType
- * - User-Agent (defined in $_server)
- * - HTTP Accept value (defined in $_server)
- * - $_storage
- *
- * @var bool
- */
- protected $_immutable = false;
-
- /**
- * Plugin loaders
- * @var array
- */
- protected $_loaders = array();
-
- /**
- * Valid plugin loader types
- * @var array
- */
- protected $_loaderTypes = array('storage', 'device');
-
- /**
- * Trace of items matched to identify the browser type
- *
- * @var array
- */
- protected $_matchLog = array();
-
- /**
- * Server variable
- *
- * @var array
- */
- protected $_server;
-
- /**
- * Persistent storage handler
- *
- * @var Zend_Http_UserAgent_Storage
- */
- protected $_storage;
-
- /**
- * Constructor
- *
- * @param null|array|Zend_Config|ArrayAccess $options
- * @return void
- */
- public function __construct($options = null)
- {
- if (null !== $options) {
- $this->setOptions($options);
- }
- }
-
- /**
- * Serialized representation of the object
- *
- * @return string
- */
- public function serialize()
- {
- $device = $this->getDevice();
- $spec = array(
- 'browser_type' => $this->_browserType,
- 'config' => $this->_config,
- 'device_class' => get_class($device),
- 'device' => $device->serialize(),
- 'user_agent' => $this->getServerValue('http_user_agent'),
- 'http_accept' => $this->getServerValue('http_accept'),
- );
- return serialize($spec);
- }
-
- /**
- * Unserialize a previous representation of the object
- *
- * @param string $serialized
- * @return void
- */
- public function unserialize($serialized)
- {
- $spec = unserialize($serialized);
-
- $this->setOptions($spec);
-
- // Determine device class and ensure the class is loaded
- $deviceClass = $spec['device_class'];
- if (!class_exists($deviceClass)) {
- $this->_getUserAgentDevice($this->getBrowserType());
- }
-
- // Get device specification and instantiate
- $deviceSpec = unserialize($spec['device']);
- $deviceSpec['_config'] = $this->getConfig();
- $deviceSpec['_server'] = $this->getServer();
- $this->_device = new $deviceClass($deviceSpec);
- }
-
- /**
- * Configure instance
- *
- * @param array|Zend_Config|ArrayAccess $options
- * @return Zend_Http_UserAgent
- */
- public function setOptions($options)
- {
- if ($options instanceof Zend_Config) {
- $options = $options->toArray();
- }
-
- if (!is_array($options)
- && !$options instanceof ArrayAccess
- && !$options instanceof Traversable
- ) {
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception(sprintf(
- 'Invalid argument; expected array, Zend_Config object, or object implementing ArrayAccess and Traversable; received %s',
- (is_object($options) ? get_class($options) : gettype($options))
- ));
- }
-
- // Set $_SERVER first
- if (isset($options['server'])) {
- $this->setServer($options['server']);
- unset($options['server']);
- }
-
- // Get plugin loaders sorted
- if (isset($options['plugin_loader'])) {
- $plConfig = $options['plugin_loader'];
- if (is_array($plConfig) || $plConfig instanceof Traversable) {
- foreach ($plConfig as $type => $class) {
- $this->setPluginLoader($type, $class);
- }
- }
- unset($plConfig, $options['plugin_loader']);
- }
-
- // And then loop through the remaining options
- $config = array();
- foreach ($options as $key => $value) {
- switch (strtolower($key)) {
- case 'browser_type':
- $this->setBrowserType($value);
- break;
- case 'http_accept':
- $this->setHttpAccept($value);
- break;
- case 'user_agent':
- $this->setUserAgent($value);
- break;
- default:
- // Cache remaining options for $_config
- $config[$key] = $value;
- break;
- }
- }
- $this->setConfig($config);
-
- return $this;
- }
-
- /**
- * Comparison of the UserAgent chain and browser signatures.
- *
- * The comparison is case-insensitive : the browser signatures must be in lower
- * case
- *
- * @param string $deviceClass Name of class against which a match will be attempted
- * @return bool
- */
- protected function _match($deviceClass)
- {
- // Validate device class
- $r = new ReflectionClass($deviceClass);
- if (!$r->implementsInterface('Zend_Http_UserAgent_Device')) {
- throw new Zend_Http_UserAgent_Exception(sprintf(
- 'Invalid device class provided ("%s"); must implement Zend_Http_UserAgent_Device',
- $deviceClass
- ));
- }
-
- $userAgent = $this->getUserAgent();
-
- // Call match method on device class
- return call_user_func(
- array($deviceClass, 'match'),
- $userAgent,
- $this->getServer()
- );
- }
-
- /**
- * Loads class for a user agent device
- *
- * @param string $browserType Browser type
- * @return string
- * @throws Zend_Loader_PluginLoader_Exception if unable to load UA device
- */
- protected function _getUserAgentDevice($browserType)
- {
- $browserType = strtolower($browserType);
- if (isset($this->_browserTypeClass[$browserType])) {
- return $this->_browserTypeClass[$browserType];
- }
-
- if (isset($this->_config[$browserType])
- && isset($this->_config[$browserType]['device'])
- ) {
- $deviceConfig = $this->_config[$browserType]['device'];
- if (is_array($deviceConfig) && isset($deviceConfig['classname'])) {
- $device = (string) $deviceConfig['classname'];
- if (!class_exists($device)) {
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception(sprintf(
- 'Invalid classname "%s" provided in device configuration for browser type "%s"',
- $device,
- $browserType
- ));
- }
- } elseif (is_array($deviceConfig) && isset($deviceConfig['path'])) {
- $loader = $this->getPluginLoader('device');
- $path = $deviceConfig['path'];
- $prefix = isset($deviceConfig['prefix']) ? $deviceConfig['prefix'] : 'Zend_Http_UserAgent';
- $loader->addPrefixPath($prefix, $path);
-
- $device = $loader->load($browserType);
- } else {
- $loader = $this->getPluginLoader('device');
- $device = $loader->load($browserType);
- }
- } else {
- $loader = $this->getPluginLoader('device');
- $device = $loader->load($browserType);
- }
-
- $this->_browserTypeClass[$browserType] = $device;
-
- return $device;
- }
-
- /**
- * Returns the User Agent value
- *
- * If $userAgent param is null, the value of $_server['HTTP_USER_AGENT'] is
- * returned.
- *
- * @return string
- */
- public function getUserAgent()
- {
- if (null === ($ua = $this->getServerValue('http_user_agent'))) {
- $ua = self::DEFAULT_HTTP_USER_AGENT;
- $this->setUserAgent($ua);
- }
-
- return $ua;
- }
-
- /**
- * Force or replace the UA chain in $_server variable
- *
- * @param string $userAgent Forced UserAgent chain
- * @return Zend_Http_UserAgent
- */
- public function setUserAgent($userAgent)
- {
- $this->setServerValue('http_user_agent', $userAgent);
- return $this;
- }
-
- /**
- * Returns the HTTP Accept server param
- *
- * @param string $httpAccept (option) forced HTTP Accept chain
- * @return string
- */
- public function getHttpAccept($httpAccept = null)
- {
- if (null === ($accept = $this->getServerValue('http_accept'))) {
- $accept = self::DEFAULT_HTTP_ACCEPT;
- $this->setHttpAccept($accept);
- }
- return $accept;
- }
-
- /**
- * Force or replace the HTTP_ACCEPT chain in self::$_server variable
- *
- * @param string $httpAccept Forced HTTP Accept chain
- * @return Zend_Http_UserAgent
- */
- public function setHttpAccept($httpAccept)
- {
- $this->setServerValue('http_accept', $httpAccept);
- return $this;
- }
-
- /**
- * Returns the persistent storage handler
- *
- * Session storage is used by default unless a different storage adapter
- * has been set via the "persistent_storage_adapter" key. That key should
- * contain either a fully qualified class name, or a short name that
- * resolves via the plugin loader.
- *
- * @param string $browser Browser identifier (User Agent chain)
- * @return Zend_Http_UserAgent_Storage
- */
- public function getStorage($browser = null)
- {
- if (null === $browser) {
- $browser = $this->getUserAgent();
- }
- if (null === $this->_storage) {
- $config = $this->_config['storage'];
- $adapter = $config['adapter'];
- if (!class_exists($adapter)) {
- $loader = $this->getPluginLoader('storage');
- $adapter = $loader->load($adapter);
- $loader = $this->getPluginLoader('storage');
- }
- $options = array('browser_type' => $browser);
- if (isset($config['options'])) {
- $options = array_merge($options, $config['options']);
- }
- $this->setStorage(new $adapter($options));
- }
- return $this->_storage;
- }
-
- /**
- * Sets the persistent storage handler
- *
- * @param Zend_Http_UserAgent_Storage $storage
- * @return Zend_Http_UserAgent
- */
- public function setStorage(Zend_Http_UserAgent_Storage $storage)
- {
- if ($this->_immutable) {
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception(
- 'The User-Agent device object has already been retrieved; the storage object is now immutable'
- );
- }
-
- $this->_storage = $storage;
- return $this;
- }
-
- /**
- * Clean the persistent storage
- *
- * @param string $browser Browser identifier (User Agent chain)
- * @return void
- */
- public function clearStorage($browser = null)
- {
- $this->getStorage($browser)->clear();
- }
-
- /**
- * Get user configuration
- *
- * @return array
- */
- public function getConfig()
- {
- return $this->_config;
- }
-
- /**
- * Config parameters is an Array or a Zend_Config object
- *
- * The allowed parameters are :
- * - the identification sequence (can be empty) => desktop browser type is the
- * default browser type returned
- * $config['identification_sequence'] : ',' separated browser types
- * - the persistent storage adapter
- * $config['persistent_storage_adapter'] = "Session" or "NonPersistent"
- * - to add or replace a browser type device
- * $config[(type)]['device']['path']
- * $config[(type)]['device']['classname']
- * - to add or replace a browser type features adapter
- * $config[(type)]['features']['path']
- * $config[(type)]['features']['classname']
- *
- * @param mixed $config (option) Config array
- * @return Zend_Http_UserAgent
- */
- public function setConfig($config = array())
- {
- if ($config instanceof Zend_Config) {
- $config = $config->toArray();
- }
-
- // Verify that Config parameters are in an array.
- if (!is_array($config) && !$config instanceof Traversable) {
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception(sprintf(
- 'Config parameters must be in an array or a Traversable object; received "%s"',
- (is_object($config) ? get_class($config) : gettype($config))
- ));
- }
-
- if ($config instanceof Traversable) {
- $tmp = array();
- foreach ($config as $key => $value) {
- $tmp[$key] = $value;
- }
- $config = $tmp;
- unset($tmp);
- }
-
- $this->_config = array_merge($this->_config, $config);
- return $this;
- }
-
- /**
- * Returns the device object
- *
- * This is the object that will contain the various discovered device
- * capabilities.
- *
- * @return Zend_Http_UserAgent_Device $device
- */
- public function getDevice()
- {
- if (null !== $this->_device) {
- return $this->_device;
- }
-
- $userAgent = $this->getUserAgent();
-
- // search an existing identification in the session
- $storage = $this->getStorage($userAgent);
-
- if (!$storage->isEmpty()) {
- // If the user agent and features are already existing, the
- // Zend_Http_UserAgent object is serialized in the session
- $object = $storage->read();
- $this->unserialize($object);
- } else {
- // Otherwise, the identification is made and stored in the session.
- // Find the browser type:
- $this->setBrowserType($this->_matchUserAgent());
- $this->_createDevice();
-
- // put the result in storage:
- $this->getStorage($userAgent)
- ->write($this->serialize());
- }
-
- // Mark the object as immutable
- $this->_immutable = true;
-
- // Return the device instance
- return $this->_device;
- }
-
- /**
- * Retrieve the browser type
- *
- * @return string $browserType
- */
- public function getBrowserType()
- {
- return $this->_browserType;
- }
-
- /**
- * Set the browser "type"
- *
- * @param string $browserType
- * @return Zend_Http_UserAgent
- */
- public function setBrowserType($browserType)
- {
- if ($this->_immutable) {
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception(
- 'The User-Agent device object has already been retrieved; the browser type is now immutable'
- );
- }
-
- $this->_browserType = $browserType;
- return $this;
- }
-
- /**
- * Retrieve the "$_SERVER" array
- *
- * Basically, the $_SERVER array or an equivalent container storing the
- * data that will be introspected.
- *
- * If the value has not been previously set, it sets itself from the
- * $_SERVER superglobal.
- *
- * @return array
- */
- public function getServer()
- {
- if (null === $this->_server) {
- $this->setServer($_SERVER);
- }
- return $this->_server;
- }
-
- /**
- * Set the "$_SERVER" array
- *
- * Basically, the $_SERVER array or an equivalent container storing the
- * data that will be introspected.
- *
- * @param array|ArrayAccess $server
- * @return void
- * @throws Zend_Http_UserAgent_Exception on invalid parameter
- */
- public function setServer($server)
- {
- if ($this->_immutable) {
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception(
- 'The User-Agent device object has already been retrieved; the server array is now immutable'
- );
- }
-
- if (!is_array($server) && !$server instanceof Traversable) {
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception(sprintf(
- 'Expected an array or object implementing Traversable; received %s',
- (is_object($server) ? get_class($server) : gettype($server))
- ));
- }
-
- // Get an array if we don't have one
- if ($server instanceof ArrayObject) {
- $server = $server->getArrayCopy();
- } elseif ($server instanceof Traversable) {
- $tmp = array();
- foreach ($server as $key => $value) {
- $tmp[$key] = $value;
- }
- $server = $tmp;
- unset($tmp);
- }
-
- // Normalize key case
- $server = array_change_key_case($server, CASE_LOWER);
-
- $this->_server = $server;
- return $this;
- }
-
- /**
- * Retrieve a server value
- *
- * @param string $key
- * @return mixed
- */
- public function getServerValue($key)
- {
- $key = strtolower($key);
- $server = $this->getServer();
- $return = null;
- if (isset($server[$key])) {
- $return = $server[$key];
- }
- unset($server);
- return $return;
- }
-
- /**
- * Set a server value
- *
- * @param string|int|float $key
- * @param mixed $value
- * @return void
- */
- public function setServerValue($key, $value)
- {
- if ($this->_immutable) {
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception(
- 'The User-Agent device object has already been retrieved; the server array is now immutable'
- );
- }
-
- $server = $this->getServer(); // ensure it's been initialized
- $key = strtolower($key);
- $this->_server[$key] = $value;
- return $this;
- }
-
- /**
- * Set plugin loader
- *
- * @param string $type Type of plugin loader; one of 'storage', (?)
- * @param string|Zend_Loader_PluginLoader $loader
- * @return Zend_Http_UserAgent
- */
- public function setPluginLoader($type, $loader)
- {
- $type = $this->_validateLoaderType($type);
-
- if (is_string($loader)) {
- if (!class_exists($loader)) {
- // require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($loader);
- }
- $loader = new $loader();
- } elseif (!is_object($loader)) {
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception(sprintf(
- 'Expected a plugin loader class or object; received %s',
- gettype($loader)
- ));
- }
- if (!$loader instanceof Zend_Loader_PluginLoader) {
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception(sprintf(
- 'Expected an object extending Zend_Loader_PluginLoader; received %s',
- get_class($loader)
- ));
- }
-
- $basePrefix = 'Zend_Http_UserAgent_';
- $basePath = 'Zend/Http/UserAgent/';
- switch ($type) {
- case 'storage':
- $prefix = $basePrefix . 'Storage';
- $path = $basePath . 'Storage';
- break;
- case 'device':
- $prefix = $basePrefix;
- $path = $basePath;
- break;
- }
- $loader->addPrefixPath($prefix, $path);
- $this->_loaders[$type] = $loader;
- return $this;
- }
-
- /**
- * Get a plugin loader
- *
- * @param string $type A valid plugin loader type; see {@link $_loaderTypes}
- * @return Zend_Loader_PluginLoader
- */
- public function getPluginLoader($type)
- {
- $type = $this->_validateLoaderType($type);
- if (!isset($this->_loaders[$type])) {
- // require_once 'Zend/Loader/PluginLoader.php';
- $this->setPluginLoader($type, new Zend_Loader_PluginLoader());
- }
- return $this->_loaders[$type];
- }
-
- /**
- * Validate a plugin loader type
- *
- * Verifies that it is in {@link $_loaderTypes}, and returns a normalized
- * version of the type.
- *
- * @param string $type
- * @return string
- * @throws Zend_Http_UserAgent_Exception on invalid type
- */
- protected function _validateLoaderType($type)
- {
- $type = strtolower($type);
- if (!in_array($type, $this->_loaderTypes)) {
- $types = implode(', ', $this->_loaderTypes);
-
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception(sprintf(
- 'Expected one of "%s" for plugin loader type; received "%s"',
- $types,
- (string) $type
- ));
- }
- return $type;
- }
-
- /**
- * Run the identification sequence to match the right browser type according to the
- * user agent
- *
- * @return Zend_Http_UserAgent_Result
- */
- protected function _matchUserAgent()
- {
- $type = self::DEFAULT_BROWSER_TYPE;
-
- // If we have no identification sequence, just return the default type
- if (empty($this->_config['identification_sequence'])) {
- return $type;
- }
-
- // Get sequence against which to match
- $sequence = explode(',', $this->_config['identification_sequence']);
-
- // If a browser type is already configured, push that to the front of the list
- if (null !== ($browserType = $this->getBrowserType())) {
- array_unshift($sequence, $browserType);
- }
-
- // Append the default browser type to the list if not alread in the list
- if (!in_array($type, $sequence)) {
- $sequence[] = $type;
- }
-
- // Test each type until we find a match
- foreach ($sequence as $browserType) {
- $browserType = trim($browserType);
- $className = $this->_getUserAgentDevice($browserType);
-
- // Attempt to match this device class
- if ($this->_match($className)) {
- $type = $browserType;
- $this->_browserTypeClass[$type] = $className;
- break;
- }
- }
-
- return $type;
- }
-
- /**
- * Creates device object instance
- *
- * @return void
- */
- protected function _createDevice()
- {
- $browserType = $this->getBrowserType();
- $classname = $this->_getUserAgentDevice($browserType);
- $this->_device = new $classname($this->getUserAgent(), $this->getServer(), $this->getConfig());
- }
-}
diff --git a/libs/Zend/Http/UserAgent/AbstractDevice.php b/libs/Zend/Http/UserAgent/AbstractDevice.php
deleted file mode 100644
index 585e5a3c38..0000000000
--- a/libs/Zend/Http/UserAgent/AbstractDevice.php
+++ /dev/null
@@ -1,985 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-// require_once 'Zend/Http/UserAgent/Device.php';
-
-/**
- * Abstract Class to define a browser device.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-abstract class Zend_Http_UserAgent_AbstractDevice
- implements Zend_Http_UserAgent_Device
-{
- /**
- * Browser signature
- *
- * @var string
- */
- protected $_browser = '';
-
- /**
- * Browser version
- *
- * @var string
- */
- protected $_browserVersion = '';
-
- /**
- * Configuration
- *
- * @var array
- */
- protected $_config;
-
- /**
- * User Agent chain
- *
- * @var string
- */
- protected $_userAgent;
-
- /**
- * Server variable
- *
- * @var array
- */
- protected $_server;
-
- /**
- * Image types
- *
- * @var array
- */
- protected $_images = array(
- 'jpeg',
- 'gif',
- 'png',
- 'pjpeg',
- 'x-png',
- 'bmp',
- );
-
- /**
- * Browser/Device features
- *
- * @var array
- */
- protected $_aFeatures = array();
-
- /**
- * Browser/Device features groups
- *
- * @var array
- */
- protected $_aGroup = array();
-
- /**
- * Constructor
- *
- * @param null|string|array $userAgent If array, restores from serialized version
- * @param array $server
- * @param array $config
- * @return void
- */
- public function __construct($userAgent = null, array $server = array(), array $config = array())
- {
- if (is_array($userAgent)) {
- // Restoring from serialized array
- $this->_restoreFromArray($userAgent);
- } else {
- // Constructing new object
- $this->setUserAgent($userAgent);
- $this->_server = $server;
- $this->_config = $config;
- $this->_getDefaultFeatures();
- $this->_defineFeatures();
- }
- }
-
- /**
- * Serialize object
- *
- * @return string
- */
- public function serialize()
- {
- $spec = array(
- '_aFeatures' => $this->_aFeatures,
- '_aGroup' => $this->_aGroup,
- '_browser' => $this->_browser,
- '_browserVersion' => $this->_browserVersion,
- '_userAgent' => $this->_userAgent,
- '_images' => $this->_images,
- );
- return serialize($spec);
- }
-
- /**
- * Unserialize
- *
- * @param string $serialized
- * @return void
- */
- public function unserialize($serialized)
- {
- $spec = unserialize($serialized);
- $this->_restoreFromArray($spec);
- }
-
- /**
- * Restore object state from array
- *
- * @param array $spec
- * @return void
- */
- protected function _restoreFromArray(array $spec)
- {
- foreach ($spec as $key => $value) {
- if (property_exists($this, $key)) {
- $this->{$key} = $value;
- }
- }
- }
-
- /**
- * Look for features
- *
- * @return array|null
- */
- protected function _defineFeatures()
- {
- $features = $this->_loadFeaturesAdapter();
-
- if (is_array($features)) {
- $this->_aFeatures = array_merge($this->_aFeatures, $features);
- }
-
- return $this->_aFeatures;
- }
-
- /**
- * Gets the browser type identifier
- *
- * @return string
- */
- abstract public function getType();
-
- /**
- * Check a feature for the current browser/device.
- *
- * @param string $feature The feature to check.
- * @return bool
- */
- public function hasFeature($feature)
- {
- return (!empty($this->_aFeatures[$feature]));
- }
-
- /**
- * Gets the value of the current browser/device feature
- *
- * @param string $feature Feature to search
- * @return string|null
- */
- public function getFeature($feature)
- {
- if ($this->hasFeature($feature)) {
- return $this->_aFeatures[$feature];
- }
- }
-
- /**
- * Set a feature for the current browser/device.
- *
- * @param string $feature The feature to set.
- * @param string $value (option) feature value.
- * @param string $group (option) Group to associate with the feature
- * @return Zend_Http_UserAgent_AbstractDevice
- */
- public function setFeature($feature, $value = false, $group = '')
- {
- $this->_aFeatures[$feature] = $value;
- if (!empty($group)) {
- $this->setGroup($group, $feature);
- }
- return $this;
- }
-
- /**
- * Affects a feature to a group
- *
- * @param string $group Group name
- * @param string $feature Feature name
- * @return Zend_Http_UserAgent_AbstractDevice
- */
- public function setGroup($group, $feature)
- {
- if (!isset($this->_aGroup[$group])) {
- $this->_aGroup[$group] = array();
- }
- if (!in_array($feature, $this->_aGroup[$group])) {
- $this->_aGroup[$group][] = $feature;
- }
- return $this;
- }
-
- /**
- * Gets an array of features associated to a group
- *
- * @param string $group Group param
- * @return array
- */
- public function getGroup($group)
- {
- return $this->_aGroup[$group];
- }
-
- /**
- * Gets all the browser/device features
- *
- * @return array
- */
- public function getAllFeatures()
- {
- return $this->_aFeatures;
- }
-
- /**
- * Gets all the browser/device features' groups
- *
- * @return array
- */
- public function getAllGroups()
- {
- return $this->_aGroup;
- }
-
- /**
- * Sets all the standard features extracted from the User Agent chain and $this->_server
- * vars
- *
- * @return void
- */
- protected function _getDefaultFeatures()
- {
- $server = array();
-
- // gets info from user agent chain
- $uaExtract = $this->extractFromUserAgent($this->getUserAgent());
-
- if (is_array($uaExtract)) {
- foreach ($uaExtract as $key => $info) {
- $this->setFeature($key, $info, 'product_info');
- }
- }
-
- if (isset($uaExtract['browser_name'])) {
- $this->_browser = $uaExtract['browser_name'];
- }
- if (isset($uaExtract['browser_version'])) {
- $this->_browserVersion = $uaExtract['browser_version'];
- }
- if (isset($uaExtract['device_os'])) {
- $this->device_os = $uaExtract['device_os_name'];
- }
-
- /* browser & device info */
- $this->setFeature('is_wireless_device', false, 'product_info');
- $this->setFeature('is_mobile', false, 'product_info');
- $this->setFeature('is_desktop', false, 'product_info');
- $this->setFeature('is_tablet', false, 'product_info');
- $this->setFeature('is_bot', false, 'product_info');
- $this->setFeature('is_email', false, 'product_info');
- $this->setFeature('is_text', false, 'product_info');
- $this->setFeature('device_claims_web_support', false, 'product_info');
-
- $this->setFeature('is_' . strtolower($this->getType()), true, 'product_info');
-
- /* sets the browser name */
- if (isset($this->list) && empty($this->_browser)) {
- $lowerUserAgent = strtolower($this->getUserAgent());
- foreach ($this->list as $browser_signature) {
- if (strpos($lowerUserAgent, $browser_signature) !== false) {
- $this->_browser = strtolower($browser_signature);
- $this->setFeature('browser_name', $this->_browser, 'product_info');
- }
- }
- }
-
- /* sets the client IP */
- if (isset($this->_server['remote_addr'])) {
- $this->setFeature('client_ip', $this->_server['remote_addr'], 'product_info');
- } elseif (isset($this->_server['http_x_forwarded_for'])) {
- $this->setFeature('client_ip', $this->_server['http_x_forwarded_for'], 'product_info');
- } elseif (isset($this->_server['http_client_ip'])) {
- $this->setFeature('client_ip', $this->_server['http_client_ip'], 'product_info');
- }
-
- /* sets the server infos */
- if (isset($this->_server['server_software'])) {
- if (strpos($this->_server['server_software'], 'Apache') !== false || strpos($this->_server['server_software'], 'LiteSpeed') !== false) {
- $server['version'] = 1;
- if (strpos($this->_server['server_software'], 'Apache/2') !== false) {
- $server['version'] = 2;
- }
- $server['server'] = 'apache';
- }
-
- if (strpos($this->_server['server_software'], 'Microsoft-IIS') !== false) {
- $server['server'] = 'iis';
- }
-
- if (strpos($this->_server['server_software'], 'Unix') !== false) {
- $server['os'] = 'unix';
- if (isset($_ENV['MACHTYPE'])) {
- if (strpos($_ENV['MACHTYPE'], 'linux') !== false) {
- $server['os'] = 'linux';
- }
- }
- } elseif (strpos($this->_server['server_software'], 'Win') !== false) {
- $server['os'] = 'windows';
- }
-
- if (preg_match('/Apache\/([0-9\.]*)/', $this->_server['server_software'], $arr)) {
- if ($arr[1]) {
- $server['version'] = $arr[1];
- $server['server'] = 'apache';
- }
- }
- }
-
- $this->setFeature('php_version', phpversion(), 'server_info');
- if (isset($server['server'])) {
- $this->setFeature('server_os', $server['server'], 'server_info');
- }
- if (isset($server['version'])) {
- $this->setFeature('server_os_version', $server['version'], 'server_info');
- }
- if (isset($this->_server['http_accept'])) {
- $this->setFeature('server_http_accept', $this->_server['http_accept'], 'server_info');
- }
- if (isset($this->_server['http_accept_language'])) {
- $this->setFeature('server_http_accept_language', $this->_server['http_accept_language'], 'server_info');
- }
- if (isset($this->_server['server_addr'])) {
- $this->setFeature('server_ip', $this->_server['server_addr'], 'server_info');
- }
- if (isset($this->_server['server_name'])) {
- $this->setFeature('server_name', $this->_server['server_name'], 'server_info');
- }
- }
-
- /**
- * Extract and sets informations from the User Agent chain
- *
- * @param string $userAgent User Agent chain
- * @return array
- */
- public static function extractFromUserAgent($userAgent)
- {
- $userAgent = trim($userAgent);
-
- /**
- * @see http://www.texsoft.it/index.php?c=software&m=sw.php.useragent&l=it
- */
- $pattern = "(([^/\s]*)(/(\S*))?)(\s*\[[a-zA-Z][a-zA-Z]\])?\s*(\\((([^()]|(\\([^()]*\\)))*)\\))?\s*";
- preg_match("#^$pattern#", $userAgent, $match);
-
- $comment = array();
- if (isset($match[7])) {
- $comment = explode(';', $match[7]);
- }
-
- // second part if exists
- $end = substr($userAgent, strlen($match[0]));
- if (!empty($end)) {
- $result['others']['full'] = $end;
- }
-
- $match2 = array();
- if (isset($result['others'])) {
- preg_match_all('/(([^\/\s]*)(\/)?([^\/\(\)\s]*)?)(\s\((([^\)]*)*)\))?/i', $result['others']['full'], $match2);
- }
- $result['user_agent'] = trim($match[1]);
- $result['product_name'] = isset($match[2]) ? trim($match[2]) : '';
- $result['browser_name'] = $result['product_name'];
- if (isset($match[4]) && trim($match[4])) {
- $result['product_version'] = trim($match[4]);
- $result['browser_version'] = trim($match[4]);
- }
- if (count($comment) && !empty($comment[0])) {
- $result['comment']['full'] = trim($match[7]);
- $result['comment']['detail'] = $comment;
- $result['compatibility_flag'] = trim($comment[0]);
- if (isset($comment[1])) {
- $result['browser_token'] = trim($comment[1]);
- }
- if (isset($comment[2])) {
- $result['device_os_token'] = trim($comment[2]);
- }
- }
- if (empty($result['device_os_token']) && !empty($result['compatibility_flag'])) {
- // some browsers do not have a platform token
- $result['device_os_token'] = $result['compatibility_flag'];
- }
- if ($match2) {
- $i = 0;
- $max = count($match2[0]);
- for ($i = 0; $i < $max; $i ++) {
- if (!empty($match2[0][$i])) {
- $result['others']['detail'][] = array(
- $match2[0][$i],
- $match2[2][$i],
- $match2[4][$i],
- );
- }
- }
- }
-
- /** Security level */
- $security = array(
- 'N' => 'no security',
- 'U' => 'strong security',
- 'I' => 'weak security',
- );
- if (!empty($result['browser_token'])) {
- if (isset($security[$result['browser_token']])) {
- $result['security_level'] = $security[$result['browser_token']];
- unset($result['browser_token']);
- }
- }
-
- $product = strtolower($result['browser_name']);
-
- // Mozilla : true && false
- $compatibleOrIe = false;
- if (isset($result['compatibility_flag']) && isset($result['comment'])) {
- $compatibleOrIe = ($result['compatibility_flag'] == 'compatible' || strpos($result['comment']['full'], "MSIE") !== false);
- }
- if ($product == 'mozilla' && $compatibleOrIe) {
- if (!empty($result['browser_token'])) {
- // Classic Mozilla chain
- preg_match_all('/([^\/\s].*)(\/|\s)(.*)/i', $result['browser_token'], $real);
- } else {
- // MSIE specific chain with 'Windows' compatibility flag
- foreach ($result['comment']['detail'] as $v) {
- if (strpos($v, 'MSIE') !== false) {
- $real[0][1] = trim($v);
- $result['browser_engine'] = "MSIE";
- $real[1][0] = "Internet Explorer";
- $temp = explode(' ', trim($v));
- $real[3][0] = $temp[1];
-
- }
- if (strpos($v, 'Win') !== false) {
- $result['device_os_token'] = trim($v);
- }
- }
- }
-
- if (!empty($real[0])) {
- $result['browser_name'] = $real[1][0];
- $result['browser_version'] = $real[3][0];
- } else {
- $result['browser_name'] = $result['browser_token'];
- $result['browser_version'] = '??';
- }
- } elseif ($product == 'mozilla' && $result['browser_version'] < 5.0) {
- // handles the real Mozilla (or old Netscape if version < 5.0)
- $result['browser_name'] = 'Netscape';
- }
-
- /** windows */
- if ($result['browser_name'] == 'MSIE') {
- $result['browser_engine'] = 'MSIE';
- $result['browser_name'] = 'Internet Explorer';
- }
- if (isset($result['device_os_token'])) {
- if (strpos($result['device_os_token'], 'Win') !== false) {
-
- $windows = array(
- 'Windows NT 6.1' => 'Windows 7',
- 'Windows NT 6.0' => 'Windows Vista',
- 'Windows NT 5.2' => 'Windows Server 2003',
- 'Windows NT 5.1' => 'Windows XP',
- 'Windows NT 5.01' => 'Windows 2000 SP1',
- 'Windows NT 5.0' => 'Windows 2000',
- 'Windows NT 4.0' => 'Microsoft Windows NT 4.0',
- 'WinNT' => 'Microsoft Windows NT 4.0',
- 'Windows 98; Win 9x 4.90' => 'Windows Me',
- 'Windows 98' => 'Windows 98',
- 'Win98' => 'Windows 98',
- 'Windows 95' => 'Windows 95',
- 'Win95' => 'Windows 95',
- 'Windows CE' => 'Windows CE',
- );
- if (isset($windows[$result['device_os_token']])) {
- $result['device_os_name'] = $windows[$result['device_os_token']];
- } else {
- $result['device_os_name'] = $result['device_os_token'];
- }
- }
- }
-
- // iphone
- $apple_device = array(
- 'iPhone',
- 'iPod',
- 'iPad',
- );
- if (isset($result['compatibility_flag'])) {
- if (in_array($result['compatibility_flag'], $apple_device)) {
- $result['device'] = strtolower($result['compatibility_flag']);
- $result['device_os_token'] = 'iPhone OS';
- $result['browser_language'] = trim($comment[3]);
- if (isset($result['others']['detail'][1])) {
- $result['browser_version'] = $result['others']['detail'][1][2];
- } elseif (count($result['others']['detail'])) {
- $result['browser_version'] = $result['others']['detail'][0][2];
- }
- if (!empty($result['others']['detail'][2])) {
- $result['firmware'] = $result['others']['detail'][2][2];
- }
- if (!empty($result['others']['detail'][3])) {
- $result['browser_name'] = $result['others']['detail'][3][1];
- $result['browser_build'] = $result['others']['detail'][3][2];
- }
- }
- }
-
- // Safari
- if (isset($result['others'])) {
- if ($result['others']['detail'][0][1] == 'AppleWebKit') {
- $result['browser_engine'] = 'AppleWebKit';
- if (isset($result['others']['detail'][1]) && $result['others']['detail'][1][1] == 'Version') {
- $result['browser_version'] = $result['others']['detail'][1][2];
- } else {
- $result['browser_version'] = $result['others']['detail'][count($result['others']['detail']) - 1][2];
- }
- if (isset($comment[3])) {
- $result['browser_language'] = trim($comment[3]);
- }
-
- $last = $result['others']['detail'][count($result['others']['detail']) - 1][1];
-
- if (empty($result['others']['detail'][2][1]) || $result['others']['detail'][2][1] == 'Safari') {
- if (isset($result['others']['detail'][1])) {
- $result['browser_name'] = ($result['others']['detail'][1][1] && $result['others']['detail'][1][1] != 'Version' ? $result['others']['detail'][1][1] : 'Safari');
- $result['browser_version'] = ($result['others']['detail'][1][2] ? $result['others']['detail'][1][2] : $result['others']['detail'][0][2]);
- } else {
- $result['browser_name'] = ($result['others']['detail'][0][1] && $result['others']['detail'][0][1] != 'Version' ? $result['others']['detail'][0][1] : 'Safari');
- $result['browser_version'] = $result['others']['detail'][0][2];
- }
- } else {
- $result['browser_name'] = $result['others']['detail'][2][1];
- $result['browser_version'] = $result['others']['detail'][2][2];
-
- // mobile version
- if ($result['browser_name'] == 'Mobile') {
- $result['browser_name'] = 'Safari ' . $result['browser_name'];
- if ($result['others']['detail'][1][1] == 'Version') {
- $result['browser_version'] = $result['others']['detail'][1][2];
- }
- }
- }
-
- // For Safari < 2.2, AppleWebKit version gives the Safari version
- if (strpos($result['browser_version'], '.') > 2 || (int) $result['browser_version'] > 20) {
- $temp = explode('.', $result['browser_version']);
- $build = (int) $temp[0];
- $awkVersion = array(
- 48 => '0.8',
- 73 => '0.9',
- 85 => '1.0',
- 103 => '1.1',
- 124 => '1.2',
- 300 => '1.3',
- 400 => '2.0',
- );
- foreach ($awkVersion as $k => $v) {
- if ($build >= $k) {
- $result['browser_version'] = $v;
- }
- }
- }
- }
-
- // Gecko (Firefox or compatible)
- if ($result['others']['detail'][0][1] == 'Gecko') {
- $searchRV = true;
- if (!empty($result['others']['detail'][1][1]) && !empty($result['others']['detail'][count($result['others']['detail']) - 1][2]) || strpos(strtolower($result['others']['full']), 'opera') !== false) {
- $searchRV = false;
- $result['browser_engine'] = $result['others']['detail'][0][1];
-
- // the name of the application is at the end indepenently
- // of quantity of information in $result['others']['detail']
- $last = count($result['others']['detail']) - 1;
-
- // exception : if the version of the last information is
- // empty we take the previous one
- if (empty($result['others']['detail'][$last][2])) {
- $last --;
- }
-
- // exception : if the last one is 'Red Hat' or 'Debian' =>
- // use rv: to find browser_version */
- if (in_array($result['others']['detail'][$last][1], array(
- 'Debian',
- 'Hat',
- ))) {
- $searchRV = true;
- }
- $result['browser_name'] = $result['others']['detail'][$last][1];
- $result['browser_version'] = $result['others']['detail'][$last][2];
- if (isset($comment[4])) {
- $result['browser_build'] = trim($comment[4]);
- }
- if (isset($comment[3])) {
- $result['browser_language'] = trim($comment[3]);
- }
-
- // Netscape
- if ($result['browser_name'] == 'Navigator' || $result['browser_name'] == 'Netscape6') {
- $result['browser_name'] = 'Netscape';
- }
- }
- if ($searchRV) {
- // Mozilla alone : the version is identified by rv:
- $result['browser_name'] = 'Mozilla';
- if (isset($result['comment']['detail'])) {
- foreach ($result['comment']['detail'] as $rv) {
- if (strpos($rv, 'rv:') !== false) {
- $result['browser_version'] = trim(str_replace('rv:', '', $rv));
- }
- }
- }
- }
- }
-
- // Netscape
- if ($result['others']['detail'][0][1] == 'Netscape') {
- $result['browser_name'] = 'Netscape';
- $result['browser_version'] = $result['others']['detail'][0][2];
- }
-
- // Opera
- // Opera: engine Presto
- if ($result['others']['detail'][0][1] == 'Presto') {
- $result['browser_engine'] = 'Presto';
- if (!empty($result['others']['detail'][1][2])) {
- $result['browser_version'] = $result['others']['detail'][1][2];
- }
- }
-
- // UA ends with 'Opera X.XX'
- if ($result['others']['detail'][0][1] == 'Opera') {
- $result['browser_name'] = $result['others']['detail'][0][1];
- $result['browser_version'] = $result['others']['detail'][1][1];
- }
-
- // Opera Mini
- if (isset($result["browser_token"])) {
- if (strpos($result["browser_token"], 'Opera Mini') !== false) {
- $result['browser_name'] = 'Opera Mini';
- }
- }
-
- // Symbian
- if ($result['others']['detail'][0][1] == 'SymbianOS') {
- $result['device_os_token'] = 'SymbianOS';
- }
- }
-
- // UA ends with 'Opera X.XX'
- if (isset($result['browser_name']) && isset($result['browser_engine'])) {
- if ($result['browser_name'] == 'Opera' && $result['browser_engine'] == 'Gecko' && empty($result['browser_version'])) {
- $result['browser_version'] = $result['others']['detail'][count($result['others']['detail']) - 1][1];
- }
- }
-
- // cleanup
- if (isset($result['browser_version']) && isset($result['browser_build'])) {
- if ($result['browser_version'] == $result['browser_build']) {
- unset($result['browser_build']);
- }
- }
-
- // compatibility
- $compatibility['AppleWebKit'] = 'Safari';
- $compatibility['Gecko'] = 'Firefox';
- $compatibility['MSIE'] = 'Internet Explorer';
- $compatibility['Presto'] = 'Opera';
- if (!empty($result['browser_engine'])) {
- if (isset($compatibility[$result['browser_engine']])) {
- $result['browser_compatibility'] = $compatibility[$result['browser_engine']];
- }
- }
-
- ksort($result);
- return $result;
- }
-
- /**
- * Loads the Features Adapter if it's defined in the $config array
- * Otherwise, nothing is done
- *
- * @param string $browserType Browser type
- * @return array
- */
- protected function _loadFeaturesAdapter()
- {
- $config = $this->_config;
- $browserType = $this->getType();
- if (!isset($config[$browserType]) || !isset($config[$browserType]['features'])) {
- return array();
- }
- $config = $config[$browserType]['features'];
-
- if (empty($config['classname'])) {
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter must have a "classname" config parameter defined');
- }
-
- $className = $config['classname'];
- if (!class_exists($className)) {
- if (isset($config['path'])) {
- $path = $config['path'];
- } else {
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter must have a "path" config parameter defined');
- }
-
- if (false === include_once ($path)) {
- // require_once 'Zend/Http/UserAgent/Exception.php';
- throw new Zend_Http_UserAgent_Exception('The ' . $this->getType() . ' features adapter path that does not exist');
- }
- }
-
- return call_user_func(array($className, 'getFromRequest'), $this->_server, $this->_config);
- }
-
- /**
- * Retrieve image format support
- *
- * @return array
- */
- public function getImageFormatSupport()
- {
- return $this->_images;
- }
-
- /**
- * Get maximum image height supported by this device
- *
- * @return int
- */
- public function getMaxImageHeight()
- {
- return null;
- }
-
- /**
- * Get maximum image width supported by this device
- *
- * @return int
- */
- public function getMaxImageWidth()
- {
- return null;
- }
-
- /**
- * Get physical screen height of this device
- *
- * @return int
- */
- public function getPhysicalScreenHeight()
- {
- return null;
- }
-
- /**
- * Get physical screen width of this device
- *
- * @return int
- */
- public function getPhysicalScreenWidth()
- {
- return null;
- }
-
- /**
- * Get preferred markup type
- *
- * @return string
- */
- public function getPreferredMarkup()
- {
- return 'xhtml';
- }
-
- /**
- * Get supported X/HTML version
- *
- * @return int
- */
- public function getXhtmlSupportLevel()
- {
- return 4;
- }
-
- /**
- * Does the device support Flash?
- *
- * @return bool
- */
- public function hasFlashSupport()
- {
- return true;
- }
-
- /**
- * Does the device support PDF?
- *
- * @return bool
- */
- public function hasPdfSupport()
- {
- return true;
- }
-
- /**
- * Does the device have a phone number associated with it?
- *
- * @return bool
- */
- public function hasPhoneNumber()
- {
- return false;
- }
-
- /**
- * Does the device support HTTPS?
- *
- * @return bool
- */
- public function httpsSupport()
- {
- return true;
- }
-
- /**
- * Get the browser type
- *
- * @return string
- */
- public function getBrowser()
- {
- return $this->_browser;
- }
-
- /**
- * Get the browser version
- *
- * @return string
- */
- public function getBrowserVersion()
- {
- return $this->_browserVersion;
- }
-
- /**
- * Get the user agent string
- *
- * @return string
- */
- public function getUserAgent()
- {
- return $this->_userAgent;
- }
-
- /**
- * @return the $_images
- */
- public function getImages()
- {
- return $this->_images;
- }
-
- /**
- * @param string $browser
- */
- public function setBrowser($browser)
- {
- $this->_browser = $browser;
- }
-
- /**
- * @param string $browserVersion
- */
- public function setBrowserVersion($browserVersion)
- {
- $this->_browserVersion = $browserVersion;
- }
-
- /**
- * @param string $userAgent
- */
- public function setUserAgent($userAgent)
- {
- $this->_userAgent = $userAgent;
- return $this;
- }
-
- /**
- * @param array $_images
- */
- public function setImages($_images)
- {
- $this->_images = $_images;
- }
-
- /**
- * Match a user agent string against a list of signatures
- *
- * @param string $userAgent
- * @param array $signatures
- * @return bool
- */
- protected static function _matchAgentAgainstSignatures($userAgent, $signatures)
- {
- $userAgent = strtolower($userAgent);
- foreach ($signatures as $signature) {
- if (!empty($signature)) {
- if (strpos($userAgent, $signature) !== false) {
- // Browser signature was found in user agent string
- return true;
- }
- }
- }
- return false;
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Bot.php b/libs/Zend/Http/UserAgent/Bot.php
deleted file mode 100644
index 832f21bb98..0000000000
--- a/libs/Zend/Http/UserAgent/Bot.php
+++ /dev/null
@@ -1,129 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-// require_once 'Zend/Http/UserAgent/AbstractDevice.php';
-
-/**
- * Bot browser type matcher
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-class Zend_Http_UserAgent_Bot extends Zend_Http_UserAgent_AbstractDevice
-{
-
- /**
- * User Agent Signatures
- *
- * @var array
- */
- protected static $_uaSignatures = array(
- // The most common ones.
- 'googlebot',
- 'msnbot',
- 'slurp',
- 'yahoo',
-
- // The rest, alphabetically.
- 'alexa',
- 'appie',
- 'archiver',
- 'ask jeeves',
- 'baiduspider',
- 'bot',
- 'crawl',
- 'crawler',
- 'curl',
- 'eventbox',
- 'facebookexternal',
- 'fast',
- 'feedfetcher-google',
- 'firefly',
- 'froogle',
- 'gigabot',
- 'girafabot',
- 'google',
- 'htdig',
- 'infoseek',
- 'inktomi',
- 'java',
- 'larbin',
- 'looksmart',
- 'mechanize',
- 'mediapartners-google',
- 'monitor',
- 'nambu',
- 'nationaldirectory',
- 'novarra',
- 'pear',
- 'perl',
- 'python',
- 'rabaz',
- 'radian',
- 'rankivabot',
- 'scooter',
- 'sogou web spider',
- 'spade',
- 'sphere',
- 'spider',
- 'technoratisnoop',
- 'tecnoseek',
- 'teoma',
- 'toolbar',
- 'transcoder',
- 'twitt',
- 'url_spider_sql',
- 'webalta crawler',
- 'webbug',
- 'webfindbot',
- 'wordpress',
- 'www.galaxy.com',
- 'yahoo! searchmonkey',
- 'yahoo! slurp',
- 'yandex',
- 'zyborg',
- );
-
- /**
- * Comparison of the UserAgent chain and browser signatures
- *
- * @param string $userAgent User Agent chain
- * @param array $server $_SERVER like param
- * @return bool
- */
- public static function match($userAgent, $server)
- {
- return self::_matchAgentAgainstSignatures($userAgent, self::$_uaSignatures);
- }
-
- /**
- * Gives the current browser type
- *
- * @return string
- */
- public function getType()
- {
- return 'bot';
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Checker.php b/libs/Zend/Http/UserAgent/Checker.php
deleted file mode 100644
index bae0a40a04..0000000000
--- a/libs/Zend/Http/UserAgent/Checker.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-// require_once 'Zend/Http/UserAgent/Desktop.php';
-
-/**
- * Checker browser type matcher
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-class Zend_Http_UserAgent_Checker extends Zend_Http_UserAgent_Desktop
-{
-
- /**
- * User Agent Signatures
- *
- * @var array
- */
- protected static $_uaSignatures = array(
- 'abilogic',
- 'checklink',
- 'checker',
- 'linksmanager',
- 'mojoo',
- 'notifixious',
- 'ploetz',
- 'zeller',
- 'sitebar',
- 'xenu',
- 'sleuth',
- );
-
- /**
- * Comparison of the UserAgent chain and User Agent signatures
- *
- * @param string $userAgent User Agent chain
- * @param array $server $_SERVER like param
- * @return bool
- */
- public static function match($userAgent, $server)
- {
- return self::_matchAgentAgainstSignatures($userAgent, self::$_uaSignatures);
- }
-
- /**
- * Gives the current browser type
- *
- * @return string
- */
- public function getType()
- {
- return 'bot';
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Console.php b/libs/Zend/Http/UserAgent/Console.php
deleted file mode 100644
index bd1c7b2848..0000000000
--- a/libs/Zend/Http/UserAgent/Console.php
+++ /dev/null
@@ -1,67 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-// require_once 'Zend/Http/UserAgent/Desktop.php';
-
-/**
- * Console browser type matcher
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Console extends Zend_Http_UserAgent_Desktop
-{
- /**
- * User Agent Signatures
- *
- * @var array
- */
- protected static $_uaSignatures = array(
- 'playstation',
- 'wii',
- 'libnup',
- );
-
- /**
- * Comparison of the UserAgent chain and User Agent signatures
- *
- * @param string $userAgent User Agent chain
- * @param array $server $_SERVER like param
- * @return bool
- */
- public static function match($userAgent, $server)
- {
- return self::_matchAgentAgainstSignatures($userAgent, self::$_uaSignatures);
- }
-
- /**
- * Gives the current browser type
- *
- * @return string
- */
- public function getType()
- {
- return 'console';
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Desktop.php b/libs/Zend/Http/UserAgent/Desktop.php
deleted file mode 100644
index fd645898ac..0000000000
--- a/libs/Zend/Http/UserAgent/Desktop.php
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-// require_once 'Zend/Http/UserAgent/AbstractDevice.php';
-
-/**
- * Desktop browser type matcher
- *
- * @category Zend
- * @package Zend_Browser
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Desktop extends Zend_Http_UserAgent_AbstractDevice
-{
-
- /**
- * Used by default : must be always true
- *
- * @param string $userAgent User Agent chain
- * @param array $server $_SERVER like param
- * @return bool
- */
- public static function match($userAgent, $server)
- {
- return true;
- }
-
- /**
- * Gives the current browser type
- *
- * @return string
- */
- public function getType()
- {
- return 'desktop';
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Device.php b/libs/Zend/Http/UserAgent/Device.php
deleted file mode 100644
index d5e9259128..0000000000
--- a/libs/Zend/Http/UserAgent/Device.php
+++ /dev/null
@@ -1,200 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Interface defining a browser device type.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-interface Zend_Http_UserAgent_Device extends Serializable
-{
- /**
- * Constructor
- *
- * Allows injecting user agent, server array, and/or config array. If an
- * array is provided for the first argument, the assumption should be that
- * the device object is being seeded with cached values from serialization.
- *
- * @param null|string|array $userAgent
- * @param array $server
- * @param array $config
- * @return void
- */
- public function __construct($userAgent = null, array $server = array(), array $config = array());
-
- /**
- * Attempt to match the user agent
- *
- * Return either an array of browser signature strings, or a boolean.
- *
- * @param string $userAgent
- * @param array $server
- * @return bool|array
- */
- public static function match($userAgent, $server);
-
- /**
- * Get all browser/device features
- *
- * @return array
- */
- public function getAllFeatures();
-
- /**
- * Get all of the browser/device's features' groups
- *
- * @return void
- */
- public function getAllGroups();
-
- /**
- * Whether or not the device has a given feature
- *
- * @param string $feature
- * @return bool
- */
- public function hasFeature($feature);
-
- /**
- * Get the value of a specific device feature
- *
- * @param string $feature
- * @return mixed
- */
- public function getFeature($feature);
-
- /**
- * Get the browser type
- *
- * @return string
- */
- public function getBrowser();
-
- /**
- * Retrurn the browser version
- *
- * @return string
- */
- public function getBrowserVersion();
-
- /**
- * Get an array of features associated with a group
- *
- * @param string $group
- * @return array
- */
- public function getGroup($group);
-
- /**
- * Retrieve image format support
- *
- * @return array
- */
- public function getImageFormatSupport();
-
- /**
- * Get image types
- *
- * @return array
- */
- public function getImages();
-
- /**
- * Get the maximum image height supported by this device
- *
- * @return int
- */
- public function getMaxImageHeight();
-
- /**
- * Get the maximum image width supported by this device
- *
- * @return int
- */
- public function getMaxImageWidth();
-
- /**
- * Get the physical screen height of this device
- *
- * @return int
- */
- public function getPhysicalScreenHeight();
-
- /**
- * Get the physical screen width of this device
- *
- * @return int
- */
- public function getPhysicalScreenWidth();
-
- /**
- * Get the preferred markup type
- *
- * @return string
- */
- public function getPreferredMarkup();
-
- /**
- * Get the user agent string
- *
- * @return string
- */
- public function getUserAgent();
-
- /**
- * Get supported X/HTML version
- *
- * @return int
- */
- public function getXhtmlSupportLevel();
-
- /**
- * Does the device support Flash?
- *
- * @return bool
- */
- public function hasFlashSupport();
-
- /**
- * Does the device support PDF?
- *
- * @return bool
- */
- public function hasPdfSupport();
-
- /**
- * Does the device have a phone number associated with it?
- *
- * @return bool
- */
- public function hasPhoneNumber();
-
- /**
- * Does the device support HTTPS?
- *
- * @return bool
- */
- public function httpsSupport();
-}
diff --git a/libs/Zend/Http/UserAgent/Email.php b/libs/Zend/Http/UserAgent/Email.php
deleted file mode 100644
index 540950f195..0000000000
--- a/libs/Zend/Http/UserAgent/Email.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-// require_once 'Zend/Http/UserAgent/Desktop.php';
-
-/**
- * Email browser type matcher
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Email extends Zend_Http_UserAgent_Desktop
-{
- /**
- * User Agent Signatures
- *
- * @var array
- */
- protected static $_uaSignatures = array(
- 'thunderbird',
- );
-
- /**
- * Comparison of the UserAgent chain and User Agent signatures
- *
- * @param string $userAgent User Agent chain
- * @param array $server $_SERVER like param
- * @return bool
- */
- public static function match($userAgent, $server)
- {
- return self::_matchAgentAgainstSignatures($userAgent, self::$_uaSignatures);
- }
-
- /**
- * Gives the current browser type
- *
- * @return string
- */
- public function getType()
- {
- return 'email';
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Exception.php b/libs/Zend/Http/UserAgent/Exception.php
deleted file mode 100644
index aff5b48455..0000000000
--- a/libs/Zend/Http/UserAgent/Exception.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_Exception
- */
-// require_once 'Zend/Exception.php';
-
-/**
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Exception extends Zend_Exception
-{
-}
diff --git a/libs/Zend/Http/UserAgent/Features/Adapter.php b/libs/Zend/Http/UserAgent/Features/Adapter.php
deleted file mode 100644
index 9dd361a035..0000000000
--- a/libs/Zend/Http/UserAgent/Features/Adapter.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * The interface required by all Zend_Browser_Features Adapter classes to implement.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-interface Zend_Http_UserAgent_Features_Adapter
-{
- /**
- * Retrieve the browser's features from a given request object ($_SERVER)
- *
- * @return array
- */
- public static function getFromRequest($request, array $config);
-}
diff --git a/libs/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php b/libs/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php
deleted file mode 100644
index 2aacf49a6b..0000000000
--- a/libs/Zend/Http/UserAgent/Features/Adapter/DeviceAtlas.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_Http_UserAgent_Features_Adapter_Interface
- */
-// require_once 'Zend/Http/UserAgent/Features/Adapter.php';
-
-/**
- * Features adapter build with the Tera Wurfl Api
- * See installation instruction here : http://deviceatlas.com/licences
- * Download : http://deviceatlas.com/getAPI/php
- *
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Features_Adapter_DeviceAtlas implements Zend_Http_UserAgent_Features_Adapter
-{
- /**
- * Get features from request
- *
- * @param array $request $_SERVER variable
- * @return array
- */
- public static function getFromRequest($request, array $config)
- {
- if (!class_exists('Mobi_Mtld_DA_Api')) {
- if (!isset($config['deviceatlas'])) {
- // require_once 'Zend/Http/UserAgent/Features/Exception.php';
- throw new Zend_Http_UserAgent_Features_Exception('"DeviceAtlas" configuration is not defined');
- }
- }
-
- $config = $config['deviceatlas'];
-
- if (!class_exists('Mobi_Mtld_DA_Api')) {
- if (empty($config['deviceatlas_lib_dir'])) {
- // require_once 'Zend/Http/UserAgent/Features/Exception.php';
- throw new Zend_Http_UserAgent_Features_Exception('The "deviceatlas_lib_dir" parameter is not defined');
- }
-
- // Include the Device Atlas file from the specified lib_dir
- // require_once ($config['deviceatlas_lib_dir'] . '/Mobi/Mtld/DA/Api.php');
- }
-
- if (empty($config['deviceatlas_data'])) {
- // require_once 'Zend/Http/UserAgent/Features/Exception.php';
- throw new Zend_Http_UserAgent_Features_Exception('The "deviceatlas_data" parameter is not defined');
- }
-
- //load the device data-tree : e.g. 'json/DeviceAtlas.json
- $tree = Mobi_Mtld_DA_Api::getTreeFromFile($config['deviceatlas_data']);
-
- $properties = Mobi_Mtld_DA_Api::getProperties($tree, $request['http_user_agent']);
-
- return $properties;
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php b/libs/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php
deleted file mode 100644
index ab1d41080d..0000000000
--- a/libs/Zend/Http/UserAgent/Features/Adapter/TeraWurfl.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_Http_UserAgent_Features_Adapter_Interface
- */
-// require_once 'Zend/Http/UserAgent/Features/Adapter.php';
-
-/**
- * Features adapter build with the Tera Wurfl Api
- * See installation instruction here : http://www.tera-wurfl.com/wiki/index.php/Installation
- * Download : http://www.tera-wurfl.com/wiki/index.php/Downloads
- *
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Features_Adapter_TeraWurfl implements Zend_Http_UserAgent_Features_Adapter
-{
- /**
- * Get features from request
- *
- * @param array $request $_SERVER variable
- * @return array
- */
- public static function getFromRequest($request, array $config)
- {
- if (!class_exists('TeraWurfl')) {
- // If TeraWurfl class not found, see if we can load it from
- // configuration
- //
- if (!isset($config['terawurfl'])) {
- // No configuration
- // require_once 'Zend/Http/UserAgent/Features/Exception.php';
- throw new Zend_Http_UserAgent_Features_Exception('"TeraWurfl" configuration is not defined');
- }
-
- $config = $config['terawurfl'];
-
- if (empty($config['terawurfl_lib_dir'])) {
- // No lib_dir given
- // require_once 'Zend/Http/UserAgent/Features/Exception.php';
- throw new Zend_Http_UserAgent_Features_Exception('The "terawurfl_lib_dir" parameter is not defined');
- }
-
- // Include the Tera-WURFL file
- // require_once ($config['terawurfl_lib_dir'] . '/TeraWurfl.php');
- }
-
-
- // instantiate the Tera-WURFL object
- $wurflObj = new TeraWurfl();
-
- // Get the capabilities of the current client.
- $matched = $wurflObj->getDeviceCapabilitiesFromRequest(array_change_key_case($request, CASE_UPPER));
-
- return self::getAllCapabilities($wurflObj);
- }
-
- /***
- * Builds an array with all capabilities
- *
- * @param TeraWurfl $wurflObj TeraWurfl object
- */
- public static function getAllCapabilities(TeraWurfl $wurflObj)
- {
-
- foreach ($wurflObj->capabilities as $group) {
- if (!is_array($group)) {
- continue;
- }
- while (list ($key, $value) = each($group)) {
- if (is_bool($value)) {
- // to have the same type than the official WURFL API
- $features[$key] = ($value ? 'true' : 'false');
- } else {
- $features[$key] = $value;
- }
- }
- }
- return $features;
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Features/Adapter/WurflApi.php b/libs/Zend/Http/UserAgent/Features/Adapter/WurflApi.php
deleted file mode 100644
index 2a8f3e01c5..0000000000
--- a/libs/Zend/Http/UserAgent/Features/Adapter/WurflApi.php
+++ /dev/null
@@ -1,103 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_Http_UserAgent_Features_Adapter_Interface
- */
-// require_once 'Zend/Http/UserAgent/Features/Adapter.php';
-
-/**
- * Features adapter build with the official WURFL PHP API
- * See installation instruction here : http://wurfl.sourceforge.net/nphp/
- * Download : http://sourceforge.net/projects/wurfl/files/WURFL PHP/1.1/wurfl-php-1.1.tar.gz/download
- *
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Features_Adapter_WurflApi
- implements Zend_Http_UserAgent_Features_Adapter
-{
- const DEFAULT_API_VERSION = '1.1';
-
- /**
- * Get features from request
- *
- * @param array $request $_SERVER variable
- * @return array
- */
- public static function getFromRequest($request, array $config)
- {
- if (!isset($config['wurflapi'])) {
- // require_once 'Zend/Http/UserAgent/Features/Exception.php';
- throw new Zend_Http_UserAgent_Features_Exception('"wurflapi" configuration is not defined');
- }
-
- $config = $config['wurflapi'];
-
- if (empty($config['wurfl_lib_dir'])) {
- // require_once 'Zend/Http/UserAgent/Features/Exception.php';
- throw new Zend_Http_UserAgent_Features_Exception('The "wurfl_lib_dir" parameter is not defined');
- }
- if (empty($config['wurfl_config_file']) && empty($config['wurfl_config_array'])) {
- // require_once 'Zend/Http/UserAgent/Features/Exception.php';
- throw new Zend_Http_UserAgent_Features_Exception('The "wurfl_config_file" parameter is not defined');
- }
-
- if (empty($config['wurfl_api_version'])) {
- $config['wurfl_api_version'] = self::DEFAULT_API_VERSION;
- }
-
- switch ($config['wurfl_api_version']) {
- case '1.0':
- // Zend_Http_UserAgent::$config['wurfl_config_file'] must be an XML file
- // require_once ($config['wurfl_lib_dir'] . 'WURFLManagerProvider.php');
- $wurflManager = WURFL_WURFLManagerProvider::getWURFLManager(Zend_Http_UserAgent::$config['wurfl_config_file']);
- break;
- case '1.1':
- // require_once ($config['wurfl_lib_dir'] . 'Application.php');
- if (!empty($config['wurfl_config_file'])) {
- $wurflConfig = WURFL_Configuration_ConfigFactory::create($config['wurfl_config_file']);
- } elseif (!empty($config['wurfl_config_array'])) {
- $c = $config['wurfl_config_array'];
- $wurflConfig = new WURFL_Configuration_InMemoryConfig();
- $wurflConfig->wurflFile($c['wurfl']['main-file'])
- ->wurflPatch($c['wurfl']['patches'])
- ->persistence($c['persistence']['provider'], $c['persistence']['dir']);
- }
-
- $wurflManagerFactory = new WURFL_WURFLManagerFactory($wurflConfig);
- $wurflManager = $wurflManagerFactory->create();
- break;
- default:
- // require_once 'Zend/Http/UserAgent/Features/Exception.php';
- throw new Zend_Http_UserAgent_Features_Exception(sprintf(
- 'Unknown API version "%s"',
- $config['wurfl_api_version']
- ));
- }
-
- $device = $wurflManager->getDeviceForHttpRequest(array_change_key_case($request, CASE_UPPER));
- $features = $device->getAllCapabilities();
- return $features;
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Features/Exception.php b/libs/Zend/Http/UserAgent/Features/Exception.php
deleted file mode 100644
index 1b384862d4..0000000000
--- a/libs/Zend/Http/UserAgent/Features/Exception.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @see Zend_Browser_Exception
- */
-// require_once 'Zend/Http/UserAgent/Exception.php';
-
-/**
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Features_Exception extends Zend_Http_UserAgent_Exception
-{
-}
diff --git a/libs/Zend/Http/UserAgent/Feed.php b/libs/Zend/Http/UserAgent/Feed.php
deleted file mode 100644
index a413af2f3b..0000000000
--- a/libs/Zend/Http/UserAgent/Feed.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-// require_once 'Zend/Http/UserAgent/AbstractDevice.php';
-
-/**
- * Feed browser type matcher
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Feed extends Zend_Http_UserAgent_AbstractDevice
-{
- /**
- * User Agent Signatures
- *
- * @var array
- */
- protected static $_uaSignatures = array(
- 'bloglines',
- 'everyfeed',
- 'feedfetcher',
- 'gregarius',
- );
-
- /**
- * Comparison of the UserAgent chain and User Agent signatures
- *
- * @param string $userAgent User Agent chain
- * @param array $server $_SERVER like param
- * @return bool
- */
- public static function match($userAgent, $server)
- {
- return self::_matchAgentAgainstSignatures($userAgent, self::$_uaSignatures);
- }
-
- /**
- * Gives the current browser type
- *
- * @return string
- */
- public function getType()
- {
- return 'feed';
- }
-
- /**
- * Look for features
- *
- * @return string
- */
- protected function _defineFeatures()
- {
- $this->setFeature('iframes', false, 'product_capability');
- $this->setFeature('frames', false, 'product_capability');
- $this->setFeature('javascript', false, 'product_capability');
- return parent::_defineFeatures();
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Mobile.php b/libs/Zend/Http/UserAgent/Mobile.php
deleted file mode 100644
index fe27388238..0000000000
--- a/libs/Zend/Http/UserAgent/Mobile.php
+++ /dev/null
@@ -1,536 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-// require_once 'Zend/Http/UserAgent/AbstractDevice.php';
-
-/**
- * Mobile browser type matcher
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Mobile extends Zend_Http_UserAgent_AbstractDevice
-{
-
- const DEFAULT_FEATURES_ADAPTER_CLASSNAME = 'Zend_Http_UserAgent_Features_Adapter_WurflApi';
-
- const DEFAULT_FEATURES_ADAPTER_PATH = 'Zend/Http/UserAgent/Features/Adapter/WurflApi.php';
-
- /**
- * User Agent Signatures
- *
- * @var array
- */
- protected static $_uaSignatures = array(
- 'iphone',
- 'ipod',
- 'ipad',
- 'android',
- 'blackberry',
- 'opera mini',
- 'opera mobi',
- 'palm',
- 'palmos',
- 'elaine',
- 'windows ce',
- 'icab',
- '_mms',
- 'ahong',
- 'archos',
- 'armv',
- 'astel',
- 'avantgo',
- 'benq',
- 'blazer',
- 'brew',
- 'com2',
- 'compal',
- 'danger',
- 'pocket',
- 'docomo',
- 'epoc',
- 'ericsson',
- 'eudoraweb',
- 'hiptop',
- 'htc-',
- 'htc_',
- 'iemobile',
- 'iris',
- 'j-phone',
- 'kddi',
- 'kindle',
- 'lg ',
- 'lg-',
- 'lg/',
- 'lg;lx',
- 'lge vx',
- 'lge',
- 'lge-',
- 'lge-cx',
- 'lge-lx',
- 'lge-mx',
- 'linux armv',
- 'maemo',
- 'midp',
- 'mini 9.5',
- 'minimo',
- 'mob-x',
- 'mobi',
- 'mobile',
- 'mobilephone',
- 'mot 24',
- 'mot-',
- 'motorola',
- 'n410',
- 'netfront',
- 'nintendo wii',
- 'nintendo',
- 'nitro',
- 'nokia',
- 'novarra-vision',
- 'nuvifone',
- 'openweb',
- 'opwv',
- 'palmsource',
- 'pdxgw',
- 'phone',
- 'playstation',
- 'polaris',
- 'portalmmm',
- 'qt embedded',
- 'reqwirelessweb',
- 'sagem',
- 'sam-r',
- 'samsu',
- 'samsung',
- 'sec-',
- 'sec-sgh',
- 'semc-browser',
- 'series60',
- 'series70',
- 'series80',
- 'series90',
- 'sharp',
- 'sie-m',
- 'sie-s',
- 'smartphone',
- 'sony cmd',
- 'sonyericsson',
- 'sprint',
- 'spv',
- 'symbian os',
- 'symbian',
- 'symbianos',
- 'telco',
- 'teleca',
- 'treo',
- 'up.browser',
- 'up.link',
- 'vodafone',
- 'vodaphone',
- 'webos',
- 'wml',
- 'windows phone os 7',
- 'wireless',
- 'wm5 pie',
- 'wms pie',
- 'xiino',
- 'wap',
- 'up/',
- 'psion',
- 'j2me',
- 'klondike',
- 'kbrowser'
- );
-
- /**
- * @var array
- */
- protected static $_haTerms = array(
- 'midp',
- 'wml',
- 'vnd.rim',
- 'vnd.wap',
- 'j2me',
- );
-
- /**
- * first 4 letters of mobile User Agent chains
- *
- * @var array
- */
- protected static $_uaBegin = array(
- 'w3c ',
- 'acs-',
- 'alav',
- 'alca',
- 'amoi',
- 'audi',
- 'avan',
- 'benq',
- 'bird',
- 'blac',
- 'blaz',
- 'brew',
- 'cell',
- 'cldc',
- 'cmd-',
- 'dang',
- 'doco',
- 'eric',
- 'hipt',
- 'inno',
- 'ipaq',
- 'java',
- 'jigs',
- 'kddi',
- 'keji',
- 'leno',
- 'lg-c',
- 'lg-d',
- 'lg-g',
- 'lge-',
- 'maui',
- 'maxo',
- 'midp',
- 'mits',
- 'mmef',
- 'mobi',
- 'mot-',
- 'moto',
- 'mwbp',
- 'nec-',
- 'newt',
- 'noki',
- 'palm',
- 'pana',
- 'pant',
- 'phil',
- 'play',
- 'port',
- 'prox',
- 'qwap',
- 'sage',
- 'sams',
- 'sany',
- 'sch-',
- 'sec-',
- 'send',
- 'seri',
- 'sgh-',
- 'shar',
- 'sie-',
- 'siem',
- 'smal',
- 'smar',
- 'sony',
- 'sph-',
- 'symb',
- 't-mo',
- 'teli',
- 'tim-',
- 'tosh',
- 'tsm-',
- 'upg1',
- 'upsi',
- 'vk-v',
- 'voda',
- 'wap-',
- 'wapa',
- 'wapi',
- 'wapp',
- 'wapr',
- 'webc',
- 'winw',
- 'winw',
- 'xda',
- 'xda-',
- );
-
- /**
- * Comparison of the UserAgent chain and User Agent signatures
- *
- * @param string $userAgent User Agent chain
- * @param array $server $_SERVER like param
- * @return bool
- */
- public static function match($userAgent, $server)
- {
- // To have a quick identification, try light-weight tests first
- if (isset($server['all_http'])) {
- if (strpos(strtolower(str_replace(' ', '', $server['all_http'])), 'operam') !== false) {
- // Opera Mini or Opera Mobi
- return true;
- }
- }
-
- if (isset($server['http_x_wap_profile']) || isset($server['http_profile'])) {
- return true;
- }
-
- if (isset($server['http_accept'])) {
- if (self::_matchAgentAgainstSignatures($server['http_accept'], self::$_haTerms)) {
- return true;
- }
- }
-
- if (self::userAgentStart($userAgent)) {
- return true;
- }
-
- if (self::_matchAgentAgainstSignatures($userAgent, self::$_uaSignatures)) {
- return true;
- }
-
- return false;
- }
-
- /**
- * Retrieve beginning clause of user agent
- *
- * @param string $userAgent
- * @return string
- */
- public static function userAgentStart($userAgent)
- {
-
- $mobile_ua = strtolower(substr($userAgent, 0, 4));
-
- return (in_array($mobile_ua, self::$_uaBegin));
- }
-
- /**
- * Constructor
- *
- * @return void
- */
- public function __construct($userAgent = null, array $server = array(), array $config = array())
- {
- // For mobile detection, an adapter must be defined
- if (empty($config['mobile']['features'])) {
- $config['mobile']['features']['path'] = self::DEFAULT_FEATURES_ADAPTER_PATH;
- $config['mobile']['features']['classname'] = self::DEFAULT_FEATURES_ADAPTER_CLASSNAME;
- }
- parent::__construct($userAgent, $server, $config);
- }
-
- /**
- * Gives the current browser type
- *
- * @return string
- */
- public function getType()
- {
- return 'mobile';
- }
-
- /**
- * Look for features
- *
- * @return string
- */
- protected function _defineFeatures()
- {
- $this->setFeature('is_wireless_device', false, 'product_info');
-
- parent::_defineFeatures();
-
- if (isset($this->_aFeatures["mobile_browser"])) {
- $this->setFeature("browser_name", $this->_aFeatures["mobile_browser"]);
- $this->_browser = $this->_aFeatures["mobile_browser"];
- }
- if (isset($this->_aFeatures["mobile_browser_version"])) {
- $this->setFeature("browser_version", $this->_aFeatures["mobile_browser_version"]);
- $this->_browserVersion = $this->_aFeatures["mobile_browser_version"];
- }
-
- // markup
- if ($this->getFeature('device_os') == 'iPhone OS'
- || $this->getFeature('device_os_token') == 'iPhone OS'
- ) {
- $this->setFeature('markup', 'iphone');
- } else {
- $this->setFeature('markup', $this->getMarkupLanguage($this->getFeature('preferred_markup')));
- }
-
- // image format
- $this->_images = array();
-
- if ($this->getFeature('png')) {
- $this->_images[] = 'png';
- }
- if ($this->getFeature('jpg')) {
- $this->_images[] = 'jpg';
- }
- if ($this->getFeature('gif')) {
- $this->_images[] = 'gif';
- }
- if ($this->getFeature('wbmp')) {
- $this->_images[] = 'wbmp';
- }
-
- return $this->_aFeatures;
- }
-
- /**
- * Determine markup language expected
- *
- * @access public
- * @return __TYPE__
- */
- public function getMarkupLanguage($preferredMarkup = null)
- {
- $return = '';
- switch ($preferredMarkup) {
- case 'wml_1_1':
- case 'wml_1_2':
- case 'wml_1_3':
- $return = 'wml'; //text/vnd.wap.wml encoding="ISO-8859-15"
- case 'html_wi_imode_compact_generic':
- case 'html_wi_imode_html_1':
- case 'html_wi_imode_html_2':
- case 'html_wi_imode_html_3':
- case 'html_wi_imode_html_4':
- case 'html_wi_imode_html_5':
- $return = 'chtml'; //text/html
- case 'html_wi_oma_xhtmlmp_1_0': //application/vnd.wap.xhtml+xml
- case 'html_wi_w3_xhtmlbasic': //application/xhtml+xml DTD XHTML Basic 1.0
- $return = 'xhtml';
- case 'html_web_3_2': //text/html DTD Html 3.2 Final
- case 'html_web_4_0': //text/html DTD Html 4.01 Transitional
- $return = '';
- }
- return $return;
- }
-
- /**
- * Determine image format support
- *
- * @return array
- */
- public function getImageFormatSupport()
- {
- return $this->_images;
- }
-
- /**
- * Determine maximum image height supported
- *
- * @return int
- */
- public function getMaxImageHeight()
- {
- return $this->getFeature('max_image_height');
- }
-
- /**
- * Determine maximum image width supported
- *
- * @return int
- */
- public function getMaxImageWidth()
- {
- return $this->getFeature('max_image_width');
- }
-
- /**
- * Determine physical screen height
- *
- * @return int
- */
- public function getPhysicalScreenHeight()
- {
- return $this->getFeature('physical_screen_height');
- }
-
- /**
- * Determine physical screen width
- *
- * @return int
- */
- public function getPhysicalScreenWidth()
- {
- return $this->getFeature('physical_screen_width');
- }
-
- /**
- * Determine preferred markup
- *
- * @return string
- */
- public function getPreferredMarkup()
- {
- return $this->getFeature("markup");
- }
-
- /**
- * Determine X/HTML support level
- *
- * @return int
- */
- public function getXhtmlSupportLevel()
- {
- return $this->getFeature('xhtml_support_level');
- }
-
- /**
- * Does the device support Flash?
- *
- * @return bool
- */
- public function hasFlashSupport()
- {
- return $this->getFeature('fl_browser');
- }
-
- /**
- * Does the device support PDF?
- *
- * @return bool
- */
- public function hasPdfSupport()
- {
- return $this->getFeature('pdf_support');
- }
-
- /**
- * Does the device have an associated phone number?
- *
- * @return bool
- */
- public function hasPhoneNumber()
- {
- return $this->getFeature('can_assign_phone_number');
- }
-
- /**
- * Does the device support HTTPS?
- *
- * @return bool
- */
- public function httpsSupport()
- {
- return ($this->getFeature('https_support') == 'supported');
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Offline.php b/libs/Zend/Http/UserAgent/Offline.php
deleted file mode 100644
index ed57e1b8a9..0000000000
--- a/libs/Zend/Http/UserAgent/Offline.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-// require_once 'Zend/Http/UserAgent/Desktop.php';
-
-/**
- * Offline browser type matcher
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Offline extends Zend_Http_UserAgent_Desktop
-{
- /**
- * User Agent Signatures
- *
- * @var array
- */
- protected static $_uaSignatures = array(
- 'wget',
- 'webzip',
- 'webcopier',
- 'downloader',
- 'superbot',
- 'offline',
- );
-
- /**
- * Comparison of the UserAgent chain and User Agent signatures
- *
- * @param string $userAgent User Agent chain
- * @param array $server $_SERVER like param
- * @return bool
- */
- public static function match($userAgent, $server)
- {
- return self::_matchAgentAgainstSignatures($userAgent, self::$_uaSignatures);
- }
-
- /**
- * Gives the current browser type
- *
- * @return string
- */
- public function getType()
- {
- return 'offline';
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Probe.php b/libs/Zend/Http/UserAgent/Probe.php
deleted file mode 100644
index 84bb819017..0000000000
--- a/libs/Zend/Http/UserAgent/Probe.php
+++ /dev/null
@@ -1,81 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-// require_once 'Zend/Http/UserAgent/AbstractDevice.php';
-
-/**
- * Probe browser type matcher
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Probe extends Zend_Http_UserAgent_AbstractDevice
-{
- /**
- * User Agent Signatures
- *
- * @var array
- */
- protected static $_uaSignatures = array(
- 'witbe',
- 'netvigie',
- );
-
- /**
- * Comparison of the UserAgent chain and User Agent signatures
- *
- * @param string $userAgent User Agent chain
- * @param array $server $_SERVER like param
- * @return bool
- */
- public static function match($userAgent, $server)
- {
- return self::_matchAgentAgainstSignatures($userAgent, self::$_uaSignatures);
- }
-
-
- /**
- * Gives the current browser type
- *
- * @return string
- */
- public function getType()
- {
- return 'probe';
- }
-
- /**
- * Look for features
- *
- * @return string
- */
- protected function _defineFeatures()
- {
- $this->setFeature('images', false, 'product_capability');
- $this->setFeature('iframes', false, 'product_capability');
- $this->setFeature('frames', false, 'product_capability');
- $this->setFeature('javascript', false, 'product_capability');
- return parent::_defineFeatures();
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Spam.php b/libs/Zend/Http/UserAgent/Spam.php
deleted file mode 100644
index 9312abdf45..0000000000
--- a/libs/Zend/Http/UserAgent/Spam.php
+++ /dev/null
@@ -1,79 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-// require_once 'Zend/Http/UserAgent/AbstractDevice.php';
-
-/**
- * Spam browser type matcher
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Spam extends Zend_Http_UserAgent_AbstractDevice
-{
- /**
- * @todo User Agent Signatures
- *
- * @var array
- */
- protected static $_uaSignatures = array(
- '',
- );
-
- /**
- * Comparison of the UserAgent chain and User Agent signatures
- *
- * @param string $userAgent User Agent chain
- * @param array $server $_SERVER like param
- * @return bool
- */
- public static function match($userAgent, $server)
- {
- return self::_matchAgentAgainstSignatures($userAgent, self::$_uaSignatures);
- }
-
- /**
- * Gives the current browser type
- *
- * @return string
- */
- public function getType()
- {
- return 'spam';
- }
-
- /**
- * Look for features
- *
- * @return string
- */
- protected function _defineFeatures()
- {
- $this->setFeature('images', false, 'product_capability');
- $this->setFeature('iframes', false, 'product_capability');
- $this->setFeature('frames', false, 'product_capability');
- $this->setFeature('javascript', false, 'product_capability');
- return parent::_defineFeatures();
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Storage.php b/libs/Zend/Http/UserAgent/Storage.php
deleted file mode 100644
index 3c4d613e4d..0000000000
--- a/libs/Zend/Http/UserAgent/Storage.php
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-interface Zend_Http_UserAgent_Storage
-{
- /**
- * Returns true if and only if storage is empty
- *
- * @throws Zend_Http_UserAgent_Storage_Exception If it is impossible to determine whether storage is empty
- * @return boolean
- */
- public function isEmpty();
-
- /**
- * Returns the contents of storage associated to the key parameter
- *
- * Behavior is undefined when storage is empty.
- *
- * @throws Zend_Http_UserAgent_Storage_Exception If reading contents from storage is impossible
- * @return mixed
- */
- public function read();
-
- /**
- * Writes $contents associated to the key parameter to storage
- *
- * @param mixed $contents
- * @throws Zend_Http_UserAgent_Storage_Exception If writing $contents to storage is impossible
- * @return void
- */
- public function write($contents);
-
- /**
- * Clears contents from storage
- *
- * @throws Zend_Http_UserAgent_Storage_Exception If clearing contents from storage is impossible
- * @return void
- */
- public function clear();
-}
diff --git a/libs/Zend/Http/UserAgent/Storage/Exception.php b/libs/Zend/Http/UserAgent/Storage/Exception.php
deleted file mode 100644
index 8b186c226e..0000000000
--- a/libs/Zend/Http/UserAgent/Storage/Exception.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * @see Zend_Http_UserAgent_Exception
- */
-// require_once 'Zend/Http/UserAgent/Exception.php';
-
-
-/**
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Storage_Exception extends Zend_Http_UserAgent_Exception
-{
-}
diff --git a/libs/Zend/Http/UserAgent/Storage/NonPersistent.php b/libs/Zend/Http/UserAgent/Storage/NonPersistent.php
deleted file mode 100644
index 2df84d639f..0000000000
--- a/libs/Zend/Http/UserAgent/Storage/NonPersistent.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id: NonPersistent.php 20096 2010-01-06 02:05:09Z bkarwin $
- */
-
-
-/**
- * @see Zend_Http_UserAgent_Storage_Interface
- */
-// require_once 'Zend/Http/UserAgent/Storage.php';
-
-
-/**
- * Non-Persistent Browser Storage
- *
- * Since HTTP Browserentication happens again on each request, this will always be
- * re-populated. So there's no need to use sessions, this simple value class
- * will hold the data for rest of the current request.
- *
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Storage_NonPersistent
- implements Zend_Http_UserAgent_Storage
-{
- /**
- * Holds the actual Browser data
- * @var mixed
- */
- protected $_data;
-
- /**
- * Returns true if and only if storage is empty
- *
- * @throws Zend_Http_UserAgent_Storage_Exception If it is impossible to determine whether storage is empty
- * @return boolean
- */
- public function isEmpty()
- {
- return empty($this->_data);
- }
-
- /**
- * Returns the contents of storage
- *
- * Behavior is undefined when storage is empty.
- *
- * @throws Zend_Http_UserAgent_Storage_Exception If reading contents from storage is impossible
- * @return mixed
- */
- public function read()
- {
- return $this->_data;
- }
-
- /**
- * Writes $contents to storage
- *
- * @param mixed $contents
- * @throws Zend_Http_UserAgent_Storage_Exception If writing $contents to storage is impossible
- * @return void
- */
- public function write($contents)
- {
- $this->_data = $contents;
- }
-
- /**
- * Clears contents from storage
- *
- * @throws Zend_Http_UserAgent_Storage_Exception If clearing contents from storage is impossible
- * @return void
- */
- public function clear()
- {
- $this->_data = null;
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Storage/Session.php b/libs/Zend/Http/UserAgent/Storage/Session.php
deleted file mode 100644
index e42a2fc155..0000000000
--- a/libs/Zend/Http/UserAgent/Storage/Session.php
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * @see Zend_Http_UserAgent_Storage
- */
-// require_once 'Zend/Http/UserAgent/Storage.php';
-
-/**
- * @see Zend_Session_Namespace
- */
-// require_once 'Zend/Session/Namespace.php';
-
-/**
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Storage_Session implements Zend_Http_UserAgent_Storage
-{
- /**
- * Default session namespace
- */
- const NAMESPACE_DEFAULT = 'Zend_Http_UserAgent';
-
- /**
- * Default session object member name
- */
- const MEMBER_DEFAULT = 'storage';
-
- /**
- * Object to proxy $_SESSION storage
- *
- * @var Zend_Session_Namespace
- */
- protected $_session;
-
- /**
- * Session namespace
- *
- * @var mixed
- */
- protected $_namespace;
-
- /**
- * Session object member
- *
- * @var mixed
- */
- protected $_member;
-
- /**
- * Sets session storage options and initializes session namespace object
- *
- * Expects options to contain 0 or more of the following keys:
- * - browser_type -- maps to "namespace" internally
- * - member
- *
- * @param null|array|object $options
- * @return void
- * @throws Zend_Http_UserAgent_Storage_Exception on invalid $options argument
- */
- public function __construct($options = null)
- {
- if (is_object($options) && method_exists($options, 'toArray')) {
- $options = $options->toArray();
- } elseif (is_object($options)) {
- $options = (array) $options;
- }
- if (null !== $options && !is_array($options)) {
- // require_once 'Zend/Http/UserAgent/Storage/Exception.php';
- throw new Zend_Http_UserAgent_Storage_Exception(sprintf(
- 'Expected array or object options; "%s" provided',
- gettype($options)
- ));
- }
-
- // add '.' to prevent the message ''Session namespace must not start with a number'
- $this->_namespace = '.'
- . (isset($options['browser_type'])
- ? $options['browser_type']
- : self::NAMESPACE_DEFAULT);
- $this->_member = isset($options['member']) ? $options['member'] : self::MEMBER_DEFAULT;
- $this->_session = new Zend_Session_Namespace($this->_namespace);
- }
-
- /**
- * Returns the session namespace name
- *
- * @return string
- */
- public function getNamespace()
- {
- return $this->_namespace;
- }
-
- /**
- * Returns the name of the session object member
- *
- * @return string
- */
- public function getMember()
- {
- return $this->_member;
- }
-
- /**
- * Defined by Zend_Http_UserAgent_Storage
- *
- * @return boolean
- */
- public function isEmpty()
- {
- return empty($this->_session->{$this->_member});
- }
-
- /**
- * Defined by Zend_Http_UserAgent_Storage
- *
- * @return mixed
- */
- public function read()
- {
- return $this->_session->{$this->_member};
- }
-
- /**
- * Defined by Zend_Http_UserAgent_Storage
- *
- * @param mixed $contents
- * @return void
- */
- public function write($content)
- {
- $this->_session->{$this->_member} = $content;
- }
-
- /**
- * Defined by Zend_Http_UserAgent_Storage
- *
- * @return void
- */
- public function clear()
- {
- unset($this->_session->{$this->_member});
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Text.php b/libs/Zend/Http/UserAgent/Text.php
deleted file mode 100644
index 1be28e2590..0000000000
--- a/libs/Zend/Http/UserAgent/Text.php
+++ /dev/null
@@ -1,132 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-// require_once 'Zend/Http/UserAgent/AbstractDevice.php';
-
-/**
- * Text browser type matcher
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Text extends Zend_Http_UserAgent_AbstractDevice
-{
- /**
- * User Agent Signatures
- *
- * @var array
- */
- protected static $_uaSignatures = array(
- 'lynx',
- 'retawq',
- 'w3m',
- );
-
- /**
- * Comparison of the UserAgent chain and User Agent signatures
- *
- * @param string $userAgent User Agent chain
- * @param array $server $_SERVER like param
- * @return bool
- */
- public static function match($userAgent, $server)
- {
- return self::_matchAgentAgainstSignatures($userAgent, self::$_uaSignatures);
- }
-
- /**
- * Gives the current browser type
- *
- * @return string
- */
- public function getType()
- {
- return 'text';
- }
-
- /**
- * Look for features
- *
- * @return string
- */
- protected function _defineFeatures()
- {
- $this->setFeature('images', false, 'product_capability');
- $this->setFeature('iframes', false, 'product_capability');
- $this->setFeature('frames', false, 'product_capability');
- $this->setFeature('javascript', false, 'product_capability');
- return parent::_defineFeatures();
- }
-
- /**
- * Determine supported image formats
- *
- * @return null
- */
- public function getImageFormatSupport()
- {
- return null;
- }
-
- /**
- * Get preferred markup format
- *
- * @return string
- */
- public function getPreferredMarkup()
- {
- return 'xhtml';
- }
-
- /**
- * Get supported X/HTML markup level
- *
- * @return int
- */
- public function getXhtmlSupportLevel()
- {
- return 1;
- }
-
- /**
- * Does the device support Flash?
- *
- * @return bool
- */
- public function hasFlashSupport()
- {
-
- return false;
- }
-
- /**
- * Does the device support PDF?
- *
- * @return bool
- */
- public function hasPdfSupport()
- {
- return false;
- }
-}
diff --git a/libs/Zend/Http/UserAgent/Validator.php b/libs/Zend/Http/UserAgent/Validator.php
deleted file mode 100644
index c0d6bf420b..0000000000
--- a/libs/Zend/Http/UserAgent/Validator.php
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-// require_once 'Zend/Http/UserAgent/Desktop.php';
-
-/**
- * Validator browser type matcher
- *
- * @category Zend
- * @package Zend_Http
- * @subpackage UserAgent
- * @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Http_UserAgent_Validator extends Zend_Http_UserAgent_Desktop
-{
- /**
- * User Agent Signatures
- *
- * @var array
- */
- protected static $_uaSignatures = array(
- 'htmlvalidator',
- 'csscheck',
- 'cynthia',
- 'htmlparser',
- 'validator',
- 'jfouffa',
- 'jigsaw',
- 'w3c_validator',
- 'wdg_validator',
- );
-
- /**
- * Comparison of the UserAgent chain and User Agent signatures
- *
- * @param string $userAgent User Agent chain
- * @param array $server $_SERVER like param
- * @return bool
- */
- public static function match($userAgent, $server)
- {
- return self::_matchAgentAgainstSignatures($userAgent, self::$_uaSignatures);
- }
-
- /**
- * Gives the current browser type
- *
- * @return string
- */
- public function getType()
- {
- return 'validator';
- }
-}