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
diff options
context:
space:
mode:
authormatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2008-03-11 22:07:20 +0300
committermatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2008-03-11 22:07:20 +0300
commit75381897f7c5ca04920464355b3cc445914ced83 (patch)
treed2a89e575ccd3273796c47d1b16565141070dbfc /libs
parentd88b9ee44be81cc63e62f5ae61940bdd33f5f41a (diff)
- deleting useless libraries
Diffstat (limited to 'libs')
-rwxr-xr-xlibs/Zend/Feed.php395
-rwxr-xr-xlibs/Zend/Feed/Abstract.php242
-rwxr-xr-xlibs/Zend/Feed/Atom.php381
-rwxr-xr-xlibs/Zend/Feed/Builder.php383
-rwxr-xr-xlibs/Zend/Feed/Builder/Entry.php283
-rwxr-xr-xlibs/Zend/Feed/Builder/Exception.php40
-rwxr-xr-xlibs/Zend/Feed/Builder/Header.php396
-rwxr-xr-xlibs/Zend/Feed/Builder/Header/Itunes.php267
-rwxr-xr-xlibs/Zend/Feed/Builder/Interface.php52
-rwxr-xr-xlibs/Zend/Feed/Element.php403
-rwxr-xr-xlibs/Zend/Feed/Entry/Abstract.php106
-rwxr-xr-xlibs/Zend/Feed/Entry/Atom.php231
-rwxr-xr-xlibs/Zend/Feed/Entry/Rss.php47
-rwxr-xr-xlibs/Zend/Feed/Exception.php42
-rwxr-xr-xlibs/Zend/Feed/Rss.php496
-rwxr-xr-xlibs/Zend/Gdata.php133
-rwxr-xr-xlibs/Zend/Json/Decoder.php454
-rwxr-xr-xlibs/Zend/Json/Encoder.php413
-rwxr-xr-xlibs/Zend/Json/Exception.php36
-rwxr-xr-xlibs/Zend/Json/TODO.txt1
-rwxr-xr-xlibs/Zend/Mail.php649
-rwxr-xr-xlibs/Zend/Mail/Exception.php36
-rwxr-xr-xlibs/Zend/Mail/Message.php105
-rwxr-xr-xlibs/Zend/Mail/Part.php422
-rwxr-xr-xlibs/Zend/Mail/Protocol/Abstract.php358
-rwxr-xr-xlibs/Zend/Mail/Protocol/Exception.php39
-rwxr-xr-xlibs/Zend/Mail/Protocol/Imap.php770
-rwxr-xr-xlibs/Zend/Mail/Protocol/Pop3.php424
-rwxr-xr-xlibs/Zend/Mail/Protocol/Smtp.php413
-rwxr-xr-xlibs/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php108
-rwxr-xr-xlibs/Zend/Mail/Protocol/Smtp/Auth/Login.php98
-rwxr-xr-xlibs/Zend/Mail/Protocol/Smtp/Auth/Plain.php96
-rwxr-xr-xlibs/Zend/Mail/Storage.php36
-rwxr-xr-xlibs/Zend/Mail/Storage/Abstract.php357
-rwxr-xr-xlibs/Zend/Mail/Storage/Exception.php39
-rwxr-xr-xlibs/Zend/Mail/Storage/Folder.php232
-rwxr-xr-xlibs/Zend/Mail/Storage/Folder/Interface.php55
-rwxr-xr-xlibs/Zend/Mail/Storage/Folder/Maildir.php226
-rwxr-xr-xlibs/Zend/Mail/Storage/Folder/Mbox.php234
-rwxr-xr-xlibs/Zend/Mail/Storage/Imap.php524
-rwxr-xr-xlibs/Zend/Mail/Storage/Maildir.php381
-rwxr-xr-xlibs/Zend/Mail/Storage/Mbox.php396
-rwxr-xr-xlibs/Zend/Mail/Storage/Pop3.php301
-rwxr-xr-xlibs/Zend/Mail/Storage/Writable/Interface.php93
-rwxr-xr-xlibs/Zend/Mail/Storage/Writable/Maildir.php524
-rwxr-xr-xlibs/Zend/Mail/TODO.txt1
-rwxr-xr-xlibs/Zend/Mail/Transport/Abstract.php335
-rwxr-xr-xlibs/Zend/Mail/Transport/Exception.php39
-rwxr-xr-xlibs/Zend/Mail/Transport/Sendmail.php153
-rwxr-xr-xlibs/Zend/Mail/Transport/Smtp.php202
-rwxr-xr-xlibs/Zend/Mime.php251
-rwxr-xr-xlibs/Zend/Mime/Decode.php228
-rwxr-xr-xlibs/Zend/Mime/Exception.php36
-rwxr-xr-xlibs/Zend/Mime/Message.php280
-rwxr-xr-xlibs/Zend/Mime/Part.php208
-rwxr-xr-xlibs/Zend/Pdf.php685
-rwxr-xr-xlibs/Zend/Uri.php163
-rwxr-xr-xlibs/Zend/Uri/Exception.php36
-rwxr-xr-xlibs/Zend/Uri/Http.php630
-rwxr-xr-xlibs/Zend/XmlRpc/Client.php267
-rwxr-xr-xlibs/Zend/XmlRpc/Client/Exception.php39
-rwxr-xr-xlibs/Zend/XmlRpc/Client/FaultException.php37
-rwxr-xr-xlibs/Zend/XmlRpc/Client/HttpException.php40
-rwxr-xr-xlibs/Zend/XmlRpc/Client/IntrospectException.php39
-rwxr-xr-xlibs/Zend/XmlRpc/Client/ServerIntrospection.php162
-rwxr-xr-xlibs/Zend/XmlRpc/Client/ServerProxy.php94
-rwxr-xr-xlibs/Zend/XmlRpc/Exception.php36
-rwxr-xr-xlibs/Zend/XmlRpc/Fault.php307
-rwxr-xr-xlibs/Zend/XmlRpc/Request.php381
-rwxr-xr-xlibs/Zend/XmlRpc/Request/Http.php129
-rwxr-xr-xlibs/Zend/XmlRpc/Request/Stdin.php84
-rwxr-xr-xlibs/Zend/XmlRpc/Response.php249
-rwxr-xr-xlibs/Zend/XmlRpc/Response/Http.php51
-rwxr-xr-xlibs/Zend/XmlRpc/Server.php728
-rwxr-xr-xlibs/Zend/XmlRpc/Server/Cache.php140
-rwxr-xr-xlibs/Zend/XmlRpc/Server/Exception.php40
-rwxr-xr-xlibs/Zend/XmlRpc/Server/Fault.php196
-rwxr-xr-xlibs/Zend/XmlRpc/Value.php377
-rwxr-xr-xlibs/Zend/XmlRpc/Value/Array.php77
-rwxr-xr-xlibs/Zend/XmlRpc/Value/Base64.php69
-rwxr-xr-xlibs/Zend/XmlRpc/Value/Boolean.php83
-rwxr-xr-xlibs/Zend/XmlRpc/Value/Collection.php78
-rwxr-xr-xlibs/Zend/XmlRpc/Value/DateTime.php80
-rwxr-xr-xlibs/Zend/XmlRpc/Value/Double.php61
-rwxr-xr-xlibs/Zend/XmlRpc/Value/Exception.php38
-rwxr-xr-xlibs/Zend/XmlRpc/Value/Integer.php61
-rwxr-xr-xlibs/Zend/XmlRpc/Value/Scalar.php59
-rwxr-xr-xlibs/Zend/XmlRpc/Value/String.php72
-rwxr-xr-xlibs/Zend/XmlRpc/Value/Struct.php78
89 files changed, 0 insertions, 19116 deletions
diff --git a/libs/Zend/Feed.php b/libs/Zend/Feed.php
deleted file mode 100755
index 057f450d97..0000000000
--- a/libs/Zend/Feed.php
+++ /dev/null
@@ -1,395 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * Feed utility class
- *
- * Base Zend_Feed class, containing constants and the Zend_Http_Client instance
- * accessor.
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Feed
-{
-
- /**
- * HTTP client object to use for retrieving feeds
- *
- * @var Zend_Http_Client
- */
- protected static $_httpClient = null;
-
- /**
- * Override HTTP PUT and DELETE request methods?
- *
- * @var boolean
- */
- protected static $_httpMethodOverride = false;
-
- /**
- * @var array
- */
- protected static $_namespaces = array(
- 'opensearch' => 'http://a9.com/-/spec/opensearchrss/1.0/',
- 'atom' => 'http://www.w3.org/2005/Atom',
- 'rss' => 'http://blogs.law.harvard.edu/tech/rss',
- );
-
-
- /**
- * Set the HTTP client instance
- *
- * Sets the HTTP client object to use for retrieving the feeds.
- *
- * @param Zend_Http_Client $httpClient
- * @return void
- */
- public static function setHttpClient(Zend_Http_Client $httpClient)
- {
- self::$_httpClient = $httpClient;
- }
-
-
- /**
- * Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used.
- *
- * @return Zend_Http_Client_Abstract
- */
- public static function getHttpClient()
- {
- if (!self::$_httpClient instanceof Zend_Http_Client) {
- /**
- * @see Zend_Http_Client
- */
- require_once 'Zend/Http/Client.php';
- self::$_httpClient = new Zend_Http_Client();
- }
-
- return self::$_httpClient;
- }
-
-
- /**
- * Toggle using POST instead of PUT and DELETE HTTP methods
- *
- * Some feed implementations do not accept PUT and DELETE HTTP
- * methods, or they can't be used because of proxies or other
- * measures. This allows turning on using POST where PUT and
- * DELETE would normally be used; in addition, an
- * X-Method-Override header will be sent with a value of PUT or
- * DELETE as appropriate.
- *
- * @param boolean $override Whether to override PUT and DELETE.
- * @return void
- */
- public static function setHttpMethodOverride($override = true)
- {
- self::$_httpMethodOverride = $override;
- }
-
-
- /**
- * Get the HTTP override state
- *
- * @return boolean
- */
- public static function getHttpMethodOverride()
- {
- return self::$_httpMethodOverride;
- }
-
-
- /**
- * Get the full version of a namespace prefix
- *
- * Looks up a prefix (atom:, etc.) in the list of registered
- * namespaces and returns the full namespace URI if
- * available. Returns the prefix, unmodified, if it's not
- * registered.
- *
- * @return string
- */
- public static function lookupNamespace($prefix)
- {
- return isset(self::$_namespaces[$prefix]) ?
- self::$_namespaces[$prefix] :
- $prefix;
- }
-
-
- /**
- * Add a namespace and prefix to the registered list
- *
- * Takes a prefix and a full namespace URI and adds them to the
- * list of registered namespaces for use by
- * Zend_Feed::lookupNamespace().
- *
- * @param string $prefix The namespace prefix
- * @param string $namespaceURI The full namespace URI
- * @return void
- */
- public static function registerNamespace($prefix, $namespaceURI)
- {
- self::$_namespaces[$prefix] = $namespaceURI;
- }
-
-
- /**
- * Imports a feed located at $uri.
- *
- * @param string $uri
- * @throws Zend_Feed_Exception
- * @return Zend_Feed_Abstract
- */
- public static function import($uri)
- {
- $client = self::getHttpClient();
- $client->setUri($uri);
- $response = $client->request('GET');
- if ($response->getStatus() !== 200) {
- /**
- * @see Zend_Feed_Exception
- */
- require_once 'Zend/Feed/Exception.php';
- throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus());
- }
- $feed = $response->getBody();
- return self::importString($feed);
- }
-
-
- /**
- * Imports a feed represented by $string.
- *
- * @param string $string
- * @throws Zend_Feed_Exception
- * @return Zend_Feed_Abstract
- */
- public static function importString($string)
- {
- // Load the feed as an XML DOMDocument object
- @ini_set('track_errors', 1);
- $doc = new DOMDocument();
- $success = @$doc->loadXML($string);
- @ini_restore('track_errors');
-
- if (!$success) {
- /**
- * @see Zend_Feed_Exception
- */
- require_once 'Zend/Feed/Exception.php';
- throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg");
- }
-
- // Try to find the base feed element or a single <entry> of an Atom feed
- if ($doc->getElementsByTagName('feed')->item(0) ||
- $doc->getElementsByTagName('entry')->item(0)) {
- /**
- * @see Zend_Feed_Atom
- */
- require_once 'Zend/Feed/Atom.php';
- // return a newly created Zend_Feed_Atom object
- return new Zend_Feed_Atom(null, $string);
- }
-
- // Try to find the base feed element of an RSS feed
- if ($doc->getElementsByTagName('channel')->item(0)) {
- /**
- * @see Zend_Feed_Rss
- */
- require_once 'Zend/Feed/Rss.php';
- // return a newly created Zend_Feed_Rss object
- return new Zend_Feed_Rss(null, $string);
- }
-
- // $string does not appear to be a valid feed of the supported types
- /**
- * @see Zend_Feed_Exception
- */
- require_once 'Zend/Feed/Exception.php';
- throw new Zend_Feed_Exception('Invalid or unsupported feed format');
- }
-
-
- /**
- * Imports a feed from a file located at $filename.
- *
- * @param string $filename
- * @throws Zend_Feed_Exception
- * @return Zend_Feed_Abstract
- */
- public static function importFile($filename)
- {
- @ini_set('track_errors', 1);
- $feed = @file_get_contents($filename);
- @ini_restore('track_errors');
- if ($feed === false) {
- /**
- * @see Zend_Feed_Exception
- */
- require_once 'Zend/Feed/Exception.php';
- throw new Zend_Feed_Exception("File could not be loaded: $php_errormsg");
- }
- return self::importString($feed);
- }
-
-
- /**
- * Attempts to find feeds at $uri referenced by <link ... /> tags. Returns an
- * array of the feeds referenced at $uri.
- *
- * @todo Allow findFeeds() to follow one, but only one, code 302.
- *
- * @param string $uri
- * @throws Zend_Feed_Exception
- * @return array
- */
- public static function findFeeds($uri)
- {
- // Get the HTTP response from $uri and save the contents
- $client = self::getHttpClient();
- $client->setUri($uri);
- $response = $client->request();
- if ($response->getStatus() !== 200) {
- /**
- * @see Zend_Feed_Exception
- */
- require_once 'Zend/Feed/Exception.php';
- throw new Zend_Feed_Exception("Failed to access $uri, got response code " . $response->getStatus());
- }
- $contents = $response->getBody();
-
- // Parse the contents for appropriate <link ... /> tags
- @ini_set('track_errors', 1);
- $pattern = '~(<link[^>]+)/?>~i';
- $result = @preg_match_all($pattern, $contents, $matches);
- @ini_restore('track_errors');
- if ($result === false) {
- /**
- * @see Zend_Feed_Exception
- */
- require_once 'Zend/Feed/Exception.php';
- throw new Zend_Feed_Exception("Internal error: $php_errormsg");
- }
-
- // Try to fetch a feed for each link tag that appears to refer to a feed
- $feeds = array();
- if (isset($matches[1]) && count($matches[1]) > 0) {
- foreach ($matches[1] as $link) {
- // force string to be an utf-8 one
- if (!mb_check_encoding($link, 'UTF-8')) {
- $link = mb_convert_encoding($link, 'UTF-8');
- }
- $xml = @simplexml_load_string(rtrim($link, ' /') . ' />');
- if ($xml === false) {
- continue;
- }
- $attributes = $xml->attributes();
- if (!isset($attributes['rel']) || !@preg_match('~^(?:alternate|service\.feed)~i', $attributes['rel'])) {
- continue;
- }
- if (!isset($attributes['type']) ||
- !@preg_match('~^application/(?:atom|rss|rdf)\+xml~', $attributes['type'])) {
- continue;
- }
- if (!isset($attributes['href'])) {
- continue;
- }
- try {
- // checks if we need to canonize the given uri
- try {
- $uri = Zend_Uri::factory((string) $attributes['href']);
- } catch (Zend_Uri_Exception $e) {
- // canonize the uri
- $path = (string) $attributes['href'];
- $query = $fragment = '';
- if (substr($path, 0, 1) != '/') {
- // add the current root path to this one
- $path = rtrim($client->getUri()->getPath(), '/') . '/' . $path;
- }
- if (strpos($path, '?') !== false) {
- list($path, $query) = explode('?', $path, 2);
- }
- if (strpos($query, '#') !== false) {
- list($query, $fragment) = explode('#', $query, 2);
- }
- $uri = Zend_Uri::factory($client->getUri(true));
- $uri->setPath($path);
- $uri->setQuery($query);
- $uri->setFragment($fragment);
- }
-
- $feed = self::import($uri);
- } catch (Exception $e) {
- continue;
- }
- $feeds[] = $feed;
- }
- }
-
- // Return the fetched feeds
- return $feeds;
- }
-
- /**
- * Construct a new Zend_Feed_Abstract object from a custom array
- *
- * @param array $data
- * @param string $format (rss|atom) the requested output format
- * @return Zend_Feed_Abstract
- */
- public static function importArray(array $data, $format = 'atom')
- {
- $obj = 'Zend_Feed_' . ucfirst(strtolower($format));
- /**
- * @see Zend_Loader
- */
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($obj);
- Zend_Loader::loadClass('Zend_Feed_Builder');
-
- return new $obj(null, null, new Zend_Feed_Builder($data));
- }
-
- /**
- * Construct a new Zend_Feed_Abstract object from a Zend_Feed_Builder_Interface data source
- *
- * @param Zend_Feed_Builder_Interface $builder this object will be used to extract the data of the feed
- * @param string $format (rss|atom) the requested output format
- * @return Zend_Feed_Abstract
- */
- public static function importBuilder(Zend_Feed_Builder_Interface $builder, $format = 'atom')
- {
- $obj = 'Zend_Feed_' . ucfirst(strtolower($format));
- /**
- * @see Zend_Loader
- */
- require_once 'Zend/Loader.php';
- Zend_Loader::loadClass($obj);
-
- return new $obj(null, null, $builder);
- }
-}
diff --git a/libs/Zend/Feed/Abstract.php b/libs/Zend/Feed/Abstract.php
deleted file mode 100755
index d290e8ff49..0000000000
--- a/libs/Zend/Feed/Abstract.php
+++ /dev/null
@@ -1,242 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * @see Zend_Feed_Element
- */
-require_once 'Zend/Feed/Element.php';
-
-
-/**
- * The Zend_Feed_Abstract class is an abstract class representing feeds.
- *
- * Zend_Feed_Abstract implements two core PHP 5 interfaces: ArrayAccess and
- * Iterator. In both cases the collection being treated as an array is
- * considered to be the entry collection, such that iterating over the
- * feed takes you through each of the feed.s entries.
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-abstract class Zend_Feed_Abstract extends Zend_Feed_Element implements Iterator
-{
- /**
- * Current index on the collection of feed entries for the
- * Iterator implementation.
- *
- * @var integer
- */
- protected $_entryIndex = 0;
-
- /**
- * Cache of feed entries.
- *
- * @var array
- */
- protected $_entries;
-
- /**
- * Feed constructor
- *
- * The Zend_Feed_Abstract constructor takes the URI of a feed or a
- * feed represented as a string and loads it as XML.
- *
- * @throws Zend_Feed_Exception If loading the feed failed.
- *
- * @param string $uri The full URI of the feed to load, or NULL if not retrieved via HTTP or as an array.
- * @param string $string The feed as a string, or NULL if retrieved via HTTP or as an array.
- * @param Zend_Feed_Builder_Interface $builder The feed as a builder instance or NULL if retrieved as a string or via HTTP.
- * @return void
- */
- public function __construct($uri = null, $string = null, Zend_Feed_Builder_Interface $builder = null)
- {
- if ($uri !== null) {
- // Retrieve the feed via HTTP
- $client = Zend_Feed::getHttpClient();
- $client->setUri($uri);
- $response = $client->request('GET');
- if ($response->getStatus() !== 200) {
- throw new Zend_Feed_Exception('Feed failed to load, got response code ' . $response->getStatus());
- }
- $this->_element = $response->getBody();
- $this->__wakeup();
- } elseif ($string !== null) {
- // Retrieve the feed from $string
- $this->_element = $string;
- $this->__wakeup();
- } else {
- // Generate the feed from the array
- $header = $builder->getHeader();
- $this->_element = new DOMDocument('1.0', $header['charset']);
- $root = $this->_mapFeedHeaders($header);
- $this->_mapFeedEntries($root, $builder->getEntries());
- $this->_element = $root;
- $this->_buildEntryCache();
- }
- }
-
-
- /**
- * Load the feed as an XML DOMDocument object
- *
- * @return void
- */
- public function __wakeup()
- {
- @ini_set('track_errors', 1);
- $doc = new DOMDocument();
- $success = @$doc->loadXML($this->_element);
- @ini_restore('track_errors');
-
- if (!$success) {
- throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg");
- }
-
- $this->_element = $doc;
- }
-
-
- /**
- * Prepare for serialiation
- *
- * @return array
- */
- public function __sleep()
- {
- $this->_element = $this->saveXML();
-
- return array('_element');
- }
-
-
- /**
- * Cache the individual feed elements so they don't need to be
- * searched for on every operation.
- *
- * @return void
- */
- protected function _buildEntryCache()
- {
- $this->_entries = array();
- foreach ($this->_element->childNodes as $child) {
- if ($child->localName == $this->_entryElementName) {
- $this->_entries[] = $child;
- }
- }
- }
-
-
- /**
- * Get the number of entries in this feed object.
- *
- * @return integer Entry count.
- */
- public function count()
- {
- return count($this->_entries);
- }
-
-
- /**
- * Required by the Iterator interface.
- *
- * @return void
- */
- public function rewind()
- {
- $this->_entryIndex = 0;
- }
-
-
- /**
- * Required by the Iterator interface.
- *
- * @return mixed The current row, or null if no rows.
- */
- public function current()
- {
- return new $this->_entryClassName(
- null,
- $this->_entries[$this->_entryIndex]);
- }
-
-
- /**
- * Required by the Iterator interface.
- *
- * @return mixed The current row number (starts at 0), or NULL if no rows
- */
- public function key()
- {
- return $this->_entryIndex;
- }
-
-
- /**
- * Required by the Iterator interface.
- *
- * @return mixed The next row, or null if no more rows.
- */
- public function next()
- {
- ++$this->_entryIndex;
- }
-
-
- /**
- * Required by the Iterator interface.
- *
- * @return boolean Whether the iteration is valid
- */
- public function valid()
- {
- return 0 <= $this->_entryIndex && $this->_entryIndex < $this->count();
- }
-
- /**
- * Generate the header of the feed when working in write mode
- *
- * @param array $array the data to use
- * @return DOMElement root node
- */
- abstract protected function _mapFeedHeaders($array);
-
- /**
- * Generate the entries of the feed when working in write mode
- *
- * @param DOMElement $root the root node to use
- * @param array $array the data to use
- * @return DOMElement root node
- */
- abstract protected function _mapFeedEntries(DOMElement $root, $array);
-
- /**
- * Send feed to a http client with the correct header
- *
- * @throws Zend_Feed_Exception if headers have already been sent
- * @return void
- */
- abstract public function send();
-}
diff --git a/libs/Zend/Feed/Atom.php b/libs/Zend/Feed/Atom.php
deleted file mode 100755
index 0225843a16..0000000000
--- a/libs/Zend/Feed/Atom.php
+++ /dev/null
@@ -1,381 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * @see Zend_Feed_Abstract
- */
-require_once 'Zend/Feed/Abstract.php';
-
-/**
- * @see Zend_Feed_Entry_Atom
- */
-require_once 'Zend/Feed/Entry/Atom.php';
-
-
-/**
- * Atom feed class
- *
- * The Zend_Feed_Atom class is a concrete subclass of the general
- * Zend_Feed_Abstract class, tailored for representing an Atom
- * feed. It shares all of the same methods with its abstract
- * parent. The distinction is made in the format of data that
- * Zend_Feed_Atom expects, and as a further pointer for users as to
- * what kind of feed object they have been passed.
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Feed_Atom extends Zend_Feed_Abstract
-{
-
- /**
- * The classname for individual feed elements.
- *
- * @var string
- */
- protected $_entryClassName = 'Zend_Feed_Entry_Atom';
-
- /**
- * The element name for individual feed elements (Atom <entry>
- * elements).
- *
- * @var string
- */
- protected $_entryElementName = 'entry';
-
- /**
- * The default namespace for Atom feeds.
- *
- * @var string
- */
- protected $_defaultNamespace = 'atom';
-
-
- /**
- * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases.
- *
- * @return void
- */
- public function __wakeup()
- {
- parent::__wakeup();
-
- // Find the base feed element and create an alias to it.
- $element = $this->_element->getElementsByTagName('feed')->item(0);
- if (!$element) {
- // Try to find a single <entry> instead.
- $element = $this->_element->getElementsByTagName($this->_entryElementName)->item(0);
- if (!$element) {
- throw new Zend_Feed_Exception('No root <feed> or <' . $this->_entryElementName
- . '> element found, cannot parse feed.');
- }
-
- $doc = new DOMDocument($this->_element->version,
- $this->_element->actualEncoding);
- $feed = $doc->appendChild($doc->createElement('feed'));
- $feed->appendChild($doc->importNode($element, true));
- $element = $feed;
- }
-
- $this->_element = $element;
-
- // Find the entries and save a pointer to them for speed and
- // simplicity.
- $this->_buildEntryCache();
- }
-
-
- /**
- * Easy access to <link> tags keyed by "rel" attributes.
- *
- * If $elt->link() is called with no arguments, we will attempt to
- * return the value of the <link> tag(s) like all other
- * method-syntax attribute access. If an argument is passed to
- * link(), however, then we will return the "href" value of the
- * first <link> tag that has a "rel" attribute matching $rel:
- *
- * $elt->link(): returns the value of the link tag.
- * $elt->link('self'): returns the href from the first <link rel="self"> in the entry.
- *
- * @param string $rel The "rel" attribute to look for.
- * @return mixed
- */
- public function link($rel = null)
- {
- if ($rel === null) {
- return parent::__call('link', null);
- }
-
- // index link tags by their "rel" attribute.
- $links = parent::__get('link');
- if (!is_array($links)) {
- if ($links instanceof Zend_Feed_Element) {
- $links = array($links);
- } else {
- return $links;
- }
- }
-
- foreach ($links as $link) {
- if (empty($link['rel'])) {
- continue;
- }
- if ($rel == $link['rel']) {
- return $link['href'];
- }
- }
-
- return null;
- }
-
-
- /**
- * Make accessing some individual elements of the feed easier.
- *
- * Special accessors 'entry' and 'entries' are provided so that if
- * you wish to iterate over an Atom feed's entries, you can do so
- * using foreach ($feed->entries as $entry) or foreach
- * ($feed->entry as $entry).
- *
- * @param string $var The property to access.
- * @return mixed
- */
- public function __get($var)
- {
- switch ($var) {
- case 'entry':
- // fall through to the next case
- case 'entries':
- return $this;
-
- default:
- return parent::__get($var);
- }
- }
-
- /**
- * Generate the header of the feed when working in write mode
- *
- * @param array $array the data to use
- * @return DOMElement root node
- */
- protected function _mapFeedHeaders($array)
- {
- $feed = $this->_element->createElement('feed');
- $feed->setAttribute('xmlns', 'http://www.w3.org/2005/Atom');
-
- $id = $this->_element->createElement('id', $array->link);
- $feed->appendChild($id);
-
- $title = $this->_element->createElement('title');
- $title->appendChild($this->_element->createCDATASection($array->title));
- $feed->appendChild($title);
-
- if (isset($array->author)) {
- $author = $this->_element->createElement('author');
- $name = $this->_element->createElement('name', $array->author);
- $author->appendChild($name);
- if (isset($array->email)) {
- $email = $this->_element->createElement('email', $array->email);
- $author->appendChild($email);
- }
- $feed->appendChild($author);
- }
-
- $updated = isset($array->lastUpdate) ? $array->lastUpdate : time();
- $updated = $this->_element->createElement('updated', date(DATE_ATOM, $updated));
- $feed->appendChild($updated);
-
- if (isset($array->published)) {
- $published = $this->_element->createElement('published', date(DATE_ATOM, $array->published));
- $feed->appendChild($published);
- }
-
- $link = $this->_element->createElement('link');
- $link->setAttribute('rel', 'self');
- $link->setAttribute('href', $array->link);
- if (isset($array->language)) {
- $link->setAttribute('hreflang', $array->language);
- }
- $feed->appendChild($link);
-
- if (isset($array->description)) {
- $subtitle = $this->_element->createElement('subtitle');
- $subtitle->appendChild($this->_element->createCDATASection($array->description));
- $feed->appendChild($subtitle);
- }
-
- if (isset($array->copyright)) {
- $copyright = $this->_element->createElement('rights', $array->copyright);
- $feed->appendChild($copyright);
- }
-
- if (isset($array->image)) {
- $image = $this->_element->createElement('logo', $array->image);
- $feed->appendChild($image);
- }
-
- $generator = !empty($array->generator) ? $array->generator : 'Zend_Feed';
- $generator = $this->_element->createElement('generator', $generator);
- $feed->appendChild($generator);
-
- return $feed;
- }
-
- /**
- * Generate the entries of the feed when working in write mode
- *
- * The following nodes are constructed for each feed entry
- * <entry>
- * <id>url to feed entry</id>
- * <title>entry title</title>
- * <updated>last update</updated>
- * <link rel="alternate" href="url to feed entry" />
- * <summary>short text</summary>
- * <content>long version, can contain html</content>
- * </entry>
- *
- * @param array $array the data to use
- * @param DOMElement $root the root node to use
- * @return void
- */
- protected function _mapFeedEntries(DOMElement $root, $array)
- {
- foreach ($array as $dataentry) {
- $entry = $this->_element->createElement('entry');
-
- $id = $this->_element->createElement('id', isset($dataentry->guid) ? $dataentry->guid : $dataentry->link);
- $entry->appendChild($id);
-
- $title = $this->_element->createElement('title');
- $title->appendChild($this->_element->createCDATASection($dataentry->title));
- $entry->appendChild($title);
-
- $updated = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time();
- $updated = $this->_element->createElement('updated', date(DATE_ATOM, $updated));
- $entry->appendChild($updated);
-
- $link = $this->_element->createElement('link');
- $link->setAttribute('rel', 'alternate');
- $link->setAttribute('href', $dataentry->link);
- $entry->appendChild($link);
-
- $summary = $this->_element->createElement('summary');
- $summary->appendChild($this->_element->createCDATASection($dataentry->description));
- $entry->appendChild($summary);
-
- if (isset($dataentry->content)) {
- $content = $this->_element->createElement('content');
- $content->setAttribute('type', 'html');
- $content->appendChild($this->_element->createCDATASection($dataentry->content));
- $entry->appendChild($content);
- }
-
- if (isset($dataentry->category)) {
- foreach ($dataentry->category as $category) {
- $node = $this->_element->createElement('category');
- $node->setAttribute('term', $category['term']);
- if (isset($category['scheme'])) {
- $node->setAttribute('scheme', $category['scheme']);
- }
- $entry->appendChild($node);
- }
- }
-
- if (isset($dataentry->source)) {
- $source = $this->_element->createElement('source');
- $title = $this->_element->createElement('title', $dataentry->source['title']);
- $source->appendChild($title);
- $link = $this->_element->createElement('link', $dataentry->source['title']);
- $link->setAttribute('rel', 'alternate');
- $link->setAttribute('href', $dataentry->source['url']);
- $source->appendChild($link);
- }
-
- if (isset($dataentry->enclosure)) {
- foreach ($dataentry->enclosure as $enclosure) {
- $node = $this->_element->createElement('link');
- $node->setAttribute('rel', 'enclosure');
- $node->setAttribute('href', $enclosure['url']);
- if (isset($enclosure['type'])) {
- $node->setAttribute('type', $enclosure['type']);
- }
- if (isset($enclosure['length'])) {
- $node->setAttribute('length', $enclosure['length']);
- }
- $entry->appendChild($node);
- }
- }
-
- if (isset($dataentry->comments)) {
- $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/',
- 'wfw:comment',
- $dataentry->comments);
- $entry->appendChild($comments);
- }
- if (isset($dataentry->commentRss)) {
- $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/',
- 'wfw:commentRss',
- $dataentry->commentRss);
- $entry->appendChild($comments);
- }
-
- $root->appendChild($entry);
- }
- }
-
- /**
- * Override Zend_Feed_Element to allow formated feeds
- *
- * @return string
- */
- public function saveXML()
- {
- // Return a complete document including XML prologue.
- $doc = new DOMDocument($this->_element->ownerDocument->version,
- $this->_element->ownerDocument->actualEncoding);
- $doc->appendChild($doc->importNode($this->_element, true));
- $doc->formatOutput = true;
-
- return $doc->saveXML();
- }
-
- /**
- * Send feed to a http client with the correct header
- *
- * @throws Zend_Feed_Exception if headers have already been sent
- * @return void
- */
- public function send()
- {
- if (headers_sent()) {
- throw new Zend_Feed_Exception('Cannot send ATOM because headers have already been sent.');
- }
-
- header('Content-type: application/atom+xml; charset: ' . $this->_element->ownerDocument->actualEncoding);
-
- echo $this->saveXML();
- }
-}
diff --git a/libs/Zend/Feed/Builder.php b/libs/Zend/Feed/Builder.php
deleted file mode 100755
index 1503046abb..0000000000
--- a/libs/Zend/Feed/Builder.php
+++ /dev/null
@@ -1,383 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * @see Zend_Feed_Builder_Interface
- */
-require_once 'Zend/Feed/Builder/Interface.php';
-
-
-/**
- * @see Zend_Feed_Builder_Header
- */
-require_once 'Zend/Feed/Builder/Header.php';
-
-
-/**
- * @see Zend_Feed_Builder_Entry
- */
-require_once 'Zend/Feed/Builder/Entry.php';
-
-
-/**
- * @see Zend_Feed_Exception
- */
-require_once 'Zend/Feed/Exception.php';
-
-
-/**
- * A simple implementation of Zend_Feed_Builder_Interface.
- *
- * Users are encouraged to make their own classes to implement Zend_Feed_Builder_Interface
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Feed_Builder implements Zend_Feed_Builder_Interface
-{
- /**
- * The data of the feed
- *
- * @var $_data array
- */
- private $_data;
-
- /**
- * Header of the feed
- *
- * @var $_header Zend_Feed_Builder_Header
- */
- private $_header;
-
- /**
- * List of the entries of the feed
- *
- * @var $_entries array
- */
- private $_entries = array();
-
- /**
- * Constructor. The $data array must conform to the following format:
- * <code>
- * array(
- * 'title' => 'title of the feed', //required
- * 'link' => 'canonical url to the feed', //required
- * 'lastUpdate' => 'timestamp of the update date', // optional
- * 'published' => 'timestamp of the publication date', //optional
- * 'charset' => 'charset', // required
- * 'description' => 'short description of the feed', //optional
- * 'author' => 'author/publisher of the feed', //optional
- * 'email' => 'email of the author', //optional
- * 'webmaster' => 'email address for person responsible for technical issues' // optional, ignored if atom is used
- * 'copyright' => 'copyright notice', //optional
- * 'image' => 'url to image', //optional
- * 'generator' => 'generator', // optional
- * 'language' => 'language the feed is written in', // optional
- * 'ttl' => 'how long in minutes a feed can be cached before refreshing', // optional, ignored if atom is used
- * 'rating' => 'The PICS rating for the channel.', // optional, ignored if atom is used
- * 'cloud' => array(
- * 'domain' => 'domain of the cloud, e.g. rpc.sys.com' // required
- * 'port' => 'port to connect to' // optional, default to 80
- * 'path' => 'path of the cloud, e.g. /RPC2 //required
- * 'registerProcedure' => 'procedure to call, e.g. myCloud.rssPleaseNotify' // required
- * 'protocol' => 'protocol to use, e.g. soap or xml-rpc' // required
- * ), a cloud to be notified of updates // optional, ignored if atom is used
- * 'textInput' => array(
- * 'title' => 'the label of the Submit button in the text input area' // required,
- * 'description' => 'explains the text input area' // required
- * 'name' => 'the name of the text object in the text input area' // required
- * 'link' => 'the URL of the CGI script that processes text input requests' // required
- * ) // a text input box that can be displayed with the feed // optional, ignored if atom is used
- * 'skipHours' => array(
- * 'hour in 24 format', // e.g 13 (1pm)
- * // up to 24 rows whose value is a number between 0 and 23
- * ) // Hint telling aggregators which hours they can skip // optional, ignored if atom is used
- * 'skipDays ' => array(
- * 'a day to skip', // e.g Monday
- * // up to 7 rows whose value is a Monday, Tuesday, Wednesday, Thursday, Friday, Saturday or Sunday
- * ) // Hint telling aggregators which days they can skip // optional, ignored if atom is used
- * 'itunes' => array(
- * 'author' => 'Artist column' // optional, default to the main author value
- * 'owner' => array(
- * 'name' => 'name of the owner' // optional, default to main author value
- * 'email' => 'email of the owner' // optional, default to main email value
- * ) // Owner of the podcast // optional
- * 'image' => 'album/podcast art' // optional, default to the main image value
- * 'subtitle' => 'short description' // optional, default to the main description value
- * 'summary' => 'longer description' // optional, default to the main description value
- * 'block' => 'Prevent an episode from appearing (yes|no)' // optional
- * 'category' => array(
- * array('main' => 'main category', // required
- * 'sub' => 'sub category' // optional
- * ),
- * // up to 3 rows
- * ) // 'Category column and in iTunes Music Store Browse' // required
- * 'explicit' => 'parental advisory graphic (yes|no|clean)' // optional
- * 'keywords' => 'a comma separated list of 12 keywords maximum' // optional
- * 'new-feed-url' => 'used to inform iTunes of new feed URL location' // optional
- * ) // Itunes extension data // optional, ignored if atom is used
- * 'entries' => array(
- * array(
- * 'title' => 'title of the feed entry', //required
- * 'link' => 'url to a feed entry', //required
- * 'description' => 'short version of a feed entry', // only text, no html, required
- * 'guid' => 'id of the article, if not given link value will used', //optional
- * 'content' => 'long version', // can contain html, optional
- * 'lastUpdate' => 'timestamp of the publication date', // optional
- * 'comments' => 'comments page of the feed entry', // optional
- * 'commentRss' => 'the feed url of the associated comments', // optional
- * 'source' => array(
- * 'title' => 'title of the original source' // required,
- * 'url' => 'url of the original source' // required
- * ) // original source of the feed entry // optional
- * 'category' => array(
- * array(
- * 'term' => 'first category label' // required,
- * 'scheme' => 'url that identifies a categorization scheme' // optional
- * ),
- * array(
- * //data for the second category and so on
- * )
- * ) // list of the attached categories // optional
- * 'enclosure' => array(
- * array(
- * 'url' => 'url of the linked enclosure' // required
- * 'type' => 'mime type of the enclosure' // optional
- * 'length' => 'length of the linked content in octets' // optional
- * ),
- * array(
- * //data for the second enclosure and so on
- * )
- * ) // list of the enclosures of the feed entry // optional
- * ),
- * array(
- * //data for the second entry and so on
- * )
- * )
- * );
- * </code>
- *
- * @param array $data
- * @return void
- */
- public function __construct(array $data)
- {
- $this->_data = $data;
- $this->_createHeader($data);
- if (isset($data['entries'])) {
- $this->_createEntries($data['entries']);
- }
- }
-
- /**
- * Returns an instance of Zend_Feed_Builder_Header
- * describing the header of the feed
- *
- * @return Zend_Feed_Builder_Header
- */
- public function getHeader()
- {
- return $this->_header;
- }
-
- /**
- * Returns an array of Zend_Feed_Builder_Entry instances
- * describing the entries of the feed
- *
- * @return array of Zend_Feed_Builder_Entry
- */
- public function getEntries()
- {
- return $this->_entries;
- }
-
- /**
- * Create the Zend_Feed_Builder_Header instance
- *
- * @param array $data
- * @throws Zend_Feed_Builder_Exception
- * @return void
- */
- private function _createHeader(array $data)
- {
- $mandatories = array('title', 'link', 'charset');
- foreach ($mandatories as $mandatory) {
- if (!isset($data[$mandatory])) {
- throw new Zend_Feed_Builder_Exception("$mandatory key is missing");
- }
- }
- $this->_header = new Zend_Feed_Builder_Header($data['title'], $data['link'], $data['charset']);
- if (isset($data['lastUpdate'])) {
- $this->_header->setLastUpdate($data['lastUpdate']);
- }
- if (isset($data['published'])) {
- $this->_header->setPublishedDate($data['published']);
- }
- if (isset($data['description'])) {
- $this->_header->setDescription($data['description']);
- }
- if (isset($data['author'])) {
- $this->_header->setAuthor($data['author']);
- }
- if (isset($data['email'])) {
- $this->_header->setEmail($data['email']);
- }
- if (isset($data['webmaster'])) {
- $this->_header->setWebmaster($data['webmaster']);
- }
- if (isset($data['copyright'])) {
- $this->_header->setCopyright($data['copyright']);
- }
- if (isset($data['image'])) {
- $this->_header->setImage($data['image']);
- }
- if (isset($data['generator'])) {
- $this->_header->setGenerator($data['generator']);
- }
- if (isset($data['language'])) {
- $this->_header->setLanguage($data['language']);
- }
- if (isset($data['ttl'])) {
- $this->_header->setTtl($data['ttl']);
- }
- if (isset($data['rating'])) {
- $this->_header->setRating($data['rating']);
- }
- if (isset($data['cloud'])) {
- $mandatories = array('domain', 'path', 'registerProcedure', 'protocol');
- foreach ($mandatories as $mandatory) {
- if (!isset($data['cloud'][$mandatory])) {
- throw new Zend_Feed_Builder_Exception("you have to define $mandatory property of your cloud");
- }
- }
- $uri_str = 'http://' . $data['cloud']['domain'] . $data['cloud']['path'];
- $this->_header->setCloud($uri_str, $data['cloud']['registerProcedure'], $data['cloud']['protocol']);
- }
- if (isset($data['textInput'])) {
- $mandatories = array('title', 'description', 'name', 'link');
- foreach ($mandatories as $mandatory) {
- if (!isset($data['textInput'][$mandatory])) {
- throw new Zend_Feed_Builder_Exception("you have to define $mandatory property of your textInput");
- }
- }
- $this->_header->setTextInput($data['textInput']['title'],
- $data['textInput']['description'],
- $data['textInput']['name'],
- $data['textInput']['link']);
- }
- if (isset($data['skipHours'])) {
- $this->_header->setSkipHours($data['skipHours']);
- }
- if (isset($data['skipDays'])) {
- $this->_header->setSkipDays($data['skipDays']);
- }
- if (isset($data['itunes'])) {
- $itunes = new Zend_Feed_Builder_Header_Itunes($data['itunes']['category']);
- if (isset($data['itunes']['author'])) {
- $itunes->setAuthor($data['itunes']['author']);
- }
- if (isset($data['itunes']['owner'])) {
- $name = isset($data['itunes']['owner']['name']) ? $data['itunes']['owner']['name'] : '';
- $email = isset($data['itunes']['owner']['email']) ? $data['itunes']['owner']['email'] : '';
- $itunes->setOwner($name, $email);
- }
- if (isset($data['itunes']['image'])) {
- $itunes->setImage($data['itunes']['image']);
- }
- if (isset($data['itunes']['subtitle'])) {
- $itunes->setSubtitle($data['itunes']['subtitle']);
- }
- if (isset($data['itunes']['summary'])) {
- $itunes->setSummary($data['itunes']['summary']);
- }
- if (isset($data['itunes']['block'])) {
- $itunes->setBlock($data['itunes']['block']);
- }
- if (isset($data['itunes']['explicit'])) {
- $itunes->setExplicit($data['itunes']['explicit']);
- }
- if (isset($data['itunes']['keywords'])) {
- $itunes->setKeywords($data['itunes']['keywords']);
- }
- if (isset($data['itunes']['new-feed-url'])) {
- $itunes->setNewFeedUrl($data['itunes']['new-feed-url']);
- }
-
- $this->_header->setITunes($itunes);
- }
- }
-
- /**
- * Create the array of article entries
- *
- * @param array $data
- * @throws Zend_Feed_Builder_Exception
- * @return void
- */
- private function _createEntries(array $data)
- {
- foreach ($data as $row) {
- $mandatories = array('title', 'link', 'description');
- foreach ($mandatories as $mandatory) {
- if (!isset($row[$mandatory])) {
- throw new Zend_Feed_Builder_Exception("$mandatory key is missing");
- }
- }
- $entry = new Zend_Feed_Builder_Entry($row['title'], $row['link'], $row['description']);
- if (isset($row['guid'])) {
- $entry->setId($row['guid']);
- }
- if (isset($row['content'])) {
- $entry->setContent($row['content']);
- }
- if (isset($row['lastUpdate'])) {
- $entry->setLastUpdate($row['lastUpdate']);
- }
- if (isset($row['comments'])) {
- $entry->setCommentsUrl($row['comments']);
- }
- if (isset($row['commentRss'])) {
- $entry->setCommentsRssUrl($row['commentRss']);
- }
- if (isset($row['source'])) {
- $mandatories = array('title', 'url');
- foreach ($mandatories as $mandatory) {
- if (!isset($row['source'][$mandatory])) {
- throw new Zend_Feed_Builder_Exception("$mandatory key of source property is missing");
- }
- }
- $entry->setSource($row['source']['title'], $row['source']['url']);
- }
- if (isset($row['category'])) {
- $entry->setCategories($row['category']);
- }
- if (isset($row['enclosure'])) {
- $entry->setEnclosures($row['enclosure']);
- }
-
- $this->_entries[] = $entry;
- }
- }
-} \ No newline at end of file
diff --git a/libs/Zend/Feed/Builder/Entry.php b/libs/Zend/Feed/Builder/Entry.php
deleted file mode 100755
index cd04c8b9a9..0000000000
--- a/libs/Zend/Feed/Builder/Entry.php
+++ /dev/null
@@ -1,283 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * @see Zend_Feed_Builder_Exception
- */
-require_once 'Zend/Feed/Builder/Exception.php';
-
-
-/**
- * An entry of a custom build feed
- *
- * Classes implementing the Zend_Feed_Builder_Interface interface
- * uses this class to describe an entry of a feed
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Feed_Builder_Entry extends ArrayObject
-{
- /**
- * Create a new builder entry
- *
- * @param string $title
- * @param string $link
- * @param string $description short version of the entry, no html
- * @return void
- */
- public function __construct($title, $link, $description)
- {
- $this->offsetSet('title', $title);
- $this->offsetSet('link', $link);
- $this->offsetSet('description', $description);
- $this->setLastUpdate(time());
- }
-
- /**
- * Read only properties accessor
- *
- * @param string $name property to read
- * @return mixed
- */
- public function __get($name)
- {
- if (!$this->offsetExists($name)) {
- return NULL;
- }
-
- return $this->offsetGet($name);
- }
-
- /**
- * Write properties accessor
- *
- * @param string $name name of the property to set
- * @param mixed $value value to set
- * @return void
- */
- public function __set($name, $value)
- {
- $this->offsetSet($name, $value);
- }
-
- /**
- * Isset accessor
- *
- * @param string $key
- * @return boolean
- */
- public function __isset($key)
- {
- return $this->offsetExists($key);
- }
-
- /**
- * Unset accessor
- *
- * @param string $key
- * @return void
- */
- public function __unset($key)
- {
- if ($this->offsetExists($key)) {
- $this->offsetUnset($key);
- }
- }
-
- /**
- * Sets the id/guid of the entry
- *
- * @param string $id
- * @return Zend_Feed_Builder_Entry
- */
- public function setId($id)
- {
- $this->offsetSet('guid', $id);
- return $this;
- }
-
- /**
- * Sets the full html content of the entry
- *
- * @param string $content
- * @return Zend_Feed_Builder_Entry
- */
- public function setContent($content)
- {
- $this->offsetSet('content', $content);
- return $this;
- }
-
- /**
- * Timestamp of the update date
- *
- * @param int $lastUpdate
- * @return Zend_Feed_Builder_Entry
- */
- public function setLastUpdate($lastUpdate)
- {
- $this->offsetSet('lastUpdate', $lastUpdate);
- return $this;
- }
-
- /**
- * Sets the url of the commented page associated to the entry
- *
- * @param string $comments
- * @return Zend_Feed_Builder_Entry
- */
- public function setCommentsUrl($comments)
- {
- $this->offsetSet('comments', $comments);
- return $this;
- }
-
- /**
- * Sets the url of the comments feed link
- *
- * @param string $commentRss
- * @return Zend_Feed_Builder_Entry
- */
- public function setCommentsRssUrl($commentRss)
- {
- $this->offsetSet('commentRss', $commentRss);
- return $this;
- }
-
- /**
- * Defines a reference to the original source
- *
- * @param string $title
- * @param string $url
- * @return Zend_Feed_Builder_Entry
- */
- public function setSource($title, $url)
- {
- $this->offsetSet('source', array('title' => $title,
- 'url' => $url));
- return $this;
- }
-
- /**
- * Sets the categories of the entry
- * Format of the array:
- * <code>
- * array(
- * array(
- * 'term' => 'first category label',
- * 'scheme' => 'url that identifies a categorization scheme' // optional
- * ),
- * // second category and so one
- * )
- * </code>
- *
- * @param array $categories
- * @return Zend_Feed_Builder_Entry
- */
- public function setCategories(array $categories)
- {
- foreach ($categories as $category) {
- $this->addCategory($category);
- }
- return $this;
- }
-
- /**
- * Add a category to the entry
- *
- * @param array $category see Zend_Feed_Builder_Entry::setCategories() for format
- * @return Zend_Feed_Builder_Entry
- * @throws Zend_Feed_Builder_Exception
- */
- public function addCategory(array $category)
- {
- if (empty($category['term'])) {
- throw new Zend_Feed_Builder_Exception("you have to define the name of the category");
- }
-
- if (!$this->offsetExists('category')) {
- $categories = array($category);
- } else {
- $categories = $this->offsetGet('category');
- $categories[] = $category;
- }
- $this->offsetSet('category', $categories);
- return $this;
- }
-
- /**
- * Sets the enclosures of the entry
- * Format of the array:
- * <code>
- * array(
- * array(
- * 'url' => 'url of the linked enclosure',
- * 'type' => 'mime type of the enclosure' // optional
- * 'length' => 'length of the linked content in octets' // optional
- * ),
- * // second enclosure and so one
- * )
- * </code>
- *
- * @param array $enclosures
- * @return Zend_Feed_Builder_Entry
- * @throws Zend_Feed_Builder_Exception
- */
- public function setEnclosures(array $enclosures)
- {
- foreach ($enclosures as $enclosure) {
- if (empty($enclosure['url'])) {
- throw new Zend_Feed_Builder_Exception("you have to supply an url for your enclosure");
- }
- $type = isset($enclosure['type']) ? $enclosure['type'] : '';
- $length = isset($enclosure['length']) ? $enclosure['length'] : '';
- $this->addEnclosure($enclosure['url'], $type, $length);
- }
- return $this;
- }
-
- /**
- * Add an enclosure to the entry
- *
- * @param string $url
- * @param string $type
- * @param string $length
- * @return Zend_Feed_Builder_Entry
- */
- public function addEnclosure($url, $type = '', $length = '')
- {
- if (!$this->offsetExists('enclosure')) {
- $enclosure = array();
- } else {
- $enclosure = $this->offsetGet('enclosure');
- }
- $enclosure[] = array('url' => $url,
- 'type' => $type,
- 'length' => $length);
- $this->offsetSet('enclosure', $enclosure);
- return $this;
- }
-}
diff --git a/libs/Zend/Feed/Builder/Exception.php b/libs/Zend/Feed/Builder/Exception.php
deleted file mode 100755
index 5ef4523539..0000000000
--- a/libs/Zend/Feed/Builder/Exception.php
+++ /dev/null
@@ -1,40 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * @see Zend_Feed_Exception
- */
-require_once 'Zend/Feed/Exception.php';
-
-
-/**
- * Zend_Feed_Builder exception class
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Feed_Builder_Exception extends Zend_Feed_Exception
-{
-}
diff --git a/libs/Zend/Feed/Builder/Header.php b/libs/Zend/Feed/Builder/Header.php
deleted file mode 100755
index 4f791b4468..0000000000
--- a/libs/Zend/Feed/Builder/Header.php
+++ /dev/null
@@ -1,396 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-
-/**
- * @see Zend_Feed_Builder_Exception
- */
-require_once 'Zend/Feed/Builder/Exception.php';
-
-
-/**
- * @see Zend_Feed_Builder_Header_Itunes
- */
-require_once 'Zend/Feed/Builder/Header/Itunes.php';
-
-
-/**
- * @see Zend_Uri
- */
-require_once 'Zend/Uri.php';
-
-
-/**
- * Header of a custom build feed
- *
- * Classes implementing the Zend_Feed_Builder_Interface interface
- * uses this class to describe the header of a feed
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Feed_Builder_Header extends ArrayObject
-{
- /**
- * Constructor
- *
- * @param string $title title of the feed
- * @param string $link canonical url of the feed
- * @param string $charset charset of the textual data
- * @return void
- */
- public function __construct($title, $link, $charset = 'utf-8')
- {
- $this->offsetSet('title', $title);
- $this->offsetSet('link', $link);
- $this->offsetSet('charset', $charset);
- $this->setLastUpdate(time())
- ->setGenerator('Zend_Feed');
- }
-
- /**
- * Read only properties accessor
- *
- * @param string $name property to read
- * @return mixed
- */
- public function __get($name)
- {
- if (!$this->offsetExists($name)) {
- return NULL;
- }
-
- return $this->offsetGet($name);
- }
-
- /**
- * Write properties accessor
- *
- * @param string $name name of the property to set
- * @param mixed $value value to set
- * @return void
- */
- public function __set($name, $value)
- {
- $this->offsetSet($name, $value);
- }
-
- /**
- * Isset accessor
- *
- * @param string $key
- * @return boolean
- */
- public function __isset($key)
- {
- return $this->offsetExists($key);
- }
-
- /**
- * Unset accessor
- *
- * @param string $key
- * @return void
- */
- public function __unset($key)
- {
- if ($this->offsetExists($key)) {
- $this->offsetUnset($key);
- }
- }
-
- /**
- * Timestamp of the update date
- *
- * @param int $lastUpdate
- * @return Zend_Feed_Builder_Header
- */
- public function setLastUpdate($lastUpdate)
- {
- $this->offsetSet('lastUpdate', $lastUpdate);
- return $this;
- }
-
- /**
- * Timestamp of the publication date
- *
- * @param int $published
- * @return Zend_Feed_Builder_Header
- */
- public function setPublishedDate($published)
- {
- $this->offsetSet('published', $published);
- return $this;
- }
-
- /**
- * Short description of the feed
- *
- * @param string $description
- * @return Zend_Feed_Builder_Header
- */
- public function setDescription($description)
- {
- $this->offsetSet('description', $description);
- return $this;
- }
-
- /**
- * Sets the author of the feed
- *
- * @param string $author
- * @return Zend_Feed_Builder_Header
- */
- public function setAuthor($author)
- {
- $this->offsetSet('author', $author);
- return $this;
- }
-
- /**
- * Sets the author's email
- *
- * @param string $email
- * @return Zend_Feed_Builder_Header
- * @throws Zend_Feed_Builder_Exception
- */
- public function setEmail($email)
- {
- Zend_Loader::loadClass('Zend_Validate_EmailAddress');
- $validate = new Zend_Validate_EmailAddress();
- if (!$validate->isValid($email)) {
- throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the email property");
- }
- $this->offsetSet('email', $email);
- return $this;
- }
-
- /**
- * Sets the copyright notice
- *
- * @param string $copyright
- * @return Zend_Feed_Builder_Header
- */
- public function setCopyright($copyright)
- {
- $this->offsetSet('copyright', $copyright);
- return $this;
- }
-
- /**
- * Sets the image of the feed
- *
- * @param string $image
- * @return Zend_Feed_Builder_Header
- */
- public function setImage($image)
- {
- $this->offsetSet('image', $image);
- return $this;
- }
-
- /**
- * Sets the generator of the feed
- *
- * @param string $generator
- * @return Zend_Feed_Builder_Header
- */
- public function setGenerator($generator)
- {
- $this->offsetSet('generator', $generator);
- return $this;
- }
-
- /**
- * Sets the language of the feed
- *
- * @param string $language
- * @return Zend_Feed_Builder_Header
- */
- public function setLanguage($language)
- {
- $this->offsetSet('language', $language);
- return $this;
- }
-
- /**
- * Email address for person responsible for technical issues
- * Ignored if atom is used
- *
- * @param string $webmaster
- * @return Zend_Feed_Builder_Header
- * @throws Zend_Feed_Builder_Exception
- */
- public function setWebmaster($webmaster)
- {
- Zend_Loader::loadClass('Zend_Validate_EmailAddress');
- $validate = new Zend_Validate_EmailAddress();
- if (!$validate->isValid($webmaster)) {
- throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the webmaster property");
- }
- $this->offsetSet('webmaster', $webmaster);
- return $this;
- }
-
- /**
- * How long in minutes a feed can be cached before refreshing
- * Ignored if atom is used
- *
- * @param int $ttl
- * @return Zend_Feed_Builder_Header
- * @throws Zend_Feed_Builder_Exception
- */
- public function setTtl($ttl)
- {
- Zend_Loader::loadClass('Zend_Validate_Int');
- $validate = new Zend_Validate_Int();
- if (!$validate->isValid($ttl)) {
- throw new Zend_Feed_Builder_Exception("you have to set an integer value to the ttl property");
- }
- $this->offsetSet('ttl', $ttl);
- return $this;
- }
-
- /**
- * PICS rating for the feed
- * Ignored if atom is used
- *
- * @param string $rating
- * @return Zend_Feed_Builder_Header
- */
- public function setRating($rating)
- {
- $this->offsetSet('rating', $rating);
- return $this;
- }
-
- /**
- * Cloud to be notified of updates of the feed
- * Ignored if atom is used
- *
- * @param string|Zend_Uri_Http $uri
- * @param string $procedure procedure to call, e.g. myCloud.rssPleaseNotify
- * @param string $protocol protocol to use, e.g. soap or xml-rpc
- * @return Zend_Feed_Builder_Header
- * @throws Zend_Feed_Builder_Exception
- */
- public function setCloud($uri, $procedure, $protocol)
- {
- if (is_string($uri) && Zend_Uri_Http::check($uri)) {
- $uri = Zend_Uri::factory($uri);
- }
- if (!$uri instanceof Zend_Uri_Http) {
- throw new Zend_Feed_Builder_Exception('Passed parameter is not a valid HTTP URI');
- }
- if (!$uri->getPort()) {
- $uri->setPort(80);
- }
- $this->offsetSet('cloud', array('uri' => $uri,
- 'procedure' => $procedure,
- 'protocol' => $protocol));
- return $this;
- }
-
- /**
- * A text input box that can be displayed with the feed
- * Ignored if atom is used
- *
- * @param string $title the label of the Submit button in the text input area
- * @param string $description explains the text input area
- * @param string $name the name of the text object in the text input area
- * @param string $link the URL of the CGI script that processes text input requests
- * @return Zend_Feed_Builder_Header
- */
- public function setTextInput($title, $description, $name, $link)
- {
- $this->offsetSet('textInput', array('title' => $title,
- 'description' => $description,
- 'name' => $name,
- 'link' => $link));
- return $this;
- }
-
- /**
- * Hint telling aggregators which hours they can skip
- * Ignored if atom is used
- *
- * @param array $hours list of hours in 24 format
- * @return Zend_Feed_Builder_Header
- * @throws Zend_Feed_Builder_Exception
- */
- public function setSkipHours(array $hours)
- {
- if (count($hours) > 24) {
- throw new Zend_Feed_Builder_Exception("you can not have more than 24 rows in the skipHours property");
- }
- foreach ($hours as $hour) {
- if ($hour < 0 || $hour > 23) {
- throw new Zend_Feed_Builder_Exception("$hour has te be between 0 and 23");
- }
- }
- $this->offsetSet('skipHours', $hours);
- return $this;
- }
-
- /**
- * Hint telling aggregators which days they can skip
- * Ignored if atom is used
- *
- * @param array $days list of days to skip, e.g. Monday
- * @return Zend_Feed_Builder_Header
- * @throws Zend_Feed_Builder_Exception
- */
- public function setSkipDays(array $days)
- {
- if (count($days) > 7) {
- throw new Zend_Feed_Builder_Exception("you can not have more than 7 days in the skipDays property");
- }
- $valid = array('monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday');
- foreach ($days as $day) {
- if (!in_array(strtolower($day), $valid)) {
- throw new Zend_Feed_Builder_Exception("$day is not a valid day");
- }
- }
- $this->offsetSet('skipDays', $days);
- return $this;
- }
-
- /**
- * Sets the iTunes rss extension
- *
- * @param Zend_Feed_Builder_Header_Itunes $itunes
- * @return Zend_Feed_Builder_Header
- */
- public function setITunes(Zend_Feed_Builder_Header_Itunes $itunes)
- {
- $this->offsetSet('itunes', $itunes);
- return $this;
- }
-}
diff --git a/libs/Zend/Feed/Builder/Header/Itunes.php b/libs/Zend/Feed/Builder/Header/Itunes.php
deleted file mode 100755
index bd4ce2fc62..0000000000
--- a/libs/Zend/Feed/Builder/Header/Itunes.php
+++ /dev/null
@@ -1,267 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * @see Zend_Feed_Builder_Exception
- */
-require_once 'Zend/Feed/Builder/Exception.php';
-
-
-/**
- * ITunes rss extension
- *
- * Classes used to describe the itunes channel extension
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Feed_Builder_Header_Itunes extends ArrayObject
-{
- /**
- * Constructor
- *
- * @param array $categories Categories columns and in iTunes Music Store Browse
- * @return void
- */
- public function __construct(array $categories)
- {
- $this->setCategories($categories);
- }
-
- /**
- * Sets the categories column and in iTunes Music Store Browse
- * $categories must conform to the following format:
- * <code>
- * array(array('main' => 'main category',
- * 'sub' => 'sub category' // optionnal
- * ),
- * // up to 3 rows
- * )
- * </code>
- *
- * @param array $categories
- * @return Zend_Feed_Builder_Header_Itunes
- * @throws Zend_Feed_Builder_Exception
- */
- public function setCategories(array $categories)
- {
- $nb = count($categories);
- if (0 === $nb) {
- throw new Zend_Feed_Builder_Exception("you have to set at least one itunes category");
- }
- if ($nb > 3) {
- throw new Zend_Feed_Builder_Exception("you have to set at most three itunes categories");
- }
- foreach ($categories as $i => $category) {
- if (empty($category['main'])) {
- throw new Zend_Feed_Builder_Exception("you have to set the main category (category #$i)");
- }
- }
- $this->offsetSet('category', $categories);
- return $this;
- }
-
- /**
- * Sets the artist value, default to the feed's author value
- *
- * @param string $author
- * @return Zend_Feed_Builder_Header_Itunes
- */
- public function setAuthor($author)
- {
- $this->offsetSet('author', $author);
- return $this;
- }
-
- /**
- * Sets the owner of the postcast
- *
- * @param string $name default to the feed's author value
- * @param string $email default to the feed's email value
- * @return Zend_Feed_Builder_Header_Itunes
- * @throws Zend_Feed_Builder_Exception
- */
- public function setOwner($name = '', $email = '')
- {
- if (!empty($email)) {
- Zend_Loader::loadClass('Zend_Validate_EmailAddress');
- $validate = new Zend_Validate_EmailAddress();
- if (!$validate->isValid($email)) {
- throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the itunes owner's email property");
- }
- }
- $this->offsetSet('owner', array('name' => $name, 'email' => $email));
- return $this;
- }
-
- /**
- * Sets the album/podcast art picture
- * Default to the feed's image value
- *
- * @param string $image
- * @return Zend_Feed_Builder_Header_Itunes
- */
- public function setImage($image)
- {
- $this->offsetSet('image', $image);
- return $this;
- }
-
- /**
- * Sets the short description of the podcast
- * Default to the feed's description
- *
- * @param string $subtitle
- * @return Zend_Feed_Builder_Header_Itunes
- */
- public function setSubtitle($subtitle)
- {
- $this->offsetSet('subtitle', $subtitle);
- return $this;
- }
-
- /**
- * Sets the longer description of the podcast
- * Default to the feed's description
- *
- * @param string $summary
- * @return Zend_Feed_Builder_Header_Itunes
- */
- public function setSummary($summary)
- {
- $this->offsetSet('summary', $summary);
- return $this;
- }
-
- /**
- * Prevent a feed from appearing
- *
- * @param string $block can be 'yes' or 'no'
- * @return Zend_Feed_Builder_Header_Itunes
- * @throws Zend_Feed_Builder_Exception
- */
- public function setBlock($block)
- {
- $block = strtolower($block);
- if (!in_array($block, array('yes', 'no'))) {
- throw new Zend_Feed_Builder_Exception("you have to set yes or no to the itunes block property");
- }
- $this->offsetSet('block', $block);
- return $this;
- }
-
- /**
- * Configuration of the parental advisory graphic
- *
- * @param string $explicit can be 'yes', 'no' or 'clean'
- * @return Zend_Feed_Builder_Header_Itunes
- * @throws Zend_Feed_Builder_Exception
- */
- public function setExplicit($explicit)
- {
- $explicit = strtolower($explicit);
- if (!in_array($explicit, array('yes', 'no', 'clean'))) {
- throw new Zend_Feed_Builder_Exception("you have to set yes, no or clean to the itunes explicit property");
- }
- $this->offsetSet('explicit', $explicit);
- return $this;
- }
-
- /**
- * Sets a comma separated list of 12 keywords maximum
- *
- * @param string $keywords
- * @return Zend_Feed_Builder_Header_Itunes
- */
- public function setKeywords($keywords)
- {
- $this->offsetSet('keywords', $keywords);
- return $this;
- }
-
- /**
- * Sets the new feed URL location
- *
- * @param string $url
- * @return Zend_Feed_Builder_Header_Itunes
- */
- public function setNewFeedUrl($url)
- {
- $this->offsetSet('new_feed_url', $url);
- return $this;
- }
-
- /**
- * Read only properties accessor
- *
- * @param string $name property to read
- * @return mixed
- */
- public function __get($name)
- {
- if (!$this->offsetExists($name)) {
- return NULL;
- }
-
- return $this->offsetGet($name);
- }
-
- /**
- * Write properties accessor
- *
- * @param string $name name of the property to set
- * @param mixed $value value to set
- * @return void
- */
- public function __set($name, $value)
- {
- $this->offsetSet($name, $value);
- }
-
- /**
- * Isset accessor
- *
- * @param string $key
- * @return boolean
- */
- public function __isset($key)
- {
- return $this->offsetExists($key);
- }
-
- /**
- * Unset accessor
- *
- * @param string $key
- * @return void
- */
- public function __unset($key)
- {
- if ($this->offsetExists($key)) {
- $this->offsetUnset($key);
- }
- }
-
-} \ No newline at end of file
diff --git a/libs/Zend/Feed/Builder/Interface.php b/libs/Zend/Feed/Builder/Interface.php
deleted file mode 100755
index 736a7c9780..0000000000
--- a/libs/Zend/Feed/Builder/Interface.php
+++ /dev/null
@@ -1,52 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * Input feed data interface
- *
- * Classes implementing this interface can be passe to Zend_Feed::importBuilder
- * as an input data source for the Zend_Feed construction
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-interface Zend_Feed_Builder_Interface
-{
- /**
- * Returns an instance of Zend_Feed_Builder_Header
- * describing the header of the feed
- *
- * @return Zend_Feed_Builder_Header
- */
- public function getHeader();
-
- /**
- * Returns an array of Zend_Feed_Builder_Entry instances
- * describing the entries of the feed
- *
- * @return array of Zend_Feed_Builder_Entry
- */
- public function getEntries();
-}
diff --git a/libs/Zend/Feed/Element.php b/libs/Zend/Feed/Element.php
deleted file mode 100755
index a444704895..0000000000
--- a/libs/Zend/Feed/Element.php
+++ /dev/null
@@ -1,403 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * Wraps a DOMElement allowing for SimpleXML-like access to attributes.
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Feed_Element implements ArrayAccess
-{
-
- /**
- * @var DOMElement
- */
- protected $_element;
-
- /**
- * @var Zend_Feed_Element
- */
- protected $_parentElement;
-
- /**
- * @var boolean
- */
- protected $_appended = true;
-
-
- /**
- * Zend_Feed_Element constructor.
- *
- * @param DOMElement $element The DOM element we're encapsulating.
- * @return void
- */
- public function __construct($element = null)
- {
- $this->_element = $element;
- }
-
-
- /**
- * Get a DOM representation of the element
- *
- * Returns the underlying DOM object, which can then be
- * manipulated with full DOM methods.
- *
- * @return DOMDocument
- */
- public function getDOM()
- {
- return $this->_element;
- }
-
-
- /**
- * Update the object from a DOM element
- *
- * Take a DOMElement object, which may be originally from a call
- * to getDOM() or may be custom created, and use it as the
- * DOM tree for this Zend_Feed_Element.
- *
- * @param DOMElement $element
- * @return void
- */
- public function setDOM(DOMElement $element)
- {
- $this->_element = $this->_element->ownerDocument->importNode($element, true);
- }
-
- /**
- * Set the parent element of this object to another
- * Zend_Feed_Element.
- *
- * @param Zend_Feed_Element $element
- * @return void
- */
- public function setParent(Zend_Feed_Element $element)
- {
- $this->_parentElement = $element;
- $this->_appended = false;
- }
-
-
- /**
- * Appends this element to its parent if necessary.
- *
- * @return void
- */
- protected function ensureAppended()
- {
- if (!$this->_appended) {
- $this->_parentElement->getDOM()->appendChild($this->_element);
- $this->_appended = true;
- $this->_parentElement->ensureAppended();
- }
- }
-
-
- /**
- * Get an XML string representation of this element
- *
- * Returns a string of this element's XML, including the XML
- * prologue.
- *
- * @return string
- */
- public function saveXML()
- {
- // Return a complete document including XML prologue.
- $doc = new DOMDocument($this->_element->ownerDocument->version,
- $this->_element->ownerDocument->actualEncoding);
- $doc->appendChild($doc->importNode($this->_element, true));
- return $doc->saveXML();
- }
-
-
- /**
- * Get the XML for only this element
- *
- * Returns a string of this element's XML without prologue.
- *
- * @return string
- */
- public function saveXMLFragment()
- {
- return $this->_element->ownerDocument->saveXML($this->_element);
- }
-
-
- /**
- * Map variable access onto the underlying entry representation.
- *
- * Get-style access returns a Zend_Feed_Element representing the
- * child element accessed. To get string values, use method syntax
- * with the __call() overriding.
- *
- * @param string $var The property to access.
- * @return mixed
- */
- public function __get($var)
- {
- $nodes = $this->_children($var);
- $length = count($nodes);
-
- if ($length == 1) {
- return new Zend_Feed_Element($nodes[0]);
- } elseif ($length > 1) {
- return array_map(create_function('$e', 'return new Zend_Feed_Element($e);'), $nodes);
- } else {
- // When creating anonymous nodes for __set chaining, don't
- // call appendChild() on them. Instead we pass the current
- // element to them as an extra reference; the child is
- // then responsible for appending itself when it is
- // actually set. This way "if ($foo->bar)" doesn't create
- // a phantom "bar" element in our tree.
- if (strpos($var, ':') !== false) {
- list($ns, $elt) = explode(':', $var, 2);
- $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), $elt);
- } else {
- $node = $this->_element->ownerDocument->createElement($var);
- }
- $node = new Zend_Feed_Element($node);
- $node->setParent($this);
- return $node;
- }
- }
-
-
- /**
- * Map variable sets onto the underlying entry representation.
- *
- * @param string $var The property to change.
- * @param string $val The property's new value.
- * @return void
- */
- public function __set($var, $val)
- {
- $this->ensureAppended();
-
- $nodes = $this->_children($var);
- if (!$nodes) {
- if (strpos($var, ':') !== false) {
- list($ns, $elt) = explode(':', $var, 2);
- $node = $this->_element->ownerDocument->createElementNS(Zend_Feed::lookupNamespace($ns), $var, $val);
- $this->_element->appendChild($node);
- } else {
- $node = $this->_element->ownerDocument->createElement($var, $val);
- $this->_element->appendChild($node);
- }
- } elseif (count($nodes) > 1) {
- throw new Zend_Feed_Exception('Cannot set the value of multiple tags simultaneously.');
- } else {
- $nodes[0]->nodeValue = $val;
- }
- }
-
-
- /**
- * Map isset calls onto the underlying entry representation.
- *
- * @param string $var
- * @return boolean
- */
- public function __isset($var)
- {
- // Look for access of the form {ns:var}. We don't use
- // _children() here because we can break out of the loop
- // immediately once we find something.
- if (strpos($var, ':') !== false) {
- list($ns, $elt) = explode(':', $var, 2);
- foreach ($this->_element->childNodes as $child) {
- if ($child->localName == $elt && $child->prefix == $ns) {
- return true;
- }
- }
- } else {
- foreach ($this->_element->childNodes as $child) {
- if ($child->localName == $var) {
- return true;
- }
- }
- }
- }
-
-
- /**
- * Get the value of an element with method syntax.
- *
- * Map method calls to get the string value of the requested
- * element. If there are multiple elements that match, this will
- * return an array of those objects.
- *
- * @param string $var The element to get the string value of.
- * @param mixed $unused This parameter is not used.
- * @return mixed The node's value, null, or an array of nodes.
- */
- public function __call($var, $unused)
- {
- $nodes = $this->_children($var);
-
- if (!$nodes) {
- return null;
- } elseif (count($nodes) > 1) {
- return $nodes;
- } else {
- return $nodes[0]->nodeValue;
- }
- }
-
-
- /**
- * Remove all children matching $var.
- *
- * @param string $var
- * @return void
- */
- public function __unset($var)
- {
- $nodes = $this->_children($var);
- foreach ($nodes as $node) {
- $parent = $node->parentNode;
- $parent->removeChild($node);
- }
- }
-
-
- /**
- * Returns the nodeValue of this element when this object is used
- * in a string context.
- *
- * @return string
- */
- public function __toString()
- {
- return $this->_element->nodeValue;
- }
-
-
- /**
- * Finds children with tagnames matching $var
- *
- * Similar to SimpleXML's children() method.
- *
- * @param string $var Tagname to match, can be either namespace:tagName or just tagName.
- * @return array
- */
- protected function _children($var)
- {
- $found = array();
-
- // Look for access of the form {ns:var}.
- if (strpos($var, ':') !== false) {
- list($ns, $elt) = explode(':', $var, 2);
- foreach ($this->_element->childNodes as $child) {
- if ($child->localName == $elt && $child->prefix == $ns) {
- $found[] = $child;
- }
- }
- } else {
- foreach ($this->_element->childNodes as $child) {
- if ($child->localName == $var) {
- $found[] = $child;
- }
- }
- }
-
- return $found;
- }
-
-
- /**
- * Required by the ArrayAccess interface.
- *
- * @param string $offset
- * @return boolean
- */
- public function offsetExists($offset)
- {
- if (strpos($offset, ':') !== false) {
- list($ns, $attr) = explode(':', $offset, 2);
- return $this->_element->hasAttributeNS(Zend_Feed::lookupNamespace($ns), $attr);
- } else {
- return $this->_element->hasAttribute($offset);
- }
- }
-
-
- /**
- * Required by the ArrayAccess interface.
- *
- * @param string $offset
- * @return string
- */
- public function offsetGet($offset)
- {
- if (strpos($offset, ':') !== false) {
- list($ns, $attr) = explode(':', $offset, 2);
- return $this->_element->getAttributeNS(Zend_Feed::lookupNamespace($ns), $attr);
- } else {
- return $this->_element->getAttribute($offset);
- }
- }
-
-
- /**
- * Required by the ArrayAccess interface.
- *
- * @param string $offset
- * @param string $value
- * @return string
- */
- public function offsetSet($offset, $value)
- {
- $this->ensureAppended();
-
- if (strpos($offset, ':') !== false) {
- list($ns, $attr) = explode(':', $offset, 2);
- return $this->_element->setAttributeNS(Zend_Feed::lookupNamespace($ns), $attr, $value);
- } else {
- return $this->_element->setAttribute($offset, $value);
- }
- }
-
-
- /**
- * Required by the ArrayAccess interface.
- *
- * @param string $offset
- * @return boolean
- */
- public function offsetUnset($offset)
- {
- if (strpos($offset, ':') !== false) {
- list($ns, $attr) = explode(':', $offset, 2);
- return $this->_element->removeAttributeNS(Zend_Feed::lookupNamespace($ns), $attr);
- } else {
- return $this->_element->removeAttribute($offset);
- }
- }
-
-}
diff --git a/libs/Zend/Feed/Entry/Abstract.php b/libs/Zend/Feed/Entry/Abstract.php
deleted file mode 100755
index 84a215427f..0000000000
--- a/libs/Zend/Feed/Entry/Abstract.php
+++ /dev/null
@@ -1,106 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id:$
- */
-
-
-/**
- * @see Zend_Feed
- */
-require_once 'Zend/Feed.php';
-
-/**
- * @see Zend_Feed_Element
- */
-require_once 'Zend/Feed/Element.php';
-
-
-/**
- * Zend_Feed_Entry_Abstract represents a single entry in an Atom or RSS
- * feed.
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-abstract class Zend_Feed_Entry_Abstract extends Zend_Feed_Element
-{
- /**
- * Root XML element for entries. Subclasses must define this to a
- * non-null value.
- *
- * @var string
- */
- protected $_rootElement;
-
- /**
- * Root namespace for entries. Subclasses may define this to a
- * non-null value.
- *
- * @var string
- */
- protected $_rootNamespace = null;
-
-
- /**
- * Zend_Feed_Entry_Abstract constructor
- *
- * The Zend_Feed_Entry_Abstract constructor takes the URI of the feed the entry
- * is part of, and optionally an XML construct (usually a
- * SimpleXMLElement, but it can be an XML string or a DOMNode as
- * well) that contains the contents of the entry.
- *
- * @param string $uri
- * @param SimpleXMLElement|DOMNode|string $element
- * @return void
- */
- public function __construct($uri = null, $element = null)
- {
- if (!($element instanceof DOMElement)) {
- if ($element) {
- // Load the feed as an XML DOMDocument object
- @ini_set('track_errors', 1);
- $doc = new DOMDocument();
- $success = @$doc->loadXML($element);
- @ini_restore('track_errors');
-
- if (!$success) {
- throw new Zend_Feed_Exception("DOMDocument cannot parse XML: $php_errormsg");
- }
-
- $element = $doc->getElementsByTagName($this->_rootElement)->item(0);
- if (!$element) {
- throw new Zend_Feed_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.');
- }
- } else {
- $doc = new DOMDocument('1.0', 'utf-8');
- if ($this->_rootNamespace !== null) {
- $element = $doc->createElementNS(Zend_Feed::lookupNamespace($this->_rootNamespace), $this->_rootElement);
- } else {
- $element = $doc->createElement($this->_rootElement);
- }
- }
- }
-
- parent::__construct($element);
- }
-
-}
diff --git a/libs/Zend/Feed/Entry/Atom.php b/libs/Zend/Feed/Entry/Atom.php
deleted file mode 100755
index fa099c2f77..0000000000
--- a/libs/Zend/Feed/Entry/Atom.php
+++ /dev/null
@@ -1,231 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * @see Zend_Feed_Entry_Abstract
- */
-require_once 'Zend/Feed/Entry/Abstract.php';
-
-
-/**
- * Concrete class for working with Atom entries.
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Feed_Entry_Atom extends Zend_Feed_Entry_Abstract
-{
- /**
- * Root XML element for Atom entries.
- *
- * @var string
- */
- protected $_rootElement = 'entry';
-
- /**
- * Root namespace for Atom entries.
- *
- * @var string
- */
- protected $_rootNamespace = 'atom';
-
-
- /**
- * Delete an atom entry.
- *
- * Delete tries to delete this entry from its feed. If the entry
- * does not contain a link rel="edit", we throw an error (either
- * the entry does not yet exist or this is not an editable
- * feed). If we have a link rel="edit", we do the empty-body
- * HTTP DELETE to that URI and check for a response of 2xx.
- * Usually the response would be 204 No Content, but the Atom
- * Publishing Protocol permits it to be 200 OK.
- *
- * @throws Zend_Feed_Exception
- * @return void
- */
- public function delete()
- {
- // Look for link rel="edit" in the entry object.
- $deleteUri = $this->link('edit');
- if (!$deleteUri) {
- throw new Zend_Feed_Exception('Cannot delete entry; no link rel="edit" is present.');
- }
-
- // DELETE
- $client = Zend_Feed::getHttpClient();
- do {
- $client->setUri($deleteUri);
- if (Zend_Feed::getHttpMethodOverride()) {
- $client->setHeader('X-HTTP-Method-Override', 'DELETE');
- $response = $client->request('POST');
- } else {
- $response = $client->request('DELETE');
- }
- $httpStatus = $response->getStatus();
- switch ((int) $httpStatus / 100) {
- // Success
- case 2:
- return true;
- // Redirect
- case 3:
- $deleteUri = $response->getHeader('Location');
- continue;
- // Error
- default:
- throw new Zend_Feed_Exception("Expected response code 2xx, got $httpStatus");
- }
- } while (true);
- }
-
-
- /**
- * Save a new or updated Atom entry.
- *
- * Save is used to either create new entries or to save changes to
- * existing ones. If we have a link rel="edit", we are changing
- * an existing entry. In this case we re-serialize the entry and
- * PUT it to the edit URI, checking for a 200 OK result.
- *
- * For posting new entries, you must specify the $postUri
- * parameter to save() to tell the object where to post itself.
- * We use $postUri and POST the serialized entry there, checking
- * for a 201 Created response. If the insert is successful, we
- * then parse the response from the POST to get any values that
- * the server has generated: an id, an updated time, and its new
- * link rel="edit".
- *
- * @param string $postUri Location to POST for creating new entries.
- * @throws Zend_Feed_Exception
- * @return void
- */
- public function save($postUri = null)
- {
- if ($this->id()) {
- // If id is set, look for link rel="edit" in the
- // entry object and PUT.
- $editUri = $this->link('edit');
- if (!$editUri) {
- throw new Zend_Feed_Exception('Cannot edit entry; no link rel="edit" is present.');
- }
-
- $client = Zend_Feed::getHttpClient();
- $client->setUri($editUri);
- if (Zend_Feed::getHttpMethodOverride()) {
- $client->setHeaders(array('X-HTTP-Method-Override: PUT',
- 'Content-Type: application/atom+xml'));
- $client->setRawData($this->saveXML());
- $response = $client->request('POST');
- } else {
- $client->setHeaders('Content-Type', 'application/atom+xml');
- $client->setRawData($this->saveXML());
- $response = $client->request('PUT');
- }
- if ($response->getStatus() !== 200) {
- throw new Zend_Feed_Exception('Expected response code 200, got ' . $response->getStatus());
- }
- } else {
- if ($postUri === null) {
- throw new Zend_Feed_Exception('PostURI must be specified to save new entries.');
- }
- $client = Zend_Feed::getHttpClient();
- $client->setUri($postUri);
- $client->setRawData($this->saveXML());
- $response = $client->request('POST');
-
- if ($response->getStatus() !== 201) {
- throw new Zend_Feed_Exception('Expected response code 201, got '
- . $response->getStatus());
- }
- }
-
- // Update internal properties using $client->responseBody;
- @ini_set('track_errors', 1);
- $newEntry = @DOMDocument::loadXML($response->getBody());
- @ini_restore('track_errors');
- if (!$newEntry) {
- throw new Zend_Feed_Exception('XML cannot be parsed: ' . $php_errormsg);
- }
-
- $newEntry = $newEntry->getElementsByTagName($this->_rootElement)->item(0);
- if (!$newEntry) {
- throw new Zend_Feed_Exception('No root <feed> element found in server response:'
- . "\n\n" . $client->responseBody);
- }
-
- if ($this->_element->parentNode) {
- $oldElement = $this->_element;
- $this->_element = $oldElement->ownerDocument->importNode($newEntry, true);
- $oldElement->parentNode->replaceChild($this->_element, $oldElement);
- } else {
- $this->_element = $newEntry;
- }
- }
-
-
- /**
- * Easy access to <link> tags keyed by "rel" attributes.
- *
- * If $elt->link() is called with no arguments, we will attempt to
- * return the value of the <link> tag(s) like all other
- * method-syntax attribute access. If an argument is passed to
- * link(), however, then we will return the "href" value of the
- * first <link> tag that has a "rel" attribute matching $rel:
- *
- * $elt->link(): returns the value of the link tag.
- * $elt->link('self'): returns the href from the first <link rel="self"> in the entry.
- *
- * @param string $rel The "rel" attribute to look for.
- * @return mixed
- */
- public function link($rel = null)
- {
- if ($rel === null) {
- return parent::__call('link', null);
- }
-
- // index link tags by their "rel" attribute.
- $links = parent::__get('link');
- if (!is_array($links)) {
- if ($links instanceof Zend_Feed_Element) {
- $links = array($links);
- } else {
- return $links;
- }
- }
-
- foreach ($links as $link) {
- if (empty($link['rel'])) {
- continue;
- }
- if ($rel == $link['rel']) {
- return $link['href'];
- }
- }
-
- return null;
- }
-
-}
diff --git a/libs/Zend/Feed/Entry/Rss.php b/libs/Zend/Feed/Entry/Rss.php
deleted file mode 100755
index efc5c20700..0000000000
--- a/libs/Zend/Feed/Entry/Rss.php
+++ /dev/null
@@ -1,47 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id:$
- */
-
-
-/**
- * @see Zend_Feed_Entry_Abstract
- */
-require_once 'Zend/Feed/Entry/Abstract.php';
-
-
-/**
- * Concrete class for working with RSS items.
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Feed_Entry_Rss extends Zend_Feed_Entry_Abstract
-{
- /**
- * Root XML element for RSS items.
- *
- * @var string
- */
- protected $_rootElement = 'item';
-
-}
diff --git a/libs/Zend/Feed/Exception.php b/libs/Zend/Feed/Exception.php
deleted file mode 100755
index 69395688c4..0000000000
--- a/libs/Zend/Feed/Exception.php
+++ /dev/null
@@ -1,42 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * @see Zend_Exception
- */
-require_once 'Zend/Exception.php';
-
-
-/**
- * Feed exceptions
- *
- * Class to represent exceptions that occur during Feed operations.
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Feed_Exception extends Zend_Exception
-{}
-
diff --git a/libs/Zend/Feed/Rss.php b/libs/Zend/Feed/Rss.php
deleted file mode 100755
index 139ed7f4e6..0000000000
--- a/libs/Zend/Feed/Rss.php
+++ /dev/null
@@ -1,496 +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_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * @see Zend_Feed_Abstract
- */
-require_once 'Zend/Feed/Abstract.php';
-
-/**
- * @see Zend_Feed_Entry_Rss
- */
-require_once 'Zend/Feed/Entry/Rss.php';
-
-
-/**
- * RSS channel class
- *
- * The Zend_Feed_Rss class is a concrete subclass of
- * Zend_Feed_Abstract meant for representing RSS channels. It does not
- * add any methods to its parent, just provides a classname to check
- * against with the instanceof operator, and expects to be handling
- * RSS-formatted data instead of Atom.
- *
- * @category Zend
- * @package Zend_Feed
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Feed_Rss extends Zend_Feed_Abstract
-{
- /**
- * The classname for individual channel elements.
- *
- * @var string
- */
- protected $_entryClassName = 'Zend_Feed_Entry_Rss';
-
- /**
- * The element name for individual channel elements (RSS <item>s).
- *
- * @var string
- */
- protected $_entryElementName = 'item';
-
- /**
- * The default namespace for RSS channels.
- *
- * @var string
- */
- protected $_defaultNamespace = 'rss';
-
- /**
- * Override Zend_Feed_Abstract to set up the $_element and $_entries aliases.
- *
- * @throws Zend_Feed_Exception
- * @return void
- */
- public function __wakeup()
- {
- parent::__wakeup();
-
- // Find the base channel element and create an alias to it.
- $this->_element = $this->_element->getElementsByTagName('channel')->item(0);
- if (!$this->_element) {
- throw new Zend_Feed_Exception('No root <channel> element found, cannot parse channel.');
- }
-
- // Find the entries and save a pointer to them for speed and
- // simplicity.
- $this->_buildEntryCache();
- }
-
-
- /**
- * Make accessing some individual elements of the channel easier.
- *
- * Special accessors 'item' and 'items' are provided so that if
- * you wish to iterate over an RSS channel's items, you can do so
- * using foreach ($channel->items as $item) or foreach
- * ($channel->item as $item).
- *
- * @param string $var The property to access.
- * @return mixed
- */
- public function __get($var)
- {
- switch ($var) {
- case 'item':
- // fall through to the next case
- case 'items':
- return $this;
-
- default:
- return parent::__get($var);
- }
- }
-
- /**
- * Generate the header of the feed when working in write mode
- *
- * @param array $array the data to use
- * @return DOMElement root node
- */
- protected function _mapFeedHeaders($array)
- {
- $channel = $this->_element->createElement('channel');
-
- $title = $this->_element->createElement('title');
- $title->appendChild($this->_element->createCDATASection($array->title));
- $channel->appendChild($title);
-
- $link = $this->_element->createElement('link', $array->link);
- $channel->appendChild($link);
-
- $desc = isset($array->description) ? $array->description : '';
- $description = $this->_element->createElement('description');
- $description->appendChild($this->_element->createCDATASection($desc));
- $channel->appendChild($description);
-
- $pubdate = isset($array->lastUpdate) ? $array->lastUpdate : time();
- $pubdate = $this->_element->createElement('pubDate', gmdate('r', $pubdate));
- $channel->appendChild($pubdate);
-
- if (isset($array->published)) {
- $lastBuildDate = $this->_element->createElement('lastBuildDate', gmdate('r', $array->published));
- }
-
- $editor = '';
- if (!empty($array->email)) {
- $editor .= $array->email;
- }
- if (!empty($array->author)) {
- $editor .= ' (' . $array->author . ')';
- }
- if (!empty($editor)) {
- $author = $this->_element->createElement('managingEditor', ltrim($editor));
- $channel->appendChild($author);
- }
- if (isset($array->webmaster)) {
- $channel->appendChild($this->_element->createElement('webMaster', $array->webmaster));
- }
-
- if (!empty($array->copyright)) {
- $copyright = $this->_element->createElement('copyright', $array->copyright);
- $channel->appendChild($copyright);
- }
-
- if (!empty($array->image)) {
- $image = $this->_element->createElement('image');
- $url = $this->_element->createElement('url', $array->image);
- $image->appendChild($url);
- $imagetitle = $this->_element->createElement('title', $array->title);
- $image->appendChild($imagetitle);
- $imagelink = $this->_element->createElement('link', $array->link);
- $image->appendChild($imagelink);
-
- $channel->appendChild($image);
- }
-
- $generator = !empty($array->generator) ? $array->generator : 'Zend_Feed';
- $generator = $this->_element->createElement('generator', $generator);
- $channel->appendChild($generator);
-
- if (!empty($array->language)) {
- $language = $this->_element->createElement('language', $array->language);
- $channel->appendChild($language);
- }
-
- $doc = $this->_element->createElement('docs', 'http://blogs.law.harvard.edu/tech/rss');
- $channel->appendChild($doc);
-
- if (isset($array->cloud)) {
- $cloud = $this->_element->createElement('cloud');
- $cloud->setAttribute('domain', $array->cloud['uri']->getHost());
- $cloud->setAttribute('port', $array->cloud['uri']->getPort());
- $cloud->setAttribute('path', $array->cloud['uri']->getPath());
- $cloud->setAttribute('registerProcedure', $array->cloud['procedure']);
- $cloud->setAttribute('protocol', $array->cloud['protocol']);
- $channel->appendChild($cloud);
- }
-
- if (isset($array->rating)) {
- $rating = $this->_element->createElement('rating', $array->rating);
- $channel->appendChild($rating);
- }
-
- if (isset($array->textInput)) {
- $textinput = $this->_element->createElement('textInput');
- $textinput->appendChild($this->_element->createElement('title', $array->textInput['title']));
- $textinput->appendChild($this->_element->createElement('description', $array->textInput['description']));
- $textinput->appendChild($this->_element->createElement('name', $array->textInput['name']));
- $textinput->appendChild($this->_element->createElement('link', $array->textInput['link']));
- $channel->appendChild($textinput);
- }
-
- if (isset($array->skipHours)) {
- $skipHours = $this->_element->createElement('skipHours');
- foreach ($array->skipHours as $hour) {
- $skipHours->appendChild($this->_element->createElement('hour', $hour));
- }
- $channel->appendChild($skipHours);
- }
-
- if (isset($array->skipDays)) {
- $skipDays = $this->_element->createElement('skipDays');
- foreach ($array->skipDays as $day) {
- $skipDays->appendChild($this->_element->createElement('day', $day));
- }
- $channel->appendChild($skipDays);
- }
-
- if (isset($array->itunes)) {
- $this->_buildiTunes($channel, $array);
- }
-
- return $channel;
- }
-
- /**
- * Adds the iTunes extensions to a root node
- *
- * @param DOMElement $root
- * @param array $array
- * @return void
- */
- private function _buildiTunes(DOMElement $root, $array)
- {
- /* author node */
- $author = '';
- if (isset($array->itunes->author)) {
- $author = $array->itunes->author;
- } elseif (isset($array->author)) {
- $author = $array->author;
- }
- if (!empty($author)) {
- $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:author', $author);
- $root->appendChild($node);
- }
-
- /* owner node */
- $author = '';
- $email = '';
- if (isset($array->itunes->owner)) {
- if (isset($array->itunes->owner['name'])) {
- $author = $array->itunes->owner['name'];
- }
- if (isset($array->itunes->owner['email'])) {
- $email = $array->itunes->owner['email'];
- }
- }
- if (empty($author) && isset($array->author)) {
- $author = $array->author;
- }
- if (empty($email) && isset($array->email)) {
- $email = $array->email;
- }
- if (!empty($author) || !empty($email)) {
- $owner = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:owner');
- if (!empty($author)) {
- $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:name', $author);
- $owner->appendChild($node);
- }
- if (!empty($email)) {
- $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:email', $email);
- $owner->appendChild($node);
- }
- $root->appendChild($owner);
- }
- $image = '';
- if (isset($array->itunes->image)) {
- $image = $array->itunes->image;
- } elseif (isset($array->image)) {
- $image = $array->image;
- }
- if (!empty($image)) {
- $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:image');
- $node->setAttribute('href', $image);
- $root->appendChild($node);
- }
- $subtitle = '';
- if (isset($array->itunes->subtitle)) {
- $subtitle = $array->itunes->subtitle;
- } elseif (isset($array->description)) {
- $subtitle = $array->description;
- }
- if (!empty($subtitle)) {
- $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:subtitle', $subtitle);
- $root->appendChild($node);
- }
- $summary = '';
- if (isset($array->itunes->summary)) {
- $summary = $array->itunes->summary;
- } elseif (isset($array->description)) {
- $summary = $array->description;
- }
- if (!empty($summary)) {
- $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:summary', $summary);
- $root->appendChild($node);
- }
- if (isset($array->itunes->block)) {
- $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:block', $array->itunes->block);
- $root->appendChild($node);
- }
- if (isset($array->itunes->explicit)) {
- $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:explicit', $array->itunes->explicit);
- $root->appendChild($node);
- }
- if (isset($array->itunes->keywords)) {
- $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:keywords', $array->itunes->keywords);
- $root->appendChild($node);
- }
- if (isset($array->itunes->new_feed_url)) {
- $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:new-feed-url', $array->itunes->new_feed_url);
- $root->appendChild($node);
- }
- if (isset($array->itunes->category)) {
- foreach ($array->itunes->category as $i => $category) {
- $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category');
- $node->setAttribute('text', $category['main']);
- $root->appendChild($node);
- $add_end_category = false;
- if (!empty($category['sub'])) {
- $add_end_category = true;
- $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category');
- $node->setAttribute('text', $category['sub']);
- $root->appendChild($node);
- }
- if ($i > 0 || $add_end_category) {
- $node = $this->_element->createElementNS('http://www.itunes.com/DTDs/Podcast-1.0.dtd', 'itunes:category');
- $root->appendChild($node);
- }
- }
- }
- }
-
- /**
- * Generate the entries of the feed when working in write mode
- *
- * The following nodes are constructed for each feed entry
- * <item>
- * <title>entry title</title>
- * <link>url to feed entry</link>
- * <guid>url to feed entry</guid>
- * <description>short text</description>
- * <content:encoded>long version, can contain html</content:encoded>
- * </item>
- *
- * @param DOMElement $root the root node to use
- * @param array $array the data to use
- * @return void
- */
- protected function _mapFeedEntries(DOMElement $root, $array)
- {
- Zend_Feed::registerNamespace('content', 'http://purl.org/rss/1.0/modules/content/');
-
- foreach ($array as $dataentry) {
- $item = $this->_element->createElement('item');
-
- $title = $this->_element->createElement('title');
- $title->appendChild($this->_element->createCDATASection($dataentry->title));
- $item->appendChild($title);
-
- $link = $this->_element->createElement('link', $dataentry->link);
- $item->appendChild($link);
-
- if (isset($dataentry->guid)) {
- $guid = $this->_element->createElement('guid', $dataentry->guid);
- $item->appendChild($guid);
- }
-
- $description = $this->_element->createElement('description');
- $description->appendChild($this->_element->createCDATASection($dataentry->description));
- $item->appendChild($description);
-
- if (isset($dataentry->content)) {
- $content = $this->_element->createElement('content:encoded');
- $content->appendChild($this->_element->createCDATASection($dataentry->content));
- $item->appendChild($content);
- }
-
- $pubdate = isset($dataentry->lastUpdate) ? $dataentry->lastUpdate : time();
- $pubdate = $this->_element->createElement('pubDate', gmdate('r', $pubdate));
- $item->appendChild($pubdate);
-
- if (isset($dataentry->category)) {
- foreach ($dataentry->category as $category) {
- $node = $this->_element->createElement('category', $category['term']);
- if (isset($category['scheme'])) {
- $node->setAttribute('domain', $category['scheme']);
- }
- $item->appendChild($node);
- }
- }
-
- if (isset($dataentry->source)) {
- $source = $this->_element->createElement('source', $dataentry->source['title']);
- $source->setAttribute('url', $dataentry->source['url']);
- $item->appendChild($source);
- }
-
- if (isset($dataentry->comments)) {
- $comments = $this->_element->createElement('comments', $dataentry->comments);
- $item->appendChild($comments);
- }
- if (isset($dataentry->commentRss)) {
- $comments = $this->_element->createElementNS('http://wellformedweb.org/CommentAPI/',
- 'wfw:commentRss',
- $dataentry->commentRss);
- $item->appendChild($comments);
- }
-
-
- if (isset($dataentry->enclosure)) {
- foreach ($dataentry->enclosure as $enclosure) {
- $node = $this->_element->createElement('enclosure');
- $node->setAttribute('url', $enclosure['url']);
- if (isset($enclosure['type'])) {
- $node->setAttribute('type', $enclosure['type']);
- }
- if (isset($enclosure['length'])) {
- $node->setAttribute('length', $enclosure['length']);
- }
- $item->appendChild($node);
- }
- }
-
- $root->appendChild($item);
- }
- }
-
- /**
- * Override Zend_Feed_Element to include <rss> root node
- *
- * @return string
- */
- public function saveXML()
- {
- // Return a complete document including XML prologue.
- $doc = new DOMDocument($this->_element->ownerDocument->version,
- $this->_element->ownerDocument->actualEncoding);
- $root = $doc->createElement('rss');
-
- // Use rss version 2.0
- $root->setAttribute('version', '2.0');
-
- // Content namespace
- $root->setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:content', 'http://purl.org/rss/1.0/modules/content/');
- $root->appendChild($doc->importNode($this->_element, true));
-
- // Append root node
- $doc->appendChild($root);
-
- // Format output
- $doc->formatOutput = true;
-
- return $doc->saveXML();
- }
-
- /**
- * Send feed to a http client with the correct header
- *
- * @throws Zend_Feed_Exception if headers have already been sent
- * @return void
- */
- public function send()
- {
- if (headers_sent()) {
- throw new Zend_Feed_Exception('Cannot send RSS because headers have already been sent.');
- }
-
- header('Content-type: application/rss+xml; charset: ' . $this->_element->ownerDocument->actualEncoding);
-
- echo $this->saveXML();
- }
-
-}
diff --git a/libs/Zend/Gdata.php b/libs/Zend/Gdata.php
deleted file mode 100755
index 8dd3785918..0000000000
--- a/libs/Zend/Gdata.php
+++ /dev/null
@@ -1,133 +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_Gdata
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_Gdata_App
- */
-require_once 'Zend/Gdata/App.php';
-
-/**
- * Provides functionality to interact with Google data APIs
- * Subclasses exist to implement service-specific features
- *
- * As the Google data API protocol is based upon the Atom Publishing Protocol
- * (APP), GData functionality extends the appropriate Zend_Gdata_App classes
- *
- * @link http://code.google.com/apis/gdata/overview.html
- *
- * @category Zend
- * @package Zend_Gdata
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Gdata extends Zend_Gdata_App
-{
-
- /**
- * Service name for use with Google's authentication mechanisms
- *
- * @var string
- */
- const AUTH_SERVICE_NAME = 'xapi';
-
- /**
- * Default URI to which to POST.
- *
- * @var string
- */
- protected $_defaultPostUri = null;
-
- /**
- * Packages to search for classes when using magic __call method, in order.
- *
- * @var array
- */
- protected $_registeredPackages = array(
- 'Zend_Gdata_Kind',
- 'Zend_Gdata_Extension',
- 'Zend_Gdata',
- 'Zend_Gdata_App_Extension',
- 'Zend_Gdata_App');
-
- /**
- * Namespaces used for GData data
- *
- * @var array
- */
- public static $namespaces = array(
- 'openSearch' => 'http://a9.com/-/spec/opensearchrss/1.0/',
- 'rss' => 'http://blogs.law.harvard.edu/tech/rss',
- 'gd' => 'http://schemas.google.com/g/2005');
-
- /**
- * Create Gdata object
- *
- * @param Zend_Http_Client $client
- */
- public function __construct($client = null)
- {
- parent::__construct($client);
- }
-
- /**
- * Retreive feed object
- *
- * @param mixed $location The location as string or Zend_Gdata_Query
- * @param string $className The class type to use for returning the feed
- * @return Zend_Gdata_Feed
- */
- public function getFeed($location, $className='Zend_Gdata_Feed')
- {
- if (is_string($location)) {
- $uri = $location;
- } elseif ($location instanceof Zend_Gdata_Query) {
- $uri = $location->getQueryUrl();
- } else {
- require_once 'Zend/Gdata/App/InvalidArgumentException.php';
- throw new Zend_Gdata_App_InvalidArgumentException(
- 'You must specify the location as either a string URI ' .
- 'or a child of Zend_Gdata_Query');
- }
- return parent::getFeed($uri, $className);
- }
-
- /**
- * Retreive entry object
- *
- * @param mixed $location The location as string or Zend_Gdata_Query
- * @return Zend_Gdata_Feed
- */
- public function getEntry($location, $className='Zend_Gdata_Entry')
- {
- if (is_string($location)) {
- $uri = $location;
- } elseif ($location instanceof Zend_Gdata_Query) {
- $uri = $location->getQueryUrl();
- } else {
- require_once 'Zend/Gdata/App/InvalidArgumentException.php';
- throw new Zend_Gdata_App_InvalidArgumentException(
- 'You must specify the location as either a string URI ' .
- 'or a child of Zend_Gdata_Query');
- }
- return parent::getEntry($uri, $className);
- }
-
-}
diff --git a/libs/Zend/Json/Decoder.php b/libs/Zend/Json/Decoder.php
deleted file mode 100755
index e2dbaf9448..0000000000
--- a/libs/Zend/Json/Decoder.php
+++ /dev/null
@@ -1,454 +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_Json
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_Json
- */
-require_once 'Zend/Json.php';
-
-/**
- * Zend_Json_Exception
- */
-require_once 'Zend/Json/Exception.php';
-
-
-/**
- * Decode JSON encoded string to PHP variable constructs
- *
- * @category Zend
- * @package Zend_Json
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Json_Decoder
-{
- /**
- * Parse tokens used to decode the JSON object. These are not
- * for public consumption, they are just used internally to the
- * class.
- */
- const EOF = 0;
- const DATUM = 1;
- const LBRACE = 2;
- const LBRACKET = 3;
- const RBRACE = 4;
- const RBRACKET = 5;
- const COMMA = 6;
- const COLON = 7;
-
- /**
- * Use to maintain a "pointer" to the source being decoded
- *
- * @var string
- */
- protected $_source;
-
- /**
- * Caches the source length
- *
- * @var int
- */
- protected $_sourceLength;
-
- /**
- * The offset within the souce being decoded
- *
- * @var int
- *
- */
- protected $_offset;
-
- /**
- * The current token being considered in the parser cycle
- *
- * @var int
- */
- protected $_token;
-
- /**
- * Flag indicating how objects should be decoded
- *
- * @var int
- * @access protected
- */
- protected $_decodeType;
-
- /**
- * Constructor
- *
- * @param string $source String source to decode
- * @param int $decodeType How objects should be decoded -- see
- * {@link Zend_Json::TYPE_ARRAY} and {@link Zend_Json::TYPE_OBJECT} for
- * valid values
- * @return void
- */
- protected function __construct($source, $decodeType)
- {
- // Set defaults
- $this->_source = $source;
- $this->_sourceLength = strlen($source);
- $this->_token = self::EOF;
- $this->_offset = 0;
-
- // Normalize and set $decodeType
- if (!in_array($decodeType, array(Zend_Json::TYPE_ARRAY, Zend_Json::TYPE_OBJECT)))
- {
- $decodeType = Zend_Json::TYPE_ARRAY;
- }
- $this->_decodeType = $decodeType;
-
- // Set pointer at first token
- $this->_getNextToken();
- }
-
- /**
- * Decode a JSON source string
- *
- * Decodes a JSON encoded string. The value returned will be one of the
- * following:
- * - integer
- * - float
- * - boolean
- * - null
- * - StdClass
- * - array
- * - array of one or more of the above types
- *
- * By default, decoded objects will be returned as associative arrays; to
- * return a StdClass object instead, pass {@link Zend_Json::TYPE_OBJECT} to
- * the $objectDecodeType parameter.
- *
- * Throws a Zend_Json_Exception if the source string is null.
- *
- * @static
- * @access public
- * @param string $source String to be decoded
- * @param int $objectDecodeType How objects should be decoded; should be
- * either or {@link Zend_Json::TYPE_ARRAY} or
- * {@link Zend_Json::TYPE_OBJECT}; defaults to TYPE_ARRAY
- * @return mixed
- * @throws Zend_Json_Exception
- */
- public static function decode($source = null, $objectDecodeType = Zend_Json::TYPE_ARRAY)
- {
- if (null === $source) {
- throw new Zend_Json_Exception('Must specify JSON encoded source for decoding');
- } elseif (!is_string($source)) {
- throw new Zend_Json_Exception('Can only decode JSON encoded strings');
- }
-
- $decoder = new self($source, $objectDecodeType);
-
- return $decoder->_decodeValue();
- }
-
-
- /**
- * Recursive driving rountine for supported toplevel tops
- *
- * @return mixed
- */
- protected function _decodeValue()
- {
- switch ($this->_token) {
- case self::DATUM:
- $result = $this->_tokenValue;
- $this->_getNextToken();
- return($result);
- break;
- case self::LBRACE:
- return($this->_decodeObject());
- break;
- case self::LBRACKET:
- return($this->_decodeArray());
- break;
- default:
- return null;
- break;
- }
- }
-
- /**
- * Decodes an object of the form:
- * { "attribute: value, "attribute2" : value,...}
- *
- * If ZJsonEnoder or ZJAjax was used to encode the original object
- * then a special attribute called __className which specifies a class
- * name that should wrap the data contained within the encoded source.
- *
- * Decodes to either an array or StdClass object, based on the value of
- * {@link $_decodeType}. If invalid $_decodeType present, returns as an
- * array.
- *
- * @return array|StdClass
- */
- protected function _decodeObject()
- {
- $members = array();
- $tok = $this->_getNextToken();
-
- while ($tok && $tok != self::RBRACE) {
- if ($tok != self::DATUM || ! is_string($this->_tokenValue)) {
- throw new Zend_Json_Exception('Missing key in object encoding: ' . $this->_source);
- }
-
- $key = $this->_tokenValue;
- $tok = $this->_getNextToken();
-
- if ($tok != self::COLON) {
- throw new Zend_Json_Exception('Missing ":" in object encoding: ' . $this->_source);
- }
-
- $tok = $this->_getNextToken();
- $members[$key] = $this->_decodeValue();
- $tok = $this->_token;
-
- if ($tok == self::RBRACE) {
- break;
- }
-
- if ($tok != self::COMMA) {
- throw new Zend_Json_Exception('Missing "," in object encoding: ' . $this->_source);
- }
-
- $tok = $this->_getNextToken();
- }
-
- switch ($this->_decodeType) {
- case Zend_Json::TYPE_OBJECT:
- // Create new StdClass and populate with $members
- $result = new StdClass();
- foreach ($members as $key => $value) {
- $result->$key = $value;
- }
- break;
- case Zend_Json::TYPE_ARRAY:
- default:
- $result = $members;
- break;
- }
-
- $this->_getNextToken();
- return $result;
- }
-
- /**
- * Decodes a JSON array format:
- * [element, element2,...,elementN]
- *
- * @return array
- */
- protected function _decodeArray()
- {
- $result = array();
- $starttok = $tok = $this->_getNextToken(); // Move past the '['
- $index = 0;
-
- while ($tok && $tok != self::RBRACKET) {
- $result[$index++] = $this->_decodeValue();
-
- $tok = $this->_token;
-
- if ($tok == self::RBRACKET || !$tok) {
- break;
- }
-
- if ($tok != self::COMMA) {
- throw new Zend_Json_Exception('Missing "," in array encoding: ' . $this->_source);
- }
-
- $tok = $this->_getNextToken();
- }
-
- $this->_getNextToken();
- return($result);
- }
-
-
- /**
- * Removes whitepsace characters from the source input
- */
- protected function _eatWhitespace()
- {
- if (preg_match(
- '/([\t\b\f\n\r ])*/s',
- $this->_source,
- $matches,
- PREG_OFFSET_CAPTURE,
- $this->_offset)
- && $matches[0][1] == $this->_offset)
- {
- $this->_offset += strlen($matches[0][0]);
- }
- }
-
-
- /**
- * Retrieves the next token from the source stream
- *
- * @return int Token constant value specified in class definition
- */
- protected function _getNextToken()
- {
- $this->_token = self::EOF;
- $this->_tokenValue = null;
- $this->_eatWhitespace();
-
- if ($this->_offset >= $this->_sourceLength) {
- return(self::EOF);
- }
-
- $str = $this->_source;
- $str_length = $this->_sourceLength;
- $i = $this->_offset;
- $start = $i;
-
- switch ($str{$i}) {
- case '{':
- $this->_token = self::LBRACE;
- break;
- case '}':
- $this->_token = self::RBRACE;
- break;
- case '[':
- $this->_token = self::LBRACKET;
- break;
- case ']':
- $this->_token = self::RBRACKET;
- break;
- case ',':
- $this->_token = self::COMMA;
- break;
- case ':':
- $this->_token = self::COLON;
- break;
- case '"':
- $result = '';
- do {
- $i++;
- if ($i >= $str_length) {
- break;
- }
-
- $chr = $str{$i};
- if ($chr == '\\') {
- $i++;
- if ($i >= $str_length) {
- break;
- }
- $chr = $str{$i};
- switch ($chr) {
- case '"' :
- $result .= '"';
- break;
- case '\\':
- $result .= '\\';
- break;
- case '/' :
- $result .= '/';
- break;
- case 'b' :
- $result .= chr(8);
- break;
- case 'f' :
- $result .= chr(12);
- break;
- case 'n' :
- $result .= chr(10);
- break;
- case 'r' :
- $result .= chr(13);
- break;
- case 't' :
- $result .= chr(9);
- break;
- default:
- throw new Zend_Json_Exception("Illegal escape "
- . "sequence '" . $chr . "'");
- }
- } elseif ($chr == '"') {
- break;
- } else {
- $result .= $chr;
- }
- } while ($i < $str_length);
-
- $this->_token = self::DATUM;
- //$this->_tokenValue = substr($str, $start + 1, $i - $start - 1);
- $this->_tokenValue = $result;
- break;
- case 't':
- if (($i+ 3) < $str_length && substr($str, $start, 4) == "true") {
- $this->_token = self::DATUM;
- }
- $this->_tokenValue = true;
- $i += 3;
- break;
- case 'f':
- if (($i+ 4) < $str_length && substr($str, $start, 5) == "false") {
- $this->_token = self::DATUM;
- }
- $this->_tokenValue = false;
- $i += 4;
- break;
- case 'n':
- if (($i+ 3) < $str_length && substr($str, $start, 4) == "null") {
- $this->_token = self::DATUM;
- }
- $this->_tokenValue = NULL;
- $i += 3;
- break;
- }
-
- if ($this->_token != self::EOF) {
- $this->_offset = $i + 1; // Consume the last token character
- return($this->_token);
- }
-
- $chr = $str{$i};
- if ($chr == '-' || $chr == '.' || ($chr >= '0' && $chr <= '9')) {
- if (preg_match('/-?([0-9])*(\.[0-9]*)?((e|E)((-|\+)?)[0-9]+)?/s',
- $str, $matches, PREG_OFFSET_CAPTURE, $start) && $matches[0][1] == $start) {
-
- $datum = $matches[0][0];
-
- if (is_numeric($datum)) {
- if (preg_match('/^0\d+$/', $datum)) {
- throw new Zend_Json_Exception("Octal notation not supported by JSON (value: $datum)");
- } else {
- $val = intval($datum);
- $fVal = floatval($datum);
- $this->_tokenValue = ($val == $fVal ? $val : $fVal);
- }
- } else {
- throw new Zend_Json_Exception("Illegal number format: $datum");
- }
-
- $this->_token = self::DATUM;
- $this->_offset = $start + strlen($datum);
- }
- } else {
- throw new Zend_Json_Exception('Illegal Token');
- }
-
- return($this->_token);
- }
-}
-
diff --git a/libs/Zend/Json/Encoder.php b/libs/Zend/Json/Encoder.php
deleted file mode 100755
index 8589b420b8..0000000000
--- a/libs/Zend/Json/Encoder.php
+++ /dev/null
@@ -1,413 +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_Json
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_Json_Exception
- */
-require_once 'Zend/Json/Exception.php';
-
-
-/**
- * Encode PHP constructs to JSON
- *
- * @category Zend
- * @package Zend_Json
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Json_Encoder
-{
- /**
- * Whether or not to check for possible cycling
- *
- * @var boolean
- */
- protected $_cycleCheck;
-
- /**
- * Array of visited objects; used to prevent cycling.
- *
- * @var array
- */
- protected $_visited = array();
-
- /**
- * Constructor
- *
- * @param boolean $cycleCheck Whether or not to check for recursion when encoding
- * @return void
- */
- protected function __construct($cycleCheck = false)
- {
- $this->_cycleCheck = $cycleCheck;
- }
-
- /**
- * Use the JSON encoding scheme for the value specified
- *
- * @param mixed $value The value to be encoded
- * @param boolean $cycleCheck Whether or not to check for possible object recursion when encoding
- * @return string The encoded value
- */
- public static function encode($value, $cycleCheck = false)
- {
- $encoder = new Zend_Json_Encoder(($cycleCheck) ? true : false);
-
- return $encoder->_encodeValue($value);
- }
-
- /**
- * Recursive driver which determines the type of value to be encoded
- * and then dispatches to the appropriate method. $values are either
- * - objects (returns from {@link _encodeObject()})
- * - arrays (returns from {@link _encodeArray()})
- * - basic datums (e.g. numbers or strings) (returns from {@link _encodeDatum()})
- *
- * @param $value mixed The value to be encoded
- * @return string Encoded value
- */
- protected function _encodeValue(&$value)
- {
- if (is_object($value)) {
- return $this->_encodeObject($value);
- } else if (is_array($value)) {
- return $this->_encodeArray($value);
- }
-
- return $this->_encodeDatum($value);
- }
-
-
-
- /**
- * Encode an object to JSON by encoding each of the public properties
- *
- * A special property is added to the JSON object called '__className'
- * that contains the name of the class of $value. This is used to decode
- * the object on the client into a specific class.
- *
- * @param $value object
- * @return string
- * @throws Zend_Json_Exception If recursive checks are enabled and the object has been serialized previously
- */
- protected function _encodeObject(&$value)
- {
- if ($this->_cycleCheck) {
- if ($this->_wasVisited($value)) {
- throw new Zend_Json_Exception(
- 'Cycles not supported in JSON encoding, cycle introduced by '
- . 'class "' . get_class($value) . '"'
- );
- }
-
- $this->_visited[] = $value;
- }
-
- $props = '';
- foreach (get_object_vars($value) as $name => $propValue) {
- if (isset($propValue)) {
- $props .= ','
- . $this->_encodeValue($name)
- . ':'
- . $this->_encodeValue($propValue);
- }
- }
-
- return '{"__className":"' . get_class($value) . '"'
- . $props . '}';
- }
-
-
- /**
- * Determine if an object has been serialized already
- *
- * @param mixed $value
- * @return boolean
- */
- protected function _wasVisited(&$value)
- {
- if (in_array($value, $this->_visited, true)) {
- return true;
- }
-
- return false;
- }
-
-
- /**
- * JSON encode an array value
- *
- * Recursively encodes each value of an array and returns a JSON encoded
- * array string.
- *
- * Arrays are defined as integer-indexed arrays starting at index 0, where
- * the last index is (count($array) -1); any deviation from that is
- * considered an associative array, and will be encoded as such.
- *
- * @param $array array
- * @return string
- */
- protected function _encodeArray(&$array)
- {
- $tmpArray = array();
-
- // Check for associative array
- if (!empty($array) && (array_keys($array) !== range(0, count($array) - 1))) {
- // Associative array
- $result = '{';
- foreach ($array as $key => $value) {
- $key = (string) $key;
- $tmpArray[] = $this->_encodeString($key)
- . ':'
- . $this->_encodeValue($value);
- }
- $result .= implode(',', $tmpArray);
- $result .= '}';
- } else {
- // Indexed array
- $result = '[';
- $length = count($array);
- for ($i = 0; $i < $length; $i++) {
- $tmpArray[] = $this->_encodeValue($array[$i]);
- }
- $result .= implode(',', $tmpArray);
- $result .= ']';
- }
-
- return $result;
- }
-
-
- /**
- * JSON encode a basic data type (string, number, boolean, null)
- *
- * If value type is not a string, number, boolean, or null, the string
- * 'null' is returned.
- *
- * @param $value mixed
- * @return string
- */
- protected function _encodeDatum(&$value)
- {
- $result = 'null';
-
- if (is_int($value) || is_float($value)) {
- $result = (string)$value;
- } elseif (is_string($value)) {
- $result = $this->_encodeString($value);
- } elseif (is_bool($value)) {
- $result = $value ? 'true' : 'false';
- }
-
- return $result;
- }
-
-
- /**
- * JSON encode a string value by escaping characters as necessary
- *
- * @param $value string
- * @return string
- */
- protected function _encodeString(&$string)
- {
- // Escape these characters with a backslash:
- // " \ / \n \r \t \b \f
- $search = array('\\', "\n", "\t", "\r", "\b", "\f", '"');
- $replace = array('\\\\', '\\n', '\\t', '\\r', '\\b', '\\f', '\"');
- $string = str_replace($search, $replace, $string);
-
- // Escape certain ASCII characters:
- // 0x08 => \b
- // 0x0c => \f
- $string = str_replace(array(chr(0x08), chr(0x0C)), array('\b', '\f'), $string);
-
- return '"' . $string . '"';
- }
-
-
- /**
- * Encode the constants associated with the ReflectionClass
- * parameter. The encoding format is based on the class2 format
- *
- * @param $cls ReflectionClass
- * @return string Encoded constant block in class2 format
- */
- private static function _encodeConstants(ReflectionClass $cls)
- {
- $result = "constants : {";
- $constants = $cls->getConstants();
-
- $tmpArray = array();
- if (!empty($constants)) {
- foreach ($constants as $key => $value) {
- $tmpArray[] = "$key: " . self::encode($value);
- }
-
- $result .= implode(', ', $tmpArray);
- }
-
- return $result . "}";
- }
-
-
- /**
- * Encode the public methods of the ReflectionClass in the
- * class2 format
- *
- * @param $cls ReflectionClass
- * @return string Encoded method fragment
- *
- */
- private static function _encodeMethods(ReflectionClass $cls)
- {
- $methods = $cls->getMethods();
- $result = 'methods:{';
-
- $started = false;
- foreach ($methods as $method) {
- if (! $method->isPublic() || !$method->isUserDefined()) {
- continue;
- }
-
- if ($started) {
- $result .= ',';
- }
- $started = true;
-
- $result .= '' . $method->getName(). ':function(';
-
- if ('__construct' != $method->getName()) {
- $parameters = $method->getParameters();
- $paramCount = count($parameters);
- $argsStarted = false;
-
- $argNames = "var argNames=[";
- foreach ($parameters as $param) {
- if ($argsStarted) {
- $result .= ',';
- }
-
- $result .= $param->getName();
-
- if ($argsStarted) {
- $argNames .= ',';
- }
-
- $argNames .= '"' . $param->getName() . '"';
-
- $argsStarted = true;
- }
- $argNames .= "];";
-
- $result .= "){"
- . $argNames
- . 'var result = ZAjaxEngine.invokeRemoteMethod('
- . "this, '" . $method->getName()
- . "',argNames,arguments);"
- . 'return(result);}';
- } else {
- $result .= "){}";
- }
- }
-
- return $result . "}";
- }
-
-
- /**
- * Encode the public properties of the ReflectionClass in the class2
- * format.
- *
- * @param $cls ReflectionClass
- * @return string Encode properties list
- *
- */
- private static function _encodeVariables(ReflectionClass $cls)
- {
- $properties = $cls->getProperties();
- $propValues = get_class_vars($cls->getName());
- $result = "variables:{";
- $cnt = 0;
-
- $tmpArray = array();
- foreach ($properties as $prop) {
- if (! $prop->isPublic()) {
- continue;
- }
-
- $tmpArray[] = $prop->getName()
- . ':'
- . self::encode($propValues[$prop->getName()]);
- }
- $result .= implode(',', $tmpArray);
-
- return $result . "}";
- }
-
- /**
- * Encodes the given $className into the class2 model of encoding PHP
- * classes into JavaScript class2 classes.
- * NOTE: Currently only public methods and variables are proxied onto
- * the client machine
- *
- * @param $className string The name of the class, the class must be
- * instantiable using a null constructor
- * @param $package string Optional package name appended to JavaScript
- * proxy class name
- * @return string The class2 (JavaScript) encoding of the class
- * @throws Zend_Json_Exception
- */
- public static function encodeClass($className, $package = '')
- {
- $cls = new ReflectionClass($className);
- if (! $cls->isInstantiable()) {
- throw new Zend_Json_Exception("$className must be instantiable");
- }
-
- return "Class.create('$package$className',{"
- . self::_encodeConstants($cls) .","
- . self::_encodeMethods($cls) .","
- . self::_encodeVariables($cls) .'});';
- }
-
-
- /**
- * Encode several classes at once
- *
- * Returns JSON encoded classes, using {@link encodeClass()}.
- *
- * @param array $classNames
- * @param string $package
- * @return string
- */
- public static function encodeClasses(array $classNames, $package = '')
- {
- $result = '';
- foreach ($classNames as $className) {
- $result .= self::encodeClass($className, $package);
- }
-
- return $result;
- }
-
-}
-
diff --git a/libs/Zend/Json/Exception.php b/libs/Zend/Json/Exception.php
deleted file mode 100755
index bf29acaa8d..0000000000
--- a/libs/Zend/Json/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_Json
- * @copyright Copyright (c) 2005-2007 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_Json
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Json_Exception extends Zend_Exception
-{}
-
diff --git a/libs/Zend/Json/TODO.txt b/libs/Zend/Json/TODO.txt
deleted file mode 100755
index cfdb24cdbd..0000000000
--- a/libs/Zend/Json/TODO.txt
+++ /dev/null
@@ -1 +0,0 @@
-* Unit tests
diff --git a/libs/Zend/Mail.php b/libs/Zend/Mail.php
deleted file mode 100755
index 59201a4ce2..0000000000
--- a/libs/Zend/Mail.php
+++ /dev/null
@@ -1,649 +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_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_Mail_Exception
- */
-require_once 'Zend/Mail/Exception.php';
-
-/**
- * Zend_Mail_Transport_Abstract
- */
-require_once 'Zend/Mail/Transport/Abstract.php';
-
-/**
- * Zend_Mime
- */
-require_once 'Zend/Mime.php';
-
-/**
- * Zend_Mail_Transport_Abstract
- */
-require_once 'Zend/Mail/Transport/Abstract.php';
-
-/**
- * Zend_Mime_Message
- */
-require_once 'Zend/Mime/Message.php';
-
-/**
- * Zend_Mime_Part
- */
-require_once 'Zend/Mime/Part.php';
-
-
-/**
- * Class for sending an email.
- *
- * @category Zend
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mail extends Zend_Mime_Message
-{
- /**#@+
- * @access protected
- */
-
- /**
- * @var Zend_Mail_Transport_Abstract
- * @static
- */
- protected static $_defaultTransport = null;
-
- /**
- * Mail character set
- * @var string
- */
- protected $_charset = null;
-
- /**
- * Mail headers
- * @var array
- */
- protected $_headers = array();
-
- /**
- * From: address
- * @var string
- */
- protected $_from = null;
-
- /**
- * To: addresses
- * @var array
- */
- protected $_to = array();
-
- /**
- * Array of all recipients
- * @var array
- */
- protected $_recipients = array();
-
- /**
- * Return-Path header
- * @var string
- */
- protected $_returnPath = null;
-
- /**
- * Subject: header
- * @var string
- */
- protected $_subject = null;
-
- /**
- * text/plain MIME part
- * @var false|Zend_Mime_Part
- */
- protected $_bodyText = false;
-
- /**
- * text/html MIME part
- * @var false|Zend_Mime_Part
- */
- protected $_bodyHtml = false;
-
- /**
- * MIME boundary string
- * @var string
- */
- protected $_mimeBoundary = null;
-
- /**
- * Content type of the message
- * @var string
- */
- protected $_type = null;
-
- /**#@-*/
-
- /**
- * Flag: whether or not email has attachments
- * @var boolean
- */
- public $hasAttachments = false;
-
-
- /**
- * Sets the default mail transport for all following uses of
- * Zend_Mail::send();
- *
- * @todo Allow passing a string to indicate the transport to load
- * @todo Allow passing in optional options for the transport to load
- * @param Zend_Mail_Transport_Abstract $transport
- */
- public static function setDefaultTransport(Zend_Mail_Transport_Abstract $transport)
- {
- self::$_defaultTransport = $transport;
- }
-
- /**
- * Public constructor
- *
- * @param string $charset
- */
- public function __construct($charset='iso-8859-1')
- {
- $this->_charset = $charset;
- }
-
- /**
- * Return charset string
- *
- * @return string
- */
- public function getCharset()
- {
- return $this->_charset;
- }
-
- /**
- * Set content type
- *
- * Should only be used for manually setting multipart content types.
- *
- * @param string $type Content type
- * @return Zend_Mail Implements fluent interface
- * @throws Zend_Mail_Exception for types not supported by Zend_Mime
- */
- public function setType($type)
- {
- $allowed = array(
- Zend_Mime::MULTIPART_ALTERNATIVE,
- Zend_Mime::MULTIPART_MIXED,
- Zend_Mime::MULTIPART_RELATED,
- );
- if (!in_array($type, $allowed)) {
- throw new Zend_Mail_Exception('Invalid content type "' . $type . '"');
- }
-
- $this->_type = $type;
- return $this;
- }
-
- /**
- * Get content type of the message
- *
- * @return string
- */
- public function getType()
- {
- return $this->_type;
- }
-
- /**
- * Set an arbitrary mime boundary for the message
- *
- * If not set, Zend_Mime will generate one.
- *
- * @param string $boundary
- * @return Zend_Mail Provides fluent interface
- */
- public function setMimeBoundary($boundary)
- {
- $this->_mimeBoundary = $boundary;
- }
-
- /**
- * Return the boundary string used for the message
- *
- * @return string
- */
- public function getMimeBoundary()
- {
- return $this->_mimeBoundary;
- }
-
- /**
- * Sets the text body for the message.
- *
- * @param string $txt
- * @param string $charset
- * @param string $encoding
- * @return Zend_Mail Provides fluent interface
- */
- public function setBodyText($txt, $charset = null, $encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE)
- {
- if ($charset === null) {
- $charset = $this->_charset;
- }
-
- $mp = new Zend_Mime_Part($txt);
- $mp->encoding = $encoding;
- $mp->type = Zend_Mime::TYPE_TEXT;
- $mp->disposition = Zend_Mime::DISPOSITION_INLINE;
- $mp->charset = $charset;
-
- $this->_bodyText = $mp;
-
- return $this;
- }
-
- /**
- * Return text body Zend_Mime_Part or string
- *
- * @param bool textOnly Whether to return just the body text content or the MIME part; defaults to false, the MIME part
- * @return false|Zend_Mime_Part|string
- */
- public function getBodyText($textOnly = false)
- {
- if ($textOnly && $this->_bodyText) {
- $body = $this->_bodyText;
- return $body->getContent();
- }
-
- return $this->_bodyText;
- }
-
- /**
- * Sets the HTML body for the message
- *
- * @param string $html
- * @param string $charset
- * @param string $encoding
- * @return Zend_Mail Provides fluent interface
- */
- public function setBodyHtml($html, $charset = null, $encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE)
- {
- if ($charset === null) {
- $charset = $this->_charset;
- }
-
- $mp = new Zend_Mime_Part($html);
- $mp->encoding = $encoding;
- $mp->type = Zend_Mime::TYPE_HTML;
- $mp->disposition = Zend_Mime::DISPOSITION_INLINE;
- $mp->charset = $charset;
-
- $this->_bodyHtml = $mp;
-
- return $this;
- }
-
- /**
- * Return Zend_Mime_Part representing body HTML
- *
- * @param bool $htmlOnly Whether to return the body HTML only, or the MIME part; defaults to false, the MIME part
- * @return false|Zend_Mime_Part|string
- */
- public function getBodyHtml($htmlOnly = false)
- {
- if ($htmlOnly && $this->_bodyHtml) {
- $body = $this->_bodyHtml;
- return $body->getContent();
- }
-
- return $this->_bodyHtml;
- }
-
- /**
- * Adds an existing attachment to the mail message
- *
- * @param Zend_Mime_Part $attachment
- * @return Zend_Mail Provides fluent interface
- */
- public function addAttachment(Zend_Mime_Part $attachment)
- {
- $this->addPart($attachment);
- $this->hasAttachments = true;
-
- return $this;
- }
-
- /**
- * Creates a Zend_Mime_Part attachment
- *
- * Attachment is automatically added to the mail object after creation. The
- * attachment object is returned to allow for further manipulation.
- *
- * @param string $body
- * @param string $mimeType
- * @param string $disposition
- * @param string $encoding
- * @param string $filename OPTIONAL A filename for the attachment
- * @return Zend_Mime_Part Newly created Zend_Mime_Part object (to allow
- * advanced settings)
- */
- public function createAttachment($body,
- $mimeType = Zend_Mime::TYPE_OCTETSTREAM,
- $disposition = Zend_Mime::DISPOSITION_ATTACHMENT,
- $encoding = Zend_Mime::ENCODING_BASE64,
- $filename = null)
- {
-
- $mp = new Zend_Mime_Part($body);
- $mp->encoding = $encoding;
- $mp->type = $mimeType;
- $mp->disposition = $disposition;
- $mp->filename = $filename;
-
- $this->addAttachment($mp);
-
- return $mp;
- }
-
- /**
- * Return a count of message parts
- *
- * @return void
- */
- public function getPartCount()
- {
- return count($this->_parts);
- }
-
- /**
- * Encode header fields
- *
- * Encodes header content according to RFC1522 if it contains non-printable
- * characters.
- *
- * @param string $value
- * @return string
- */
- protected function _encodeHeader($value)
- {
- if (Zend_Mime::isPrintable($value)) {
- return $value;
- } else {
- $quotedValue = Zend_Mime::encodeQuotedPrintable($value);
- $quotedValue = str_replace(array('?', ' '), array('=3F', '=20'), $quotedValue);
- return '=?' . $this->_charset . '?Q?' . $quotedValue . '?=';
- }
- }
-
- /**
- * Add a header to the message
- *
- * Adds a header to this message. If append is true and the header already
- * exists, raises a flag indicating that the header should be appended.
- *
- * @param string $headerName
- * @param string $value
- * @param boolean $append
- */
- protected function _storeHeader($headerName, $value, $append=false)
- {
- $value = strtr($value,"\r\n\t",'???');
- if (isset($this->_headers[$headerName])) {
- $this->_headers[$headerName][] = $value;
- } else {
- $this->_headers[$headerName] = array($value);
- }
-
- if ($append) {
- $this->_headers[$headerName]['append'] = true;
- }
-
- }
-
- /**
- * Add a recipient
- *
- * @param string $email
- */
- protected function _addRecipient($email, $to = false)
- {
- // prevent duplicates
- $this->_recipients[$email] = 1;
-
- if ($to) {
- $this->_to[] = $email;
- }
- }
-
- /**
- * Helper function for adding a recipient and the corresponding header
- *
- * @param string $headerName
- * @param string $name
- * @param string $email
- */
- protected function _addRecipientAndHeader($headerName, $name, $email)
- {
- $email = strtr($email,"\r\n\t",'???');
- $this->_addRecipient($email, ('To' == $headerName) ? true : false);
- if ($name != '') {
- $name = '"' . $this->_encodeHeader($name) . '" ';
- }
-
- $this->_storeHeader($headerName, $name .'<'. $email . '>', true);
- }
-
- /**
- * Adds To-header and recipient
- *
- * @param string $name
- * @param string $email
- * @return Zend_Mail Provides fluent interface
- */
- public function addTo($email, $name='')
- {
- $this->_addRecipientAndHeader('To', $name, $email);
- return $this;
- }
-
- /**
- * Adds Cc-header and recipient
- *
- * @param string $name
- * @param string $email
- * @return Zend_Mail Provides fluent interface
- */
- public function addCc($email, $name='')
- {
- $this->_addRecipientAndHeader('Cc', $name, $email);
- return $this;
- }
-
- /**
- * Adds Bcc recipient
- *
- * @param string $email
- * @return Zend_Mail Provides fluent interface
- */
- public function addBcc($email)
- {
- $this->_addRecipientAndHeader('Bcc', '', $email);
- return $this;
- }
-
- /**
- * Return list of recipient email addresses
- *
- * @return array (of strings)
- */
- public function getRecipients()
- {
- return array_keys($this->_recipients);
- }
-
- /**
- * Sets From-header and sender of the message
- *
- * @param string $email
- * @param string $name
- * @return Zend_Mail Provides fluent interface
- * @throws Zend_Mail_Exception if called subsequent times
- */
- public function setFrom($email, $name = '')
- {
- if ($this->_from === null) {
- $email = strtr($email,"\r\n\t",'???');
- $this->_from = $email;
- $this->_storeHeader('From', $this->_encodeHeader('"'.$name.'"').' <'.$email.'>', true);
- } else {
- throw new Zend_Mail_Exception('From Header set twice');
- }
- return $this;
- }
-
- /**
- * Returns the sender of the mail
- *
- * @return string
- */
- public function getFrom()
- {
- return $this->_from;
- }
-
- /**
- * Sets the Return-Path header for an email
- *
- * @param string $email
- * @return Zend_Mail Provides fluent interface
- * @throws Zend_Mail_Exception if set multiple times
- */
- public function setReturnPath($email)
- {
- if ($this->_returnPath === null) {
- $email = strtr($email,"\r\n\t",'???');
- $this->_returnPath = $email;
- $this->_storeHeader('Return-Path', $email, false);
- } else {
- throw new Zend_Mail_Exception('Return-Path Header set twice');
- }
- return $this;
- }
-
- /**
- * Returns the current Return-Path address for the email
- *
- * If no Return-Path header is set, returns the value of {@link $_from}.
- *
- * @return string
- */
- public function getReturnPath()
- {
- if (null !== $this->_returnPath) {
- return $this->_returnPath;
- }
-
- return $this->_from;
- }
-
- /**
- * Sets the subject of the message
- *
- * @param string $subject
- * @return Zend_Mail Provides fluent interface
- */
- public function setSubject($subject)
- {
- if ($this->_subject === null) {
- $subject = strtr($subject,"\r\n\t",'???');
- $this->_subject = $this->_encodeHeader($subject);
- $this->_storeHeader('Subject', $this->_subject);
- } else {
- throw new Zend_Mail_Exception('Subject set twice');
- }
- return $this;
- }
-
- /**
- * Returns the encoded subject of the message
- *
- * @return string
- */
- public function getSubject()
- {
- return $this->_subject;
- }
-
- /**
- * Add a custom header to the message
- *
- * @param string $name
- * @param string $value
- * @param boolean $append
- * @return Zend_Mail Provides fluent interface
- * @throws Zend_Mail_Exception on attempts to create standard headers
- */
- public function addHeader($name, $value, $append = false)
- {
- if (in_array(strtolower($name), array('to', 'cc', 'bcc', 'from', 'subject', 'return-path'))) {
- throw new Zend_Mail_Exception('Cannot set standard header from addHeader()');
- }
-
- $value = strtr($value,"\r\n\t",'???');
- $value = $this->_encodeHeader($value);
- $this->_storeHeader($name, $value, $append);
- }
-
- /**
- * Return mail headers
- *
- * @return void
- */
- public function getHeaders()
- {
- return $this->_headers;
- }
-
- /**
- * Sends this email using the given transport or a previously
- * set DefaultTransport or the internal mail function if no
- * default transport had been set.
- *
- * @param Zend_Mail_Transport_Abstract $transport
- * @return Zend_Mail Provides fluent interface
- */
- public function send($transport = null)
- {
- if ($transport === null) {
- if (! self::$_defaultTransport instanceof Zend_Mail_Transport_Abstract) {
- require_once 'Zend/Mail/Transport/Sendmail.php';
- $transport = new Zend_Mail_Transport_Sendmail();
- } else {
- $transport = self::$_defaultTransport;
- }
- }
-
- $transport->send($this);
-
- return $this;
- }
-
-}
diff --git a/libs/Zend/Mail/Exception.php b/libs/Zend/Mail/Exception.php
deleted file mode 100755
index 6cb4262caf..0000000000
--- a/libs/Zend/Mail/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_Mail
- * @copyright Copyright (c) 2005-2007 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_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mail_Exception extends Zend_Exception
-{}
-
diff --git a/libs/Zend/Mail/Message.php b/libs/Zend/Mail/Message.php
deleted file mode 100755
index bdb2f72516..0000000000
--- a/libs/Zend/Mail/Message.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-
-/**
- * Zend_Mail_Exception
- */
-require_once 'Zend/Mail/Exception.php';
-
-/**
- * Zend_Mail_Part
- */
-require_once 'Zend/Mail/Part.php';
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_Mail_Message extends Zend_Mail_Part
-{
- /**
- * flags for this message
- * @var array
- */
- protected $_flags = array();
-
- /**
- * Public constructor
- *
- * In addition to the parameters of Zend_Mail_Part::__construct() this constructor supports:
- * - file filename or file handle of a file with raw message content
- * - flags array with flags for message, keys are ignored, use constants defined in Zend_Mail_Storage
- *
- * @param string $rawMessage full message with or without headers
- * @throws Zend_Mail_Exception
- */
- public function __construct(array $params)
- {
- if (isset($params['file'])) {
- if (!is_resource($params['file'])) {
- $params['raw'] = @file_get_contents($params['file']);
- if ($params['raw'] === false) {
- throw new Zend_Mail_Exception('could not open file');
- }
- } else {
- $params['raw'] = stream_get_contents($params['file']);
- }
- }
-
- if (!empty($params['flags'])) {
- // set key and value to the same value for easy lookup
- $this->_flags = array_combine($params['flags'], $params['flags']);
- }
-
- parent::__construct($params);
- }
-
- /**
- * return toplines as found after headers
- *
- * @return string toplines
- */
- public function getTopLines()
- {
- return $this->_topLines;
- }
-
- /**
- * check if flag is set
- *
- * @param mixed $flag a flag name, use constants defined in Zend_Mail_Storage
- * @return bool true if set, otherwise false
- */
- public function hasFlag($flag)
- {
- return isset($this->_flags[$flag]);
- }
-
- /**
- * get all set flags
- *
- * @return array array with flags, key and value are the same for easy lookup
- */
- public function getFlags()
- {
- return $this->_flags;
- }
-}
diff --git a/libs/Zend/Mail/Part.php b/libs/Zend/Mail/Part.php
deleted file mode 100755
index dbc33d53ff..0000000000
--- a/libs/Zend/Mail/Part.php
+++ /dev/null
@@ -1,422 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-
-/**
- * Zend_Mime_Decode
- */
-require_once 'Zend/Mime/Decode.php';
-
-/**
- * Zend_Mail_Exception
- */
-require_once 'Zend/Mail/Exception.php';
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_Mail_Part implements RecursiveIterator
-{
- /**
- * headers of part as array
- * @var null|array
- */
- protected $_headers;
-
- /**
- * raw part body
- * @var null|string
- */
- protected $_content;
-
- /**
- * toplines as fetched with headers
- * @var string
- */
- protected $_topLines = '';
-
- /**
- * parts of multipart message
- * @var array
- */
- protected $_parts = array();
-
- /**
- * count of parts of a multipart message
- * @var null|int
- */
- protected $_countParts;
-
- /**
- * current position of iterator
- * @var int
- */
- protected $_iterationPos = 1;
-
- /**
- * mail handler, if late fetch is active
- * @var null|Zend_Mail_Storage_Abstract
- */
- protected $_mail;
-
- /**
- * message number for mail handler
- * @var int
- */
- protected $_messageNum = 0;
-
- /**
- * Public constructor
- *
- * Zend_Mail_Part supports different sources for content. The possible params are:
- * - handler a instance of Zend_Mail_Storage_Abstract for late fetch
- * - id number of message for handler
- * - raw raw content with header and body as string
- * - headers headers as array (name => value) or string, if a content part is found it's used as toplines
- * - noToplines ignore content found after headers in param 'headers'
- * - content content as string
- *
- * @param array $params full message with or without headers
- */
- public function __construct(array $params)
- {
- if (isset($params['handler'])) {
- if (!$params['handler'] instanceof Zend_Mail_Storage_Abstract) {
- throw new Zend_Mail_Exception('handler is not a valid mail handler');
- }
- if (!isset($params['id'])) {
- throw new Zend_Mail_Exception('need a message id with a handler');
- }
-
- $this->_mail = $params['handler'];
- $this->_messageNum = $params['id'];
- }
-
- if (isset($params['raw'])) {
- Zend_Mime_Decode::splitMessage($params['raw'], $this->_headers, $this->_content);
- } else if (isset($params['headers'])) {
- if (is_array($params['headers'])) {
- $this->_headers = $params['headers'];
- } else {
- if (!empty($params['noToplines'])) {
- Zend_Mime_Decode::splitMessage($params['headers'], $this->_headers, $null);
- } else {
- Zend_Mime_Decode::splitMessage($params['headers'], $this->_headers, $this->_topLines);
- }
- }
- if (isset($params['content'])) {
- $this->_content = $params['content'];
- }
- }
- }
-
- /**
- * Check if part is a multipart message
- *
- * @return bool if part is multipart
- */
- public function isMultipart()
- {
- try {
- return strpos($this->contentType, 'multipart/') === 0;
- } catch(Zend_Mail_Exception $e) {
- return false;
- }
- }
-
-
- /**
- * Body of part
- *
- * If part is multipart the raw content of this part with all sub parts is returned
- *
- * @return string body
- * @throws Zend_Mail_Exception
- */
- public function getContent()
- {
- if ($this->_content !== null) {
- return $this->_content;
- }
-
- if ($this->_mail) {
- return $this->_mail->getRawContent($this->_messageNum);
- } else {
- throw new Zend_Mail_Exception('no content');
- }
- }
-
- /**
- * Cache content and split in parts if multipart
- *
- * @return null
- * @throws Zend_Mail_Exception
- */
- protected function _cacheContent()
- {
- // caching content if we can't fetch parts
- if ($this->_content === null && $this->_mail) {
- $this->_content = $this->_mail->getRawContent($this->_messageNum);
- }
-
- if (!$this->isMultipart()) {
- return;
- }
-
- // split content in parts
- $boundary = Zend_Mime_Decode::splitContentType($this->contentType, 'boundary');
- if (!$boundary) {
- throw new Zend_Mail_Exception('no boundary found in content type to split message');
- }
- $parts = Zend_Mime_Decode::splitMessageStruct($this->_content, $boundary);
- $counter = 1;
- foreach ($parts as $part) {
- $this->_parts[$counter++] = new self(array('headers' => $part['header'], 'content' => $part['body']));
- }
- }
-
- /**
- * Get part of multipart message
- *
- * @param int $num number of part starting with 1 for first part
- * @return Zend_Mail_Part wanted part
- * @throws Zend_Mail_Exception
- */
- public function getPart($num)
- {
- if (isset($this->_parts[$num])) {
- return $this->_parts[$num];
- }
-
- if (!$this->_mail && $this->_content === null) {
- throw new Zend_Mail_Exception('part not found');
- }
-
- if ($this->_mail && $this->_mail->hasFetchPart) {
- // TODO: fetch part
- // return
- }
-
- $this->_cacheContent();
-
- if (!isset($this->_parts[$num])) {
- throw new Zend_Mail_Exception('part not found');
- }
-
- return $this->_parts[$num];
- }
-
- /**
- * Count parts of a multipart part
- *
- * @return int number of sub-parts
- */
- public function countParts()
- {
- if ($this->_countParts) {
- return $this->_countParts;
- }
-
- $this->_countParts = count($this->_parts);
- if ($this->_countParts) {
- return $this->_countParts;
- }
-
- if ($this->_mail && $this->_mail->hasFetchPart) {
- // TODO: fetch part
- // return
- }
-
- $this->_cacheContent();
-
- $this->_countParts = count($this->_parts);
- return $this->_countParts;
- }
-
-
- /**
- * Get all headers
- *
- * The returned headers are as saved internally. All names are lowercased. The value is a string or an array
- * if a header with the same name occurs more than once.
- *
- * @return array headers as array(name => value)
- */
- public function getHeaders()
- {
- if ($this->_headers === null) {
- if (!$this->_mail) {
- $this->_headers = array();
- } else {
- $part = $this->_mail->getRawHeader($this->_messageNum);
- Zend_Mime_Decode::splitMessage($part, $this->_headers, $null);
- }
- }
-
- return $this->_headers;
- }
-
- /**
- * Get a header in specificed format
- *
- * Internally headers that occur more than once are saved as array, all other as string. If $format
- * is set to string implode is used to concat the values (with Zend_Mime::LINEEND as delim).
- *
- * @param string $name name of header, matches case-insensitive, but camel-case is replaced with dashes
- * @param string $format change type of return value to 'string' or 'array'
- * @return string|array value of header in wanted or internal format
- * @throws Zend_Mail_Exception
- */
- public function getHeader($name, $format = null)
- {
- if ($this->_headers === null) {
- $this->getHeaders();
- }
-
- $lowerName = strtolower($name);
-
- if (!isset($this->_headers[$lowerName])) {
- $lowerName = strtolower(preg_replace('%([a-z])([A-Z])%', '\1-\2', $name));
- if (!isset($this->_headers[$lowerName])) {
- throw new Zend_Mail_Exception("no Header with Name $name found");
- }
- }
- $name = $lowerName;
-
- $header = $this->_headers[$name];
-
- switch ($format) {
- case 'string':
- if (is_array($header)) {
- $header = implode(Zend_Mime::LINEEND, $header);
- }
- break;
- case 'array':
- $header = (array)$header;
- default:
- // do nothing
- }
-
- return $header;
- }
-
-
- /**
- * Getter for mail headers - name is matched in lowercase
- *
- * This getter is short for Zend_Mail_Part::getHeader($name, 'string')
- *
- * @see Zend_Mail_Part::getHeader()
- *
- * @param string $name header name
- * @return string value of header
- * @throws Zend_Mail_Exception
- */
- public function __get($name)
- {
- return $this->getHeader($name, 'string');
- }
-
- /**
- * magic method to get content of part
- *
- * @return string content
- */
- public function __toString()
- {
- return $this->getContent();
- }
-
- /**
- * implements RecursiveIterator::hasChildren()
- *
- * @return bool current element has children/is multipart
- */
- public function hasChildren()
- {
- $current = $this->current();
- return $current && $current instanceof Zend_Mail_Part && $current->isMultipart();
- }
-
- /**
- * implements RecursiveIterator::getChildren()
- *
- * @return Zend_Mail_Part same as self::current()
- */
- public function getChildren()
- {
- return $this->current();
- }
-
- /**
- * implements Iterator::valid()
- *
- * @return bool check if there's a current element
- */
- public function valid()
- {
- if ($this->_countParts === null) {
- $this->countParts();
- }
- return $this->_iterationPos && $this->_iterationPos <= $this->_countParts;
- }
-
- /**
- * implements Iterator::next()
- *
- * @return null
- */
- public function next()
- {
- ++$this->_iterationPos;
- }
-
- /**
- * implements Iterator::key()
- *
- * @return string key/number of current part
- */
- public function key()
- {
- return $this->_iterationPos;
- }
-
- /**
- * implements Iterator::current()
- *
- * @return Zend_Mail_Part current part
- */
- public function current()
- {
- return $this->getPart($this->_iterationPos);
- }
-
- /**
- * implements Iterator::rewind()
- *
- * @return null
- */
- public function rewind()
- {
- $this->countParts();
- $this->_iterationPos = 1;
- }
-}
diff --git a/libs/Zend/Mail/Protocol/Abstract.php b/libs/Zend/Mail/Protocol/Abstract.php
deleted file mode 100755
index 948ef38bd1..0000000000
--- a/libs/Zend/Mail/Protocol/Abstract.php
+++ /dev/null
@@ -1,358 +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_Mail
- * @subpackage Protocol
- * @version $Id$
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_Validate
- */
-require_once 'Zend/Validate.php';
-
-
-/**
- * Zend_Validate_Hostname
- */
-require_once 'Zend/Validate/Hostname.php';
-
-
-/**
- * Zend_Mail_Protocol_Abstract
- *
- * Provides low-level methods for concrete adapters to communicate with a remote mail server and track requests and responses.
- *
- * @todo Implement proxy settings
- * @category Zend
- * @package Zend_Mail
- * @subpackage Protocol
- * @throws Zend_Mail_Protocol_Exception
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-abstract class Zend_Mail_Protocol_Abstract
-{
- /**
- * Mail default EOL string
- */
- const EOL = "\r\n";
-
-
- /**
- * Default timeout in seconds for initiating session
- */
- const TIMEOUT_CONNECTION = 30;
-
-
- /**
- * Hostname or IP address of remote server
- * @var string
- */
- protected $_host;
-
-
- /**
- * Port number of connection
- * @var integer
- */
- protected $_port;
-
-
- /**
- * Instance of Zend_Validate to check hostnames
- * @var Zend_Validate
- */
- protected $_validHost;
-
-
- /**
- * Socket connection resource
- * @var resource
- */
- protected $_socket;
-
-
- /**
- * Last request sent to server
- * @var string
- */
- protected $_request;
-
-
- /**
- * Array of server responses to last request
- * @var array
- */
- protected $_response;
-
-
- /**
- * String template for parsing server responses using sscanf (default: 3 digit code and response string)
- * @var resource
- */
- protected $_template = '%d%s';
-
-
- /**
- * Log of mail requests and server responses for a session
- * @var string
- */
- private $_log;
-
-
- /**
- * Constructor.
- *
- * @param string $host OPTIONAL Hostname of remote connection (default: 127.0.0.1)
- * @param integer $port OPTIONAL Port number (default: null)
- * @throws Zend_Mail_Protocol_Exception
- * @return void
- */
- public function __construct($host = '127.0.0.1', $port = null)
- {
- $this->_validHost = new Zend_Validate();
- $this->_validHost->addValidator(new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_ALL));
-
- if (!$this->_validHost->isValid($host)) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception(join(', ', $this->_validHost->getMessages()));
- }
-
- $this->_host = $host;
- $this->_port = $port;
- }
-
-
- /**
- * Class destructor to cleanup open resources
- *
- * @return void
- */
- public function __destruct()
- {
- $this->_disconnect();
- }
-
-
- /**
- * Create a connection to the remote host
- *
- * Concrete adapters for this class will implement their own unique connect scripts, using the _connect() method to create the socket resource.
- */
- abstract public function connect();
-
-
- /**
- * Retrieve the last client request
- *
- * @return string
- */
- public function getRequest()
- {
- return $this->_request;
- }
-
-
- /**
- * Retrieve the last server response
- *
- * @return array
- */
- public function getResponse()
- {
- return $this->_response;
- }
-
-
- /**
- * Retrieve the transaction log
- *
- * @return string
- */
- public function getLog()
- {
- return $this->_log;
- }
-
-
- /**
- * Reset the transaction log
- *
- * @return void
- */
- public function resetLog()
- {
- $this->_log = '';
- }
-
-
- /**
- * Connect to the server using the supplied transport and target
- *
- * An example $remote string may be 'tcp://mail.example.com:25' or 'ssh://hostname.com:2222'
- *
- * @param string $remote Remote
- * @throws Zend_Mail_Protocol_Exception
- * @return boolean
- */
- protected function _connect($remote)
- {
- $errorNum = 0;
- $errorStr = '';
-
- // open connection
- $this->_socket = stream_socket_client($remote, $errorNum, $errorStr, self::TIMEOUT_CONNECTION);
-
- if ($this->_socket === false) {
- if ($errorNum == 0) {
- $errorStr = 'Could not open socket';
- }
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception($errorStr);
- }
-
- if (($result = stream_set_timeout($this->_socket, self::TIMEOUT_CONNECTION)) === false) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception('Could not set stream timeout');
- }
-
- return $result;
- }
-
-
- /**
- * Disconnect from remote host and free resource
- *
- * @return void
- */
- protected function _disconnect()
- {
- if (is_resource($this->_socket)) {
- fclose($this->_socket);
- }
- }
-
-
- /**
- * Send the given request followed by a LINEEND to the server.
- *
- * @param string $request
- * @throws Zend_Mail_Protocol_Exception
- * @return integer|boolean Number of bytes written to remote host
- */
- protected function _send($request)
- {
- if (!is_resource($this->_socket)) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception('No connection has been established to ' . $this->_host);
- }
-
- $this->_request = $request;
-
- $result = fwrite($this->_socket, $request . self::EOL);
-
- // Save request to internal log
- $this->_log .= $request . self::EOL;
-
- if ($result === false) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception('Could not send request to ' . $this->_host);
- }
-
- return $result;
- }
-
-
- /**
- * Get a line from the stream.
- *
- * @var integer $timeout Per-request timeout value if applicable
- * @throws Zend_Mail_Protocol_Exception
- * @return string
- */
- protected function _receive($timeout = null)
- {
- if (!is_resource($this->_socket)) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception('No connection has been established to ' . $this->_host);
- }
-
- // Adapters may wish to supply per-commend timeouts according to appropriate RFC
- if ($timeout !== null) {
- stream_set_timeout($this->_socket, $timeout);
- }
-
- // Retrieve response
- $reponse = fgets($this->_socket, 1024);
-
- // Save request to internal log
- $this->_log .= $reponse;
-
- // Check meta data to ensure connection is still valid
- $info = stream_get_meta_data($this->_socket);
-
- if (!empty($info['timed_out'])) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception($this->_host . ' has timed out');
- }
-
- if ($reponse === false) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception('Could not read from ' . $this->_host);
- }
-
- return $reponse;
- }
-
-
- /**
- * Parse server response for successful codes
- *
- * Read the response from the stream and check for expected return code.
- * Throws a Zend_Mail_Protocol_Exception if an unexpected code is returned.
- *
- * @param string|array $code One or more codes that indicate a successful response
- * @throws Zend_Mail_Protocol_Exception
- * @return string Last line of response string
- */
- protected function _expect($code, $timeout = null)
- {
- $this->_response = array();
- $cmd = '';
- $msg = '';
-
- if (!is_array($code)) {
- $code = array($code);
- }
-
- do {
- $this->_response[] = $result = $this->_receive($timeout);
- sscanf($result, $this->_template, $cmd, $msg);
-
- if ($cmd === null || !in_array($cmd, $code)) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception($result);
- }
-
- } while (strpos($msg, '-') === 0); // The '-' message prefix indicates an information string instead of a response string.
-
- return $msg;
- }
-}
diff --git a/libs/Zend/Mail/Protocol/Exception.php b/libs/Zend/Mail/Protocol/Exception.php
deleted file mode 100755
index 1690d53083..0000000000
--- a/libs/Zend/Mail/Protocol/Exception.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_Mail
- * @subpackage Protocol
- * @version $Id$
- * @copyright Copyright (c) 2005-2007 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_Mail
- * @subpackage Protocol
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mail_Protocol_Exception extends Zend_Exception
-{}
-
diff --git a/libs/Zend/Mail/Protocol/Imap.php b/libs/Zend/Mail/Protocol/Imap.php
deleted file mode 100755
index d86608700c..0000000000
--- a/libs/Zend/Mail/Protocol/Imap.php
+++ /dev/null
@@ -1,770 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-/**
- * Zend_Mail_Protocol_Exception
- */
-require_once 'Zend/Mail/Protocol/Exception.php';
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_Mail_Protocol_Imap
-{
- /**
- * socket to imap server
- * @var resource|null
- */
- protected $_socket;
-
- /**
- * counter for request tag
- * @var int
- */
- protected $_tagCount = 0;
-
-
- /**
- * Public constructor
- *
- * @param string $host hostname of IP address of IMAP server, if given connect() is called
- * @param int|null $port port of IMAP server, null for default (143 or 993 for ssl)
- * @param bool $ssl use ssl? 'SSL', 'TLS' or false
- * @throws Zend_Mail_Protocol_Exception
- */
- function __construct($host = '', $port = null, $ssl = false)
- {
- if ($host) {
- $this->connect($host, $port, $ssl);
- }
- }
-
- /**
- * Public destructor
- */
- public function __destruct()
- {
- $this->logout();
- }
-
- /**
- * Open connection to POP3 server
- *
- * @param string $host hostname of IP address of POP3 server
- * @param int|null $port of IMAP server, default is 143 (993 for ssl)
- * @param string|bool $ssl use 'SSL', 'TLS' or false
- * @return string welcome message
- * @throws Zend_Mail_Protocol_Exception
- */
- public function connect($host, $port = null, $ssl = false)
- {
- if ($ssl == 'SSL') {
- $host = 'ssl://' . $host;
- }
-
- if ($port === null) {
- $port = $ssl === 'SSL' ? 993 : 143;
- }
-
- $this->_socket = @fsockopen($host, $port);
- if (!$this->_socket) {
- throw new Zend_Mail_Protocol_Exception('cannot connect to host');
- }
-
- if (!$this->_assumedNextLine('* OK')) {
- throw new Zend_Mail_Protocol_Exception('host doesn\'t allow connection');
- }
-
- if ($ssl === 'TLS') {
- $result = $this->requestAndResponse('STARTTLS');
- $result = $result && stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
- if (!$result) {
- throw new Zend_Mail_Protocol_Exception('cannot enable TLS');
- }
- }
- }
-
- /**
- * get the next line from socket with error checking, but nothing else
- *
- * @return string next line
- * @throws Zend_Mail_Protocol_Exception
- */
- protected function _nextLine()
- {
- $line = @fgets($this->_socket);
- if ($line === false) {
- throw new Zend_Mail_Protocol_Exception('cannot read - connection closed?');
- }
-
- return $line;
- }
-
- /**
- * get next line and assume it starts with $start. some requests give a simple
- * feedback so we can quickly check if we can go on.
- *
- * @param string $start the first bytes we assume to be in the next line
- * @return bool line starts with $start
- * @throws Zend_Mail_Protocol_Exception
- */
- protected function _assumedNextLine($start)
- {
- $line = $this->_nextLine();
- return strpos($line, $start) === 0;
- }
-
- /**
- * get next line and split the tag. that's the normal case for a response line
- *
- * @param string $tag tag of line is returned by reference
- * @return string next line
- * @throws Zend_Mail_Protocol_Exception
- */
- protected function _nextTaggedLine(&$tag)
- {
- $line = $this->_nextLine();
-
- // seperate tag from line
- list($tag, $line) = explode(' ', $line, 2);
-
- return $line;
- }
-
- /**
- * split a given line in tokens. a token is literal of any form or a list
- *
- * @param string $line line to decode
- * @return array tokens, literals are returned as string, lists as array
- * @throws Zend_Mail_Protocol_Exception
- */
- protected function _decodeLine($line)
- {
- $tokens = array();
- $stack = array();
-
- /*
- We start to decode the response here. The unterstood tokens are:
- literal
- "literal" or also "lit\\er\"al"
- {bytes}<NL>literal
- (literals*)
- All tokens are returned in an array. Literals in braces (the last unterstood
- token in the list) are returned as an array of tokens. I.e. the following response:
- "foo" baz {3}<NL>bar ("f\\\"oo" bar)
- would be returned as:
- array('foo', 'baz', 'bar', array('f\\\"oo', 'bar'));
- */
- // replace any trailling <NL> including spaces with a single space
- $line = rtrim($line) . ' ';
- while (($pos = strpos($line, ' ')) !== false) {
- $token = substr($line, 0, $pos);
- while ($token[0] == '(') {
- array_push($stack, $tokens);
- $tokens = array();
- $token = substr($token, 1);
- }
- if ($token[0] == '"') {
- if (preg_match('%^"((.|\\\\|\\")*?)"%', $line, $matches)) {
- $tokens[] = $matches[1];
- $line = substr($line, strlen($matches[0]) + 1);
- continue;
- }
- }
- if ($token[0] == '{') {
- $endPos = strpos($token, '}');
- $chars = substr($token, 1, $endPos - 1);
- if (is_numeric($chars)) {
- $token = '';
- while (strlen($token) < $chars) {
- $token .= $this->_nextLine();
- }
- $line = '';
- if (strlen($token) > $chars) {
- $line = substr($token, $chars);
- $token = substr($token, 0, $chars);
- } else {
- $line .= $this->_nextLine();
- }
- $tokens[] = $token;
- $line = trim($line) . ' ';
- continue;
- }
- }
- if ($stack && $token[strlen($token) - 1] == ')') {
- // closing braces are not seperated by spaces, so we need to count them
- $braces = strlen($token);
- $token = rtrim($token, ')');
- // only count braces if more than one
- $braces -= strlen($token) + 1;
- // only add if token had more than just closing braces
- if ($token) {
- $tokens[] = $token;
- }
- $token = $tokens;
- $tokens = array_pop($stack);
- // special handline if more than one closing brace
- while ($braces-- > 0) {
- $tokens[] = $token;
- $token = $tokens;
- $tokens = array_pop($stack);
- }
- }
- $tokens[] = $token;
- $line = substr($line, $pos + 1);
- }
-
- // maybe the server forgot to send some closing braces
- while ($stack) {
- $child = $tokens;
- $tokens = array_pop($stack);
- $tokens[] = $child;
- }
-
- return $tokens;
- }
-
- /**
- * read a response "line" (could also be more than one real line if response has {..}<NL>)
- * and do a simple decode
- *
- * @param array|string $tokens decoded tokens are returned by reference, if $dontParse
- * is true the unparsed line is returned here
- * @param string $wantedTag check for this tag for response code. Default '*' is
- * continuation tag.
- * @param bool $dontParse if true only the unparsed line is returned $tokens
- * @return bool if returned tag matches wanted tag
- * @throws Zend_Mail_Protocol_Exception
- */
- public function readLine(&$tokens = array(), $wantedTag = '*', $dontParse = false)
- {
- $line = $this->_nextTaggedLine($tag);
- if (!$dontParse) {
- $tokens = $this->_decodeLine($line);
- } else {
- $tokens = $line;
- }
-
- // if tag is wanted tag we might be at the end of a multiline response
- return $tag == $wantedTag;
- }
-
- /**
- * read all lines of response until given tag is found (last line of response)
- *
- * @param string $tag the tag of your request
- * @param string|array $filter you can filter the response so you get only the
- * given response lines
- * @param bool $dontParse if true every line is returned unparsed instead of
- * the decoded tokens
- * @return null|bool|array tokens if success, false if error, null if bad request
- * @throws Zend_Mail_Protocol_Exception
- */
- public function readResponse($tag, $dontParse = false)
- {
- $lines = array();
- while (!$this->readLine($tokens, $tag, $dontParse)) {
- $lines[] = $tokens;
- }
-
- if ($dontParse) {
- // last to chars are still needed for response code
- $tokens = array(substr($tokens, 0, 2));
- }
- // last line has response code
- if ($tokens[0] == 'OK') {
- return $lines ? $lines : true;
- } else if ($tokens[0] == 'NO'){
- return false;
- }
- return null;
- }
-
- /**
- * send a request
- *
- * @param string $command your request command
- * @param array $tokens additional parameters to command, use escapeString() to prepare
- * @param string $tag provide a tag otherwise an autogenerated is returned
- * @return null
- * @throws Zend_Mail_Protocol_Exception
- */
- public function sendRequest($command, $tokens = array(), &$tag = null)
- {
- if (!$tag) {
- ++$this->_tagCount;
- $tag = 'TAG' . $this->_tagCount;
- }
-
- $line = $tag . ' ' . $command;
-
- foreach ($tokens as $token) {
- if (is_array($token)) {
- if (@fputs($this->_socket, $line . ' ' . $token[0] . "\r\n") === false) {
- throw new Zend_Mail_Protocol_Exception('cannot write - connection closed?');
- }
- if (!$this->_assumedNextLine('+ OK')) {
- throw new Zend_Mail_Protocol_Exception('cannot send literal string');
- }
- $line = $token[1];
- } else {
- $line .= ' ' . $token;
- }
- }
-
- if (@fputs($this->_socket, $line . "\r\n") === false) {
- throw new Zend_Mail_Protocol_Exception('cannot write - connection closed?');
- }
- }
-
- /**
- * send a request and get response at once
- *
- * @param string $command command as in sendRequest()
- * @param array $tokens parameters as in sendRequest()
- * @param bool $dontParse if true unparsed lines are returned instead of tokens
- * @return mixed response as in readResponse()
- * @throws Zend_Mail_Protocol_Exception
- */
- public function requestAndResponse($command, $tokens = array(), $dontParse = false)
- {
- $this->sendRequest($command, $tokens, $tag);
- $response = $this->readResponse($tag, $dontParse);
-
- return $response;
- }
-
- /**
- * escape one or more literals i.e. for sendRequest
- *
- * @param string|array $string the literal/-s
- * @return string|array escape literals, literals with newline ar returned
- * as array('{size}', 'string');
- */
- public function escapeString($string)
- {
- if (func_num_args() < 2) {
- if (strpos($string, "\n") !== false) {
- return array('{' . strlen($string) . '}', $string);
- } else {
- return '"' . str_replace(array('\\', '"'), array('\\\\', '\\"'), $string) . '"';
- }
- }
- $result = array();
- foreach (func_get_args() as $string) {
- $result[] = $this->escapeString($string);
- }
- return $result;
- }
-
- /**
- * escape a list with literals or lists
- *
- * @param array $list list with literals or lists as PHP array
- * @return string escaped list for imap
- */
- public function escapeList($list)
- {
- $result = array();
- foreach ($list as $k => $v) {
- if (!is_array($v)) {
-// $result[] = $this->escapeString($v);
- $result[] = $v;
- continue;
- }
- $result[] = $this->escapeList($v);
- }
- return '(' . implode(' ', $result) . ')';
- }
-
- /**
- * Login to IMAP server.
- *
- * @param string $user username
- * @param string $password password
- * @return bool success
- * @throws Zend_Mail_Protocol_Exception
- */
- public function login($user, $password)
- {
- return $this->requestAndResponse('LOGIN', $this->escapeString($user, $password), true);
- }
-
- /**
- * logout of imap server
- *
- * @return bool success
- */
- public function logout()
- {
- $result = false;
- if ($this->_socket) {
- try {
- $result = $this->requestAndResponse('LOGOUT', array(), true);
- } catch (Zend_Mail_Protocol_Exception $e) {
- // ignoring exception
- }
- fclose($this->_socket);
- $this->_socket = null;
- }
- return $result;
- }
-
-
- /**
- * Get capabilities from IMAP server
- *
- * @return array list of capabilities
- * @throws Zend_Mail_Protocol_Exception
- */
- public function capability()
- {
- $response = $this->requestAndResponse('CAPABILITY');
-
- if (!$response) {
- return $response;
- }
-
- $capabilities = array();
- foreach ($response as $line) {
- $capabilities = array_merge($capabilities, $line);
- }
- return $capabilities;
- }
-
- /**
- * Examine and select have the same response. The common code for both
- * is in this method
- *
- * @param string $command can be 'EXAMINE' or 'SELECT' and this is used as command
- * @param string $box which folder to change to or examine
- * @return bool|array false if error, array with returned information
- * otherwise (flags, exists, recent, uidvalidity)
- * @throws Zend_Mail_Protocol_Exception
- */
- public function examineOrSelect($command = 'EXAMINE', $box = 'INBOX')
- {
- $this->sendRequest($command, array($this->escapeString($box)), $tag);
-
- $result = array();
- while (!$this->readLine($tokens, $tag)) {
- if ($tokens[0] == 'FLAGS') {
- array_shift($tokens);
- $result['flags'] = $tokens;
- continue;
- }
- switch ($tokens[1]) {
- case 'EXISTS':
- case 'RECENT':
- $result[strtolower($tokens[1])] = $tokens[0];
- break;
- case '[UIDVALIDITY':
- $result['uidvalidity'] = (int)$tokens[2];
- break;
- default:
- // ignore
- }
- }
-
- if ($tokens[0] != 'OK') {
- return false;
- }
- return $result;
- }
-
- /**
- * change folder
- *
- * @param string $box change to this folder
- * @return bool|array see examineOrselect()
- * @throws Zend_Mail_Protocol_Exception
- */
- public function select($box = 'INBOX')
- {
- return $this->examineOrSelect('SELECT', $box);
- }
-
- /**
- * examine folder
- *
- * @param string $box examine this folder
- * @return bool|array see examineOrselect()
- * @throws Zend_Mail_Protocol_Exception
- */
- public function examine($box = 'INBOX')
- {
- return $this->examineOrSelect('EXAMINE', $box);
- }
-
- /**
- * fetch one or more items of one or more messages
- *
- * @param string|array $items items to fetch from message(s) as string (if only one item)
- * or array of strings
- * @param int $from message for items or start message if $to !== null
- * @param int|null $to if null only one message ($from) is fetched, else it's the
- * last message, INF means last message avaible
- * @return string|array if only one item of one message is fetched it's returned as string
- * if items of one message are fetched it's returned as (name => value)
- * if one items of messages are fetched it's returned as (msgno => value)
- * if items of messages are fetchted it's returned as (msgno => (name => value))
- * @throws Zend_Mail_Protocol_Exception
- */
- public function fetch($items, $from, $to = null)
- {
- if (is_array($from)) {
- $set = implode(',', $from);
- } else if ($to === null) {
- $set = (int)$from;
- } else if ($to === INF) {
- $set = (int)$from . ':*';
- } else {
- $set = (int)$from . ':' . (int)$to;
- }
-
- $items = (array)$items;
- $itemList = $this->escapeList($items);
-
- $this->sendRequest('FETCH', array($set, $itemList), $tag);
-
- $result = array();
- while (!$this->readLine($tokens, $tag)) {
- // ignore other responses
- if ($tokens[1] != 'FETCH') {
- continue;
- }
- // ignore other messages
- if ($to === null && !is_array($from) && $tokens[0] != $from) {
- continue;
- }
- // if we only want one item we return that one directly
- if (count($items) == 1) {
- if ($tokens[2][0] == $items[0]) {
- $data = $tokens[2][1];
- } else {
- // maybe the server send an other field we didn't wanted
- $count = count($tokens[2]);
- // we start with 2, because 0 was already checked
- for ($i = 2; $i < $count; $i += 2) {
- if ($tokens[2][$i] != $items[0]) {
- continue;
- }
- $data = $tokens[2][$i + 1];
- break;
- }
- }
- } else {
- $data = array();
- while (key($tokens[2]) !== null) {
- $data[current($tokens[2])] = next($tokens[2]);
- next($tokens[2]);
- }
- }
- // if we want only one message we can ignore everything else and just return
- if ($to === null && !is_array($from) && $tokens[0] == $from) {
- // we still need to read all lines
- while (!$this->readLine($tokens, $tag));
- return $data;
- }
- $result[$tokens[0]] = $data;
- }
-
- if ($to === null && !is_array($from)) {
- throw new Zend_Mail_Protocol_Exception('the single id was not found in response');
- }
-
- return $result;
- }
-
- /**
- * get mailbox list
- *
- * this method can't be named after the IMAP command 'LIST', as list is a reserved keyword
- *
- * @param string $reference mailbox reference for list
- * @param string $mailbox mailbox name match with wildcards
- * @return array mailboxes that matched $mailbox as array(globalName => array('delim' => .., 'flags' => ..))
- * @throws Zend_Mail_Protocol_Exception
- */
- public function listMailbox($reference = '', $mailbox = '*')
- {
- $result = array();
- $list = $this->requestAndResponse('LIST', $this->escapeString($reference, $mailbox));
- if (!$list) {
- return $result;
- }
-
- foreach ($list as $item) {
- if (count($item) != 4 || $item[0] != 'LIST') {
- continue;
- }
- $result[$item[3]] = array('delim' => $item[2], 'flags' => $item[1]);
- }
-
- return $result;
- }
-
- /**
- * set flags
- *
- * @param array $flags flags to set, add or remove - see $mode
- * @param int $from message for items or start message if $to !== null
- * @param int|null $to if null only one message ($from) is fetched, else it's the
- * last message, INF means last message avaible
- * @param string|null $mode '+' to add flags, '-' to remove flags, everything else sets the flags as given
- * @param bool $silent if false the return values are the new flags for the wanted messages
- * @return bool|array new flags if $silent is false, else true or false depending on success
- * @throws Zend_Mail_Protocol_Exception
- */
- public function store(array $flags, $from, $to = null, $mode = null, $silent = true)
- {
- $item = 'FLAGS';
- if ($mode == '+' || $mode == '-') {
- $item = $mode . $item;
- }
- if ($silent) {
- $item .= '.SILENT';
- }
-
- $flags = $this->escapeList($flags);
- $set = (int)$from;
- if ($to != null) {
- $set .= ':' . ($to == INF ? '*' : (int)$to);
- }
-
- $result = $this->requestAndResponse('STORE', array($set, $item, $flags), $silent);
-
- if ($silent) {
- return $result ? true : false;
- }
-
- $tokens = $result;
- $result = array();
- foreach ($tokens as $token) {
- if ($token[1] != 'FETCH' || $token[2][0] != 'FLAGS') {
- continue;
- }
- $result[$token[0]] = $token[2][1];
- }
-
- return $result;
- }
-
- /**
- * append a new message to given folder
- *
- * @param string $folder name of target folder
- * @param string $message full message content
- * @param array $flags flags for new message
- * @param string $date date for new message
- * @return bool success
- * @throws Zend_Mail_Protocol_Exception
- */
- public function append($folder, $message, $flags = null, $date = null)
- {
- $tokens = array();
- $tokens[] = $this->escapeString($folder);
- if ($flags !== null) {
- $tokens[] = $this->escapeList($flags);
- }
- if ($date !== null) {
- $tokens[] = $this->escapeString($date);
- }
- $tokens[] = $this->escapeString($message);
-
- return $this->requestAndResponse('APPEND', $tokens, true);
- }
-
- /**
- * copy message set from current folder to other folder
- *
- * @param string $folder destination folder
- * @param int|null $to if null only one message ($from) is fetched, else it's the
- * last message, INF means last message avaible
- * @return bool success
- * @throw Zend_Mail_Protocol_Exception
- */
- public function copy($folder, $from, $to = null)
- {
- $set = (int)$from;
- if ($to != null) {
- $set .= ':' . ($to == INF ? '*' : (int)$to);
- }
-
- return $this->requestAndResponse('COPY', array($set, $this->escapeString($folder)), true);
- }
-
- /**
- * create a new folder (and parent folders if needed)
- *
- * @param string $folder folder name
- * @return bool success
- */
- public function create($folder)
- {
- return $this->requestAndResponse('CREATE', array($this->escapeString($folder)), true);
- }
-
- /**
- * rename an existing folder
- *
- * @param string $old old name
- * @param string $new new name
- * @return bool success
- */
- public function rename($old, $new)
- {
- return $this->requestAndResponse('RENAME', $this->escapeString($old, $new), true);
- }
-
- /**
- * remove a folder
- *
- * @param string $folder folder name
- * @return bool success
- */
- public function delete($folder)
- {
- return $this->requestAndResponse('DELETE', array($this->escapeString($folder)), true);
- }
-
- /**
- * permanently remove messages
- *
- * @return bool success
- */
- public function expunge()
- {
- // TODO: parse response?
- return $this->requestAndResponse('EXPUNGE');
- }
-
- /**
- * send noop
- *
- * @return bool success
- */
- public function noop()
- {
- // TODO: parse response
- return $this->requestAndResponse('NOOP');
- }
-}
diff --git a/libs/Zend/Mail/Protocol/Pop3.php b/libs/Zend/Mail/Protocol/Pop3.php
deleted file mode 100755
index d406b3e707..0000000000
--- a/libs/Zend/Mail/Protocol/Pop3.php
+++ /dev/null
@@ -1,424 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-/**
- * Zend_Mail_Protocol_Exception
- */
-require_once 'Zend/Mail/Protocol/Exception.php';
-
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_Mail_Protocol_Pop3
-{
- /**
- * saves if server supports top
- * @var null|bool
- */
- public $hasTop = null;
-
- /**
- * socket to pop3
- * @var null|resource
- */
- protected $_socket;
-
- /**
- * greeting timestamp for apop
- * @var null|string
- */
- protected $_timestamp;
-
-
- /**
- * Public constructor
- *
- * @param string $host hostname of IP address of POP3 server, if given connect() is called
- * @param int|null $port port of POP3 server, null for default (110 or 995 for ssl)
- * @param bool|string $ssl use ssl? 'SSL', 'TLS' or false
- * @throws Zend_Mail_Protocol_Exception
- */
- public function __construct($host = '', $port = null, $ssl = false)
- {
- if ($host) {
- $this->connect($host, $port, $ssl);
- }
- }
-
-
- /**
- * Public destructor
- */
- public function __destruct()
- {
- $this->logout();
- }
-
-
- /**
- * Open connection to POP3 server
- *
- * @param string $host hostname of IP address of POP3 server
- * @param int|null $port of POP3 server, default is 110 (995 for ssl)
- * @param string|bool $ssl use 'SSL', 'TLS' or false
- * @return string welcome message
- * @throws Zend_Mail_Protocol_Exception
- */
- public function connect($host, $port = null, $ssl = false)
- {
- if ($ssl == 'SSL') {
- $host = 'ssl://' . $host;
- }
-
- if ($port === null) {
- $port = $ssl == 'SSL' ? 995 : 110;
- }
-
- $this->_socket = @fsockopen($host, $port);
- if (!$this->_socket) {
- throw new Zend_Mail_Protocol_Exception('cannot connect to host');
- }
-
- $welcome = $this->readResponse();
-
- strtok($welcome, '<');
- $this->_timestamp = strtok('>');
- if (!strpos($this->_timestamp, '@')) {
- $this->_timestamp = null;
- } else {
- $this->_timestamp = '<' . $this->_timestamp . '>';
- }
-
- if ($ssl === 'TLS') {
- $this->request('STLS');
- $result = stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
- if (!$result) {
- throw new Zend_Mail_Protocol_Exception('cannot enable TLS');
- }
- }
-
- return $welcome;
- }
-
-
- /**
- * Send a request
- *
- * @param string $request your request without newline
- * @return null
- * @throws Zend_Mail_Protocol_Exception
- */
- public function sendRequest($request)
- {
- $result = @fputs($this->_socket, $request."\n");
- if (!$result) {
- throw new Zend_Mail_Protocol_Exception('send failed - connection closed?');
- }
- }
-
-
- /**
- * read a response
- *
- * @param boolean $multiline response has multiple lines and should be read until "<nl>.<nl>"
- * @return string response
- * @throws Zend_Mail_Protocol_Exception
- */
- public function readResponse($multiline = false)
- {
- $result = @fgets($this->_socket);
- if (!is_string($result)) {
- throw new Zend_Mail_Protocol_Exception('read failed - connection closed?');
- }
-
- $result = trim($result);
- if (strpos($result, ' ')) {
- list($status, $message) = explode(' ', $result, 2);
- } else {
- $status = $result;
- $message = '';
- }
-
- if ($status != '+OK') {
- throw new Zend_Mail_Protocol_Exception('last request failed');
- }
-
- if ($multiline) {
- $message = '';
- $line = fgets($this->_socket);
- while ($line && trim($line) != '.') {
- $message .= $line;
- $line = fgets($this->_socket);
- };
- }
-
- return $message;
- }
-
-
- /**
- * Send request and get resposne
- *
- * @see sendRequest(), readResponse()
- *
- * @param string $request request
- * @param bool $multiline multiline response?
- * @return string result from readResponse()
- * @throws Zend_Mail_Protocol_Exception
- */
- public function request($request, $multiline = false)
- {
- $this->sendRequest($request);
- return $this->readResponse($multiline);
- }
-
-
- /**
- * End communication with POP3 server (also closes socket)
- *
- * @return null
- */
- public function logout()
- {
- if (!$this->_socket) {
- return;
- }
-
- try {
- $this->request('QUIT');
- } catch (Zend_Mail_Protocol_Exception $e) {
- // ignore error - we're closing the socket anyway
- }
-
- fclose($this->_socket);
- $this->_socket = null;
- }
-
-
- /**
- * Get capabilities from POP3 server
- *
- * @return array list of capabilities
- * @throws Zend_Mail_Protocol_Exception
- */
- public function capa()
- {
- $result = $this->request('CAPA', true);
- return explode("\n", $result);
- }
-
-
- /**
- * Login to POP3 server. Can use APOP
- *
- * @param string $user username
- * @param string $password password
- * @param bool $try_apop should APOP be tried?
- * @return void
- * @throws Zend_Mail_Protocol_Exception
- */
- public function login($user, $password, $tryApop = true)
- {
- if ($tryApop && $this->_timestamp) {
- try {
- $this->request("APOP $user " . md5($this->_timestamp . $password));
- return;
- } catch (Zend_Mail_Protocol_Exception $e) {
- // ignore
- }
- }
-
- $result = $this->request("USER $user");
- $result = $this->request("PASS $password");
- }
-
-
- /**
- * Make STAT call for message count and size sum
- *
- * @param int $messages out parameter with count of messages
- * @param int $octets out parameter with size in octects of messages
- * @return void
- * @throws Zend_Mail_Protocol_Exception
- */
- public function status(&$messages, &$octets)
- {
- $messages = 0;
- $octets = 0;
- $result = $this->request('STAT');
-
- list($messages, $octets) = explode(' ', $result);
- }
-
-
- /**
- * Make LIST call for size of message(s)
- *
- * @param int|null $msgno number of message, null for all
- * @return int|array size of given message or list with array(num => size)
- * @throws Zend_Mail_Protocol_Exception
- */
- public function getList($msgno = null)
- {
- if ($msgno !== null) {
- $result = $this->request("LIST $msgno");
-
- list(, $result) = explode(' ', $result);
- return (int)$result;
- }
-
- $result = $this->request('LIST', true);
- $messages = array();
- $line = strtok($result, "\n");
- while ($line) {
- list($no, $size) = explode(' ', trim($line));
- $messages[(int)$no] = (int)$size;
- $line = strtok("\n");
- }
-
- return $messages;
- }
-
-
- /**
- * Make UIDL call for getting a uniqueid
- *
- * @param int|null $msgno number of message, null for all
- * @return string|array uniqueid of message or list with array(num => uniqueid)
- * @throws Zend_Mail_Protocol_Exception
- */
- public function uniqueid($msgno = null)
- {
- if ($msgno !== null) {
- $result = $this->request("UIDL $msgno");
-
- list(, $result) = explode(' ', $result);
- return $result;
- }
-
- $result = $this->request('UIDL', true);
-
- $result = explode("\n", $result);
- $messages = array();
- foreach ($result as $line) {
- if (!$line) {
- continue;
- }
- list($no, $id) = explode(' ', trim($line), 2);
- $messages[(int)$no] = $id;
- }
-
- return $messages;
-
- }
-
-
- /**
- * Make TOP call for getting headers and maybe some body lines
- * This method also sets hasTop - before it it's not known if top is supported
- *
- * The fallback makes normale RETR call, which retrieves the whole message. Additional
- * lines are not removed.
- *
- * @param int $msgno number of message
- * @param int $lines number of wanted body lines (empty line is inserted after header lines)
- * @param bool $fallback fallback with full retrieve if top is not supported
- * @return string message headers with wanted body lines
- * @throws Zend_Mail_Protocol_Exception
- */
- public function top($msgno, $lines = 0, $fallback = false)
- {
- if ($this->hasTop === false) {
- if ($fallback) {
- return $this->retrive($msgno);
- } else {
- throw new Zend_Mail_Protocol_Exception('top not supported and no fallback wanted');
- }
- }
- $this->hasTop = true;
-
- $lines = (!$lines || $lines < 1) ? 0 : (int)$lines;
-
- try {
- $result = $this->request("TOP $msgno $lines", true);
- } catch (Zend_Mail_Protocol_Exception $e) {
- $this->hasTop = false;
- if ($fallback) {
- $result = $this->retrive($msgno);
- } else {
- throw $e;
- }
- }
-
- return $result;
- }
-
-
- /**
- * Make a RETR call for retrieving a full message with headers and body
- *
- * @param int $msgno message number
- * @return string message
- * @throws Zend_Mail_Protocol_Exception
- */
- public function retrive($msgno)
- {
- $result = $this->request("RETR $msgno", true);
- return $result;
- }
-
-
- /**
- * Make a NOOP call, maybe needed for keeping the server happy
- *
- * @return null
- * @throws Zend_Mail_Protocol_Exception
- */
- public function noop()
- {
- $this->request('NOOP');
- }
-
-
- /**
- * Make a DELE count to remove a message
- *
- * @return null
- * @throws Zend_Mail_Protocol_Exception
- */
- public function delete($msgno)
- {
- $this->request("DELE $msgno");
- }
-
-
- /**
- * Make RSET call, which rollbacks delete requests
- *
- * @return null
- * @throws Zend_Mail_Protocol_Exception
- */
- public function undelete()
- {
- $this->request('RSET');
- }
-}
diff --git a/libs/Zend/Mail/Protocol/Smtp.php b/libs/Zend/Mail/Protocol/Smtp.php
deleted file mode 100755
index dbf77a30e8..0000000000
--- a/libs/Zend/Mail/Protocol/Smtp.php
+++ /dev/null
@@ -1,413 +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_Mail
- * @subpackage Protocol
- * @version $Id$
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_Mail_Protocol_Abstract
- */
-require_once 'Zend/Mail/Protocol/Abstract.php';
-
-
-/**
- * Smtp implementation of Zend_Mail_Protocol_Abstract
- *
- * Minimum implementation according to RFC2821: EHLO, MAIL FROM, RCPT TO, DATA, RSET, NOOP, QUIT
- *
- * @category Zend
- * @package Zend_Mail
- * @subpackage Protocol
- * @throws Zend_Mail_Protocol_Exception
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mail_Protocol_Smtp extends Zend_Mail_Protocol_Abstract
-{
- /**
- * The transport method for the socket
- *
- * @var string
- */
- protected $_transport = 'tcp';
-
-
- /**
- * Indicates that a session is requested to be secure
- *
- * @var string
- */
- protected $_secure;
-
-
- /**
- * Indicates an smtp session has been started by the HELO command
- *
- * @var boolean
- */
- protected $_sess = false;
-
-
- /**
- * Indicates the HELO command has been issues
- *
- * @var unknown_type
- */
- protected $_helo = false;
-
-
- /**
- * Indicates an smtp AUTH has been issued and authenticated
- *
- * @var unknown_type
- */
- protected $_auth = false;
-
-
- /**
- * Indicates a MAIL command has been issued
- *
- * @var unknown_type
- */
- protected $_mail = false;
-
-
- /**
- * Indicates one or more RCTP commands have been issued
- *
- * @var unknown_type
- */
- protected $_rcpt = false;
-
-
- /**
- * Indicates that DATA has been issued and sent
- *
- * @var unknown_type
- */
- protected $_data = null;
-
-
- /**
- * Constructor.
- *
- * @param string $host
- * @param integer $port
- * @param array $config
- * @return void
- */
- public function __construct($host = '127.0.0.1', $port = null, array $config = array())
- {
- if (isset($config['ssl'])) {
- switch (strtolower($config['ssl'])) {
- case 'tls':
- $this->_secure = 'tls';
- break;
-
- case 'ssl':
- $this->_transport = 'ssl';
- $this->_secure = 'ssl';
- if ($port == null) {
- $port = 465;
- }
- break;
-
- default:
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception($ssl . ' is unsupported SSL type');
- break;
- }
- }
-
- // If no port has been specified then check the master PHP ini file. Defaults to 25 if the ini setting is null.
- if ($port == null) {
- if (($port = ini_get('smtp_port')) == '') {
- $port = 25;
- }
- }
-
- parent::__construct($host, $port);
- }
-
-
- /**
- * Connect to the server with the parameters given in the constructor.
- *
- * @return boolean
- */
- public function connect()
- {
- return $this->_connect($this->_transport . '://' . $this->_host . ':'. $this->_port);
- }
-
-
- /**
- * Initiate HELO/EHLO sequence and set flag to indicate valid smtp session
- *
- * @param string $host The client hostname or IP address (default: 127.0.0.1)
- * @throws Zend_Mail_Protocol_Exception
- * @return void
- */
- public function helo($host = '127.0.0.1')
- {
- // Respect RFC 2821 and disallow HELO attempts if session is already initiated.
- if ($this->_sess === true) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception('Cannot issue HELO to existing session');
- }
-
- // Validate client hostname
- if (!$this->_validHost->isValid($host)) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception(join(', ', $this->_validHost->getMessage()));
- }
-
- // Initiate helo sequence
- $this->_expect(220, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
- $this->_ehlo($host);
-
- // If a TLS session is required, commence negotiation
- if ($this->_secure == 'tls') {
- $this->_send('STARTTLS');
- $this->_expect(220, 180);
- if (!stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception('Unable to connect via TLS');
- }
- $this->_ehlo($host);
- }
-
- $this->_startSession();
- $this->auth();
- }
-
-
- /**
- * Send EHLO or HELO depending on capabilities of smtp host
- *
- * @param string $host The client hostname or IP address (default: 127.0.0.1)
- * @throws Zend_Mail_Protocol_Exception
- * @return void
- */
- protected function _ehlo($host)
- {
- // Support for older, less-compliant remote servers. Tries multiple attempts of EHLO or HELO.
- try {
- $this->_send('EHLO ' . $host);
- $this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
- } catch (Zend_Mail_Protocol_Exception $e) {
- $this->_send('HELO ' . $host);
- $this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
- } catch (Zend_Mail_Protocol_Exception $e) {
- throw $e;
- }
- }
-
-
- /**
- * Issues MAIL command
- *
- * @param string $from Sender mailbox
- * @throws Zend_Mail_Protocol_Exception
- * @return void
- */
- public function mail($from)
- {
- if ($this->_sess !== true) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception('A valid session has not been started');
- }
-
- $this->_send('MAIL FROM:<' . $from . '>');
- $this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
-
- // Set mail to true, clear recipients and any existing data flags as per 4.1.1.2 of RFC 2821
- $this->_mail = true;
- $this->_rcpt = false;
- $this->_data = false;
- }
-
-
- /**
- * Issues RCPT command
- *
- * @param string $to Receiver(s) mailbox
- * @throws Zend_Mail_Protocol_Exception
- * @return void
- */
- public function rcpt($to)
- {
- if ($this->_mail !== true) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception('No sender reverse path has been supplied');
- }
-
- // Set rcpt to true, as per 4.1.1.3 of RFC 2821
- $this->_send('RCPT TO:<' . $to . '>');
- $this->_expect(array(250, 251), 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
- $this->_rcpt = true;
- }
-
-
- /**
- * Issues DATA command
- *
- * @param string $data
- * @throws Zend_Mail_Protocol_Exception
- * @return void
- */
- public function data($data)
- {
- // Ensure recipients have been set
- if ($this->_rcpt !== true) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception('No recipient forward path has been supplied');
- }
-
- $this->_send('DATA');
- $this->_expect(354, 120); // Timeout set for 2 minutes as per RFC 2821 4.5.3.2
-
- foreach (explode(self::EOL, $data) as $line) {
- if (strpos($line, '.') === 0) {
- // Escape lines prefixed with a '.'
- $line = '.' . $line;
- }
- $this->_send($line);
- }
-
- $this->_send('.');
- $this->_expect(250, 600); // Timeout set for 10 minutes as per RFC 2821 4.5.3.2
- $this->_data = true;
- }
-
-
- /**
- * Issues the RSET command end validates answer
- *
- * Can be used to restore a clean smtp communication state when a transaction has been cancelled or commencing a new transaction.
- *
- * @return void
- */
- public function rset()
- {
- $this->_send('RSET');
- // MS ESMTP doesn't follow RFC, see [ZF-1377]
- $this->_expect(array(250, 220));
-
- $this->_mail = false;
- $this->_rcpt = false;
- $this->_data = false;
- }
-
-
- /**
- * Issues the NOOP command end validates answer
- *
- * Not used by Zend_Mail, could be used to keep a connection alive or check if it is still open.
- *
- * @return void
- */
- public function noop()
- {
- $this->_send('NOOP');
- $this->_expect(250, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
- }
-
-
- /**
- * Issues the VRFY command end validates answer
- *
- * Not used by Zend_Mail.
- *
- * @param string $user User Name or eMail to verify
- * @return void
- */
- public function vrfy($user)
- {
- $this->_send('VRFY ' . $user);
- $this->_expect(array(250, 251, 252), 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
- }
-
-
- /**
- * Issues the QUIT command and clears the current session
- *
- * @return void
- */
- public function quit()
- {
- if ($this->_sess) {
- $this->_send('QUIT');
- $this->_expect(221, 300); // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
- $this->_stopSession();
- }
- }
-
-
- /**
- * Default authentication method
- *
- * This default method is implemented by AUTH adapters to properly authenticate to a remote host.
- *
- * @throws Zend_Mail_Protocol_Exception
- * @return void
- */
- public function auth()
- {
- if ($this->_auth === true) {
- require_once 'Zend/Mail/Protocol/Exception.php';
- throw new Zend_Mail_Protocol_Exception('Already authenticated for this session');
- }
- }
-
-
- /**
- * Closes connection
- *
- * @return void
- */
- public function disconnect()
- {
- $this->_disconnect();
- }
-
-
- /**
- * Start mail session
- *
- * @return void
- */
- protected function _startSession()
- {
- $this->_sess = true;
- }
-
-
- /**
- * Stop mail session
- *
- * @return void
- */
- protected function _stopSession()
- {
- $this->_sess = false;
- }
-}
diff --git a/libs/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php b/libs/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php
deleted file mode 100755
index 7140889430..0000000000
--- a/libs/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php
+++ /dev/null
@@ -1,108 +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_Mail
- * @subpackage Protocol
- * @version $Id$
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_Mail_Protocol_Smtp
- */
-require_once 'Zend/Mail/Protocol/Smtp.php';
-
-
-/**
- * Performs CRAM-MD5 authentication
- *
- * @category Zend
- * @package Zend_Mail
- * @subpackage Protocol
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mail_Protocol_Smtp_Auth_Crammd5 extends Zend_Mail_Protocol_Smtp
-{
- /**
- * Constructor.
- *
- * @param string $host (Default: 127.0.0.1)
- * @param int $port (Default: null)
- * @param array $config Auth-specific parameters
- * @return void
- */
- public function __construct($host = '127.0.0.1', $port = null, $config = null)
- {
- if (is_array($config)) {
- if (isset($config['username'])) {
- $this->_username = $config['username'];
- }
- if (isset($config['password'])) {
- $this->_password = $config['password'];
- }
- }
-
- parent::__construct($host, $port, $config);
- }
-
-
- /**
- * @todo Perform CRAM-MD5 authentication with supplied credentials
- *
- * @return void
- */
- public function auth()
- {
- // Ensure AUTH has not already been initiated.
- parent::auth();
-
- $this->_send('AUTH CRAM-MD5');
- $challenge = $this->_expect(334);
- $challenge = base64_decode($challenge);
- $digest = $this->_hmacMd5($this->_password, $challenge);
- $this->_send(base64_encode($this->_username . ' ' . $digest));
- $this->_expect(235);
- $this->_auth = true;
- }
-
-
- /**
- * Prepare CRAM-MD5 response to server's ticket
- *
- * @param string $key Challenge key (usually password)
- * @param string $data Challenge data
- * @param string $block Length of blocks
- * @return string
- */
- protected function _hmacMd5($key, $data, $block = 64)
- {
- if (strlen($key) > 64) {
- $key = pack('H32', md5($key));
- } elseif (strlen($key) < 64) {
- $key = str_pad($key, $block, chr(0));
- }
-
- $k_ipad = substr($key, 0, 64) ^ str_repeat(chr(0x36), 64);
- $k_opad = substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64);
-
- $inner = pack('H32', md5($k_ipad . $data));
- $digest = md5($k_opad . $inner);
-
- return $digest;
- }
-}
diff --git a/libs/Zend/Mail/Protocol/Smtp/Auth/Login.php b/libs/Zend/Mail/Protocol/Smtp/Auth/Login.php
deleted file mode 100755
index 668247bd5f..0000000000
--- a/libs/Zend/Mail/Protocol/Smtp/Auth/Login.php
+++ /dev/null
@@ -1,98 +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_Mail
- * @subpackage Protocol
- * @version $Id$
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_Mail_Protocol_Smtp
- */
-require_once 'Zend/Mail/Protocol/Smtp.php';
-
-
-/**
- * Performs LOGIN authentication
- *
- * @category Zend
- * @package Zend_Mail
- * @subpackage Protocol
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mail_Protocol_Smtp_Auth_Login extends Zend_Mail_Protocol_Smtp
-{
- /**
- * LOGIN username
- *
- * @var string
- */
- protected $_username;
-
-
- /**
- * LOGIN password
- *
- * @var string
- */
- protected $_password;
-
-
- /**
- * Constructor.
- *
- * @param string $host (Default: 127.0.0.1)
- * @param int $port (Default: null)
- * @param array $config Auth-specific parameters
- * @return void
- */
- public function __construct($host = '127.0.0.1', $port = null, $config = null)
- {
- if (is_array($config)) {
- if (isset($config['username'])) {
- $this->_username = $config['username'];
- }
- if (isset($config['password'])) {
- $this->_password = $config['password'];
- }
- }
-
- parent::__construct($host, $port, $config);
- }
-
-
- /**
- * Perform LOGIN authentication with supplied credentials
- *
- * @return void
- */
- public function auth()
- {
- // Ensure AUTH has not already been initiated.
- parent::auth();
-
- $this->_send('AUTH LOGIN');
- $this->_expect(334);
- $this->_send(base64_encode($this->_username));
- $this->_expect(334);
- $this->_send(base64_encode($this->_password));
- $this->_expect(235);
- $this->_auth = true;
- }
-}
diff --git a/libs/Zend/Mail/Protocol/Smtp/Auth/Plain.php b/libs/Zend/Mail/Protocol/Smtp/Auth/Plain.php
deleted file mode 100755
index 0a2201c524..0000000000
--- a/libs/Zend/Mail/Protocol/Smtp/Auth/Plain.php
+++ /dev/null
@@ -1,96 +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_Mail
- * @subpackage Protocol
- * @version $Id$
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_Mail_Protocol_Smtp
- */
-require_once 'Zend/Mail/Protocol/Smtp.php';
-
-
-/**
- * Performs PLAIN authentication
- *
- * @category Zend
- * @package Zend_Mail
- * @subpackage Protocol
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mail_Protocol_Smtp_Auth_Plain extends Zend_Mail_Protocol_Smtp
-{
- /**
- * PLAIN username
- *
- * @var string
- */
- protected $_username;
-
-
- /**
- * PLAIN password
- *
- * @var string
- */
- protected $_password;
-
-
- /**
- * Constructor.
- *
- * @param string $host (Default: 127.0.0.1)
- * @param int $port (Default: null)
- * @param array $config Auth-specific parameters
- * @return void
- */
- public function __construct($host = '127.0.0.1', $port = null, $config = null)
- {
- if (is_array($config)) {
- if (isset($config['username'])) {
- $this->_username = $config['username'];
- }
- if (isset($config['password'])) {
- $this->_password = $config['password'];
- }
- }
-
- parent::__construct($host, $port, $config);
- }
-
-
- /**
- * Perform PLAIN authentication with supplied credentials
- *
- * @return void
- */
- public function auth()
- {
- // Ensure AUTH has not already been initiated.
- parent::auth();
-
- $this->_send('AUTH PLAIN');
- $this->_expect(334);
- $this->_send(base64_encode(chr(0) . $this->_username . chr(0) . $this->_password));
- $this->_expect(235);
- $this->_auth = true;
- }
-}
diff --git a/libs/Zend/Mail/Storage.php b/libs/Zend/Mail/Storage.php
deleted file mode 100755
index 94171e6ae1..0000000000
--- a/libs/Zend/Mail/Storage.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_Mail_Storage
-{
- // maildir and IMAP flags, using IMAP names, where possible to be able to distinguish between IMAP
- // system flags and other flags
- const FLAG_PASSED = 'Passed';
- const FLAG_SEEN = '\Seen';
- const FLAG_ANSWERED = '\Answered';
- const FLAG_FLAGGED = '\Flagged';
- const FLAG_DELETED = '\Deleted';
- const FLAG_DRAFT = '\Draft';
- const FLAG_RECENT = '\Recent';
-}
diff --git a/libs/Zend/Mail/Storage/Abstract.php b/libs/Zend/Mail/Storage/Abstract.php
deleted file mode 100755
index 8ae79d06d5..0000000000
--- a/libs/Zend/Mail/Storage/Abstract.php
+++ /dev/null
@@ -1,357 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-/**
- * Zend_Mail_Exception
- */
-require_once 'Zend/Mail/Storage/Exception.php';
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-abstract class Zend_Mail_Storage_Abstract implements Countable, ArrayAccess, SeekableIterator
-{
- /**
- * class capabilities with default values
- * @var array
- */
- protected $_has = array('uniqueid' => true,
- 'delete' => false,
- 'create' => false,
- 'top' => false,
- 'fetchPart' => true,
- 'flags' => false);
-
- /**
- * current iteration position
- * @var int
- */
- protected $_iterationPos = 0;
-
- /**
- * maximum iteration position (= message count)
- * @var null|int
- */
- protected $_iterationMax = null;
-
- /**
- * used message class, change it in an extened class to extend the returned message class
- * @var string
- */
- protected $_messageClass = 'Zend_Mail_Message';
-
- /**
- * Getter for has-properties. The standard has properties
- * are: hasFolder, hasUniqueid, hasDelete, hasCreate, hasTop
- *
- * The valid values for the has-properties are:
- * - true if a feature is supported
- * - false if a feature is not supported
- * - null is it's not yet known or it can't be know if a feature is supported
- *
- * @param string $var property name
- * @return bool supported or not
- * @throws Zend_Mail_Storage_Exception
- */
- public function __get($var)
- {
- if (strpos($var, 'has') === 0) {
- $var = strtolower(substr($var, 3));
- return isset($this->_has[$var]) ? $this->_has[$var] : null;
- }
-
- throw new Zend_Mail_Storage_Exception($var . ' not found');
- }
-
-
- /**
- * Get a full list of features supported by the specific mail lib and the server
- *
- * @return array list of features as array(featurename => true|false[|null])
- */
- public function getCapabilities()
- {
- return $this->_has;
- }
-
-
- /**
- * Count messages messages in current box/folder
- *
- * @return int number of messages
- * @throws Zend_Mail_Storage_Exception
- */
- abstract public function countMessages();
-
-
- /**
- * Get a list of messages with number and size
- *
- * @param int $id number of message
- * @return int|array size of given message of list with all messages as array(num => size)
- */
- abstract public function getSize($id = 0);
-
-
- /**
- * Get a message with headers and body
- *
- * @param $id int number of message
- * @return Zend_Mail_Message
- */
- abstract public function getMessage($id);
-
-
- /**
- * Get raw header of message or part
- *
- * @param int $id number of message
- * @param null|array|string $part path to part or null for messsage header
- * @param int $topLines include this many lines with header (after an empty line)
- * @return string raw header
- */
- abstract public function getRawHeader($id, $part = null, $topLines = 0);
-
- /**
- * Get raw content of message or part
- *
- * @param int $id number of message
- * @param null|array|string $part path to part or null for messsage content
- * @return string raw content
- */
- abstract public function getRawContent($id, $part = null);
-
- /**
- * Create instance with parameters
- *
- * @param array $params mail reader specific parameters
- * @throws Zend_Mail_Storage_Exception
- */
- abstract public function __construct($params);
-
-
- /**
- * Destructor calls close() and therefore closes the resource.
- */
- public function __destruct()
- {
- $this->close();
- }
-
-
- /**
- * Close resource for mail lib. If you need to control, when the resource
- * is closed. Otherwise the destructor would call this.
- *
- * @return null
- */
- abstract public function close();
-
-
- /**
- * Keep the resource alive.
- *
- * @return null
- */
- abstract public function noop();
-
- /**
- * delete a message from current box/folder
- *
- * @return null
- */
- abstract public function removeMessage($id);
-
- /**
- * get unique id for one or all messages
- *
- * if storage does not support unique ids it's the same as the message number
- *
- * @param int|null $id message number
- * @return array|string message number for given message or all messages as array
- * @throws Zend_Mail_Storage_Exception
- */
- abstract public function getUniqueId($id = null);
-
- /**
- * get a message number from a unique id
- *
- * I.e. if you have a webmailer that supports deleting messages you should use unique ids
- * as parameter and use this method to translate it to message number right before calling removeMessage()
- *
- * @param string $id unique id
- * @return int message number
- * @throws Zend_Mail_Storage_Exception
- */
- abstract public function getNumberByUniqueId($id);
-
- // interface implementations follows
-
- /**
- * Countable::count()
- *
- * @return int
- */
- public function count()
- {
- return $this->countMessages();
- }
-
-
- /**
- * ArrayAccess::offsetExists()
- *
- * @param int $id
- * @return boolean
- */
- public function offsetExists($id)
- {
- try {
- if ($this->getMessage($id)) {
- return true;
- }
- } catch(Zend_Mail_Storage_Exception $e) {}
-
- return false;
- }
-
-
- /**
- * ArrayAccess::offsetGet()
- *
- * @param int $id
- * @return Zend_Mail_Message message object
- */
- public function offsetGet($id)
- {
- return $this->getMessage($id);
- }
-
-
- /**
- * ArrayAccess::offsetSet()
- *
- * @param id $id
- * @param mixed $value
- * @throws Zend_Mail_Storage_Exception
- * @return void
- */
- public function offsetSet($id, $value)
- {
- throw new Zend_Mail_Storage_Exception('cannot write mail messages via array access');
- }
-
-
- /**
- * ArrayAccess::offsetUnset()
- *
- * @param int $id
- * @return boolean success
- */
- public function offsetUnset($id)
- {
- return $this->removeMessage($id);
- }
-
-
- /**
- * Iterator::rewind()
- *
- * Rewind always gets the new count from the storage. Thus if you use
- * the interfaces and your scripts take long you should use reset()
- * from time to time.
- *
- * @return void
- */
- public function rewind()
- {
- $this->_iterationMax = $this->countMessages();
- $this->_iterationPos = 1;
- }
-
-
- /**
- * Iterator::current()
- *
- * @return Zend_Mail_Message current message
- */
- public function current()
- {
- return $this->getMessage($this->_iterationPos);
- }
-
-
- /**
- * Iterator::key()
- *
- * @return int id of current position
- */
- public function key()
- {
- return $this->_iterationPos;
- }
-
-
- /**
- * Iterator::next()
- *
- * @return void
- */
- public function next()
- {
- ++$this->_iterationPos;
- }
-
-
- /**
- * Iterator::valid()
- *
- * @return boolean
- */
- public function valid()
- {
- if ($this->_iterationMax === null) {
- $this->_iterationMax = $this->countMessages();
- }
- return $this->_iterationPos && $this->_iterationPos <= $this->_iterationMax;
- }
-
-
- /**
- * SeekableIterator::seek()
- *
- * @param int $pos
- * @return void
- * @throws OutOfBoundsException
- */
- public function seek($pos)
- {
- if ($this->_iterationMax === null) {
- $this->_iterationMax = $this->countMessages();
- }
-
- if ($pos > $this->_iterationMax) {
- throw new OutOfBoundsException('this position does not exist');
- }
- $this->_iterationPos = $pos;
- }
-
-}
diff --git a/libs/Zend/Mail/Storage/Exception.php b/libs/Zend/Mail/Storage/Exception.php
deleted file mode 100755
index 34d8e96c6b..0000000000
--- a/libs/Zend/Mail/Storage/Exception.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_Mail
- * @subpackage Storage
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-
-/**
- * Zend_Mail_Exception
- */
-require_once 'Zend/Mail/Exception.php';
-
-
-/**
- * @category Zend
- * @package Zend_Mail
- * @subpackage Storage
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mail_Storage_Exception extends Zend_Mail_Exception
-{}
-
diff --git a/libs/Zend/Mail/Storage/Folder.php b/libs/Zend/Mail/Storage/Folder.php
deleted file mode 100755
index f7f5d8bf72..0000000000
--- a/libs/Zend/Mail/Storage/Folder.php
+++ /dev/null
@@ -1,232 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-
-/**
- * Zend_Mail_Storage_Exception
- */
-require_once 'Zend/Mail/Storage/Exception.php';
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_Mail_Storage_Folder implements RecursiveIterator
-{
- /**
- * subfolders of folder array(localName => Zend_Mail_Storage_Folder folder)
- * @var array
- */
- protected $_folders;
-
- /**
- * local name (name of folder in parent folder)
- * @var string
- */
- protected $_localName;
-
- /**
- * global name (absolute name of folder)
- * @var string
- */
- protected $_globalName;
-
- /**
- * folder is selectable if folder is able to hold messages, else it's just a parent folder
- * @var bool
- */
- protected $_selectable = true;
-
- /**
- * create a new mail folder instance
- *
- * @param string $localName name of folder in current subdirectory
- * @param string $globalName absolute name of folder
- * @param bool $selectable if true folder holds messages, if false it's just a parent for subfolders
- * @param array $folders init with given instances of Zend_Mail_Storage_Folder as subfolders
- */
- public function __construct($localName, $globalName = '', $selectable = true, array $folders = array())
- {
- $this->_localName = $localName;
- $this->_globalName = $globalName ? $globalName : $localName;
- $this->_selectable = $selectable;
- $this->_folders = $folders;
- }
-
- /**
- * implements RecursiveIterator::hasChildren()
- *
- * @return bool current element has children
- */
- public function hasChildren()
- {
- $current = $this->current();
- return $current && $current instanceof Zend_Mail_Storage_Folder && !$current->isLeaf();
- }
-
- /**
- * implements RecursiveIterator::getChildren()
- *
- * @return Zend_Mail_Storage_Folder same as self::current()
- */
- public function getChildren()
- {
- return $this->current();
- }
-
- /**
- * implements Iterator::valid()
- *
- * @return bool check if there's a current element
- */
- public function valid()
- {
- return key($this->_folders) !== null;
- }
-
- /**
- * implements Iterator::next()
- *
- * @return null
- */
- public function next()
- {
- next($this->_folders);
- }
-
- /**
- * implements Iterator::key()
- *
- * @return string key/local name of current element
- */
- public function key()
- {
- return key($this->_folders);
- }
-
- /**
- * implements Iterator::current()
- *
- * @return Zend_Mail_Storage_Folder current folder
- */
- public function current()
- {
- return current($this->_folders);
- }
-
- /**
- * implements Iterator::rewind()
- *
- * @return null
- */
- public function rewind()
- {
- reset($this->_folders);
- }
-
- /**
- * get subfolder named $name
- *
- * @param string $name wanted subfolder
- * @return Zend_Mail_Storage_Folder folder named $folder
- * @throws Zend_Mail_Storage_Exception
- */
- public function __get($name)
- {
- if (!isset($this->_folders[$name])) {
- throw new Zend_Mail_Storage_Exception("no subfolder named $name");
- }
-
- return $this->_folders[$name];
- }
-
- /**
- * add or replace subfolder named $name
- *
- * @param string $name local name of subfolder
- * @param Zend_Mail_Storage_Folder $folder instance for new subfolder
- * @return null
- */
- public function __set($name, Zend_Mail_Storage_Folder $folder)
- {
- $this->_folders[$name] = $folder;
- }
-
- /**
- * remove subfolder named $name
- *
- * @param string $name local name of subfolder
- * @return null
- */
- public function __unset($name)
- {
- unset($this->_folders[$name]);
- }
-
- /**
- * magic method for easy output of global name
- *
- * @return string global name of folder
- */
- public function __toString()
- {
- return (string)$this->getGlobalName();
- }
-
- /**
- * get local name
- *
- * @return string local name
- */
- public function getLocalName()
- {
- return $this->_localName;
- }
-
- /**
- * get global name
- *
- * @return string global name
- */
- public function getGlobalName()
- {
- return $this->_globalName;
- }
-
- /**
- * is this folder selectable?
- *
- * @return bool selectable
- */
- public function isSelectable()
- {
- return $this->_selectable;
- }
-
- /**
- * check if folder has no subfolder
- *
- * @return bool true if no subfolders
- */
- public function isLeaf()
- {
- return empty($this->_folders);
- }
-}
diff --git a/libs/Zend/Mail/Storage/Folder/Interface.php b/libs/Zend/Mail/Storage/Folder/Interface.php
deleted file mode 100755
index 4087466ad5..0000000000
--- a/libs/Zend/Mail/Storage/Folder/Interface.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-interface Zend_Mail_Storage_Folder_Interface
-{
- /**
- * get root folder or given folder
- *
- * @param string $rootFolder get folder structure for given folder, else root
- * @return Zend_Mail_Storage_Folder root or wanted folder
- */
- public function getFolders($rootFolder = null);
-
- /**
- * select given folder
- *
- * folder must be selectable!
- *
- * @param Zend_Mail_Storage_Folder|string $globalName global name of folder or instance for subfolder
- * @return null
- * @throws Zend_Mail_Storage_Exception
- */
- public function selectFolder($globalName);
-
-
- /**
- * get Zend_Mail_Storage_Folder instance for current folder
- *
- * @return Zend_Mail_Storage_Folder instance of current folder
- * @throws Zend_Mail_Storage_Exception
- */
- public function getCurrentFolder();
-}
diff --git a/libs/Zend/Mail/Storage/Folder/Maildir.php b/libs/Zend/Mail/Storage/Folder/Maildir.php
deleted file mode 100755
index 817900c5c9..0000000000
--- a/libs/Zend/Mail/Storage/Folder/Maildir.php
+++ /dev/null
@@ -1,226 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-/**
- * Zend_Mail_Storage_Folder
- */
-require_once 'Zend/Mail/Storage/Folder.php';
-
-/**
- * Zend_Mail_Storage_Folder_Interface
- */
-require_once 'Zend/Mail/Storage/Folder/Interface.php';
-
-/**
- * Zend_Mail_Storage_Maildir
- */
-require_once 'Zend/Mail/Storage/Maildir.php';
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_Mail_Storage_Folder_Maildir extends Zend_Mail_Storage_Maildir implements Zend_Mail_Storage_Folder_Interface
-{
- /**
- * Zend_Mail_Storage_Folder root folder for folder structure
- * @var Zend_Mail_Storage_Folder
- */
- protected $_rootFolder;
-
- /**
- * rootdir of folder structure
- * @var string
- */
- protected $_rootdir;
-
- /**
- * name of current folder
- * @var string
- */
- protected $_currentFolder;
-
- /**
- * delim char for subfolders
- * @var string
- */
- protected $_delim;
-
- /**
- * Create instance with parameters
- * Supported parameters are:
- * - dirname rootdir of maildir structure
- * - delim delim char for folder structur, default is '.'
- * - folder intial selected folder, default is 'INBOX'
- *
- * @param $params array mail reader specific parameters
- * @throws Zend_Mail_Storage_Exception
- */
- public function __construct($params)
- {
- if (!isset($params['dirname']) || !is_dir($params['dirname'])) {
- throw new Zend_Mail_Storage_Exception('no valid dirname given in params');
- }
-
- $this->_rootdir = rtrim($params['dirname'], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
-
- $this->_delim = isset($params['delim']) ? $params['delim'] : '.';
-
- $this->_buildFolderTree();
- $this->selectFolder(!empty($params['folder']) ? $params['folder'] : 'INBOX');
- $this->_has['top'] = true;
- $this->_has['flags'] = true;
- }
-
- /**
- * find all subfolders and mbox files for folder structure
- *
- * Result is save in Zend_Mail_Storage_Folder instances with the root in $this->_rootFolder.
- * $parentFolder and $parentGlobalName are only used internally for recursion.
- *
- * @return null
- * @throws Zend_Mail_Storage_Exception
- */
- protected function _buildFolderTree()
- {
- $this->_rootFolder = new Zend_Mail_Storage_Folder('/', '/', false);
- $this->_rootFolder->INBOX = new Zend_Mail_Storage_Folder('INBOX', 'INBOX', true);
-
- $dh = @opendir($this->_rootdir);
- if (!$dh) {
- throw new Zend_Mail_Storage_Exception("can't read folders in maildir");
- }
- $dirs = array();
- while (($entry = readdir($dh)) !== false) {
- // maildir++ defines folders must start with .
- if ($entry[0] != '.' || $entry == '.' || $entry == '..') {
- continue;
- }
- if ($this->_isMaildir($this->_rootdir . $entry)) {
- $dirs[] = $entry;
- }
- }
- closedir($dh);
-
- sort($dirs);
- $stack = array(null);
- $folderStack = array(null);
- $parentFolder = $this->_rootFolder;
- $parent = '.';
-
- foreach ($dirs as $dir) {
- do {
- if (strpos($dir, $parent) === 0) {
- $local = substr($dir, strlen($parent));
- if (strpos($local, $this->_delim) !== false) {
- throw new Zend_Mail_Storage_Exception('error while reading maildir');
- }
- array_push($stack, $parent);
- $parent = $dir . $this->_delim;
- $folder = new Zend_Mail_Storage_Folder($local, substr($dir, 1), true);
- $parentFolder->$local = $folder;
- array_push($folderStack, $parentFolder);
- $parentFolder = $folder;
- break;
- } else if ($stack) {
- $parent = array_pop($stack);
- $parentFolder = array_pop($folderStack);
- }
- } while ($stack);
- if (!$stack) {
- throw new Zend_Mail_Storage_Exception('error while reading maildir');
- }
- }
- }
-
- /**
- * get root folder or given folder
- *
- * @param string $rootFolder get folder structure for given folder, else root
- * @return Zend_Mail_Storage_Folder root or wanted folder
- * @throws Zend_Mail_Storage_Exception
- */
- public function getFolders($rootFolder = null)
- {
- if (!$rootFolder || $rootFolder == 'INBOX') {
- return $this->_rootFolder;
- }
-
- // rootdir is same as INBOX in maildir
- if (strpos($rootFolder, 'INBOX' . $this->_delim) === 0) {
- $rootFolder = substr($rootFolder, 6);
- }
- $currentFolder = $this->_rootFolder;
- $subname = trim($rootFolder, $this->_delim);
- while ($currentFolder) {
- @list($entry, $subname) = @explode($this->_delim, $subname, 2);
- $currentFolder = $currentFolder->$entry;
- if (!$subname) {
- break;
- }
- }
-
- if ($currentFolder->getGlobalName() != rtrim($rootFolder, $this->_delim)) {
- throw new Zend_Mail_Storage_Exception("folder $rootFolder not found");
- }
- return $currentFolder;
- }
-
- /**
- * select given folder
- *
- * folder must be selectable!
- *
- * @param Zend_Mail_Storage_Folder|string $globalName global name of folder or instance for subfolder
- * @return null
- * @throws Zend_Mail_Storage_Exception
- */
- public function selectFolder($globalName)
- {
- $this->_currentFolder = (string)$globalName;
-
- // getting folder from folder tree for validation
- $folder = $this->getFolders($this->_currentFolder);
-
- try {
- $this->_openMaildir($this->_rootdir . '.' . $folder->getGlobalName());
- } catch(Zend_Mail_Storage_Exception $e) {
- // check what went wrong
- if (!$folder->isSelectable()) {
- throw new Zend_Mail_Storage_Exception("{$this->_currentFolder} is not selectable");
- }
- // seems like file has vanished; rebuilding folder tree - but it's still an exception
- $this->_buildFolderTree($this->_rootdir);
- throw new Zend_Mail_Storage_Exception('seems like the maildir has vanished, I\'ve rebuild the ' .
- 'folder tree, search for an other folder and try again');
- }
- }
-
- /**
- * get Zend_Mail_Storage_Folder instance for current folder
- *
- * @return Zend_Mail_Storage_Folder instance of current folder
- * @throws Zend_Mail_Storage_Exception
- */
- public function getCurrentFolder()
- {
- return $this->_currentFolder;
- }
-}
diff --git a/libs/Zend/Mail/Storage/Folder/Mbox.php b/libs/Zend/Mail/Storage/Folder/Mbox.php
deleted file mode 100755
index 1bb05e4155..0000000000
--- a/libs/Zend/Mail/Storage/Folder/Mbox.php
+++ /dev/null
@@ -1,234 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-/**
- * Zend_Mail_Storage_Folder
- */
-require_once 'Zend/Mail/Storage/Folder.php';
-
-/**
- * Zend_Mail_Storage_Folder_Interface
- */
-require_once 'Zend/Mail/Storage/Folder/Interface.php';
-
-/**
- * Zend_Mail_Storage_Mbox
- */
-require_once 'Zend/Mail/Storage/Mbox.php';
-
-/**
- * Zend_Mail_Storage_Exception
- */
-require_once 'Zend/Mail/Storage/Exception.php';
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_Mail_Storage_Folder_Mbox extends Zend_Mail_Storage_Mbox implements Zend_Mail_Storage_Folder_Interface
-{
- /**
- * Zend_Mail_Storage_Folder root folder for folder structure
- * @var Zend_Mail_Storage_Folder
- */
- protected $_rootFolder;
-
- /**
- * rootdir of folder structure
- * @var string
- */
- protected $_rootdir;
-
- /**
- * name of current folder
- * @var string
- */
- protected $_currentFolder;
-
- /**
- * Create instance with parameters
- *
- * Disallowed parameters are:
- * - filename use Zend_Mail_Storage_Mbox for a single file
- * Supported parameters are:
- * - dirname rootdir of mbox structure
- * - folder intial selected folder, default is 'INBOX'
- *
- * @param $params array mail reader specific parameters
- * @throws Zend_Mail_Storage_Exception
- */
- public function __construct($params)
- {
- if (isset($params['filename'])) {
- throw new Zend_Mail_Storage_Exception('use Zend_Mail_Storage_Mbox for a single file');
- }
-
- if (!isset($params['dirname']) || !is_dir($params['dirname'])) {
- throw new Zend_Mail_Storage_Exception('no valid dirname given in params');
- }
-
- $this->_rootdir = rtrim($params['dirname'], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
-
- $this->_buildFolderTree($this->_rootdir);
- $this->selectFolder(!empty($params['folder']) ? $params['folder'] : 'INBOX');
- $this->_has['top'] = true;
- $this->_has['uniqueid'] = false;
- }
-
- /**
- * find all subfolders and mbox files for folder structure
- *
- * Result is save in Zend_Mail_Storage_Folder instances with the root in $this->_rootFolder.
- * $parentFolder and $parentGlobalName are only used internally for recursion.
- *
- * @param string $currentDir call with root dir, also used for recursion.
- * @param Zend_Mail_Storage_Folder|null $parentFolder used for recursion
- * @param string $parentGlobalName used for rescursion
- * @return null
- * @throws Zend_Mail_Storage_Exception
- */
- protected function _buildFolderTree($currentDir, $parentFolder = null, $parentGlobalName = '')
- {
- if (!$parentFolder) {
- $this->_rootFolder = new Zend_Mail_Storage_Folder('/', '/', false);
- $parentFolder = $this->_rootFolder;
- }
-
- $dh = @opendir($currentDir);
- if (!$dh) {
- throw new Zend_Mail_Storage_Exception("can't read dir $currentDir");
- }
- while (($entry = readdir($dh)) !== false) {
- // ignore hidden files for mbox
- if ($entry[0] == '.') {
- continue;
- }
- $absoluteEntry = $currentDir . $entry;
- $globalName = $parentGlobalName . DIRECTORY_SEPARATOR . $entry;
- if (is_file($absoluteEntry) && $this->_isMboxFile($absoluteEntry)) {
- $parentFolder->$entry = new Zend_Mail_Storage_Folder($entry, $globalName);
- continue;
- }
- if (!is_dir($absoluteEntry) /* || $entry == '.' || $entry == '..' */) {
- continue;
- }
- $folder = new Zend_Mail_Storage_Folder($entry, $globalName, false);
- $parentFolder->$entry = $folder;
- $this->_buildFolderTree($absoluteEntry . DIRECTORY_SEPARATOR, $folder, $globalName);
- }
-
- closedir($dh);
- }
-
- /**
- * get root folder or given folder
- *
- * @param string $rootFolder get folder structure for given folder, else root
- * @return Zend_Mail_Storage_Folder root or wanted folder
- * @throws Zend_Mail_Storage_Exception
- */
- public function getFolders($rootFolder = null)
- {
- if (!$rootFolder) {
- return $this->_rootFolder;
- }
-
- $currentFolder = $this->_rootFolder;
- $subname = trim($rootFolder, DIRECTORY_SEPARATOR);
- while ($currentFolder) {
- @list($entry, $subname) = @explode(DIRECTORY_SEPARATOR, $subname, 2);
- $currentFolder = $currentFolder->$entry;
- if (!$subname) {
- break;
- }
- }
-
- if ($currentFolder->getGlobalName() != DIRECTORY_SEPARATOR . trim($rootFolder, DIRECTORY_SEPARATOR)) {
- throw new Zend_Mail_Storage_Exception("folder $rootFolder not found");
- }
- return $currentFolder;
- }
-
- /**
- * select given folder
- *
- * folder must be selectable!
- *
- * @param Zend_Mail_Storage_Folder|string $globalName global name of folder or instance for subfolder
- * @return null
- * @throws Zend_Mail_Storage_Exception
- */
- public function selectFolder($globalName)
- {
- $this->_currentFolder = (string)$globalName;
-
- // getting folder from folder tree for validation
- $folder = $this->getFolders($this->_currentFolder);
-
- try {
- $this->_openMboxFile($this->_rootdir . $folder->getGlobalName());
- } catch(Zend_Mail_Storage_Exception $e) {
- // check what went wrong
- if (!$folder->isSelectable()) {
- throw new Zend_Mail_Storage_Exception("{$this->_currentFolder} is not selectable");
- }
- // seems like file has vanished; rebuilding folder tree - but it's still an exception
- $this->_buildFolderTree($this->_rootdir);
- throw new Zend_Mail_Storage_Exception('seems like the mbox file has vanished, I\'ve rebuild the ' .
- 'folder tree, search for an other folder and try again');
- }
- }
-
- /**
- * get Zend_Mail_Storage_Folder instance for current folder
- *
- * @return Zend_Mail_Storage_Folder instance of current folder
- * @throws Zend_Mail_Storage_Exception
- */
- public function getCurrentFolder()
- {
- return $this->_currentFolder;
- }
-
- /**
- * magic method for serialize()
- *
- * with this method you can cache the mbox class
- *
- * @return array name of variables
- */
- public function __sleep()
- {
- return array_merge(parent::__sleep(), array('_currentFolder', '_rootFolder', '_rootdir'));
- }
-
- /**
- * magic method for unserialize()
- *
- * with this method you can cache the mbox class
- *
- * @return null
- */
- public function __wakeup()
- {
- // if cache is stall selectFolder() rebuilds the tree on error
- parent::__wakeup();
- }
-}
diff --git a/libs/Zend/Mail/Storage/Imap.php b/libs/Zend/Mail/Storage/Imap.php
deleted file mode 100755
index 0b5017cc1a..0000000000
--- a/libs/Zend/Mail/Storage/Imap.php
+++ /dev/null
@@ -1,524 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-
-/**
- * Zend_Mail_Storage_Abstract
- */
-require_once 'Zend/Mail/Storage/Abstract.php';
-
-/**
- * Zend_Mail_Protocol_Imap
- */
-require_once 'Zend/Mail/Protocol/Imap.php';
-
-/**
- * Zend_Mail_Storage_Writable_Interface
- */
-require_once 'Zend/Mail/Storage/Writable/Interface.php';
-
-/**
- * Zend_Mail_Storage_Folder_Interface
- */
-require_once 'Zend/Mail/Storage/Folder/Interface.php';
-
-/**
- * Zend_Mail_Storage_Folder
- */
-require_once 'Zend/Mail/Storage/Folder.php';
-
-/**
- * Zend_Mail_Message
- */
-require_once 'Zend/Mail/Message.php';
-
-/**
- * Zend_Mail_Storage_Exception
- */
-require_once 'Zend/Mail/Storage/Exception.php';
-
-/**
- * Zend_Mail_Storage
- */
-require_once 'Zend/Mail/Storage.php';
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
- implements Zend_Mail_Storage_Folder_Interface, Zend_Mail_Storage_Writable_Interface
-{
- // TODO: with an internal cache we could optimize this class, or create an extra class with
- // such optimizations. Especially the various fetch calls could be combined to one cache call
-
- /**
- * protocol handler
- * @var null|Zend_Mail_Protocol_Imap
- */
- protected $_protocol;
-
- /**
- * name of current folder
- * @var string
- */
- protected $_currentFolder = '';
-
- /**
- * imap flags to constants translation
- * @var array
- */
- protected static $_knownFlags = array('\Passed' => Zend_Mail_Storage::FLAG_PASSED,
- '\Answered' => Zend_Mail_Storage::FLAG_ANSWERED,
- '\Seen' => Zend_Mail_Storage::FLAG_SEEN,
- '\Deleted' => Zend_Mail_Storage::FLAG_DELETED,
- '\Draft' => Zend_Mail_Storage::FLAG_DRAFT,
- '\Flagged' => Zend_Mail_Storage::FLAG_FLAGGED);
-
- /**
- * Count messages all messages in current box
- *
- * @return int number of messages
- * @throws Zend_Mail_Storage_Exception
- * @throws Zend_Mail_Protocol_Exception
- */
- public function countMessages()
- {
- if (!$this->_currentFolder) {
- throw new Zend_Mail_Storage_Exception('No selected folder to count');
- }
-
- // we're reselecting the current mailbox, because STATUS is slow and shouldn't be used on the current mailbox
- $result = $this->_protocol->select($this->_currentFolder);
- return $result['exists'];
- }
-
- /**
- * get a list of messages with number and size
- *
- * @param int $id number of message
- * @return int|array size of given message of list with all messages as array(num => size)
- * @throws Zend_Mail_Protocol_Exception
- */
- public function getSize($id = 0)
- {
- if ($id) {
- return $this->_protocol->fetch('RFC822.SIZE', $id);
- }
- return $this->_protocol->fetch('RFC822.SIZE', 1, INF);
- }
-
- /**
- * Fetch a message
- *
- * @param int $id number of message
- * @return Zend_Mail_Message
- * @throws Zend_Mail_Protocol_Exception
- */
- public function getMessage($id)
- {
- $data = $this->_protocol->fetch(array('FLAGS', 'RFC822.HEADER'), $id);
- $header = $data['RFC822.HEADER'];
-
- $flags = array();
- foreach ($data['FLAGS'] as $flag) {
- $flags[] = isset(self::$_knownFlags[$flag]) ? self::$_knownFlags[$flag] : $flag;
- }
-
- return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $header, 'flags' => $flags));
- }
-
- /*
- * Get raw header of message or part
- *
- * @param int $id number of message
- * @param null|array|string $part path to part or null for messsage header
- * @param int $topLines include this many lines with header (after an empty line)
- * @param int $topLines include this many lines with header (after an empty line)
- * @return string raw header
- * @throws Zend_Mail_Protocol_Exception
- */
- public function getRawHeader($id, $part = null, $topLines = 0)
- {
- if ($part !== null) {
- // TODO: implement
- throw new Zend_Mail_Storage_Exception('not implemented');
- }
-
- // TODO: toplines
- return $this->_protocol->fetch('RFC822.HEADER', $id);
- }
-
- /*
- * Get raw content of message or part
- *
- * @param int $id number of message
- * @param null|array|string $part path to part or null for messsage content
- * @return string raw content
- * @throws Zend_Mail_Protocol_Exception
- */
- public function getRawContent($id, $part = null)
- {
- if ($part !== null) {
- // TODO: implement
- throw new Zend_Mail_Storage_Exception('not implemented');
- }
-
- return $this->_protocol->fetch('RFC822.TEXT', $id);
- }
-
- /**
- * create instance with parameters
- * Supported paramters are
- * - user username
- * - host hostname or ip address of IMAP server [optional, default = 'localhost']
- * - password password for user 'username' [optional, default = '']
- * - port port for IMAP server [optional, default = 110]
- * - ssl 'SSL' or 'TLS' for secure sockets
- * - folder select this folder [optional, default = 'INBOX']
- *
- * @param array $params mail reader specific parameters
- * @throws Zend_Mail_Storage_Exception
- * @throws Zend_Mail_Protocol_Exception
- */
- public function __construct($params)
- {
- $this->_has['flags'] = true;
-
- if ($params instanceof Zend_Mail_Protocol_Imap) {
- $this->_protocol = $params;
- try {
- $this->selectFolder('INBOX');
- } catch(Zend_Mail_Storage_Exception $e) {
- throw new Zend_Mail_Storage_Exception('cannot select INBOX, is this a valid transport?');
- }
- return;
- }
-
- if (!isset($params['user'])) {
- throw new Zend_Mail_Storage_Exception('need at least user in params');
- }
-
- $params['host'] = isset($params['host']) ? $params['host'] : 'localhost';
- $params['password'] = isset($params['password']) ? $params['password'] : '';
- $params['port'] = isset($params['port']) ? $params['port'] : null;
- $params['ssl'] = isset($params['ssl']) ? $params['ssl'] : false;
-
- $this->_protocol = new Zend_Mail_Protocol_Imap();
- $this->_protocol->connect($params['host'], $params['port'], $params['ssl']);
- if (!$this->_protocol->login($params['user'], $params['password'])) {
- throw new Zend_Mail_Storage_Exception('cannot login, user or password wrong');
- }
- $this->selectFolder(isset($params['folder']) ? $params['folder'] : 'INBOX');
- }
-
- /**
- * Close resource for mail lib. If you need to control, when the resource
- * is closed. Otherwise the destructor would call this.
- *
- * @return null
- */
- public function close()
- {
- $this->_currentFolder = '';
- $this->_protocol->logout();
- }
-
- /**
- * Keep the server busy.
- *
- * @return null
- */
- public function noop()
- {
- if (!$this->_protocol->noop()) {
- throw new Zend_Mail_Storage_Exception('could not do nothing');
- }
- }
-
- /**
- * Remove a message from server. If you're doing that from a web enviroment
- * you should be careful and use a uniqueid as parameter if possible to
- * identify the message.
- *
- * @param int $id number of message
- * @return null
- */
- public function removeMessage($id)
- {
- if (!$this->_protocol->store(array(Zend_Mail_Storage::FLAG_DELETED), $id, null, '+')) {
- throw new Zend_Mail_Storage_Exception('cannot set deleted flag');
- }
- // TODO: expunge here or at close? we can handle an error here better and are more fail safe
- if (!$this->_protocol->expunge()) {
- throw new Zend_Mail_Storage_Exception('message marked as deleted, but could not expunge');
- }
- }
-
- /**
- * get unique id for one or all messages
- *
- * if storage does not support unique ids it's the same as the message number
- *
- * @param int|null $id message number
- * @return array|string message number for given message or all messages as array
- * @throws Zend_Mail_Storage_Exception
- */
- public function getUniqueId($id = null)
- {
- if ($id) {
- return $this->_protocol->fetch('UID', $id);
- }
-
- return $this->_protocol->fetch('UID', 1, INF);
- }
-
- /**
- * get a message number from a unique id
- *
- * I.e. if you have a webmailer that supports deleting messages you should use unique ids
- * as parameter and use this method to translate it to message number right before calling removeMessage()
- *
- * @param string $id unique id
- * @return int message number
- * @throws Zend_Mail_Storage_Exception
- */
- public function getNumberByUniqueId($id)
- {
- // TODO: use search to find number directly
- $ids = $this->getUniqueId();
- foreach ($ids as $k => $v) {
- if ($v == $id) {
- return $k;
- }
- }
-
- throw new Zend_Mail_Storage_Exception('unique id not found');
- }
-
-
- /**
- * get root folder or given folder
- *
- * @param string $rootFolder get folder structure for given folder, else root
- * @return Zend_Mail_Storage_Folder root or wanted folder
- * @throws Zend_Mail_Storage_Exception
- * @throws Zend_Mail_Protocol_Exception
- */
- public function getFolders($rootFolder = null)
- {
- $folders = $this->_protocol->listMailbox((string)$rootFolder);
- if (!$folders) {
- throw new Zend_Mail_Storage_Exception('folder not found');
- }
-
- ksort($folders, SORT_STRING);
- $root = new Zend_Mail_Storage_Folder('/', '/', false);
- $stack = array(null);
- $folderStack = array(null);
- $parentFolder = $root;
- $parent = '';
-
- foreach ($folders as $globalName => $data) {
- do {
- if (!$parent || strpos($globalName, $parent) === 0) {
- $pos = strrpos($globalName, $data['delim']);
- if ($pos === false) {
- $localName = $globalName;
- } else {
- $localName = substr($globalName, $pos + 1);
- }
- $selectable = !$data['flags'] || !in_array('\\Noselect', $data['flags']);
-
- array_push($stack, $parent);
- $parent = $globalName . $data['delim'];
- $folder = new Zend_Mail_Storage_Folder($localName, $globalName, $selectable);
- $parentFolder->$localName = $folder;
- array_push($folderStack, $parentFolder);
- $parentFolder = $folder;
- break;
- } else if ($stack) {
- $parent = array_pop($stack);
- $parentFolder = array_pop($folderStack);
- }
- } while ($stack);
- if (!$stack) {
- throw new Zend_Mail_Storage_Exception('error while constructing folder tree');
- }
- }
-
- return $root;
- }
-
- /**
- * select given folder
- *
- * folder must be selectable!
- *
- * @param Zend_Mail_Storage_Folder|string $globalName global name of folder or instance for subfolder
- * @return null
- * @throws Zend_Mail_Storage_Exception
- * @throws Zend_Mail_Protocol_Exception
- */
- public function selectFolder($globalName)
- {
- $this->_currentFolder = $globalName;
- if (!$this->_protocol->select($this->_currentFolder)) {
- $this->_currentFolder = '';
- throw new Zend_Mail_Storage_Exception('cannot change folder, maybe it does not exist');
- }
- }
-
-
- /**
- * get Zend_Mail_Storage_Folder instance for current folder
- *
- * @return Zend_Mail_Storage_Folder instance of current folder
- * @throws Zend_Mail_Storage_Exception
- */
- public function getCurrentFolder()
- {
- return $this->_currentFolder;
- }
-
- /**
- * create a new folder
- *
- * This method also creates parent folders if necessary. Some mail storages may restrict, which folder
- * may be used as parent or which chars may be used in the folder name
- *
- * @param string $name global name of folder, local name if $parentFolder is set
- * @param string|Zend_Mail_Storage_Folder $parentFolder parent folder for new folder, else root folder is parent
- * @return null
- * @throw Zend_Mail_Storage_Exception
- */
- public function createFolder($name, $parentFolder = null)
- {
- // TODO: we assume / as the hierarchy delim - need to get that from the folder class!
- if ($parentFolder instanceof Zend_Mail_Storage_Folder) {
- $folder = $parentFolder->getGlobalName() . '/' . $name;
- } else if ($parentFolder != null) {
- $folder = $parentFolder . '/' . $name;
- } else {
- $folder = $name;
- }
-
- if (!$this->_protocol->create($folder)) {
- throw new Zend_Mail_Storage_Exception('cannot create folder');
- }
- }
-
- /**
- * remove a folder
- *
- * @param string|Zend_Mail_Storage_Folder $name name or instance of folder
- * @return null
- * @throw Zend_Mail_Storage_Exception
- */
- public function removeFolder($name)
- {
- if ($name instanceof Zend_Mail_Storage_Folder) {
- $name = $name->getGlobalName();
- }
-
- if (!$this->_protocol->delete($name)) {
- throw new Zend_Mail_Storage_Exception('cannot delete folder');
- }
- }
-
- /**
- * rename and/or move folder
- *
- * The new name has the same restrictions as in createFolder()
- *
- * @param string|Zend_Mail_Storage_Folder $oldName name or instance of folder
- * @param string $newName new global name of folder
- * @return null
- * @throw Zend_Mail_Storage_Exception
- */
- public function renameFolder($oldName, $newName)
- {
- if ($oldName instanceof Zend_Mail_Storage_Folder) {
- $oldName = $oldName->getGlobalName();
- }
-
- if (!$this->_protocol->rename($oldName, $newName)) {
- throw new Zend_Mail_Storage_Exception('cannot rename folder');
- }
- }
-
- /**
- * append a new message to mail storage
- *
- * @param string $message message as string or instance of message class
- * @param null|string|Zend_Mail_Storage_Folder $folder folder for new message, else current folder is taken
- * @param null|array $flags set flags for new message, else a default set is used
- * @throw Zend_Mail_Storage_Exception
- */
- // not yet * @param string|Zend_Mail_Message|Zend_Mime_Message $message message as string or instance of message class
- public function appendMessage($message, $folder = null, $flags = null)
- {
- if ($folder === null) {
- $folder = $this->_currentFolder;
- }
-
- if ($flags === null) {
- $flags = array(Zend_Mail_Storage::FLAG_SEEN);
- }
-
- // TODO: handle class instances for $message
- if (!$this->_protocol->append($folder, $message, $flags)) {
- throw new Zend_Mail_Storage_Exception('cannot create message, please check if the folder exists and your flags');
- }
- }
-
- /**
- * copy an existing message
- *
- * @param int $id number of message
- * @param string|Zend_Mail_Storage_Folder $folder name or instance of targer folder
- * @return null
- * @throw Zend_Mail_Storage_Exception
- */
- public function copyMessage($id, $folder)
- {
- if (!$this->_protocol->copy($folder, $id)) {
- throw new Zend_Mail_Storage_Exception('cannot copy message, does the folder exist?');
- }
- }
-
-
- /**
- * set flags for message
- *
- * NOTE: this method can't set the recent flag.
- *
- * @param int $id number of message
- * @param array $flags new flags for message
- * @throw Zend_Mail_Storage_Exception
- */
- public function setFlags($id, $flags)
- {
- if (!$this->_protocol->store($flags, $id)) {
- throw new Zend_Mail_Storage_Exception('cannot set flags, have you tried to set the recent flag or special chars?');
- }
- }
-}
-
diff --git a/libs/Zend/Mail/Storage/Maildir.php b/libs/Zend/Mail/Storage/Maildir.php
deleted file mode 100755
index cd8503df83..0000000000
--- a/libs/Zend/Mail/Storage/Maildir.php
+++ /dev/null
@@ -1,381 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-
-/**
- * Zend_Mail_Storage_Abstract
- */
-require_once 'Zend/Mail/Storage/Abstract.php';
-
-/**
- * Zend_Mail_Message
- */
-require_once 'Zend/Mail/Message.php';
-
-/**
- * Zend_Mail_Storage_Exception
- */
-require_once 'Zend/Mail/Storage/Exception.php';
-
-/**
- * Zend_Mail_Storage
- */
-require_once 'Zend/Mail/Storage.php';
-
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract
-{
- /**
- * data of found message files in maildir dir
- * @var array
- */
- protected $_files = array();
-
- /**
- * known flag chars in filenames
- *
- * This list has to be in alphabetical order for setFlags()
- *
- * @var array
- */
- protected static $_knownFlags = array('D' => Zend_Mail_Storage::FLAG_DRAFT,
- 'F' => Zend_Mail_Storage::FLAG_FLAGGED,
- 'P' => Zend_Mail_Storage::FLAG_PASSED,
- 'R' => Zend_Mail_Storage::FLAG_ANSWERED,
- 'S' => Zend_Mail_Storage::FLAG_SEEN,
- 'T' => Zend_Mail_Storage::FLAG_DELETED);
-
- /**
- * Count messages all messages in current box
- *
- * @return int number of messages
- * @throws Zend_Mail_Storage_Exception
- */
- public function countMessages()
- {
- return count($this->_files);
- }
-
- /**
- * Get one or all fields from file structure. Also checks if message is valid
- *
- * @param int $id message number
- * @param string|null $field wanted field
- * @return string|array wanted field or all fields as array
- * @throws Zend_Mail_Storage_Exception
- */
- protected function _getFileData($id, $field = null)
- {
- if (!isset($this->_files[$id - 1])) {
- throw new Zend_Mail_Storage_Exception('id does not exist');
- }
-
- if (!$field) {
- return $this->_files[$id - 1];
- }
-
- if (!isset($this->_files[$id - 1][$field])) {
- throw new Zend_Mail_Storage_Exception('field does not exist');
- }
-
- return $this->_files[$id - 1][$field];
- }
-
- /**
- * Get a list of messages with number and size
- *
- * @param int|null $id number of message or null for all messages
- * @return int|array size of given message of list with all messages as array(num => size)
- * @throws Zend_Mail_Storage_Exception
- */
- public function getSize($id = null)
- {
- if ($id !== null) {
- return filesize($this->_getFileData($id, 'filename'));
- }
-
- $result = array();
- foreach ($this->_files as $num => $pos) {
- $result[$num + 1] = filesize($this->_files[$num]['filename']);
- }
-
- return $result;
- }
-
-
-
- /**
- * Fetch a message
- *
- * @param int $id number of message
- * @return Zend_Mail_Message
- * @throws Zend_Mail_Storage_Exception
- */
- public function getMessage($id)
- {
- return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $this->getRawHeader($id),
- 'flags' => $this->_getFileData($id, 'flags')));
- }
-
- /*
- * Get raw header of message or part
- *
- * @param int $id number of message
- * @param null|array|string $part path to part or null for messsage header
- * @param int $topLines include this many lines with header (after an empty line)
- * @return string raw header
- * @throws Zend_Mail_Storage_Exception
- */
- public function getRawHeader($id, $part = null, $topLines = 0)
- {
- if ($part !== null) {
- // TODO: implement
- throw new Zend_Mail_Storage_Exception('not implemented');
- }
-
- $fh = fopen($this->_getFileData($id, 'filename'), 'r');
-
- $content = '';
- while (!feof($fh)) {
- $line = fgets($fh);
- if (!trim($line)) {
- break;
- }
- $content .= $line;
- }
-
- fclose($fh);
- return $content;
- }
-
- /*
- * Get raw content of message or part
- *
- * @param int $id number of message
- * @param null|array|string $part path to part or null for messsage content
- * @return string raw content
- * @throws Zend_Mail_Storage_Exception
- */
- public function getRawContent($id, $part = null)
- {
- if ($part !== null) {
- // TODO: implement
- throw new Zend_Mail_Storage_Exception('not implemented');
- }
-
- $fh = fopen($this->_getFileData($id, 'filename'), 'r');
-
- while (!feof($fh)) {
- $line = fgets($fh);
- if (!trim($line)) {
- break;
- }
- }
-
- $content = stream_get_contents($fh);
- fclose($fh);
- return $content;
- }
-
- /**
- * Create instance with parameters
- * Supported parameters are:
- * - dirname dirname of mbox file
- *
- * @param $params array mail reader specific parameters
- * @throws Zend_Mail_Storage_Exception
- */
- public function __construct($params)
- {
- if (!isset($params['dirname']) || !is_dir($params['dirname'])) {
- throw new Zend_Mail_Storage_Exception('no valid dirname given in params');
- }
-
- if (!$this->_isMaildir($params['dirname'])) {
- throw new Zend_Mail_Storage_Exception('invalid maildir given');
- }
-
- $this->_has['top'] = true;
- $this->_has['flags'] = true;
- $this->_openMaildir($params['dirname']);
- }
-
- /**
- * check if a given dir is a valid maildir
- *
- * @param string $dirname name of dir
- * @return bool dir is valid maildir
- */
- protected function _isMaildir($dirname)
- {
- if (file_exists($dirname . '/new') && !is_dir($dirname . '/new')) {
- return false;
- }
- if (file_exists($dirname . '/tmp') && !is_dir($dirname . '/tmp')) {
- return false;
- }
- return is_dir($dirname . '/cur');
- }
-
- /**
- * open given dir as current maildir
- *
- * @param string $dirname name of maildir
- * @return null
- * @throws Zend_Mail_Storage_Exception
- */
- protected function _openMaildir($dirname)
- {
- if ($this->_files) {
- $this->close();
- }
-
- $dh = @opendir($dirname . '/cur/');
- if (!$dh) {
- throw new Zend_Mail_Storage_Exception('cannot open maildir');
- }
- $this->_getMaildirFiles($dh, $dirname . '/cur/');
- closedir($dh);
-
- $dh = @opendir($dirname . '/new/');
- if ($dh) {
- $this->_getMaildirFiles($dh, $dirname . '/new/', array(Zend_Mail_Storage::FLAG_RECENT));
- closedir($dh);
- } else if (file_exists($dirname . '/new/')) {
- throw new Zend_Mail_Storage_Exception('cannot read recent mails in maildir');
- }
- }
-
- /**
- * find all files in opened dir handle and add to maildir files
- *
- * @param resource $dh dir handle used for search
- * @param string $dirname dirname of dir in $dh
- * @param array $default_flags default flags for given dir
- * @return null
- */
- protected function _getMaildirFiles($dh, $dirname, $default_flags = array())
- {
- while (($entry = readdir($dh)) !== false) {
- if ($entry[0] == '.' || !is_file($dirname . $entry)) {
- continue;
- }
-
- @list($uniq, $info) = explode(':', $entry, 2);
- @list($version, $flags) = explode(',', $info, 2);
- if ($version != 2) {
- $flags = '';
- }
-
- $named_flags = $default_flags;
- $length = strlen($flags);
- for ($i = 0; $i < $length; ++$i) {
- $flag = $flags[$i];
- $named_flags[$flag] = isset(self::$_knownFlags[$flag]) ? self::$_knownFlags[$flag] : $flag;
- }
-
- $this->_files[] = array('uniq' => $uniq,
- 'flags' => $named_flags,
- 'filename' => $dirname . $entry);
- }
- }
-
-
- /**
- * Close resource for mail lib. If you need to control, when the resource
- * is closed. Otherwise the destructor would call this.
- *
- * @return void
- */
- public function close()
- {
- $this->_files = array();
- }
-
-
- /**
- * Waste some CPU cycles doing nothing.
- *
- * @return void
- */
- public function noop()
- {
- return true;
- }
-
-
- /**
- * stub for not supported message deletion
- *
- * @return null
- * @throws Zend_Mail_Storage_Exception
- */
- public function removeMessage($id)
- {
- throw new Zend_Mail_Storage_Exception('maildir is (currently) read-only');
- }
-
- /**
- * get unique id for one or all messages
- *
- * if storage does not support unique ids it's the same as the message number
- *
- * @param int|null $id message number
- * @return array|string message number for given message or all messages as array
- * @throws Zend_Mail_Storage_Exception
- */
- public function getUniqueId($id = null)
- {
- if ($id) {
- return $this->_getFileData($id, 'uniq');
- }
-
- $ids = array();
- foreach ($this->_files as $num => $file) {
- $ids[$num + 1] = $file['uniq'];
- }
- return $ids;
- }
-
- /**
- * get a message number from a unique id
- *
- * I.e. if you have a webmailer that supports deleting messages you should use unique ids
- * as parameter and use this method to translate it to message number right before calling removeMessage()
- *
- * @param string $id unique id
- * @return int message number
- * @throws Zend_Mail_Storage_Exception
- */
- public function getNumberByUniqueId($id)
- {
- foreach ($this->_files as $num => $file) {
- if ($file['uniq'] == $id) {
- return $num + 1;
- }
- }
-
- throw new Zend_Mail_Storage_Exception('unique id not found');
- }
-}
diff --git a/libs/Zend/Mail/Storage/Mbox.php b/libs/Zend/Mail/Storage/Mbox.php
deleted file mode 100755
index 9d0155edc5..0000000000
--- a/libs/Zend/Mail/Storage/Mbox.php
+++ /dev/null
@@ -1,396 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-
-/**
- * Zend_Loader
- * May be used in constructor, but commented out for now
- */
-// require_once 'Zend/Loader.php';
-
-/**
- * Zend_Mail_Storage_Abstract
- */
-require_once 'Zend/Mail/Storage/Abstract.php';
-
-/**
- * Zend_Mail_Message
- */
-require_once 'Zend/Mail/Message.php';
-
-/**
- * Zend_Mail_Storage_Exception
- */
-require_once 'Zend/Mail/Storage/Exception.php';
-
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract
-{
- /**
- * file handle to mbox file
- * @var null|resource
- */
- protected $_fh;
-
- /**
- * filename of mbox file for __wakeup
- * @var string
- */
- protected $_filename;
-
- /**
- * modification date of mbox file for __wakeup
- * @var int
- */
- protected $_filemtime;
-
- /**
- * start and end position of messages as array('start' => start, 'seperator' => headersep, 'end' => end)
- * @var array
- */
- protected $_positions;
-
-
- /**
- * Count messages all messages in current box
- *
- * @return int number of messages
- * @throws Zend_Mail_Storage_Exception
- */
- public function countMessages()
- {
- return count($this->_positions);
- }
-
-
- /**
- * Get a list of messages with number and size
- *
- * @param int|null $id number of message or null for all messages
- * @return int|array size of given message of list with all messages as array(num => size)
- */
- public function getSize($id = 0)
- {
- if ($id) {
- $pos = $this->_positions[$id - 1];
- return $pos['end'] - $pos['start'];
- }
-
- $result = array();
- foreach ($this->_positions as $num => $pos) {
- $result[$num + 1] = $pos['end'] - $pos['start'];
- }
-
- return $result;
- }
-
-
- /**
- * Get positions for mail message or throw exeption if id is invalid
- *
- * @param int $id number of message
- * @return array positions as in _positions
- * @throws Zend_Mail_Storage_Exception
- */
- protected function _getPos($id)
- {
- if (!isset($this->_positions[$id - 1])) {
- throw new Zend_Mail_Storage_Exception('id does not exist');
- }
-
- return $this->_positions[$id - 1];
- }
-
-
- /**
- * Fetch a message
- *
- * @param int $id number of message
- * @return Zend_Mail_Message
- * @throws Zend_Mail_Storage_Exception
- */
- public function getMessage($id)
- {
- $bodyLines = 0; // TODO: need a way to change that
-
- $message = $this->getRawHeader($id);
- // file pointer is after headers now
- if ($bodyLines) {
- $message .= "\n";
- while ($bodyLines-- && ftell($this->_fh) < $this->_positions[$id - 1]['end']) {
- $message .= fgets($this->_fh);
- }
- }
-
- return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $message));
- }
-
- /*
- * Get raw header of message or part
- *
- * @param int $id number of message
- * @param null|array|string $part path to part or null for messsage header
- * @param int $topLines include this many lines with header (after an empty line)
- * @return string raw header
- * @throws Zend_Mail_Protocol_Exception
- */
- public function getRawHeader($id, $part = null, $topLines = 0)
- {
- if ($part !== null) {
- // TODO: implement
- throw new Zend_Mail_Storage_Exception('not implemented');
- }
- $messagePos = $this->_getPos($id);
- // TODO: toplines
- return stream_get_contents($this->_fh, $messagePos['separator'] - $messagePos['start'], $messagePos['start']);
- }
-
- /*
- * Get raw content of message or part
- *
- * @param int $id number of message
- * @param null|array|string $part path to part or null for messsage content
- * @return string raw content
- * @throws Zend_Mail_Protocol_Exception
- */
- public function getRawContent($id, $part = null)
- {
- if ($part !== null) {
- // TODO: implement
- throw new Zend_Mail_Storage_Exception('not implemented');
- }
- $messagePos = $this->_getPos($id);
- return stream_get_contents($this->_fh, $messagePos['end'] - $messagePos['separator'], $messagePos['separator']);
- }
-
- /**
- * Create instance with parameters
- * Supported parameters are:
- * - filename filename of mbox file
- *
- * @param $params array mail reader specific parameters
- * @throws Zend_Mail_Storage_Exception
- */
- public function __construct($params)
- {
- if (!isset($params['filename']) /* || Zend_Loader::isReadable($params['filename']) */) {
- throw new Zend_Mail_Storage_Exception('no valid filename given in params');
- }
-
- $this->_openMboxFile($params['filename']);
- $this->_has['top'] = true;
- $this->_has['uniqueid'] = false;
- }
-
- /**
- * check if given file is a mbox file
- *
- * if $file is a resource its file pointer is moved after the first line
- *
- * @param resource|string $file stream resource of name of file
- * @param bool $fileIsString file is string or resource
- * @return bool file is mbox file
- */
- protected function _isMboxFile($file, $fileIsString = true)
- {
- if ($fileIsString) {
- $file = @fopen($file, 'r');
- if (!$file) {
- return false;
- }
- } else {
- fseek($file, 0);
- }
-
- $result = false;
-
- $line = fgets($file);
- if (strpos($line, 'From ') === 0) {
- $result = true;
- }
-
- if ($fileIsString) {
- @fclose($file);
- }
-
- return $result;
- }
-
- /**
- * open given file as current mbox file
- *
- * @param string $filename filename of mbox file
- * @return null
- * @throws Zend_Mail_Storage_Exception
- */
- protected function _openMboxFile($filename)
- {
- if ($this->_fh) {
- $this->close();
- }
-
- $this->_fh = @fopen($filename, 'r');
- if (!$this->_fh) {
- throw new Zend_Mail_Storage_Exception('cannot open mbox file');
- }
- $this->_filename = $filename;
- $this->_filemtime = filemtime($this->_filename);
-
- if (!$this->_isMboxFile($this->_fh, false)) {
- @fclose($this->_fh);
- throw new Zend_Mail_Storage_Exception('file is not a valid mbox format');
- }
-
- $messagePos = array('start' => ftell($this->_fh), 'separator' => 0, 'end' => 0);
- while (($line = fgets($this->_fh)) !== false) {
- if (strpos($line, 'From ') === 0) {
- $messagePos['end'] = ftell($this->_fh) - strlen($line) - 2; // + newline
- if (!$messagePos['separator']) {
- $messagePos['separator'] = $messagePos['end'];
- }
- $this->_positions[] = $messagePos;
- $messagePos = array('start' => ftell($this->_fh), 'separator' => 0, 'end' => 0);
- }
- if (!$messagePos['separator'] && !trim($line)) {
- $messagePos['separator'] = ftell($this->_fh);
- }
- }
-
- $messagePos['end'] = ftell($this->_fh);
- if (!$messagePos['separator']) {
- $messagePos['separator'] = $messagePos['end'];
- }
- $this->_positions[] = $messagePos;
- }
-
- /**
- * Close resource for mail lib. If you need to control, when the resource
- * is closed. Otherwise the destructor would call this.
- *
- * @return void
- */
- public function close()
- {
- @fclose($this->_fh);
- $this->_positions = array();
- }
-
-
- /**
- * Waste some CPU cycles doing nothing.
- *
- * @return void
- */
- public function noop()
- {
- return true;
- }
-
-
- /**
- * stub for not supported message deletion
- *
- * @return null
- * @throws Zend_Mail_Storage_Exception
- */
- public function removeMessage($id)
- {
- throw new Zend_Mail_Storage_Exception('mbox is read-only');
- }
-
- /**
- * get unique id for one or all messages
- *
- * Mbox does not support unique ids (yet) - it's always the same as the message number.
- * That shouldn't be a problem, because we can't change mbox files. Therefor the message
- * number is save enough.
- *
- * @param int|null $id message number
- * @return array|string message number for given message or all messages as array
- * @throws Zend_Mail_Storage_Exception
- */
- public function getUniqueId($id = null)
- {
- if ($id) {
- // check if id exists
- $this->_getPos($id);
- return $id;
- }
-
- $range = range(1, $this->countMessages());
- return array_combine($range, $range);
- }
-
- /**
- * get a message number from a unique id
- *
- * I.e. if you have a webmailer that supports deleting messages you should use unique ids
- * as parameter and use this method to translate it to message number right before calling removeMessage()
- *
- * @param string $id unique id
- * @return int message number
- * @throws Zend_Mail_Storage_Exception
- */
- public function getNumberByUniqueId($id)
- {
- // check if id exists
- $this->_getPos($id);
- return $id;
- }
-
- /**
- * magic method for serialize()
- *
- * with this method you can cache the mbox class
- *
- * @return array name of variables
- */
- public function __sleep()
- {
- return array('_filename', '_positions', '_filemtime');
- }
-
- /**
- * magic method for unserialize()
- *
- * with this method you can cache the mbox class
- * for cache validation the mtime of the mbox file is used
- *
- * @return null
- * @throws Zend_Mail_Storage_Exception
- */
- public function __wakeup()
- {
- if ($this->_filemtime != @filemtime($this->_filename)) {
- $this->close();
- $this->_openMboxFile($this->_filename);
- } else {
- $this->_fh = @fopen($this->_filename, 'r');
- if (!$this->_fh) {
- throw new Zend_Mail_Storage_Exception('cannot open mbox file');
- }
- }
- }
-
-}
diff --git a/libs/Zend/Mail/Storage/Pop3.php b/libs/Zend/Mail/Storage/Pop3.php
deleted file mode 100755
index 5b5effe4c3..0000000000
--- a/libs/Zend/Mail/Storage/Pop3.php
+++ /dev/null
@@ -1,301 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-
-/**
- * Zend_Mail_Storage_Abstract
- */
-require_once 'Zend/Mail/Storage/Abstract.php';
-
-/**
- * Zend_Mail_Protocol_Pop3
- */
-require_once 'Zend/Mail/Protocol/Pop3.php';
-
-/**
- * Zend_Mail_Message
- */
-require_once 'Zend/Mail/Message.php';
-
-/**
- * Zend_Mail_Storage_Exception
- */
-require_once 'Zend/Mail/Storage/Exception.php';
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_Mail_Storage_Pop3 extends Zend_Mail_Storage_Abstract
-{
- /**
- * protocol handler
- * @var null|Zend_Mail_Protocol_Pop3
- */
- protected $_protocol;
-
-
- /**
- * Count messages all messages in current box
- *
- * @return int number of messages
- * @throws Zend_Mail_Storage_Exception
- * @throws Zend_Mail_Protocol_Exception
- */
- public function countMessages()
- {
- $this->_protocol->status($count, $null);
- return (int)$count;
- }
-
- /**
- * get a list of messages with number and size
- *
- * @param int $id number of message
- * @return int|array size of given message of list with all messages as array(num => size)
- * @throws Zend_Mail_Protocol_Exception
- */
- public function getSize($id = 0)
- {
- $id = $id ? $id : null;
- return $this->_protocol->getList($id);
- }
-
- /**
- * Fetch a message
- *
- * @param int $id number of message
- * @return Zend_Mail_Message
- * @throws Zend_Mail_Protocol_Exception
- */
- public function getMessage($id)
- {
- $bodyLines = 0;
- $message = $this->_protocol->top($id, $bodyLines, true);
-
- return new $this->_messageClass(array('handler' => $this, 'id' => $id, 'headers' => $message,
- 'noToplines' => $bodyLines < 1));
- }
-
- /*
- * Get raw header of message or part
- *
- * @param int $id number of message
- * @param null|array|string $part path to part or null for messsage header
- * @param int $topLines include this many lines with header (after an empty line)
- * @return string raw header
- * @throws Zend_Mail_Protocol_Exception
- */
- public function getRawHeader($id, $part = null, $topLines = 0)
- {
- if ($part !== null) {
- // TODO: implement
- throw new Zend_Mail_Storage_Exception('not implemented');
- }
-
- return $this->_protocol->top($id, 0, true);
- }
-
- /*
- * Get raw content of message or part
- *
- * @param int $id number of message
- * @param null|array|string $part path to part or null for messsage content
- * @return string raw content
- * @throws Zend_Mail_Protocol_Exception
- */
- public function getRawContent($id, $part = null)
- {
- if ($part !== null) {
- // TODO: implement
- throw new Zend_Mail_Storage_Exception('not implemented');
- }
-
- $content = $this->_protocol->retrive($id);
- // TODO: find a way to avoid decoding the headers
- Zend_Mime_Decode::splitMessage($content, $null, $body);
- return $body;
- }
-
- /**
- * create instance with parameters
- * Supported paramters are
- * - host hostname or ip address of POP3 server
- * - user username
- * - password password for user 'username' [optional, default = '']
- * - port port for POP3 server [optional, default = 110]
- * - ssl 'SSL' or 'TLS' for secure sockets
- *
- * @param $params array mail reader specific parameters
- * @throws Zend_Mail_Storage_Exception
- * @throws Zend_Mail_Protocol_Exception
- */
- public function __construct($params)
- {
- $this->_has['fetchPart'] = false;
- $this->_has['top'] = null;
- $this->_has['uniqueid'] = null;
-
- if ($params instanceof Zend_Mail_Protocol_Pop3) {
- $this->_protocol = $params;
- return;
- }
-
- if (!isset($params['user'])) {
- throw new Zend_Mail_Storage_Exception('need at least user in params');
- }
-
- $params['host'] = isset($params['host']) ? $params['host'] : 'localhost';
- $params['password'] = isset($params['password']) ? $params['password'] : '';
- $params['port'] = isset($params['port']) ? $params['port'] : null;
- $params['ssl'] = isset($params['ssl']) ? $params['ssl'] : false;
-
- $this->_protocol = new Zend_Mail_Protocol_Pop3();
- $this->_protocol->connect($params['host'], $params['port'], $params['ssl']);
- $this->_protocol->login($params['user'], $params['password']);
- }
-
- /**
- * Close resource for mail lib. If you need to control, when the resource
- * is closed. Otherwise the destructor would call this.
- *
- * @return null
- */
- public function close()
- {
- $this->_protocol->logout();
- }
-
- /**
- * Keep the server busy.
- *
- * @return null
- * @throws Zend_Mail_Protocol_Exception
- */
- public function noop()
- {
- return $this->_protocol->noop();
- }
-
- /**
- * Remove a message from server. If you're doing that from a web enviroment
- * you should be careful and use a uniqueid as parameter if possible to
- * identify the message.
- *
- * @param int $id number of message
- * @return null
- * @throws Zend_Mail_Protocol_Exception
- */
- public function removeMessage($id)
- {
- $this->_protocol->delete($id);
- }
-
- /**
- * get unique id for one or all messages
- *
- * if storage does not support unique ids it's the same as the message number
- *
- * @param int|null $id message number
- * @return array|string message number for given message or all messages as array
- * @throws Zend_Mail_Storage_Exception
- */
- public function getUniqueId($id = null)
- {
- if (!$this->hasUniqueid) {
- if ($id) {
- return $id;
- }
- $range = range(1, $this->countMessages());
- return array_combine($range, $range);
- }
-
- return $this->_protocol->uniqueid($id);
- }
-
- /**
- * get a message number from a unique id
- *
- * I.e. if you have a webmailer that supports deleting messages you should use unique ids
- * as parameter and use this method to translate it to message number right before calling removeMessage()
- *
- * @param string $id unique id
- * @return int message number
- * @throws Zend_Mail_Storage_Exception
- */
- public function getNumberByUniqueId($id)
- {
- if (!$this->hasUniqueid) {
- return $id;
- }
-
- $ids = $this->getUniqueId();
- foreach ($ids as $k => $v) {
- if ($v == $id) {
- return $k;
- }
- }
-
- throw new Zend_Mail_Storage_Exception('unique id not found');
- }
-
- /**
- * Special handling for hasTop and hasUniqueid. The headers of the first message is
- * retrieved if Top wasn't needed/tried yet.
- *
- * @see Zend_Mail_Storage_Abstract:__get()
- * @param string $var
- * @return string
- * @throws Zend_Mail_Storage_Exception
- */
- public function __get($var)
- {
- $result = parent::__get($var);
- if ($result !== null) {
- return $result;
- }
-
- if (strtolower($var) == 'hastop') {
- if ($this->_protocol->hasTop === null) {
- // need to make a real call, because not all server are honest in their capas
- try {
- $this->_protocol->top(1, 0, false);
- } catch(Zend_Mail_Exception $e) {
- // ignoring error
- }
- }
- $this->_has['top'] = $this->_protocol->hasTop;
- return $this->_protocol->hasTop;
- }
-
- if (strtolower($var) == 'hasuniqueid') {
- $id = null;
- try {
- $id = $this->_protocol->uniqueid(1);
- } catch(Zend_Mail_Exception $e) {
- // ignoring error
- }
- $this->_has['uniqueid'] = $id ? true : false;
- return $this->_has['uniqueid'];
- }
-
- return $result;
- }
-}
diff --git a/libs/Zend/Mail/Storage/Writable/Interface.php b/libs/Zend/Mail/Storage/Writable/Interface.php
deleted file mode 100755
index 936dd95767..0000000000
--- a/libs/Zend/Mail/Storage/Writable/Interface.php
+++ /dev/null
@@ -1,93 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-interface Zend_Mail_Storage_Writable_Interface
-{
- /**
- * create a new folder
- *
- * This method also creates parent folders if necessary. Some mail storages may restrict, which folder
- * may be used as parent or which chars may be used in the folder name
- *
- * @param string $name global name of folder, local name if $parentFolder is set
- * @param string|Zend_Mail_Storage_Folder $parentFolder parent folder for new folder, else root folder is parent
- * @return null
- * @throw Zend_Mail_Storage_Exception
- */
- public function createFolder($name, $parentFolder = null);
-
- /**
- * remove a folder
- *
- * @param string|Zend_Mail_Storage_Folder $name name or instance of folder
- * @return null
- * @throw Zend_Mail_Storage_Exception
- */
- public function removeFolder($name);
-
- /**
- * rename and/or move folder
- *
- * The new name has the same restrictions as in createFolder()
- *
- * @param string|Zend_Mail_Storage_Folder $oldName name or instance of folder
- * @param string $newName new global name of folder
- * @return null
- * @throw Zend_Mail_Storage_Exception
- */
- public function renameFolder($oldName, $newName);
-
- /**
- * append a new message to mail storage
- *
- * @param string|Zend_Mail_Message|Zend_Mime_Message $message message as string or instance of message class
- * @param null|string|Zend_Mail_Storage_Folder $folder folder for new message, else current folder is taken
- * @param null|array $flags set flags for new message, else a default set is used
- * @throw Zend_Mail_Storage_Exception
- */
- public function appendMessage($message, $folder = null, $flags = null);
-
- /**
- * copy an existing message
- *
- * @param int $id number of message
- * @param string|Zend_Mail_Storage_Folder $folder name or instance of targer folder
- * @return null
- * @throw Zend_Mail_Storage_Exception
- */
- public function copyMessage($id, $folder);
-
- /**
- * set flags for message
- *
- * NOTE: this method can't set the recent flag.
- *
- * @param int $id number of message
- * @param array $flags new flags for message
- * @throw Zend_Mail_Storage_Exception
- */
- public function setFlags($id, $flags);
-} \ No newline at end of file
diff --git a/libs/Zend/Mail/Storage/Writable/Maildir.php b/libs/Zend/Mail/Storage/Writable/Maildir.php
deleted file mode 100755
index 766b91acad..0000000000
--- a/libs/Zend/Mail/Storage/Writable/Maildir.php
+++ /dev/null
@@ -1,524 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-
-/**
- * Zend_Mail_Storage_Folder_Maildir
- */
-require_once 'Zend/Mail/Storage/Folder/Maildir.php';
-
-/**
- * Zend_Mail_Storage_Exception
- */
-require_once 'Zend/Mail/Storage/Exception.php';
-
-/**
- * Zend_Mail_Storage_Writable_Interface
- */
-require_once 'Zend/Mail/Storage/Writable/Interface.php';
-
-
-/**
- * @package Zend_Mail
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Maildir
- implements Zend_Mail_Storage_Writable_Interface
-{
- /**
- * create a new folder
- *
- * This method also creates parent folders if necessary. Some mail storages may restrict, which folder
- * may be used as parent or which chars may be used in the folder name
- *
- * @param string $name global name of folder, local name if $parentFolder is set
- * @param string|Zend_Mail_Storage_Folder $parentFolder parent folder for new folder, else root folder is parent
- * @return string only used internally (new created maildir)
- * @throw Zend_Mail_Storage_Exception
- */
- public function createFolder($name, $parentFolder = null)
- {
- if ($parentFolder instanceof Zend_Mail_Storage_Folder) {
- $folder = $parentFolder->getGlobalName() . $this->_delim . $name;
- } else if ($parentFolder != null) {
- $folder = rtrim($parentFolder, $this->_delim) . $this->_delim . $name;
- } else {
- $folder = $name;
- }
-
- $folder = trim($folder, $this->_delim);
-
- // first we check if we try to create a folder that does exist
- $exists = null;
- try {
- $exists = $this->getFolders($folder);
- } catch (Zend_Mail_Exception $e) {
- // ok
- }
- if ($exists) {
- throw new Zend_Mail_Storage_Exception('folder already exists');
- }
-
- if (strpos($folder, $this->_delim . $this->_delim) !== false) {
- throw new Zend_Mail_Storage_Exception('invalid name - folder parts may not be empty');
- }
-
- if (strpos($folder, 'INBOX' . $this->_delim) === 0) {
- $folder = substr($folder, 6);
- }
-
- $fulldir = $this->_rootdir . '.' . $folder;
-
- // check if we got tricked and would create a dir outside of the rootdir or not as direct child
- if (strpos($folder, DIRECTORY_SEPARATOR) !== false || strpos($folder, '/') !== false
- || dirname($fulldir) . DIRECTORY_SEPARATOR != $this->_rootdir) {
- throw new Zend_Mail_Storage_Exception('invalid name - no directory seprator allowed in folder name');
- }
-
- // has a parent folder?
- $parent = null;
- if (strpos($folder, $this->_delim)) {
- // let's see if the parent folder exists
- $parent = substr($folder, 0, strrpos($folder, $this->_delim));
- try {
- $this->getFolders($parent);
- } catch (Zend_Mail_Exception $e) {
- // does not - create parent folder
- $this->createFolder($parent);
- }
- }
-
- if (!@mkdir($fulldir) || !@mkdir($fulldir . DIRECTORY_SEPARATOR . 'cur')) {
- throw new Zend_Mail_Storage_Exception('error while creating new folder, may be created incompletly');
- }
-
- mkdir($fulldir . DIRECTORY_SEPARATOR . 'new');
- mkdir($fulldir . DIRECTORY_SEPARATOR . 'tmp');
-
- $localName = $parent ? substr($folder, strlen($parent) + 1) : $folder;
- $this->getFolders($parent)->$localName = new Zend_Mail_Storage_Folder($localName, $folder, true);
-
- return $fulldir;
- }
-
- /**
- * remove a folder
- *
- * @param string|Zend_Mail_Storage_Folder $name name or instance of folder
- * @return null
- * @throw Zend_Mail_Storage_Exception
- */
- public function removeFolder($name)
- {
- // TODO: This could fail in the middle of the task, which is not optimal.
- // But there is no defined standard way to mark a folder as removed and there is no atomar fs-op
- // to remove a directory. Also moving the folder to a/the trash folder is not possible, as
- // all parent folders must be created. What we could do is add a dash to the front of the
- // directory name and it should be ignored as long as other processes obey the standard.
-
- if ($name instanceof Zend_Mail_Storage_Folder) {
- $name = $name->getGlobalName();
- }
-
- $name = trim($name, $this->_delim);
- if (strpos($name, 'INBOX' . $this->_delim) === 0) {
- $name = substr($name, 6);
- }
-
- // check if folder exists and has no children
- if (!$this->getFolders($name)->isLeaf()) {
- throw new Zend_Mail_Storage_Exception('delete children first');
- }
-
- if ($name == 'INBOX' || $name == '/') {
- throw new Zend_Mail_Storage_Exception('wont delete INBOX');
- }
-
- if ($name == $this->getCurrentFolder()) {
- throw new Zend_Mail_Storage_Exception('wont delete selected folder');
- }
-
- foreach (array('tmp', 'new', 'cur', '.') as $subdir) {
- $dir = $this->_rootdir . '.' . $name . '/' . $subdir;
- if (!file_exists($dir)) {
- continue;
- }
- $dh = opendir($dir);
- if (!$dh) {
- throw new Zend_Mail_Storage_Exception("error opening $subdir");
- }
- while (($entry = readdir($dh)) !== false) {
- if ($entry == '.' || $entry == '..') {
- continue;
- }
- if (!unlink($dir . '/' . $entry)) {
- throw new Zend_Mail_Storage_Exception("error cleaning $subdir");
- }
- }
- closedir($dh);
- if ($subdir !== '.') {
- if (!rmdir($dir)) {
- throw new Zend_Mail_Storage_Exception("error removing $subdir");
- }
- }
- }
-
- if (!rmdir($this->_rootdir . '.' . $name)) {
- // at least we should try to make it a valid maildir again
- mkdir($this->_rootdir . '.' . $name . '/' . 'cur');
- throw new Zend_Mail_Storage_Exception("error removing maindir");
- }
-
- $parent = strpos($name, $this->_delim) ? substr($name, 0, strrpos($name, $this->_delim)) : null;
- $localName = $parent ? substr($name, strlen($parent) + 1) : $name;
- unset($this->getFolders($parent)->$localName);
- }
-
- /**
- * rename and/or move folder
- *
- * The new name has the same restrictions as in createFolder()
- *
- * @param string|Zend_Mail_Storage_Folder $oldName name or instance of folder
- * @param string $newName new global name of folder
- * @return null
- * @throw Zend_Mail_Storage_Exception
- */
- public function renameFolder($oldName, $newName)
- {
- // TODO: This is also not atomar and has similar problems as removeFolder()
-
- if ($oldName instanceof Zend_Mail_Storage_Folder) {
- $oldName = $oldName->getGlobalName();
- }
-
- $oldName = trim($oldName, $this->_delim);
- if (strpos($oldName, 'INBOX' . $this->_delim) === 0) {
- $oldName = substr($oldName, 6);
- }
-
- $newName = trim($newName, $this->_delim);
- if (strpos($newName, 'INBOX' . $this->_delim) === 0) {
- $newName = substr($newName, 6);
- }
-
- if (strpos($newName, $oldName . $this->_delim) === 0) {
- throw new Zend_Mail_Storage_Exception('new folder cannot be a child of old folder');
- }
-
- // check if folder exists and has no children
- $folder = $this->getFolders($oldName);
-
- if ($oldName == 'INBOX' || $oldName == '/') {
- throw new Zend_Mail_Storage_Exception('wont rename INBOX');
- }
-
- if ($oldName == $this->getCurrentFolder()) {
- throw new Zend_Mail_Storage_Exception('wont rename selected folder');
- }
-
- $newdir = $this->createFolder($newName);
-
- if (!$folder->isLeaf()) {
- foreach ($folder as $k => $v) {
- $this->renameFolder($v->getGlobalName(), $newName . $this->_delim . $k);
- }
- }
-
- $olddir = $this->_rootdir . '.' . $folder;
- foreach (array('tmp', 'new', 'cur') as $subdir) {
- $subdir = DIRECTORY_SEPARATOR . $subdir;
- if (!file_exists($olddir . $subdir)) {
- continue;
- }
- // using copy or moving files would be even better - but also much slower
- if (!rename($olddir . $subdir, $newdir . $subdir)) {
- throw new Zend_Mail_Storage_Exception('error while moving ' . $subdir);
- }
- }
- // create a dummy if removing fails - otherwise we can't read it next time
- mkdir($olddir . DIRECTORY_SEPARATOR . 'cur');
- $this->removeFolder($oldName);
- }
-
- /**
- * create a uniqueid for maildir filename
- *
- * This is nearly the format defined in the maildir standard. The microtime() call should already
- * create a uniqueid, the pid is for multicore/-cpu machine that manage to call this function at the
- * exact same time, and uname() gives us the hostname for multiple machines accessing the same storage.
- *
- * If someone disables posix we create a random number of the same size, so this method should also
- * work on Windows - if you manage to get maildir working on Windows.
- * Microtime could also be disabled, altough I've never seen it.
- *
- * @return string new uniqueid
- */
- protected function _createUniqueId()
- {
- $id = '';
- $id .= function_exists('microtime') ? microtime(true) : (time() . ' ' . rand(0, 100000));
- $id .= '.' . (function_exists('posix_getpid') ? posix_getpid() : rand(50, 65535));
- $id .= '.' . php_uname('n');
-
- return $id;
- }
-
- /**
- * open a temporary maildir file
- *
- * makes sure tmp/ exists and create a file with a unique name
- * you should close the returned filehandle!
- *
- * @param string $folder name of current folder without leading .
- * @return array array('dirname' => dir of maildir folder, 'uniq' => unique id, 'filename' => name of create file
- * 'handle' => file opened for writing)
- * @throw Zend_Mail_Storage_Exception
- */
- protected function _createTmpFile($folder)
- {
- $tmpdir = $this->_rootdir . '.' . $folder . '/tmp/';
- if (!file_exists($tmpdir)) {
- if (!mkdir($tmpdir)) {
- throw new Zend_Mail_Storage_Exception('problems creating tmp dir');
- }
- }
-
- // we should retry to create a unique id if a file with the same name exists
- // to avoid a script timeout we only wait 1 second (instead of 2) and stop
- // after a defined retry count
- // if you change this variable take into account that it can take up to $max_tries seconds
- // normally we should have a valid unique name after the first try, we're just following the "standard" here
- $max_tries = 5;
- for ($i = 0; $i < $max_tries; ++$i) {
- $uniq = $this->_createUniqueId();
- if (!file_exists($tmpdir . $uniq)) {
- // here is the race condition! - as defined in the standard
- // to avoid having a long time between stat()ing the file and creating it we're opening it here
- // to mark the filename as taken
- $fh = fopen($tmpdir . $uniq, 'w');
- if (!$fh) {
- throw new Zend_Mail_Storage_Exception('could not open temp file');
- }
- break;
- }
- sleep(1);
- }
-
- if (!$fh) {
- throw new Zend_Mail_Storage_Exception("tried $max_tries unique ids for a temp file, but all were taken"
- . ' - giving up');
- }
-
- return array('dirname' => $this->_rootdir . '.' . $folder, 'uniq' => $uniq, 'filename' => $tmpdir . $uniq,
- 'handle' => $fh);
- }
-
- /**
- * create an info string for filenames with given flags
- *
- * @param array $flags wanted flags, with the reference you'll get the set flags with correct key (= char for flag)
- * @return string info string for version 2 filenames including the leading colon
- */
- protected function _getInfoString(&$flags)
- {
- // accessing keys is easier, faster and it removes duplicated flags
- $wanted_flags = array_flip($flags);
- if (isset($wanted_flags[Zend_Mail_Storage::FLAG_RECENT])) {
- throw new Zend_Mail_Storage_Exception('recent flag may not be set');
- }
-
- $info = ':2,';
- $flags = array();
- foreach (Zend_Mail_Storage_Maildir::$_knownFlags as $char => $flag) {
- if (!isset($wanted_flags[$flag])) {
- continue;
- }
- $info .= $char;
- $flags[$char] = $flag;
- unset($wanted_flags[$flag]);
- }
-
- if (!empty($wanted_flags)) {
- $wanted_flags = implode(', ', array_keys($wanted_flags));
- throw new Zend_Mail_Storage_Exception('unknown flag(s): ' . $wanted_flags);
- }
-
- return $info;
- }
-
- /**
- * append a new message to mail storage
- *
- * @param string $message message as string or instance of message class
- * @param null|string|Zend_Mail_Storage_Folder $folder folder for new message, else current folder is taken
- * @param null|array $flags set flags for new message, else a default set is used
- * @throw Zend_Mail_Storage_Exception
- */
- // not yet * @param string|Zend_Mail_Message|Zend_Mime_Message $message message as string or instance of message class
-
- public function appendMessage($message, $folder = null, $flags = null)
- {
- if ($folder === null) {
- $folder = $this->_currentFolder;
- }
-
- if (!($folder instanceof Zend_Mail_Storage_Folder)) {
- $folder = $this->getFolders($folder);
- }
-
- if ($flags === null) {
- $flags = array(Zend_Mail_Storage::FLAG_SEEN);
- }
- $info = $this->_getInfoString($flags);
- $temp_file = $this->_createTmpFile($folder->getGlobalName());
-
- // TODO: handle class instances for $message
- fputs($temp_file['handle'], $message);
- fclose($temp_file['handle']);
-
- // we're adding the size to the filename for maildir++
- $size = filesize($temp_file['filename']);
- if ($size) {
- $info = ',S=' . $size . $info;
- }
- $new_filename = $temp_file['dirname'] . '/cur/' . $temp_file['uniq'] . $info;
-
- // we're throwing any exception after removing our temp file and saving it to this variable instead
- $exception = null;
-
- if (!link($temp_file['filename'], $new_filename)) {
- $exception = new Zend_Mail_Storage_Exception('cannot link message file to final dir');
- }
- @unlink($temp_file['filename']);
-
- if ($exception) {
- throw $exception;
- }
-
- $this->_files[] = array('uniq' => $temp_file['uniq'],
- 'flags' => $flags,
- 'filename' => $new_filename);
- }
-
- /**
- * copy an existing message
- *
- * @param int $id number of message
- * @param string|Zend_Mail_Storage_Folder $folder name or instance of targer folder
- * @return null
- * @throw Zend_Mail_Storage_Exception
- */
- public function copyMessage($id, $folder)
- {
- if (!($folder instanceof Zend_Mail_Storage_Folder)) {
- $folder = $this->getFolders($folder);
- }
-
- $filedata = $this->_getFileData($id);
- $old_file = $filedata['filename'];
- $flags = $filedata['flags'];
-
- // copied message can't be recent
- while (($key = array_search(Zend_Mail_Storage::FLAG_RECENT, $flags)) !== false) {
- unset($flags[$key]);
- }
- $info = $this->_getInfoString($flags);
-
- // we're creating the copy as temp file before moving to cur/
- $temp_file = $this->_createTmpFile($folder->getGlobalName());
- // we don't write directly to the file
- fclose($temp_file['handle']);
-
- // we're adding the size to the filename for maildir++
- // TODO: maybe we should support maildirsize or we just let the MDA do the work
- $size = filesize($old_file);
- if ($size) {
- $info = ',S=' . $size . $info;
- }
- $new_file = $temp_file['dirname'] . '/cur/' . $temp_file['uniq'] . $info;
-
- // we're throwing any exception after removing our temp file and saving it to this variable instead
- $exception = null;
-
- if (!copy($old_file, $temp_file['filename'])) {
- $exception = new Zend_Mail_Storage_Exception('cannot copy message file');
- } else if (!link($temp_file['filename'], $new_file)) {
- $exception = new Zend_Mail_Storage_Exception('cannot link message file to final dir');
- }
- @unlink($temp_file['filename']);
-
- if ($exception) {
- throw $exception;
- }
-
- if ($folder->getGlobalName() == $this->_currentFolder
- || ($this->_currentFolder == 'INBOX' && $folder->getGlobalName() == '/')) {
- $this->_files[] = array('uniq' => $temp_file['uniq'],
- 'flags' => $flags,
- 'filename' => $new_file);
- }
- }
-
- /**
- * set flags for message
- *
- * NOTE: this method can't set the recent flag.
- *
- * @param int $id number of message
- * @param array $flags new flags for message
- * @throw Zend_Mail_Storage_Exception
- */
- public function setFlags($id, $flags)
- {
- $info = $this->_getInfoString($flags);
- $filedata = $this->_getFileData($id);
-
- // TODO: move file from new to cur
- $new_filename = dirname($filedata['filename']) . "/$filedata[uniq]$info";
-
- if (!@rename($filedata['filename'], $new_filename)) {
- throw new Zend_Mail_Storage_Exception('cannot rename file');
- }
-
- $filedata['flags'] = $flags;
- $filedata['filename'] = $new_filename;
-
- $this->_files[$id - 1] = $filedata;
- }
-
-
- /**
- * stub for not supported message deletion
- *
- * @return null
- * @throws Zend_Mail_Storage_Exception
- */
- public function removeMessage($id)
- {
- $filename = $this->_getFileData($id, 'filename');
- if (!@unlink($filename)) {
- throw new Zend_Mail_Storage_Exception('cannot remove message');
- }
- unset($this->_files[$id - 1]);
- // remove the gap
- $this->_files = array_values($this->_files);
- }
-}
diff --git a/libs/Zend/Mail/TODO.txt b/libs/Zend/Mail/TODO.txt
deleted file mode 100755
index 0f6d39dff2..0000000000
--- a/libs/Zend/Mail/TODO.txt
+++ /dev/null
@@ -1 +0,0 @@
-./. \ No newline at end of file
diff --git a/libs/Zend/Mail/Transport/Abstract.php b/libs/Zend/Mail/Transport/Abstract.php
deleted file mode 100755
index d41d9fc48c..0000000000
--- a/libs/Zend/Mail/Transport/Abstract.php
+++ /dev/null
@@ -1,335 +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_Mail
- * @subpackage Transport
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_Mail_Transport_Exception
- */
-require_once 'Zend/Mail/Transport/Exception.php';
-
-/**
- * Zend_Mime
- */
-require_once 'Zend/Mime.php';
-
-/**
- * Abstract for sending eMails through different
- * ways of transport
- *
- * @category Zend
- * @package Zend_Mail
- * @subpackage Transport
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-abstract class Zend_Mail_Transport_Abstract {
- /**
- * Mail body
- * @var string
- * @access public
- */
- public $body = '';
-
- /**
- * MIME boundary
- * @var string
- * @access public
- */
- public $boundary = '';
-
- /**
- * Mail header string
- * @var string
- * @access public
- */
- public $header = '';
-
- /**
- * Array of message headers
- * @var array
- * @access protected
- */
- protected $_headers = array();
-
- /**
- * Message is a multipart message
- * @var boolean
- * @access protected
- */
- protected $_isMultipart = false;
-
- /**
- * Zend_Mail object
- * @var false|Zend_Mail
- * @access protected
- */
- protected $_mail = false;
-
- /**
- * Array of message parts
- * @var array
- * @access protected
- */
- protected $_parts = array();
-
- /**
- * Recipients string
- * @var string
- * @access public
- */
- public $recipients = '';
-
- /**
- * EOL character string used by transport
- * @var string
- * @access public
- */
- public $EOL = "\r\n";
-
- /**
- * Send an email independent from the used transport
- *
- * The requisite information for the email will be found in the following
- * properties:
- *
- * - {@link $recipients} - list of recipients (string)
- * - {@link $header} - message header
- * - {@link $body} - message body
- */
- abstract protected function _sendMail();
-
- /**
- * Return all mail headers as an array
- *
- * If a boundary is given, a multipart header is generated with a
- * Content-Type of either multipart/alternative or multipart/mixed depending
- * on the mail parts present in the {@link $_mail Zend_Mail object} present.
- *
- * @param string $boundary
- * @return array
- */
- protected function _getHeaders($boundary)
- {
- if (null !== $boundary) {
- // Build multipart mail
- $type = $this->_mail->getType();
- if (!$type) {
- if ($this->_mail->hasAttachments) {
- $type = Zend_Mime::MULTIPART_MIXED;
- } elseif ($this->_mail->getBodyText() && $this->_mail->getBodyHtml()) {
- $type = Zend_Mime::MULTIPART_ALTERNATIVE;
- } else {
- $type = Zend_Mime::MULTIPART_MIXED;
- }
- }
-
- $this->_headers['Content-Type'] = array(
- $type . '; charset="' . $this->_mail->getCharset() . '";'
- . $this->EOL
- . " " . 'boundary="' . $boundary . '"'
- );
- $this->_headers['MIME-Version'] = array('1.0');
-
- $this->boundary = $boundary;
- }
-
- return $this->_headers;
- }
-
- /**
- * Prepend header name to header value
- *
- * @param string $item
- * @param string $key
- * @param string $prefix
- * @static
- * @access protected
- * @return void
- */
- protected static function _formatHeader(&$item, $key, $prefix)
- {
- $item = $prefix . ': ' . $item;
- }
-
- /**
- * Prepare header string for use in transport
- *
- * Prepares and generates {@link $header} based on the headers provided.
- *
- * @param mixed $headers
- * @access protected
- * @return void
- * @throws Zend_Mail_Transport_Exception if any header lines exceed 998
- * characters
- */
- protected function _prepareHeaders($headers)
- {
- if (!$this->_mail) {
- throw new Zend_Mail_Transport_Exception('Missing Zend_Mail object in _mail property');
- }
-
- $this->header = '';
-
- foreach ($headers as $header => $content) {
- if (isset($content['append'])) {
- unset($content['append']);
- $value = implode(',' . $this->EOL . ' ', $content);
- $this->header .= $header . ': ' . $value . $this->EOL;
- } else {
- array_walk($content, array(get_class($this), '_formatHeader'), $header);
- $this->header .= implode($this->EOL, $content) . $this->EOL;
- }
- }
-
- // Sanity check on headers -- should not be > 998 characters
- $sane = true;
- foreach (explode($this->EOL, $this->header) as $line) {
- if (strlen(trim($line)) > 998) {
- $sane = false;
- break;
- }
- }
- if (!$sane) {
- throw new Zend_Mail_Exception('At least one mail header line is too long');
- }
- }
-
- /**
- * Generate MIME compliant message from the current configuration
- *
- * If both a text and HTML body are present, generates a
- * multipart/alternative Zend_Mime_Part containing the headers and contents
- * of each. Otherwise, uses whichever of the text or HTML parts present.
- *
- * The content part is then prepended to the list of Zend_Mime_Parts for
- * this message.
- *
- * @return void
- */
- protected function _buildBody()
- {
- if (($text = $this->_mail->getBodyText())
- && ($html = $this->_mail->getBodyHtml()))
- {
- // Generate unique boundary for multipart/alternative
- $mime = new Zend_Mime(null);
- $boundaryLine = $mime->boundaryLine($this->EOL);
- $boundaryEnd = $mime->mimeEnd($this->EOL);
-
- $text->disposition = false;
- $html->disposition = false;
-
- $body = $boundaryLine
- . $text->getHeaders($this->EOL)
- . $this->EOL
- . $text->getContent()
- . $this->EOL
- . $boundaryLine
- . $html->getHeaders($this->EOL)
- . $this->EOL
- . $html->getContent()
- . $this->EOL
- . $boundaryEnd;
-
- $mp = new Zend_Mime_Part($body);
- $mp->type = Zend_Mime::MULTIPART_ALTERNATIVE;
- $mp->boundary = $mime->boundary();
-
- $this->_isMultipart = true;
-
- // Ensure first part contains text alternatives
- array_unshift($this->_parts, $mp);
-
- // Get headers
- $this->_headers = $this->_mail->getHeaders();
- return;
- }
-
- // If not multipart, then get the body
- if (false !== ($body = $this->_mail->getBodyHtml())) {
- array_unshift($this->_parts, $body);
- } elseif (false !== ($body = $this->_mail->getBodyText())) {
- array_unshift($this->_parts, $body);
- }
-
- if (!$body) {
- throw new Zend_Mail_Transport_Exception('No body specified');
- }
-
- // Get headers
- $this->_headers = $this->_mail->getHeaders();
- $headers = $body->getHeadersArray($this->EOL);
- foreach ($headers as $header) {
- // Headers in Zend_Mime_Part are kept as arrays with two elements, a
- // key and a value
- $this->_headers[$header[0]] = array($header[1]);
- }
- }
-
- /**
- * Send a mail using this transport
- *
- * @param Zend_Mail $mail
- * @access public
- * @return void
- * @throws Zend_Mail_Transport_Exception if mail is empty
- */
- public function send(Zend_Mail $mail)
- {
- $this->_isMultipart = false;
- $this->_mail = $mail;
- $this->_parts = $mail->getParts();
- $mime = $mail->getMime();
-
- // Build body content
- $this->_buildBody();
-
- // Determine number of parts and boundary
- $count = count($this->_parts);
- $boundary = null;
- if ($count < 1) {
- throw new Zend_Mail_Transport_Exception('Empty mail cannot be sent');
- }
-
- if ($count > 1) {
- // Multipart message; create new MIME object and boundary
- $mime = new Zend_Mime($this->_mail->getMimeBoundary());
- $boundary = $mime->boundary();
- } elseif ($this->_isMultipart) {
- // multipart/alternative -- grab boundary
- $boundary = $this->_parts[0]->boundary;
- }
-
- // Determine recipients, and prepare headers
- $this->recipients = implode(',', $mail->getRecipients());
- $this->_prepareHeaders($this->_getHeaders($boundary));
-
- // Create message body
- // This is done so that the same Zend_Mail object can be used in
- // multiple transports
- $message = new Zend_Mime_Message();
- $message->setParts($this->_parts);
- $message->setMime($mime);
- $this->body = $message->generateMessage($this->EOL);
-
- // Send to transport!
- $this->_sendMail();
- }
-}
diff --git a/libs/Zend/Mail/Transport/Exception.php b/libs/Zend/Mail/Transport/Exception.php
deleted file mode 100755
index abb0eaa1cd..0000000000
--- a/libs/Zend/Mail/Transport/Exception.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_Mail
- * @subpackage Transport
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-
-/**
- * Zend_Mail_Exception
- */
-require_once 'Zend/Mail/Exception.php';
-
-
-/**
- * @category Zend
- * @package Zend_Mail
- * @subpackage Transport
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mail_Transport_Exception extends Zend_Mail_Exception
-{}
-
diff --git a/libs/Zend/Mail/Transport/Sendmail.php b/libs/Zend/Mail/Transport/Sendmail.php
deleted file mode 100755
index f4510f4eca..0000000000
--- a/libs/Zend/Mail/Transport/Sendmail.php
+++ /dev/null
@@ -1,153 +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_Mail
- * @subpackage Transport
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_Mail_Transport_Abstract
- */
-require_once 'Zend/Mail/Transport/Abstract.php';
-
-
-/**
- * Class for sending eMails via the PHP internal mail() function
- *
- * @category Zend
- * @package Zend_Mail
- * @subpackage Transport
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mail_Transport_Sendmail extends Zend_Mail_Transport_Abstract
-{
- /**
- * Subject
- * @var string
- * @access public
- */
- public $subject = null;
-
-
- /**
- * Config options for sendmail parameters
- *
- * @var string
- */
- public $parameters;
-
-
- /**
- * EOL character string
- * @var string
- * @access public
- */
- public $EOL = PHP_EOL;
-
-
- /**
- * Constructor.
- *
- * @param string $parameters OPTIONAL (Default: null)
- * @return void
- */
- public function __construct($parameters = null)
- {
- $this->parameters = $parameters;
- }
-
-
- /**
- * Send mail using PHP native mail()
- *
- * @access public
- * @return void
- * @throws Zend_Mail_Transport_Exception on mail() failure
- */
- public function _sendMail()
- {
- if ($this->parameters === null) {
- $result = mail(
- $this->recipients,
- $this->_mail->getSubject(),
- $this->body,
- $this->header);
- } else {
- $result = mail(
- $this->recipients,
- $this->_mail->getSubject(),
- $this->body,
- $this->header,
- $this->parameters);
- }
- if (!$result)
- {
- throw new Zend_Mail_Transport_Exception('Unable to send mail');
- }
- }
-
-
- /**
- * Format and fix headers
- *
- * mail() uses its $to and $subject arguments to set the To: and Subject:
- * headers, respectively. This method strips those out as a sanity check to
- * prevent duplicate header entries.
- *
- * @access protected
- * @param array $headers
- * @return void
- */
- protected function _prepareHeaders($headers)
- {
- if (!$this->_mail) {
- throw new Zend_Mail_Transport_Exception('_prepareHeaders requires a registered Zend_Mail object');
- }
-
- // mail() uses its $to parameter to set the To: header, and the $subject
- // parameter to set the Subject: header. We need to strip them out.
- if (0 === strpos(PHP_OS, 'WIN')) {
- // If the current recipients list is empty, throw an error
- if (empty($this->recipients)) {
- throw new Zend_Mail_Transport_Exception('Missing To addresses');
- }
- } else {
- // All others, simply grab the recipients and unset the To: header
- if (!isset($headers['To'])) {
- throw new Zend_Mail_Transport_Exception('Missing To header');
- }
-
- unset($headers['To']['append']);
- $this->recipients = implode(',', $headers['To']);
- }
-
- // Remove recipient header
- unset($headers['To']);
-
- // Remove subject header, if present
- if (isset($headers['Subject'])) {
- unset($headers['Subject']);
- }
-
- // Prepare headers
- parent::_prepareHeaders($headers);
- }
-
-}
-
diff --git a/libs/Zend/Mail/Transport/Smtp.php b/libs/Zend/Mail/Transport/Smtp.php
deleted file mode 100755
index 7e7e2c31a6..0000000000
--- a/libs/Zend/Mail/Transport/Smtp.php
+++ /dev/null
@@ -1,202 +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_Mail
- * @subpackage Transport
- * @version $Id$
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-
-/**
- * Zend_Mail_Protocol_Smtp
- */
-require_once 'Zend/Mail/Protocol/Smtp.php';
-
-
-/**
- * Zend_Mail_Transport_Abstract
- */
-require_once 'Zend/Mail/Transport/Abstract.php';
-
-
-/**
- * SMTP connection object
- *
- * Loads an instance of Zend_Mail_Protocol_Smtp and forwards smtp transactions
- *
- * @category Zend
- * @package Zend_Mail
- * @subpackage Transport
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract
-{
- /**
- * Remote smtp hostname or i.p.
- *
- * @var string
- */
- protected $_host;
-
-
- /**
- * Port number
- *
- * @var integer|null
- */
- protected $_port;
-
-
- /**
- * Local client hostname or i.p.
- *
- * @var string
- */
- protected $_name = 'localhost';
-
-
- /**
- * Authentication type OPTIONAL
- *
- * @var string
- */
- protected $_auth;
-
-
- /**
- * Config options for authentication
- *
- * @var array
- */
- protected $_config;
-
-
- /**
- * Instance of Zend_Mail_Protocol_Smtp
- *
- * @var Zend_Mail_Protocol_Smtp
- */
- protected $_connection;
-
-
- /**
- * Constructor.
- *
- * @param string $host OPTIONAL (Default: 127.0.0.1)
- * @param array|null $config OPTIONAL (Default: null)
- * @return void
- */
- public function __construct($host = '127.0.0.1', Array $config = array())
- {
- if (isset($config['name'])) {
- $this->_name = $config['name'];
- }
- if (isset($config['port'])) {
- $this->_port = $config['port'];
- }
- if (isset($config['auth'])) {
- $this->_auth = $config['auth'];
- }
-
- $this->_host = $host;
- $this->_config = $config;
- }
-
-
- /**
- * Class destructor to ensure all open connections are closed
- *
- * @return void
- */
- public function __destruct()
- {
- if ($this->_connection instanceof Zend_Mail_Protocol_Smtp) {
- $this->_connection->quit();
- $this->_connection->disconnect();
- }
- }
-
-
- /**
- * Sets the connection protocol instance
- *
- * @param Zend_Mail_Protocol_Abstract $client
- *
- * @return void
- */
- public function setConnection(Zend_Mail_Protocol_Abstract $connection)
- {
- $this->_connection = $connection;
- }
-
-
- /**
- * Gets the connection protocol instance
- *
- * @return Zend_Mail_Protocol|null
- */
- public function getConnection()
- {
- return $this->_connection;
- }
-
- /**
- * Send an email via the SMTP connection protocol
- *
- * The connection via the protocol adapter is made just-in-time to allow a
- * developer to add a custom adapter if required before mail is sent.
- *
- * @return void
- */
- public function _sendMail()
- {
- // If sending multiple messages per session use existing adapter
- if (!($this->_connection instanceof Zend_Mail_Protocol_Smtp)) {
- // Check if authentication is required and determine required class
- $connectionClass = 'Zend_Mail_Protocol_Smtp';
- if ($this->_auth) {
- $connectionClass .= '_Auth_' . ucwords($this->_auth);
- }
- Zend_Loader::loadClass($connectionClass);
- $this->setConnection(new $connectionClass($this->_host, $this->_port, $this->_config));
- $this->_connection->connect();
- $this->_connection->helo($this->_name);
- } else {
- // Reset connection to ensure reliable transaction
- $this->_connection->rset();
- }
-
- // Set mail return path from sender email address
- $this->_connection->mail($this->_mail->getReturnPath());
-
- // Set recipient forward paths
- foreach ($this->_mail->getRecipients() as $recipient) {
- $this->_connection->rcpt($recipient);
- }
-
- // Issue DATA command to client
- $this->_connection->data($this->header . $this->EOL . $this->body);
- }
-
-}
diff --git a/libs/Zend/Mime.php b/libs/Zend/Mime.php
deleted file mode 100755
index e6640ad4fe..0000000000
--- a/libs/Zend/Mime.php
+++ /dev/null
@@ -1,251 +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_Mime
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Support class for MultiPart Mime Messages
- *
- * @category Zend
- * @package Zend_Mime
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mime
-{
- const TYPE_OCTETSTREAM = 'application/octet-stream';
- const TYPE_TEXT = 'text/plain';
- const TYPE_HTML = 'text/html';
- const ENCODING_7BIT = '7bit';
- const ENCODING_8BIT = '8bit';
- const ENCODING_QUOTEDPRINTABLE = 'quoted-printable';
- const ENCODING_BASE64 = 'base64';
- const DISPOSITION_ATTACHMENT = 'attachment';
- const DISPOSITION_INLINE = 'inline';
- const LINELENGTH = 74;
- const LINEEND = "\n";
- const MULTIPART_ALTERNATIVE = 'multipart/alternative';
- const MULTIPART_MIXED = 'multipart/mixed';
- const MULTIPART_RELATED = 'multipart/related';
-
- protected $_boundary;
- protected static $makeUnique = 0;
-
- // lookup-Tables for QuotedPrintable
- public static $qpKeys = array(
- "\x00","\x01","\x02","\x03","\x04","\x05","\x06","\x07",
- "\x08","\x09","\x0A","\x0B","\x0C","\x0D","\x0E","\x0F",
- "\x10","\x11","\x12","\x13","\x14","\x15","\x16","\x17",
- "\x18","\x19","\x1A","\x1B","\x1C","\x1D","\x1E","\x1F",
- "\x7F","\x80","\x81","\x82","\x83","\x84","\x85","\x86",
- "\x87","\x88","\x89","\x8A","\x8B","\x8C","\x8D","\x8E",
- "\x8F","\x90","\x91","\x92","\x93","\x94","\x95","\x96",
- "\x97","\x98","\x99","\x9A","\x9B","\x9C","\x9D","\x9E",
- "\x9F","\xA0","\xA1","\xA2","\xA3","\xA4","\xA5","\xA6",
- "\xA7","\xA8","\xA9","\xAA","\xAB","\xAC","\xAD","\xAE",
- "\xAF","\xB0","\xB1","\xB2","\xB3","\xB4","\xB5","\xB6",
- "\xB7","\xB8","\xB9","\xBA","\xBB","\xBC","\xBD","\xBE",
- "\xBF","\xC0","\xC1","\xC2","\xC3","\xC4","\xC5","\xC6",
- "\xC7","\xC8","\xC9","\xCA","\xCB","\xCC","\xCD","\xCE",
- "\xCF","\xD0","\xD1","\xD2","\xD3","\xD4","\xD5","\xD6",
- "\xD7","\xD8","\xD9","\xDA","\xDB","\xDC","\xDD","\xDE",
- "\xDF","\xE0","\xE1","\xE2","\xE3","\xE4","\xE5","\xE6",
- "\xE7","\xE8","\xE9","\xEA","\xEB","\xEC","\xED","\xEE",
- "\xEF","\xF0","\xF1","\xF2","\xF3","\xF4","\xF5","\xF6",
- "\xF7","\xF8","\xF9","\xFA","\xFB","\xFC","\xFD","\xFE",
- "\xFF"
- );
-
- public static $qpReplaceValues = array(
- "=00","=01","=02","=03","=04","=05","=06","=07",
- "=08","=09","=0A","=0B","=0C","=0D","=0E","=0F",
- "=10","=11","=12","=13","=14","=15","=16","=17",
- "=18","=19","=1A","=1B","=1C","=1D","=1E","=1F",
- "=7F","=80","=81","=82","=83","=84","=85","=86",
- "=87","=88","=89","=8A","=8B","=8C","=8D","=8E",
- "=8F","=90","=91","=92","=93","=94","=95","=96",
- "=97","=98","=99","=9A","=9B","=9C","=9D","=9E",
- "=9F","=A0","=A1","=A2","=A3","=A4","=A5","=A6",
- "=A7","=A8","=A9","=AA","=AB","=AC","=AD","=AE",
- "=AF","=B0","=B1","=B2","=B3","=B4","=B5","=B6",
- "=B7","=B8","=B9","=BA","=BB","=BC","=BD","=BE",
- "=BF","=C0","=C1","=C2","=C3","=C4","=C5","=C6",
- "=C7","=C8","=C9","=CA","=CB","=CC","=CD","=CE",
- "=CF","=D0","=D1","=D2","=D3","=D4","=D5","=D6",
- "=D7","=D8","=D9","=DA","=DB","=DC","=DD","=DE",
- "=DF","=E0","=E1","=E2","=E3","=E4","=E5","=E6",
- "=E7","=E8","=E9","=EA","=EB","=EC","=ED","=EE",
- "=EF","=F0","=F1","=F2","=F3","=F4","=F5","=F6",
- "=F7","=F8","=F9","=FA","=FB","=FC","=FD","=FE",
- "=FF"
- );
-
- public static $qpKeysString =
- "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x7F\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF";
-
- /**
- * Check if the given string is "printable"
- *
- * Checks that a string contains no unprintable characters. If this returns
- * false, encode the string for secure delivery.
- *
- * @param string $str
- * @return boolean
- */
- public static function isPrintable($str)
- {
- return (strcspn($str, self::$qpKeysString) == strlen($str));
- }
-
- /**
- * Encode a given string with the QUOTED_PRINTABLE mechanism
- *
- * @param string $str
- * @param int $lineLength Defaults to {@link LINELENGTH}
- * @param int $lineEnd Defaults to {@link LINEEND}
- * @return string
- */
- public static function encodeQuotedPrintable($str,
- $lineLength = self::LINELENGTH,
- $lineEnd = self::LINEEND)
- {
- $out = '';
- $str = str_replace('=', '=3D', $str);
- $str = str_replace(self::$qpKeys, self::$qpReplaceValues, $str);
- $str = rtrim($str);
-
- // Split encoded text into separate lines
- while ($str) {
- $ptr = strlen($str);
- if ($ptr > $lineLength) {
- $ptr = $lineLength;
- }
-
- // Ensure we are not splitting across an encoded character
- $pos = strrpos(substr($str, 0, $ptr), '=');
- if ($pos !== false && $pos >= $ptr - 2) {
- $ptr = $pos;
- }
-
- // Check if there is a space at the end of the line and rewind
- if ($ptr > 0 && $str[$ptr - 1] == ' ') {
- --$ptr;
- }
-
- // Add string and continue
- $out .= substr($str, 0, $ptr) . '=' . $lineEnd;
- $str = substr($str, $ptr);
- }
-
- $out = rtrim($out, $lineEnd);
- $out = rtrim($out, '=');
- return $out;
- }
-
- /**
- * Encode a given string in base64 encoding and break lines
- * according to the maximum linelength.
- *
- * @param string $str
- * @param int $lineLength Defaults to {@link LINELENGTH}
- * @param int $lineEnd Defaults to {@link LINEEND}
- * @return string
- */
- public static function encodeBase64($str,
- $lineLength = self::LINELENGTH,
- $lineEnd = self::LINEEND)
- {
- return rtrim(chunk_split(base64_encode($str), $lineLength, $lineEnd));
- }
-
- /**
- * Constructor
- *
- * @param null|string $boundary
- * @access public
- * @return void
- */
- public function __construct($boundary = null)
- {
- // This string needs to be somewhat unique
- if ($boundary === null) {
- $this->_boundary = '=_' . md5(microtime(1) . self::$makeUnique++);
- } else {
- $this->_boundary = $boundary;
- }
- }
-
- /**
- * Encode the given string with the given encoding.
- *
- * @param string $str
- * @param string $encoding
- * @return string
- */
- public static function encode($str, $encoding)
- {
- switch ($encoding) {
- case self::ENCODING_BASE64:
- return self::encodeBase64($str);
-
- case self::ENCODING_QUOTEDPRINTABLE:
- return self::encodeQuotedPrintable($str);
-
- default:
- /**
- * @todo 7Bit and 8Bit is currently handled the same way.
- */
- return $str;
- }
- }
-
- /**
- * Return a MIME boundary
- *
- * @access public
- * @return string
- */
- public function boundary()
- {
- return $this->_boundary;
- }
-
- /**
- * Return a MIME boundary line
- *
- * @param mixed $EOL Defaults to {@link LINEEND}
- * @access public
- * @return string
- */
- public function boundaryLine($EOL = self::LINEEND)
- {
- return $EOL . '--' . $this->_boundary . $EOL;
- }
-
- /**
- * Return MIME ending
- *
- * @access public
- * @return string
- */
- public function mimeEnd($EOL = self::LINEEND)
- {
- return $EOL . '--' . $this->_boundary . '--' . $EOL;
- }
-}
diff --git a/libs/Zend/Mime/Decode.php b/libs/Zend/Mime/Decode.php
deleted file mode 100755
index 3198ce27a2..0000000000
--- a/libs/Zend/Mime/Decode.php
+++ /dev/null
@@ -1,228 +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_Mime
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_Mime
- */
-require_once 'Zend/Mime.php';
-
-/**
- * @category Zend
- * @package Zend_Mime
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mime_Decode
-{
- /**
- * Explode MIME multipart string into seperate parts
- *
- * Parts consist of the header and the body of each MIME part.
- *
- * @param string $body raw body of message
- * @param string $boundary boundary as found in content-type
- * @return array parts with content of each part, empty if no parts found
- * @throws Zend_Exception
- */
- public static function splitMime($body, $boundary)
- {
- // TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r?
- $body = str_replace("\r", '', $body);
-
- $start = 0;
- $res = array();
- // find every mime part limiter and cut out the
- // string before it.
- // the part before the first boundary string is discarded:
- $p = strpos($body, '--' . $boundary . "\n", $start);
- if ($p === false) {
- // no parts found!
- return array();
- }
-
- // position after first boundary line
- $start = $p + 3 + strlen($boundary);
-
- while (($p = strpos($body, '--' . $boundary . "\n", $start)) !== false) {
- $res[] = substr($body, $start, $p-$start);
- $start = $p + 3 + strlen($boundary);
- }
-
- // no more parts, find end boundary
- $p = strpos($body, '--' . $boundary . '--', $start);
- if ($p===false) {
- throw new Zend_Exception('Not a valid Mime Message: End Missing');
- }
-
- // the remaining part also needs to be parsed:
- $res[] = substr($body, $start, $p-$start);
- return $res;
- }
-
- /**
- * decodes a mime encoded String and returns a
- * struct of parts with header and body
- *
- * @param string $message raw message content
- * @param string $boundary boundary as found in content-type
- * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
- * @return array|null parts as array('header' => array(name => value), 'body' => content), null if no parts found
- * @throws Zend_Exception
- */
- public static function splitMessageStruct($message, $boundary, $EOL = Zend_Mime::LINEEND)
- {
- $parts = self::splitMime($message, $boundary);
- if (count($parts) <= 0) {
- return null;
- }
- $result = array();
- foreach ($parts as $part) {
- self::splitMessage($part, $headers, $body, $EOL);
- $result[] = array('header' => $headers,
- 'body' => $body );
- }
- return $result;
- }
-
- /**
- * split a message in header and body part, if no header or an
- * invalid header is found $headers is empty
- *
- * The charset of the returned headers depend on your iconv settings.
- *
- * @param string $message raw message with header and optional content
- * @param array $headers output param, array with headers as array(name => value)
- * @param string $body output param, content of message
- * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
- * @return null
- */
- public static function splitMessage($message, &$headers, &$body, $EOL = Zend_Mime::LINEEND)
- {
- // check for valid header at first line
- $firstline = strtok($message, "\n");
- if (!preg_match('%^[^\s]+[^:]*:%', $firstline)) {
- $headers = array();
- // TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r?
- $body = str_replace(array("\r", "\n"), array('', $EOL), $message);
- return;
- }
-
- // find an empty line between headers and body
- // default is set new line
- if (strpos($message, $EOL . $EOL)) {
- list($headers, $body) = explode($EOL . $EOL, $message, 2);
- // next is the standard new line
- } else if ($EOL != "\r\n" && strpos($message, "\r\n\r\n")) {
- list($headers, $body) = explode("\r\n\r\n", $message, 2);
- // next is the other "standard" new line
- } else if ($EOL != "\n" && strpos($message, "\n\n")) {
- list($headers, $body) = explode("\n\n", $message, 2);
- // at last resort find anything that looks like a new line
- } else {
- @list($headers, $body) = @preg_split("%([\r\n]+)\\1%U", $message, 2);
- }
-
- $headers = iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
-
- // normalize header names
- foreach ($headers as $name => $header) {
- $lower = strtolower($name);
- if ($lower == $name) {
- continue;
- }
- unset($headers[$name]);
- if (!isset($headers[$lower])) {
- $headers[$lower] = $header;
- continue;
- }
- if (is_array($headers[$lower])) {
- $headers[$lower][] = $header;
- continue;
- }
- $headers[$lower] = array($headers[$lower], $header);
- }
- }
-
- /**
- * split a content type in its different parts
- *
- * @param string $type content-type
- * @param string $wantedPart the wanted part, else an array with all parts is returned
- * @return string|array wanted part or all parts as array('type' => content-type, partname => value)
- */
- public static function splitContentType($type, $wantedPart = null)
- {
- return self::splitHeaderField($type, $wantedPart, 'type');
- }
-
- /**
- * split a header field like content type in its different parts
- *
- * @param string $type header field
- * @param string $wantedPart the wanted part, else an array with all parts is returned
- * @param string $firstName key name for the first part
- * @return string|array wanted part or all parts as array($firstName => firstPart, partname => value)
- * @throws Zend_Exception
- */
- public static function splitHeaderField($field, $wantedPart = null, $firstName = 0)
- {
- $field = $firstName . '=' . $field;
- if (!preg_match_all('%([^=]+)=("[^"]+"|[^;]+)(;\s*|$)%', $field, $matches)) {
- throw new Zend_Exception('not a valid header field');
- }
-
- if ($wantedPart) {
- foreach ($matches[1] as $key => $name) {
- if ($name != $wantedPart) {
- continue;
- }
- if ($matches[2][$key][0] != '"') {
- return $matches[2][$key];
- }
- return substr($matches[2][$key], 1, -1);
- }
- return null;
- }
-
- $split = array();
- foreach ($matches[1] as $key => $name) {
- if ($matches[2][$key][0] == '"') {
- $split[$name] = substr($matches[2][$key], 1, -1);
- } else {
- $split[$name] = $matches[2][$key];
- }
- }
-
- return $split;
- }
-
- /**
- * decode a quoted printable encoded string
- *
- * The charset of the returned string depends on your iconv settings.
- *
- * @param string encoded string
- * @return string decoded string
- */
- public static function decodeQuotedPrintable($string)
- {
- return iconv_mime_decode($string, ICONV_MIME_DECODE_CONTINUE_ON_ERROR);
- }
-}
diff --git a/libs/Zend/Mime/Exception.php b/libs/Zend/Mime/Exception.php
deleted file mode 100755
index b2bce88f84..0000000000
--- a/libs/Zend/Mime/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_Mime
- * @copyright Copyright (c) 2005-2007 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_Mime
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mime_Exception extends Zend_Exception
-{}
-
diff --git a/libs/Zend/Mime/Message.php b/libs/Zend/Mime/Message.php
deleted file mode 100755
index 72f1a42de5..0000000000
--- a/libs/Zend/Mime/Message.php
+++ /dev/null
@@ -1,280 +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_Mime
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_Mime
- */
-require_once 'Zend/Mime.php';
-
-/**
- * Zend_Mime_Part
- */
-require_once 'Zend/Mime/Part.php';
-
-
-/**
- * @category Zend
- * @package Zend_Mime
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mime_Message
-{
-
- protected $_parts = array();
- protected $_mime = null;
-
- /**
- * Returns the list of all Zend_Mime_Parts in the message
- *
- * @return array of Zend_Mime_Part
- */
- public function getParts()
- {
- return $this->_parts;
- }
-
- /**
- * Sets the given array of Zend_Mime_Parts as the array for the message
- *
- * @param array $parts
- */
- public function setParts($parts)
- {
- $this->_parts = $parts;
- }
-
- /**
- * Append a new Zend_Mime_Part to the current message
- *
- * @param Zend_Mime_Part $part
- */
- public function addPart(Zend_Mime_Part $part)
- {
- /**
- * @todo check for duplicate object handle
- */
- $this->_parts[] = $part;
- }
-
- /**
- * Check if message needs to be sent as multipart
- * MIME message or if it has only one part.
- *
- * @return boolean
- */
- public function isMultiPart()
- {
- return (count($this->_parts) > 1);
- }
-
- /**
- * Set Zend_Mime object for the message
- *
- * This can be used to set the boundary specifically or to use a subclass of
- * Zend_Mime for generating the boundary.
- *
- * @param Zend_Mime $mime
- */
- public function setMime(Zend_Mime $mime)
- {
- $this->_mime = $mime;
- }
-
- /**
- * Returns the Zend_Mime object in use by the message
- *
- * If the object was not present, it is created and returned. Can be used to
- * determine the boundary used in this message.
- *
- * @return Zend_Mime
- */
- public function getMime()
- {
- if ($this->_mime === null) {
- $this->_mime = new Zend_Mime();
- }
-
- return $this->_mime;
- }
-
- /**
- * Generate MIME-compliant message from the current configuration
- *
- * This can be a multipart message if more than one MIME part was added. If
- * only one part is present, the content of this part is returned. If no
- * part had been added, an empty string is returned.
- *
- * Parts are seperated by the mime boundary as defined in Zend_Mime. If
- * {@link setMime()} has been called before this method, the Zend_Mime
- * object set by this call will be used. Otherwise, a new Zend_Mime object
- * is generated and used.
- *
- * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
- * @return string
- */
- public function generateMessage($EOL = Zend_Mime::LINEEND)
- {
- if (! $this->isMultiPart()) {
- $body = array_shift($this->_parts);
- $body = $body->getContent($EOL);
- } else {
- $mime = $this->getMime();
-
- $boundaryLine = $mime->boundaryLine($EOL);
- $body = 'This is a message in Mime Format. If you see this, '
- . "your mail reader does not support this format." . $EOL;
-
- foreach (array_keys($this->_parts) as $p) {
- $body .= $boundaryLine
- . $this->getPartHeaders($p, $EOL)
- . $EOL
- . $this->getPartContent($p);
- }
-
- $body .= $mime->mimeEnd($EOL);
- }
-
- return trim($body);
- }
-
- /**
- * Get the headers of a given part as an array
- *
- * @param int $partnum
- * @return array
- */
- public function getPartHeadersArray($partnum)
- {
- return $this->_parts[$partnum]->getHeadersArray();
- }
-
- /**
- * Get the headers of a given part as a string
- *
- * @param int $partnum
- * @return string
- */
- public function getPartHeaders($partnum, $EOL = Zend_Mime::LINEEND)
- {
- return $this->_parts[$partnum]->getHeaders($EOL);
- }
-
- /**
- * Get the (encoded) content of a given part as a string
- *
- * @param int $partnum
- * @return string
- */
- public function getPartContent($partnum)
- {
- return $this->_parts[$partnum]->getContent();
- }
-
- /**
- * Explode MIME multipart string into seperate parts
- *
- * Parts consist of the header and the body of each MIME part.
- *
- * @param string $body
- * @param string $boundary
- * @return array
- */
- protected static function _disassembleMime($body, $boundary)
- {
- $start = 0;
- $res = array();
- // find every mime part limiter and cut out the
- // string before it.
- // the part before the first boundary string is discarded:
- $p = strpos($body, '--'.$boundary."\n", $start);
- if ($p === false) {
- // no parts found!
- return array();
- }
-
- // position after first boundary line
- $start = $p + 3 + strlen($boundary);
-
- while (($p = strpos($body, '--' . $boundary . "\n", $start)) !== false) {
- $res[] = substr($body, $start, $p-$start);
- $start = $p + 3 + strlen($boundary);
- }
-
- // no more parts, find end boundary
- $p = strpos($body, '--' . $boundary . '--', $start);
- if ($p===false) {
- throw new Zend_Exception('Not a valid Mime Message: End Missing');
- }
-
- // the remaining part also needs to be parsed:
- $res[] = substr($body, $start, $p-$start);
- return $res;
- }
-
- /**
- * Decodes a MIME encoded string and returns a Zend_Mime_Message object with
- * all the MIME parts set according to the given string
- *
- * @param string $message
- * @param string $boundary
- * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
- * @return Zend_Mime_Message
- */
- public static function createFromMessage($message, $boundary, $EOL = Zend_Mime::LINEEND)
- {
- require_once 'Zend/Mime/Decode.php';
- $parts = Zend_Mime_Decode::splitMessageStruct($message, $boundary, $EOL);
-
- $res = new Zend_Mime_Message();
- foreach ($parts as $part) {
- // now we build a new MimePart for the current Message Part:
- $newPart = new Zend_Mime_Part($part);
- foreach ($part['header'] as $key => $value) {
- /**
- * @todo check for characterset and filename
- */
- // list($key, $value) = $header;
- switch($key) {
- case 'content-type':
- $newPart->type = $value;
- break;
- case 'content-transfer-encoding':
- $newPart->encoding = $value;
- break;
- case 'content-id':
- $newPart->id = trim($value,'<>');
- break;
- case 'Content-Disposition':
- $newPart->disposition = $value;
- break;
- case 'content-description':
- $newPart->description = $value;
- break;
- default:
- throw new Zend_Exception('Unknown header ignored for MimePart:' . $key);
- }
- }
- $res->addPart($newPart);
- }
- return $res;
- }
-}
diff --git a/libs/Zend/Mime/Part.php b/libs/Zend/Mime/Part.php
deleted file mode 100755
index fc3a2bff48..0000000000
--- a/libs/Zend/Mime/Part.php
+++ /dev/null
@@ -1,208 +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_Mime
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_Mime
- */
-require_once 'Zend/Mime.php';
-
-/**
- * Zend_Mime_Exception
- */
-require_once 'Zend/Mime/Exception.php';
-
-/**
- * Class representing a MIME part.
- *
- * @category Zend
- * @package Zend_Mime
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Mime_Part {
-
- public $type = Zend_Mime::TYPE_OCTETSTREAM;
- public $encoding = Zend_Mime::ENCODING_8BIT;
- public $id;
- public $disposition;
- public $filename;
- public $description;
- public $charset;
- public $boundary;
- protected $_content;
- protected $_isStream = false;
-
-
- /**
- * create a new Mime Part.
- * The (unencoded) content of the Part as passed
- * as a string or stream
- *
- * @param mixed $content String or Stream containing the content
- */
- public function __construct($content)
- {
- $this->_content = $content;
- if (is_resource($content)) {
- $this->_isStream = true;
- }
- }
-
- /**
- * @todo setters/getters
- * @todo error checking for setting $type
- * @todo error checking for setting $encoding
- */
-
- /**
- * check if this part can be read as a stream.
- * if true, getEncodedStream can be called, otherwise
- * only getContent can be used to fetch the encoded
- * content of the part
- *
- * @return bool
- */
- public function isStream()
- {
- return $this->_isStream;
- }
-
- /**
- * if this was created with a stream, return a filtered stream for
- * reading the content. very useful for large file attachments.
- *
- * @return stream
- * @throws Zend_Mime_Exception if not a stream or unable to append filter
- */
- public function getEncodedStream()
- {
- if (!$this->_isStream) {
- throw new Zend_Mime_Exception('Attempt to get a stream from a string part');
- }
-
- //stream_filter_remove(); // ??? is that right?
- switch ($this->encoding) {
- case Zend_Mime::ENCODING_QUOTEDPRINTABLE:
- $filter = stream_filter_append(
- $this->_content,
- 'convert.quoted-printable-encode',
- STREAM_FILTER_READ,
- array(
- 'line-length' => 76,
- 'line-break-chars' => Zend_Mime::LINEEND
- )
- );
- if (!is_resource($filter)) {
- throw new Zend_Mime_Exception('Failed to append quoted-printable filter');
- }
- break;
- case Zend_Mime::ENCODING_BASE64:
- $filter = stream_filter_append(
- $this->_content,
- 'convert.base64-encode',
- STREAM_FILTER_READ,
- array(
- 'line-length' => 76,
- 'line-break-chars' => Zend_Mime::LINEEND
- )
- );
- if (!is_resource($filter)) {
- throw new Zend_Mime_Exception('Failed to append base64 filter');
- }
- break;
- default:
- }
- return $this->_content;
- }
-
- /**
- * Get the Content of the current Mime Part in the given encoding.
- *
- * @return String
- */
- public function getContent($EOL = Zend_Mime::LINEEND)
- {
- if ($this->_isStream) {
- return stream_get_contents($this->getEncodedStream());
- } else {
- return Zend_Mime::encode($this->_content, $this->encoding, $EOL);
- }
- }
-
- /**
- * Create and return the array of headers for this MIME part
- *
- * @access public
- * @return array
- */
- public function getHeadersArray($EOL = Zend_Mime::LINEEND)
- {
- $headers = array();
-
- $contentType = $this->type;
- if ($this->charset) {
- $contentType .= '; charset="' . $this->charset . '"';
- }
-
- if ($this->boundary) {
- $contentType .= ';' . $EOL
- . " boundary=\"" . $this->boundary . '"';
- }
-
- $headers[] = array('Content-Type', $contentType);
-
- if ($this->encoding) {
- $headers[] = array('Content-Transfer-Encoding', $this->encoding);
- }
-
- if ($this->id) {
- $headers[] = array('Content-ID', '<' . $this->id . '>');
- }
-
- if ($this->disposition) {
- $disposition = $this->disposition;
- if ($this->filename) {
- $disposition .= '; filename="' . $this->filename . '"';
- }
- $headers[] = array('Content-Disposition', $disposition);
- }
-
- if ($this->description) {
- $headers[] = array('Content-Description', $this->description);
- }
-
- return $headers;
- }
-
- /**
- * Return the headers for this part as a string
- *
- * @return String
- */
- public function getHeaders($EOL = Zend_Mime::LINEEND)
- {
- $res = '';
- foreach ($this->getHeadersArray($EOL) as $header) {
- $res .= $header[0] . ': ' . $header[1] . $EOL;
- }
-
- return $res;
- }
-}
diff --git a/libs/Zend/Pdf.php b/libs/Zend/Pdf.php
deleted file mode 100755
index 8e54a62396..0000000000
--- a/libs/Zend/Pdf.php
+++ /dev/null
@@ -1,685 +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_Pdf
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/** Zend_Pdf_Exception */
-require_once 'Zend/Pdf/Exception.php';
-
-/** Zend_Pdf_Page */
-require_once 'Zend/Pdf/Page.php';
-
-/** Zend_Pdf_Cmap */
-require_once 'Zend/Pdf/Cmap.php';
-
-/** Zend_Pdf_Font */
-require_once 'Zend/Pdf/Font.php';
-
-/** Zend_Pdf_Style */
-require_once 'Zend/Pdf/Style.php';
-
-/** Zend_Pdf_Parser */
-require_once 'Zend/Pdf/Parser.php';
-
-/** Zend_Pdf_Trailer */
-require_once 'Zend/Pdf/Trailer.php';
-
-/** Zend_Pdf_Trailer_Generator */
-require_once 'Zend/Pdf/Trailer/Generator.php';
-
-/** Zend_Pdf_Color */
-require_once 'Zend/Pdf/Color.php';
-
-/** Zend_Pdf_Color_GrayScale */
-require_once 'Zend/Pdf/Color/GrayScale.php';
-
-/** Zend_Pdf_Color_Rgb */
-require_once 'Zend/Pdf/Color/Rgb.php';
-
-/** Zend_Pdf_Color_Cmyk */
-require_once 'Zend/Pdf/Color/Cmyk.php';
-
-/** Zend_Pdf_Color_Html */
-require_once 'Zend/Pdf/Color/Html.php';
-
-/** Zend_Pdf_Image */
-require_once 'Zend/Pdf/Resource/Image.php';
-
-/** Zend_Pdf_Image */
-require_once 'Zend/Pdf/Image.php';
-
-/** Zend_Pdf_Image_Jpeg */
-require_once 'Zend/Pdf/Resource/Image/Jpeg.php';
-
-/** Zend_Pdf_Image_Tiff */
-require_once 'Zend/Pdf/Resource/Image/Tiff.php';
-
-/** Zend_Pdf_Image_Png */
-require_once 'Zend/Pdf/Resource/Image/Png.php';
-
-
-/** Zend_Memory */
-require_once 'Zend/Memory.php';
-
-
-/**
- * General entity which describes PDF document.
- * It implements document abstraction with a document level operations.
- *
- * Class is used to create new PDF document or load existing document.
- * See details in a class constructor description
- *
- * Class agregates document level properties and entities (pages, bookmarks,
- * document level actions, attachments, form object, etc)
- *
- * @category Zend
- * @package Zend_Pdf
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Pdf
-{
- /**** Class Constants ****/
-
- /**
- * Version number of generated PDF documents.
- */
- const PDF_VERSION = 1.4;
-
- /**
- * PDF file header.
- */
- const PDF_HEADER = "%PDF-1.4\n%\xE2\xE3\xCF\xD3\n";
-
-
-
- /**
- * Pages collection
- *
- * @todo implement it as a class, which supports ArrayAccess and Iterator interfaces,
- * to provide incremental parsing and pages tree updating.
- * That will give good performance and memory (PDF size) benefits.
- *
- * @var array - array of Zend_Pdf_Page object
- */
- public $pages = array();
-
- /**
- * Document properties
- *
- * @var array
- */
- private $_properties = array();
-
- /**
- * Document level javascript
- *
- * @var string
- */
- private $_javaScript = null;
-
- /**
- * Document named actions
- * "GoTo..." actions, used to refer document parts
- * from outside PDF
- *
- * @var array - array of Zend_Pdf_Action objects
- */
- private $_namedActions = array();
-
-
- /**
- * Pdf trailer (last or just created)
- *
- * @var Zend_Pdf_Trailer
- */
- private $_trailer = null;
-
-
- /**
- * PDF objects factory.
- *
- * @var Zend_Pdf_ElementFactory_Interface
- */
- private $_objFactory = null;
-
- /**
- * Memory manager for stream objects
- *
- * @var Zend_Memory_Manager|null
- */
- private static $_memoryManager = null;
-
- /**
- * Pdf file parser.
- * It's not used, but has to be destroyed only with Zend_Pdf object
- *
- * @var Zend_Pdf_Parser
- */
- private $_parser;
-
- /**
- * Request used memory manager
- *
- * @return Zend_Memory_Manager
- */
- static public function getMemoryManager()
- {
- if (self::$_memoryManager === null) {
- self::$_memoryManager = Zend_Memory::factory('none');
- }
-
- return self::$_memoryManager;
- }
-
- /**
- * Set user defined memory manager
- *
- * @param Zend_Memory_Manager $memoryManager
- */
- static public function setMemoryManager(Zend_Memory_Manager $memoryManager)
- {
- self::$_memoryManager = $memoryManager;
- }
-
-
- /**
- * Create new PDF document from a $source string
- *
- * @param string $source
- * @param integer $revision
- * @return Zend_Pdf
- */
- public static function parse(&$source = null, $revision = null)
- {
- return new Zend_Pdf($source, $revision);
- }
-
- /**
- * Load PDF document from a file
- *
- * @param string $source
- * @param integer $revision
- * @return Zend_Pdf
- */
- public static function load($source = null, $revision = null)
- {
- return new Zend_Pdf($source, $revision, true);
- }
-
- /**
- * Render PDF document and save it.
- *
- * If $updateOnly is true, then it only appends new section to the end of file.
- *
- * @param string $filename
- * @param boolean $updateOnly
- * @throws Zend_Pdf_Exception
- */
- public function save($filename, $updateOnly = false)
- {
- if (($file = @fopen($filename, $updateOnly ? 'ab':'wb')) === false ) {
- throw new Zend_Pdf_Exception( "Can not open '$filename' file for writing." );
- }
-
- $this->render($updateOnly, $file);
-
- fclose($file);
- }
-
- /**
- * Creates or loads PDF document.
- *
- * If $source is null, then it creates a new document.
- *
- * If $source is a string and $load is false, then it loads document
- * from a binary string.
- *
- * If $source is a string and $load is true, then it loads document
- * from a file.
-
- * $revision used to roll back document to specified version
- * (0 - currtent version, 1 - previous version, 2 - ...)
- *
- * @param string $source - PDF file to load
- * @param integer $revision
- * @throws Zend_Pdf_Exception
- * @return Zend_Pdf
- */
- public function __construct($source = null, $revision = null, $load = false)
- {
- $this->_objFactory = Zend_Pdf_ElementFactory::createFactory(1);
-
- if ($source !== null) {
- $this->_parser = new Zend_Pdf_Parser($source, $this->_objFactory, $load);
- $this->_trailer = $this->_parser->getTrailer();
- if ($revision !== null) {
- $this->rollback($revision);
- } else {
- $this->_loadPages($this->_trailer->Root->Pages);
- }
- } else {
- $trailerDictionary = new Zend_Pdf_Element_Dictionary();
-
- /**
- * Document id
- */
- $docId = md5(uniqid(rand(), true)); // 32 byte (128 bit) identifier
- $docIdLow = substr($docId, 0, 16); // first 16 bytes
- $docIdHigh = substr($docId, 16, 16); // second 16 bytes
-
- $trailerDictionary->ID = new Zend_Pdf_Element_Array();
- $trailerDictionary->ID->items[] = new Zend_Pdf_Element_String_Binary($docIdLow);
- $trailerDictionary->ID->items[] = new Zend_Pdf_Element_String_Binary($docIdHigh);
-
- $trailerDictionary->Size = new Zend_Pdf_Element_Numeric(0);
-
- $this->_trailer = new Zend_Pdf_Trailer_Generator($trailerDictionary);
-
- /**
- * Document catalog indirect object.
- */
- $docCatalog = $this->_objFactory->newObject(new Zend_Pdf_Element_Dictionary());
- $docCatalog->Type = new Zend_Pdf_Element_Name('Catalog');
- $docCatalog->Version = new Zend_Pdf_Element_Name(Zend_Pdf::PDF_VERSION);
- $this->_trailer->Root = $docCatalog;
-
- /**
- * Pages container
- */
- $docPages = $this->_objFactory->newObject(new Zend_Pdf_Element_Dictionary());
- $docPages->Type = new Zend_Pdf_Element_Name('Pages');
- $docPages->Kids = new Zend_Pdf_Element_Array();
- $docPages->Count = new Zend_Pdf_Element_Numeric(0);
- $docCatalog->Pages = $docPages;
- }
- }
-
- /**
- * Retrive number of revisions.
- *
- * @return integer
- */
- public function revisions()
- {
- $revisions = 1;
- $currentTrailer = $this->_trailer;
-
- while ($currentTrailer->getPrev() !== null && $currentTrailer->getPrev()->Root !== null ) {
- $revisions++;
- $currentTrailer = $currentTrailer->getPrev();
- }
-
- return $revisions++;
- }
-
- /**
- * Rollback document $steps number of revisions.
- * This method must be invoked before any changes, applied to the document.
- * Otherwise behavior is undefined.
- *
- * @param integer $steps
- */
- public function rollback($steps)
- {
- for ($count = 0; $count < $steps; $count++) {
- if ($this->_trailer->getPrev() !== null && $this->_trailer->getPrev()->Root !== null) {
- $this->_trailer = $this->_trailer->getPrev();
- } else {
- break;
- }
- }
- $this->_objFactory->setObjectCount($this->_trailer->Size->value);
-
- // Mark content as modified to force new trailer generation at render time
- $this->_trailer->Root->touch();
-
- $this->pages = array();
- $this->_loadPages($this->_trailer->Root->Pages);
- }
-
-
-
- /**
- * List of inheritable attributesfor pages tree
- *
- * @var array
- */
- private static $_inheritableAttributes = array('Resources', 'MediaBox', 'CropBox', 'Rotate');
-
-
- /**
- * Load pages recursively
- *
- * @param Zend_Pdf_Element_Reference $pages
- * @param array|null $attributes
- */
- private function _loadPages(Zend_Pdf_Element_Reference $pages, $attributes = array())
- {
- if ($pages->getType() != Zend_Pdf_Element::TYPE_DICTIONARY) {
- throw new Zend_Pdf_Exception('Wrong argument');
- }
-
- foreach ($pages->getKeys() as $property) {
- if (in_array($property, self::$_inheritableAttributes)) {
- $attributes[$property] = $pages->$property;
- $pages->$property = null;
- }
- }
-
-
- foreach ($pages->Kids->items as $child) {
- if ($child->Type->value == 'Pages') {
- $this->_loadPages($child, $attributes);
- } else if ($child->Type->value == 'Page') {
- foreach (self::$_inheritableAttributes as $property) {
- if ($child->$property === null && array_key_exists($property, $attributes)) {
- /**
- * Important note.
- * If any attribute or dependant object is an indirect object, then it's still
- * shared between pages.
- */
- if ($attributes[$property] instanceof Zend_Pdf_Element_Object) {
- $child->$property = $attributes[$property];
- } else {
- $child->$property = $this->_objFactory->newObject($attributes[$property]);
- }
- }
- }
- $this->pages[] = new Zend_Pdf_Page($child, $this->_objFactory);
- }
- }
- }
-
-
- /**
- * Orginize pages to tha pages tree structure.
- *
- * @todo atomatically attach page to the document, if it's not done yet.
- * @todo check, that page is attached to the current document
- *
- * @todo Dump pages as a balanced tree instead of a plain set.
- */
- private function _dumpPages()
- {
- $pagesContainer = $this->_trailer->Root->Pages;
- $pagesContainer->touch();
- $pagesContainer->Kids->items->clear();
-
- foreach ($this->pages as $page ) {
- $page->render($this->_objFactory);
-
- $pageDictionary = $page->getPageDictionary();
- $pageDictionary->touch();
- $pageDictionary->Parent = $pagesContainer;
-
- $pagesContainer->Kids->items[] = $pageDictionary;
- }
-
- $pagesContainer->Count->touch();
- $pagesContainer->Count->value = count($this->pages);
- }
-
-
- /**
- * Create page object, attached to the PDF document.
- * Method signatures:
- *
- * 1. Create new page with a specified pagesize.
- * If $factory is null then it will be created and page must be attached to the document to be
- * included into output.
- * ---------------------------------------------------------
- * new Zend_Pdf_Page(string $pagesize);
- * ---------------------------------------------------------
- *
- * 2. Create new page with a specified pagesize (in default user space units).
- * If $factory is null then it will be created and page must be attached to the document to be
- * included into output.
- * ---------------------------------------------------------
- * new Zend_Pdf_Page(numeric $width, numeric $height);
- * ---------------------------------------------------------
- *
- * @param mixed $param1
- * @param mixed $param2
- * @return Zend_Pdf_Page
- */
- public function newPage($param1, $param2 = null)
- {
- if ($param2 === null) {
- return new Zend_Pdf_Page($param1, $this->_objFactory);
- } else {
- return new Zend_Pdf_Page($param1, $param2, $this->_objFactory);
- }
- }
-
- /**
- * Return return the an associative array with PDF meta information, values may
- * be string, boolean or float.
- * Returned array could be used directly to access, add, modify or remove
- * document properties.
- *
- * Standard document properties: Title (must be set for PDF/X documents), Author,
- * Subject, Keywords (comma separated list), Creator (the name of the application,
- * that created document, if it was converted from other format), Trapped (must be
- * true, false or null, can not be null for PDF/X documents)
- *
- * @todo implementation
- *
- * @return array
- */
- public function properties()
- {
- return $this->_properties;
- }
-
-
- /**
- * Return the document-level JavaScript
- * or null if there is no JavaScript for this document
- *
- * @return string
- */
- public function getJavaScript()
- {
- return $this->_javaScript;
- }
-
-
- /**
- * Return an associative array containing all the named actions in the PDF.
- * Named actions (it's always "GoTo" actions) can be used to reference from outside
- * the PDF, ex: 'http://www.something.com/mydocument.pdf#MyAction'
- *
- * @return array
- */
- public function getNamedActions()
- {
- return $this->_namedActions;
- }
-
-
- /**
- * Render the completed PDF to a string.
- * If $newSegmentOnly is true, then only appended part of PDF is returned.
- *
- * @param boolean $newSegmentOnly
- * @param resource $outputStream
- * @return string
- */
- public function render($newSegmentOnly = false, $outputStream = null)
- {
- $this->_dumpPages();
-
- // Check, that PDF file was modified
- // File is always modified by _dumpPages() now, but future implementations may eliminate this.
- if (!$this->_objFactory->isModified()) {
- if ($newSegmentOnly) {
- // Do nothing, return
- return '';
- }
-
- if ($outputStream === null) {
- return $this->_trailer->getPDFString();
- } else {
- $pdfData = $this->_trailer->getPDFString();
- while ( strlen($pdfData) > 0 && ($byteCount = fwrite($outputStream, $pdfData)) != false ) {
- $pdfData = substr($pdfData, $byteCount);
- }
-
- return '';
- }
- }
-
- // offset (from a start of PDF file) of new PDF file segment
- $offset = $this->_trailer->getPDFLength();
- // Last Object number in a list of free objects
- $lastFreeObject = $this->_trailer->getLastFreeObject();
-
- // Array of cross-reference table subsections
- $xrefTable = array();
- // Object numbers of first objects in each subsection
- $xrefSectionStartNums = array();
-
- // Last cross-reference table subsection
- $xrefSection = array();
- // Dummy initialization of the first element (specail case - header of linked list of free objects).
- $xrefSection[] = 0;
- $xrefSectionStartNums[] = 0;
- // Object number of last processed PDF object.
- // Used to manage cross-reference subsections.
- // Initialized by zero (specail case - header of linked list of free objects).
- $lastObjNum = 0;
-
- if ($outputStream !== null) {
- if (!$newSegmentOnly) {
- $pdfData = $this->_trailer->getPDFString();
- while ( strlen($pdfData) > 0 && ($byteCount = fwrite($outputStream, $pdfData)) != false ) {
- $pdfData = substr($pdfData, $byteCount);
- }
- }
- } else {
- $pdfSegmentBlocks = ($newSegmentOnly) ? array() : array($this->_trailer->getPDFString());
- }
-
- // Iterate objects to create new reference table
- foreach ($this->_objFactory->listModifiedObjects() as $updateInfo) {
- $objNum = $updateInfo->getObjNum();
-
- if ($objNum - $lastObjNum != 1) {
- // Save cross-reference table subsection and start new one
- $xrefTable[] = $xrefSection;
- $xrefSection = array();
- $xrefSectionStartNums[] = $objNum;
- }
-
- if ($updateInfo->isFree()) {
- // Free object cross-reference table entry
- $xrefSection[] = sprintf("%010d %05d f \n", $lastFreeObject, $updateInfo->getGenNum());
- $lastFreeObject = $objNum;
- } else {
- // In-use object cross-reference table entry
- $xrefSection[] = sprintf("%010d %05d n \n", $offset, $updateInfo->getGenNum());
-
- $pdfBlock = $updateInfo->getObjectDump();
- $offset += strlen($pdfBlock);
-
- if ($outputStream === null) {
- $pdfSegmentBlocks[] = $pdfBlock;
- } else {
- while ( strlen($pdfBlock) > 0 && ($byteCount = fwrite($outputStream, $pdfBlock)) != false ) {
- $pdfBlock = substr($pdfBlock, $byteCount);
- }
- }
- }
- $lastObjNum = $objNum;
- }
- // Save last cross-reference table subsection
- $xrefTable[] = $xrefSection;
-
- // Modify first entry (specail case - header of linked list of free objects).
- $xrefTable[0][0] = sprintf("%010d 65535 f \n", $lastFreeObject);
-
- $xrefTableStr = "xref\n";
- foreach ($xrefTable as $sectId => $xrefSection) {
- $xrefTableStr .= sprintf("%d %d \n", $xrefSectionStartNums[$sectId], count($xrefSection));
- foreach ($xrefSection as $xrefTableEntry) {
- $xrefTableStr .= $xrefTableEntry;
- }
- }
-
- $this->_trailer->Size->value = $this->_objFactory->getObjectCount();
-
- $pdfBlock = $xrefTableStr
- . $this->_trailer->toString()
- . "startxref\n" . $offset . "\n"
- . "%%EOF\n";
-
- if ($outputStream === null) {
- $pdfSegmentBlocks[] = $pdfBlock;
-
- return implode('', $pdfSegmentBlocks);
- } else {
- while ( strlen($pdfBlock) > 0 && ($byteCount = fwrite($outputStream, $pdfBlock)) != false ) {
- $pdfBlock = substr($pdfBlock, $byteCount);
- }
-
- return '';
- }
- }
-
-
- /**
- * Set the document-level JavaScript
- *
- * @param string $javascript
- */
- public function setJavaScript($javascript)
- {
- $this->_javaScript = $javascript;
- }
-
-
- /**
- * Convert date to PDF format (it's close to ASN.1 (Abstract Syntax Notation
- * One) defined in ISO/IEC 8824).
- *
- * @todo This really isn't the best location for this method. It should
- * probably actually exist as Zend_Pdf_Element_Date or something like that.
- *
- * @todo Address the following E_STRICT issue:
- * PHP Strict Standards: date(): It is not safe to rely on the system's
- * timezone settings. Please use the date.timezone setting, the TZ
- * environment variable or the date_default_timezone_set() function. In
- * case you used any of those methods and you are still getting this
- * warning, you most likely misspelled the timezone identifier.
- *
- * @param integer $timestamp (optional) If omitted, uses the current time.
- * @return string
- */
- public static function pdfDate($timestamp = null)
- {
- if (is_null($timestamp)) {
- $date = date('\D\:YmdHisO');
- } else {
- $date = date('\D\:YmdHisO', $timestamp);
- }
- return substr_replace($date, '\'', -2, 0) . '\'';
- }
-
-}
diff --git a/libs/Zend/Uri.php b/libs/Zend/Uri.php
deleted file mode 100755
index c0e07fbb3d..0000000000
--- a/libs/Zend/Uri.php
+++ /dev/null
@@ -1,163 +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_Uri
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * @see Zend_Uri_Exception
- */
-require_once 'Zend/Uri/Exception.php';
-
-
-/**
- * @see Zend_Loader
- */
-require_once 'Zend/Loader.php';
-
-
-/**
- * @category Zend
- * @package Zend_Uri
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-abstract class Zend_Uri
-{
- /**
- * Scheme of this URI (http, ftp, etc.)
- * @var string
- */
- protected $_scheme = '';
-
- /**
- * Return a string representation of this URI.
- *
- * @see getUri()
- * @return string
- */
- public function __toString()
- {
- return $this->getUri();
- }
-
- /**
- * Convenience function, checks that a $uri string is well-formed
- * by validating it but not returning an object. Returns TRUE if
- * $uri is a well-formed URI, or FALSE otherwise.
- *
- * @param string $uri
- * @return boolean
- */
- public static function check($uri)
- {
- try {
- $uri = self::factory($uri);
- } catch (Exception $e) {
- return false;
- }
-
- return $uri->valid();
- }
-
- /**
- * Create a new Zend_Uri object for a URI. If building a new URI, then $uri should contain
- * only the scheme (http, ftp, etc). Otherwise, supply $uri with the complete URI.
- *
- * @param string $uri
- * @throws Zend_Uri_Exception
- * @return Zend_Uri
- */
- public static function factory($uri = 'http')
- {
- /**
- * Separate the scheme from the scheme-specific parts
- * @link http://www.faqs.org/rfcs/rfc2396.html
- */
- $uri = explode(':', $uri, 2);
- $scheme = strtolower($uri[0]);
- $schemeSpecific = isset($uri[1]) ? $uri[1] : '';
-
- if (!strlen($scheme)) {
- throw new Zend_Uri_Exception('An empty string was supplied for the scheme');
- }
-
- // Security check: $scheme is used to load a class file, so only alphanumerics are allowed.
- if (!ctype_alnum($scheme)) {
- throw new Zend_Uri_Exception('Illegal scheme supplied, only alphanumeric characters are permitted');
- }
-
- /**
- * Create a new Zend_Uri object for the $uri. If a subclass of Zend_Uri exists for the
- * scheme, return an instance of that class. Otherwise, a Zend_Uri_Exception is thrown.
- */
- switch ($scheme) {
- case 'http':
- case 'https':
- $className = 'Zend_Uri_Http';
- break;
- case 'mailto':
- // @todo
- default:
- throw new Zend_Uri_Exception("Scheme \"$scheme\" is not supported");
- }
- Zend_Loader::loadClass($className);
- return new $className($scheme, $schemeSpecific);
-
- }
-
- /**
- * Get the URI's scheme
- *
- * @return string|false Scheme or false if no scheme is set.
- */
- public function getScheme()
- {
- if (!empty($this->_scheme)) {
- return $this->_scheme;
- } else {
- return false;
- }
- }
-
- /******************************************************************************
- * Abstract Methods
- *****************************************************************************/
-
- /**
- * Zend_Uri and its subclasses cannot be instantiated directly.
- * Use Zend_Uri::factory() to return a new Zend_Uri object.
- */
- abstract protected function __construct($scheme, $schemeSpecific = '');
-
- /**
- * Return a string representation of this URI.
- *
- * @return string
- */
- abstract public function getUri();
-
- /**
- * Returns TRUE if this URI is valid, or FALSE otherwise.
- *
- * @return boolean
- */
- abstract public function valid();
-}
diff --git a/libs/Zend/Uri/Exception.php b/libs/Zend/Uri/Exception.php
deleted file mode 100755
index 4190a30fcb..0000000000
--- a/libs/Zend/Uri/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_Uri
- * @copyright Copyright (c) 2005-2007 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_Uri
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Uri_Exception extends Zend_Exception
-{}
-
diff --git a/libs/Zend/Uri/Http.php b/libs/Zend/Uri/Http.php
deleted file mode 100755
index 0755423667..0000000000
--- a/libs/Zend/Uri/Http.php
+++ /dev/null
@@ -1,630 +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_Uri
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-
-
-/**
- * @see Zend_Uri
- */
-require_once 'Zend/Uri.php';
-
-
-/**
- * @see Zend_Validate_Hostname
- */
-require_once 'Zend/Validate/Hostname.php';
-
-
-/**
- * @category Zend
- * @package Zend_Uri
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_Uri_Http extends Zend_Uri
-{
- /**
- * URI parts are divided among these instance variables
- */
- protected $_username = '';
- protected $_password = '';
- protected $_host = '';
- protected $_port = '';
- protected $_path = '';
- protected $_query = '';
- protected $_fragment = '';
-
- /**
- * Regular expression grammar rules for validation; values added by constructor
- */
- protected $_regex = array();
-
- /**
- * Constructor accepts a string $scheme (e.g., http, https) and a scheme-specific part of the URI
- * (e.g., example.com/path/to/resource?query=param#fragment)
- *
- * @param string $scheme
- * @param string $schemeSpecific
- * @throws Zend_Uri_Exception
- * @return void
- */
- protected function __construct($scheme, $schemeSpecific = '')
- {
- // Set the scheme
- $this->_scheme = $scheme;
-
- // Set up grammar rules for validation via regular expressions. These
- // are to be used with slash-delimited regular expression strings.
- $this->_regex['alphanum'] = '[^\W_]';
- $this->_regex['escaped'] = '(?:%[\da-fA-F]{2})';
- $this->_regex['mark'] = '[-_.!~*\'()\[\]]';
- $this->_regex['reserved'] = '[;\/?:@&=+$,]';
- $this->_regex['unreserved'] = '(?:' . $this->_regex['alphanum'] . '|' . $this->_regex['mark'] . ')';
- $this->_regex['segment'] = '(?:(?:' . $this->_regex['unreserved'] . '|' . $this->_regex['escaped']
- . '|[:@&=+$,;])*)';
- $this->_regex['path'] = '(?:\/' . $this->_regex['segment'] . '?)+';
- $this->_regex['uric'] = '(?:' . $this->_regex['reserved'] . '|' . $this->_regex['unreserved'] . '|'
- . $this->_regex['escaped'] . ')';
- // If no scheme-specific part was supplied, the user intends to create
- // a new URI with this object. No further parsing is required.
- if (strlen($schemeSpecific) == 0) {
- return;
- }
-
- // Parse the scheme-specific URI parts into the instance variables.
- $this->_parseUri($schemeSpecific);
-
- // Validate the URI
- if (!$this->valid()) {
- throw new Zend_Uri_Exception('Invalid URI supplied');
- }
- }
-
- /**
- * Parse the scheme-specific portion of the URI and place its parts into instance variables.
- *
- * @param string $schemeSpecific
- * @throws Zend_Uri_Exception
- * @return void
- */
- protected function _parseUri($schemeSpecific)
- {
- // High-level decomposition parser
- $pattern = '~^((//)([^/?#]*))([^?#]*)(\?([^#]*))?(#(.*))?$~';
- $status = @preg_match($pattern, $schemeSpecific, $matches);
- if ($status === false) {
- throw new Zend_Uri_Exception('Internal error: scheme-specific decomposition failed');
- }
-
- // Failed decomposition; no further processing needed
- if (!$status) {
- return;
- }
-
- // Save URI components that need no further decomposition
- $this->_path = isset($matches[4]) ? $matches[4] : '';
- $this->_query = isset($matches[6]) ? $matches[6] : '';
- $this->_fragment = isset($matches[8]) ? $matches[8] : '';
-
- // Additional decomposition to get username, password, host, and port
- $combo = isset($matches[3]) ? $matches[3] : '';
- $pattern = '~^(([^:@]*)(:([^@]*))?@)?([^:]+)(:(.*))?$~';
- $status = @preg_match($pattern, $combo, $matches);
- if ($status === false) {
- throw new Zend_Uri_Exception('Internal error: authority decomposition failed');
- }
-
- // Failed decomposition; no further processing needed
- if (!$status) {
- return;
- }
-
- // Save remaining URI components
- $this->_username = isset($matches[2]) ? $matches[2] : '';
- $this->_password = isset($matches[4]) ? $matches[4] : '';
- $this->_host = isset($matches[5]) ? $matches[5] : '';
- $this->_port = isset($matches[7]) ? $matches[7] : '';
-
- }
-
- /**
- * Returns a URI based on current values of the instance variables. If any
- * part of the URI does not pass validation, then an exception is thrown.
- *
- * @throws Zend_Uri_Exception
- * @return string
- */
- public function getUri()
- {
- if (!$this->valid()) {
- throw new Zend_Uri_Exception('One or more parts of the URI are invalid');
- }
- $password = strlen($this->_password) ? ":$this->_password" : '';
- $auth = strlen($this->_username) ? "$this->_username$password@" : '';
- $port = strlen($this->_port) ? ":$this->_port" : '';
- $query = strlen($this->_query) ? "?$this->_query" : '';
- $fragment = strlen($this->_fragment) ? "#$this->_fragment" : '';
- return "$this->_scheme://$auth$this->_host$port$this->_path$query$fragment";
- }
-
- /**
- * Validate the current URI from the instance variables. Returns true if and only if all
- * parts pass validation.
- *
- * @return boolean
- */
- public function valid()
- {
- /**
- * Return true if and only if all parts of the URI have passed validation
- */
- return $this->validateUsername()
- && $this->validatePassword()
- && $this->validateHost()
- && $this->validatePort()
- && $this->validatePath()
- && $this->validateQuery()
- && $this->validateFragment();
- }
-
- /**
- * Returns the username portion of the URL, or FALSE if none.
- *
- * @return string
- */
- public function getUsername()
- {
- return strlen($this->_username) ? $this->_username : false;
- }
-
- /**
- * Returns true if and only if the username passes validation. If no username is passed,
- * then the username contained in the instance variable is used.
- *
- * @param string $username
- * @throws Zend_Uri_Exception
- * @return boolean
- */
- public function validateUsername($username = null)
- {
- if ($username === null) {
- $username = $this->_username;
- }
-
- // If the username is empty, then it is considered valid
- if (strlen($username) == 0) {
- return true;
- }
- /**
- * Check the username against the allowed values
- *
- * @link http://www.faqs.org/rfcs/rfc2396.html
- */
- $status = @preg_match('/^(' . $this->_regex['alphanum'] . '|' . $this->_regex['mark'] . '|'
- . $this->_regex['escaped'] . '|[;:&=+$,])+$/', $username);
- if ($status === false) {
- throw new Zend_Uri_Exception('Internal error: username validation failed');
- }
-
- return $status == 1;
- }
-
- /**
- * Sets the username for the current URI, and returns the old username
- *
- * @param string $username
- * @throws Zend_Uri_Exception
- * @return string
- */
- public function setUsername($username)
- {
- if (!$this->validateUsername($username)) {
- throw new Zend_Uri_Exception("Username \"$username\" is not a valid HTTP username");
- }
- $oldUsername = $this->_username;
- $this->_username = $username;
- return $oldUsername;
- }
-
- /**
- * Returns the password portion of the URL, or FALSE if none.
- *
- * @return string
- */
- public function getPassword()
- {
- return strlen($this->_password) ? $this->_password : false;
- }
-
- /**
- * Returns true if and only if the password passes validation. If no password is passed,
- * then the password contained in the instance variable is used.
- *
- * @param string $password
- * @throws Zend_Uri_Exception
- * @return boolean
- */
- public function validatePassword($password = null)
- {
- if ($password === null) {
- $password = $this->_password;
- }
-
- // If the password is empty, then it is considered valid
- if (strlen($password) == 0) {
- return true;
- }
-
- // If the password is nonempty, but there is no username, then it is considered invalid
- if (strlen($password) > 0 && strlen($this->_username) == 0) {
- return false;
- }
-
- /**
- * Check the password against the allowed values
- *
- * @link http://www.faqs.org/rfcs/rfc2396.html
- */
- $status = @preg_match('/^(' . $this->_regex['alphanum'] . '|' . $this->_regex['mark'] . '|'
- . $this->_regex['escaped'] . '|[;:&=+$,])+$/', $password);
- if ($status === false) {
- throw new Zend_Uri_Exception('Internal error: password validation failed.');
- }
- return $status == 1;
- }
-
- /**
- * Sets the password for the current URI, and returns the old password
- *
- * @param string $password
- * @throws Zend_Uri_Exception
- * @return string
- */
- public function setPassword($password)
- {
- if (!$this->validatePassword($password)) {
- throw new Zend_Uri_Exception("Password \"$password\" is not a valid HTTP password.");
- }
- $oldPassword = $this->_password;
- $this->_password = $password;
- return $oldPassword;
- }
-
- /**
- * Returns the domain or host IP portion of the URL, or FALSE if none.
- *
- * @return string
- */
- public function getHost()
- {
- return strlen($this->_host) ? $this->_host : false;
- }
-
- /**
- * Returns true if and only if the host string passes validation. If no host is passed,
- * then the host contained in the instance variable is used.
- *
- * @param string $host
- * @return boolean
- * @uses Zend_Filter
- */
- public function validateHost($host = null)
- {
- if ($host === null) {
- $host = $this->_host;
- }
-
- /**
- * If the host is empty, then it is considered invalid
- */
- if (strlen($host) == 0) {
- return false;
- }
-
- /**
- * Check the host against the allowed values; delegated to Zend_Filter.
- */
- $validate = new Zend_Validate_Hostname(Zend_Validate_Hostname::ALLOW_ALL);
- return $validate->isValid($host);
- }
-
- /**
- * Sets the host for the current URI, and returns the old host
- *
- * @param string $host
- * @throws Zend_Uri_Exception
- * @return string
- */
- public function setHost($host)
- {
- if (!$this->validateHost($host)) {
- throw new Zend_Uri_Exception("Host \"$host\" is not a valid HTTP host");
- }
- $oldHost = $this->_host;
- $this->_host = $host;
- return $oldHost;
- }
-
- /**
- * Returns the TCP port, or FALSE if none.
- *
- * @return string
- */
- public function getPort()
- {
- return strlen($this->_port) ? $this->_port : false;
- }
-
- /**
- * Returns true if and only if the TCP port string passes validation. If no port is passed,
- * then the port contained in the instance variable is used.
- *
- * @param string $port
- * @return boolean
- */
- public function validatePort($port = null)
- {
- if ($port === null) {
- $port = $this->_port;
- }
-
- // If the port is empty, then it is considered valid
- if (!strlen($port)) {
- return true;
- }
-
- // Check the port against the allowed values
- return ctype_digit((string)$port) && 1 <= $port && $port <= 65535;
- }
-
- /**
- * Sets the port for the current URI, and returns the old port
- *
- * @param string $port
- * @throws Zend_Uri_Exception
- * @return string
- */
- public function setPort($port)
- {
- if (!$this->validatePort($port)) {
- throw new Zend_Uri_Exception("Port \"$port\" is not a valid HTTP port.");
- }
- $oldPort = $this->_port;
- $this->_port = $port;
- return $oldPort;
- }
-
- /**
- * Returns the path and filename portion of the URL, or FALSE if none.
- *
- * @return string
- */
- public function getPath()
- {
- return strlen($this->_path) ? $this->_path : '/';
- }
-
- /**
- * Returns true if and only if the path string passes validation. If no path is passed,
- * then the path contained in the instance variable is used.
- *
- * @param string $path
- * @throws Zend_Uri_Exception
- * @return boolean
- */
- public function validatePath($path = null)
- {
- if ($path === null) {
- $path = $this->_path;
- }
- /**
- * If the path is empty, then it is considered valid
- */
- if (strlen($path) == 0) {
- return true;
- }
- /**
- * Determine whether the path is well-formed
- */
- $pattern = '/^' . $this->_regex['path'] . '$/';
- $status = @preg_match($pattern, $path);
- if ($status === false) {
- throw new Zend_Uri_Exception('Internal error: path validation failed');
- }
- if (!$status) {
- echo "'$path' does not match pattern '$pattern'\n";
- }
- return (boolean) $status;
- }
-
- /**
- * Sets the path for the current URI, and returns the old path
- *
- * @param string $path
- * @throws Zend_Uri_Exception
- * @return string
- */
- public function setPath($path)
- {
- if (!$this->validatePath($path)) {
- throw new Zend_Uri_Exception("Path \"$path\" is not a valid HTTP path");
- }
- $oldPath = $this->_path;
- $this->_path = $path;
- return $oldPath;
- }
-
- /**
- * Returns the query portion of the URL (after ?), or FALSE if none.
- *
- * @return string
- */
- public function getQuery()
- {
- return strlen($this->_query) ? $this->_query : false;
- }
-
- /**
- * Returns true if and only if the query string passes validation. If no query is passed,
- * then the query string contained in the instance variable is used.
- *
- * @param string $query
- * @throws Zend_Uri_Exception
- * @return boolean
- */
- public function validateQuery($query = null)
- {
- if ($query === null) {
- $query = $this->_query;
- }
-
- // If query is empty, it is considered to be valid
- if (strlen($query) == 0) {
- return true;
- }
-
- /**
- * Determine whether the query is well-formed
- *
- * @link http://www.faqs.org/rfcs/rfc2396.html
- */
- $pattern = '/^' . $this->_regex['uric'] . '*$/';
- $status = @preg_match($pattern, $query);
- if ($status === false) {
- throw new Zend_Uri_Exception('Internal error: query validation failed');
- }
-
- return $status == 1;
- }
-
- /**
- * Set the query string for the current URI, and return the old query
- * string This method accepts both strings and arrays.
- *
- * @param string|array $query The query string or array
- * @return string Old query string
- */
- public function setQuery($query)
- {
- $oldQuery = $this->_query;
- $this->_query = $this->_parseQuery($query);
- return $oldQuery;
- }
-
- /**
- * Parse a query string or array, validate it and return it as a query string
- *
- * @param string|array $query
- * @return string
- */
- protected function _parseQuery($query)
- {
- // If query is empty, return an empty string
- if (empty($query)) {
- return '';
- }
-
- // If query is an array, make a string out of it
- if (is_array($query)) {
- // fails on PHP < 5.1.2
- $query_str = @http_build_query($query, '', '&');
- // If it failed, try calling with only 2 args
- if (!$query_str) {
- $query_str = http_build_query($query, '');
- }
- // Just in case they use &amp; in their php.ini, replace it with &
- $query_str = str_replace("&amp;", "&", $query_str);
-
- $query = $query_str;
- } else {
- $query = (string) $query;
- }
-
- // Make sure the query is valid, and set it
- if ($this->validateQuery($query)) {
- return $query;
- } else {
- throw new Zend_Uri_Exception("'$query' is not a valid query string");
- }
- return $query;
- }
-
- /**
- * Returns the fragment portion of the URL (after #), or FALSE if none.
- *
- * @return string|false
- */
- public function getFragment()
- {
- return strlen($this->_fragment) ? $this->_fragment : false;
- }
-
- /**
- * Returns true if and only if the fragment passes validation. If no fragment is passed,
- * then the fragment contained in the instance variable is used.
- *
- * @param string $fragment
- * @throws Zend_Uri_Exception
- * @return boolean
- */
- public function validateFragment($fragment = null)
- {
- if ($fragment === null) {
- $fragment = $this->_fragment;
- }
-
- // If fragment is empty, it is considered to be valid
- if (strlen($fragment) == 0) {
- return true;
- }
-
- /**
- * Determine whether the fragment is well-formed
- *
- * @link http://www.faqs.org/rfcs/rfc2396.html
- */
- $pattern = '/^' . $this->_regex['uric'] . '*$/';
- $status = @preg_match($pattern, $fragment);
- if ($status === false) {
- throw new Zend_Uri_Exception('Internal error: fragment validation failed');
- }
-
- return (boolean) $status;
- }
-
- /**
- * Sets the fragment for the current URI, and returns the old fragment
- *
- * @param string $fragment
- * @throws Zend_Uri_Exception
- * @return string
- */
- public function setFragment($fragment)
- {
- if (!$this->validateFragment($fragment)) {
- throw new Zend_Uri_Exception("Fragment \"$fragment\" is not a valid HTTP fragment");
- }
- $oldFragment = $this->_fragment;
- $this->_fragment = $fragment;
- return $oldFragment;
- }
-}
-
diff --git a/libs/Zend/XmlRpc/Client.php b/libs/Zend/XmlRpc/Client.php
deleted file mode 100755
index 7e2cbb569e..0000000000
--- a/libs/Zend/XmlRpc/Client.php
+++ /dev/null
@@ -1,267 +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_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * For handling the HTTP connection to the XML-RPC service
- */
-require_once 'Zend/Http/Client.php';
-
-/**
- * Exception thrown when an HTTP error occurs
- */
-require_once 'Zend/XmlRpc/Client/HttpException.php';
-
-/**
- * Exception thrown when an XML-RPC fault is returned
- */
-require_once 'Zend/XmlRpc/Client/FaultException.php';
-
-/**
- * Enables object chaining for calling namespaced XML-RPC methods.
- */
-require_once 'Zend/XmlRpc/Client/ServerProxy.php';
-
-/**
- * Introspects remote servers using the XML-RPC de facto system.* methods
- */
-require_once 'Zend/XmlRpc/Client/ServerIntrospection.php';
-
-/**
- * Represent a native XML-RPC value, used both in sending parameters
- * to methods and as the parameters retrieve from method calls
- */
-require_once 'Zend/XmlRpc/Value.php';
-
-/**
- * XML-RPC Request
- */
-require_once 'Zend/XmlRpc/Request.php';
-
-/**
- * XML-RPC Response
- */
-require_once 'Zend/XmlRpc/Response.php';
-
-/**
- * XML-RPC Fault
- */
-require_once 'Zend/XmlRpc/Fault.php';
-
-
-/**
- * An XML-RPC client implementation
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Client
-{
- /** @var string */
- private $_serverAddress;
-
- /** @var Zend_Http_Client */
- private $_httpClient = null;
-
- /** @var Zend_Http_Client_Introspector */
- private $_introspector = null;
-
- /** @var Zend_XmlRpc_Request */
- private $_lastRequest = null;
-
- /** @var Zend_XmlRpc_Response */
- private $_lastResponse = null;
-
- /** @var array of Zend_XmlRpc_Client_ServerProxy */
- private $_proxyCache = array();
-
-
- /**
- * Create a new XML-RPC client to a remote server
- *
- * @param string $server Full address of the XML-RPC service
- * (e.g. http://time.xmlrpc.com/RPC2)
- * @param Zend_Http_Client $httpClient HTTP Client to use for requests
- * @return void
- */
- public function __construct($server, Zend_Http_Client $httpClient = null)
- {
- if ($httpClient === null) {
- $this->_httpClient = new Zend_Http_Client();
- } else {
- $this->_httpClient = $httpClient;
- }
-
- $this->_introspector = new Zend_XmlRpc_Client_ServerIntrospection($this);
- $this->_serverAddress = $server;
- }
-
-
- /**
- * Sets the HTTP client object to use for connecting the XML-RPC server.
- *
- * @param Zend_Http_Client $httpClient
- * @return Zend_Http_Client
- */
- public function setHttpClient(Zend_Http_Client $httpClient)
- {
- return $this->_httpClient = $httpClient;
- }
-
-
- /**
- * Gets the HTTP client object.
- *
- * @return Zend_Http_Client
- */
- public function getHttpClient()
- {
- return $this->_httpClient;
- }
-
-
- /**
- * Sets the object used to introspect remote servers
- *
- * @param Zend_XmlRpc_Client_ServerIntrospection
- * @return Zend_XmlRpc_Client_ServerIntrospection
- */
- public function setIntrospector(Zend_XmlRpc_Client_ServerIntrospection $introspector)
- {
- return $this->_introspector = $introspector;
- }
-
-
- /**
- * Gets the introspection object.
- *
- * @return Zend_XmlRpc_Client_ServerIntrospection
- */
- public function getIntrospector()
- {
- return $this->_introspector;
- }
-
-
- /**
- * The request of the last method call
- *
- * @return Zend_XmlRpc_Request
- */
- public function getLastRequest()
- {
- return $this->_lastRequest;
- }
-
-
- /**
- * The response received from the last method call
- *
- * @return Zend_XmlRpc_Response
- */
- public function getLastResponse()
- {
- return $this->_lastResponse;
- }
-
-
- /**
- * Returns a proxy object for more convenient method calls
- *
- * @param $namespace Namespace to proxy or empty string for none
- * @return Zend_XmlRpc_Client_ServerProxy
- */
- public function getProxy($namespace = '')
- {
- if (empty($this->_proxyCache[$namespace])) {
- $proxy = new Zend_XmlRpc_Client_ServerProxy($this, $namespace);
- $this->_proxyCache[$namespace] = $proxy;
- }
- return $this->_proxyCache[$namespace];
- }
-
-
- /**
- * Perform an XML-RPC request and return a response.
- *
- * @param Zend_XmlRpc_Request $request
- * @param null|Zend_XmlRpc_Response $response
- * @return void
- */
- public function doRequest($request, $response = null)
- {
- $this->_lastRequest = $request;
-
- iconv_set_encoding('input_encoding', 'UTF-8');
- iconv_set_encoding('output_encoding', 'UTF-8');
- iconv_set_encoding('internal_encoding', 'UTF-8');
-
- $http = $this->getHttpClient();
- $http->setUri($this->_serverAddress);
-
- $http->setHeaders(array(
- 'Content-Type: text/xml; charset=utf-8',
- 'User-Agent: Zend_XmlRpc_Client'
- ));
-
- $xml = $this->_lastRequest->__toString();
- $http->setRawData($xml);
- $httpResponse = $http->request(Zend_Http_Client::POST);
-
- if (! $httpResponse->isSuccessful()) {
- throw new Zend_XmlRpc_Client_HttpException(
- $httpResponse->getMessage(),
- $httpResponse->getStatus());
- }
-
- if ($response === null) {
- $response = new Zend_XmlRpc_Response();
- }
- $this->_lastResponse = $response;
- $this->_lastResponse->loadXml($httpResponse->getBody());
- }
-
-
- /**
- * Send an XML-RPC request to the service (for a specific method)
- *
- * @param string $method Name of the method we want to call
- * @param array $params Array of parameters for the method
- * @throws Zend_Http_Client_FaultException
- */
- public function call($method, $params=array())
- {
- $request = new Zend_XmlRpc_Request($method, $params);
-
- $this->doRequest($request);
-
- if ($this->_lastResponse->isFault()) {
- $fault = $this->_lastResponse->getFault();
- throw new Zend_XmlRpc_Client_FaultException($fault->getMessage(),
- $fault->getCode());
- }
-
- return $this->_lastResponse->getReturnValue();
- }
-}
diff --git a/libs/Zend/XmlRpc/Client/Exception.php b/libs/Zend/XmlRpc/Client/Exception.php
deleted file mode 100755
index 2527b3a099..0000000000
--- a/libs/Zend/XmlRpc/Client/Exception.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_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_XmlRpc_Exception
- */
-require_once 'Zend/XmlRpc/Exception.php';
-
-
-/**
- * Base class for all Zend_XmlRpc_Client_* exceptions
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Client_Exception extends Zend_XmlRpc_Exception
-{}
diff --git a/libs/Zend/XmlRpc/Client/FaultException.php b/libs/Zend/XmlRpc/Client/FaultException.php
deleted file mode 100755
index c31e5bde62..0000000000
--- a/libs/Zend/XmlRpc/Client/FaultException.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_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/** Zend_XmlRpc_Client_Exception */
-require_once 'Zend/XmlRpc/Client/Exception.php';
-
-
-/**
- * Thrown by Zend_XmlRpc_Client when an XML-RPC fault response is returned.
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Client_FaultException extends Zend_XmlRpc_Client_Exception
-{}
diff --git a/libs/Zend/XmlRpc/Client/HttpException.php b/libs/Zend/XmlRpc/Client/HttpException.php
deleted file mode 100755
index 8b3f001660..0000000000
--- a/libs/Zend/XmlRpc/Client/HttpException.php
+++ /dev/null
@@ -1,40 +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_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_XmlRpc_Exception
- */
-require_once 'Zend/XmlRpc/Client/Exception.php';
-
-
-/**
- * Thrown by Zend_XmlRpc_Client when an HTTP error occurs during an
- * XML-RPC method call.
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Client_HttpException extends Zend_XmlRpc_Client_Exception
-{}
diff --git a/libs/Zend/XmlRpc/Client/IntrospectException.php b/libs/Zend/XmlRpc/Client/IntrospectException.php
deleted file mode 100755
index d947086873..0000000000
--- a/libs/Zend/XmlRpc/Client/IntrospectException.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_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_XmlRpc_Client_Exception
- */
-require_once 'Zend/XmlRpc/Client/Exception.php';
-
-
-/**
- * Thrown by Zend_XmlRpc_Client_Introspection when any error occurs.
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Client_IntrospectException extends Zend_XmlRpc_Client_Exception
-{}
diff --git a/libs/Zend/XmlRpc/Client/ServerIntrospection.php b/libs/Zend/XmlRpc/Client/ServerIntrospection.php
deleted file mode 100755
index efba08ef6a..0000000000
--- a/libs/Zend/XmlRpc/Client/ServerIntrospection.php
+++ /dev/null
@@ -1,162 +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_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/** Zend_XmlRpc_Client_IntrospectException */
-require_once 'Zend/XmlRpc/Client/IntrospectException.php';
-
-
-/**
- * Wraps the XML-RPC system.* introspection methods
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Client_ServerIntrospection
-{
- /**
- * @var Zend_XmlRpc_Client_ServerProxy
- */
- private $_system = null;
-
-
- /**
- * @param Zend_XmlRpc_Client $client
- */
- public function __construct(Zend_XmlRpc_Client $client)
- {
- $this->_system = $client->getProxy('system');
- }
-
- /**
- * Returns the signature for each method on the server,
- * autodetecting whether system.multicall() is supported and
- * using it if so.
- *
- * @return array
- */
- public function getSignatureForEachMethod()
- {
- $methods = $this->listMethods();
-
- try {
- $signatures = $this->getSignatureForEachMethodByMulticall($methods);
- } catch (Zend_XmlRpc_Client_FaultException $e) {
- // degrade to looping
- }
-
- if (empty($signatures)) {
- $signatures = $this->getSignatureForEachMethodByLooping($methods);
- }
-
- return $signatures;
- }
-
- /**
- * Attempt to get the method signatures in one request via system.multicall().
- * This is a boxcar feature of XML-RPC and is found on fewer servers. However,
- * can significantly improve performance if present.
- *
- * @param array $methods
- * @return array array(array(return, param, param, param...))
- */
- public function getSignatureForEachMethodByMulticall($methods = null)
- {
- if ($methods === null) {
- $methods = $this->listMethods();
- }
-
- $multicallParams = array();
- foreach ($methods as $method) {
- $multicallParams[] = array('methodName' => 'system.methodSignature',
- 'params' => array($method));
- }
-
- $serverSignatures = $this->_system->multicall($multicallParams);
-
- if (! is_array($serverSignatures)) {
- $type = gettype($serverSignatures);
- $error = "Multicall return is malformed. Expected array, got $type";
- throw new Zend_XmlRpc_Client_IntrospectException($error);
- }
-
- if (count($serverSignatures) != count($methods)) {
- $error = 'Bad number of signatures received from multicall';
- throw new Zend_XmlRpc_Client_IntrospectException($error);
- }
-
- // Create a new signatures array with the methods name as keys and the signature as value
- $signatures = array();
- foreach ($serverSignatures as $i => $signature) {
- $signatures[$methods[$i]] = $signature;
- }
-
- return $signatures;
- }
-
- /**
- * Get the method signatures for every method by
- * successively calling system.methodSignature
- *
- * @param array $methods
- * @return array
- */
- public function getSignatureForEachMethodByLooping($methods = null)
- {
- if ($methods === null) {
- $methods = $this->listMethods();
- }
-
- $signatures = array();
- foreach ($methods as $method) {
- $signatures[$method] = $this->getMethodSignature($method);
- }
-
- return $signatures;
- }
-
- /**
- * Call system.methodSignature() for the given method
- *
- * @param array $method
- * @return array array(array(return, param, param, param...))
- */
- public function getMethodSignature($method)
- {
- $signature = $this->_system->methodSignature($method);
- return $signature;
- }
-
- /**
- * Call system.listMethods()
- *
- * @param array $method
- * @return array array(method, method, method...)
- */
- public function listMethods()
- {
- return $this->_system->listMethods();
- }
-
-}
diff --git a/libs/Zend/XmlRpc/Client/ServerProxy.php b/libs/Zend/XmlRpc/Client/ServerProxy.php
deleted file mode 100755
index e057390fda..0000000000
--- a/libs/Zend/XmlRpc/Client/ServerProxy.php
+++ /dev/null
@@ -1,94 +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_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * The namespace decorator enables object chaining to permit
- * calling XML-RPC namespaced functions like "foo.bar.baz()"
- * as "$remote->foo->bar->baz()".
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Client
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Client_ServerProxy
-{
- /**
- * @var Zend_XmlRpc_Client
- */
- private $_client = null;
-
- /**
- * @var string
- */
- private $_namespace = '';
-
-
- /**
- * @var array of Zend_XmlRpc_Client_ServerProxy
- */
- private $_cache = array();
-
-
- /**
- * Class constructor
- *
- * @param string $namespace
- * @param Zend_XmlRpc_Client $client
- */
- public function __construct($client, $namespace = '')
- {
- $this->_namespace = $namespace;
- $this->_client = $client;
- }
-
-
- /**
- * Get the next successive namespace
- *
- * @param string $name
- * @return Zend_XmlRpc_Client_ServerProxy
- */
- public function __get($namespace)
- {
- $namespace = ltrim("$this->_namespace.$namespace", '.');
- if (!isset($this->_cache[$namespace])) {
- $this->_cache[$namespace] = new $this($this->_client, $namespace);
- }
- return $this->_cache[$namespace];
- }
-
-
- /**
- * Call a method in this namespace.
- *
- * @param string $methodN
- * @param array $args
- * @return mixed
- */
- public function __call($method, $args)
- {
- $method = ltrim("$this->_namespace.$method", '.');
- return $this->_client->call($method, $args);
- }
-}
diff --git a/libs/Zend/XmlRpc/Exception.php b/libs/Zend/XmlRpc/Exception.php
deleted file mode 100755
index 5f4ce41570..0000000000
--- a/libs/Zend/XmlRpc/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_XmlRpc
- * @copyright Copyright (c) 2005-2007 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_XmlRpc
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Exception extends Zend_Exception
-{}
-
diff --git a/libs/Zend/XmlRpc/Fault.php b/libs/Zend/XmlRpc/Fault.php
deleted file mode 100755
index 949ec5a57f..0000000000
--- a/libs/Zend/XmlRpc/Fault.php
+++ /dev/null
@@ -1,307 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_XmlRpc
- * @subpackage Server
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-/**
- * Zend_XmlRpc_Value
- */
-require_once 'Zend/XmlRpc/Value.php';
-
-/**
- * Zend_XmlRpc_Exception
- */
-require_once 'Zend/XmlRpc/Exception.php';
-
-/**
- * XMLRPC Faults
- *
- * Container for XMLRPC faults, containing both a code and a message;
- * additionally, has methods for determining if an XML response is an XMLRPC
- * fault, as well as generating the XML for an XMLRPC fault response.
- *
- * To allow method chaining, you may only use the {@link getInstance()} factory
- * to instantiate a Zend_XmlRpc_Server_Fault.
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_XmlRpc_Fault
-{
- /**
- * Fault code
- * @var int
- */
- protected $_code;
-
- /**
- * Fault character encoding
- * @var string
- */
- protected $_encoding = 'UTF-8';
-
- /**
- * Fault message
- * @var string
- */
- protected $_message;
-
- /**
- * Internal fault codes => messages
- * @var array
- */
- protected $_internal = array(
- 404 => 'Unknown Error',
-
- // 610 - 619 reflection errors
- 610 => 'Invalid method class',
- 611 => 'Unable to attach function or callback; not callable',
- 612 => 'Unable to load array; not an array',
- 613 => 'One or more method records are corrupt or otherwise unusable',
-
- // 620 - 629 dispatch errors
- 620 => 'Method does not exist',
- 621 => 'Error instantiating class to invoke method',
- 622 => 'Method missing implementation',
- 623 => 'Calling parameters do not match signature',
-
- // 630 - 639 request errors
- 630 => 'Unable to read request',
- 631 => 'Failed to parse request',
- 632 => 'Invalid request, no method passed; request must contain a \'methodName\' tag',
- 633 => 'Param must contain a value',
- 634 => 'Invalid method name',
- 635 => 'Invalid XML provided to request',
- 636 => 'Error creating xmlrpc value',
-
- // 640 - 649 system.* errors
- 640 => 'Method does not exist',
-
- // 650 - 659 response errors
- 650 => 'Invalid XML provided for response',
- 651 => 'Failed to parse response',
- 652 => 'Invalid response',
- 653 => 'Invalid XMLRPC value in response',
- );
-
- /**
- * Constructor
- *
- * @return Zend_XmlRpc_Fault
- */
- public function __construct($code = 404, $message = '')
- {
- $this->setCode($code);
- $code = $this->getCode();
-
- if (empty($message) && isset($this->_internal[$code])) {
- $message = $this->_internal[$code];
- } elseif (empty($message)) {
- $message = 'Unknown error';
- }
- $this->setMessage($message);
- }
-
- /**
- * Set the fault code
- *
- * @param int $code
- * @return Zend_XmlRpc_Fault
- */
- public function setCode($code)
- {
- $this->_code = (int) $code;
- return $this;
- }
-
- /**
- * Return fault code
- *
- * @return int
- */
- public function getCode()
- {
- return $this->_code;
- }
-
- /**
- * Retrieve fault message
- *
- * @param string
- * @return Zend_XmlRpc_Fault
- */
- public function setMessage($message)
- {
- $this->_message = (string) $message;
- return $this;
- }
-
- /**
- * Retrieve fault message
- *
- * @return string
- */
- public function getMessage()
- {
- return $this->_message;
- }
-
- /**
- * Set encoding to use in fault response
- *
- * @param string $encoding
- * @return Zend_XmlRpc_Fault
- */
- public function setEncoding($encoding)
- {
- $this->_encoding = $encoding;
- return $this;
- }
-
- /**
- * Retrieve current fault encoding
- *
- * @return string
- */
- public function getEncoding()
- {
- return $this->_encoding;
- }
-
- /**
- * Load an XMLRPC fault from XML
- *
- * @param string $fault
- * @return boolean Returns true if successfully loaded fault response, false
- * if response was not a fault response
- * @throws Zend_XmlRpc_Exception if no or faulty XML provided, or if fault
- * response does not contain either code or message
- */
- public function loadXml($fault)
- {
- if (!is_string($fault)) {
- throw new Zend_XmlRpc_Exception('Invalid XML provided to fault');
- }
-
- try {
- $xml = @new SimpleXMLElement($fault);
- } catch (Exception $e) {
- // Not valid XML
- throw new Zend_XmlRpc_Exception('Failed to parse XML fault: ' . $e->getMessage(), 500);
- }
-
- // Check for fault
- if (!$xml->fault) {
- // Not a fault
- return false;
- }
-
- if (!$xml->fault->value->struct) {
- // not a proper fault
- throw new Zend_XmlRpc_Exception('Invalid fault structure', 500);
- }
-
- $structXml = $xml->fault->value->asXML();
- $structXml = preg_replace('/<\?xml version=.*?\?>/i', '', $structXml);
- $struct = Zend_XmlRpc_Value::getXmlRpcValue(trim($structXml), Zend_XmlRpc_Value::XML_STRING);
- $struct = $struct->getValue();
-
- if (isset($struct['faultCode'])) {
- $code = $struct['faultCode'];
- }
- if (isset($struct['faultString'])) {
- $message = $struct['faultString'];
- }
-
- if (empty($code) && empty($message)) {
- throw new Zend_XmlRpc_Exception('Fault code and string required');
- }
-
- if (empty($code)) {
- $code = '404';
- }
-
- if (empty($message)) {
- if (isset($this->_internal[$code])) {
- $message = $this->_internal[$code];
- } else {
- $message = 'Unknown Error';
- }
- }
-
- $this->setCode($code);
- $this->setMessage($message);
-
- return true;
- }
-
- /**
- * Determine if an XML response is an XMLRPC fault
- *
- * @param string $xml
- * @return boolean
- */
- public static function isFault($xml)
- {
- $fault = new self();
- try {
- $isFault = $fault->loadXml($xml);
- } catch (Zend_XmlRpc_Exception $e) {
- $isFault = false;
- }
-
- return $isFault;
- }
-
- /**
- * Serialize fault to XML
- *
- * @return string
- */
- public function saveXML()
- {
- // Create fault value
- $faultStruct = array(
- 'faultCode' => $this->getCode(),
- 'faultString' => $this->getMessage()
- );
- $value = Zend_XmlRpc_Value::getXmlRpcValue($faultStruct);
- $valueDOM = new DOMDocument('1.0', $this->getEncoding());
- $valueDOM->loadXML($value->saveXML());
-
- // Build response XML
- $dom = new DOMDocument('1.0', 'ISO-8859-1');
- $r = $dom->appendChild($dom->createElement('methodResponse'));
- $f = $r->appendChild($dom->createElement('fault'));
- $f->appendChild($dom->importNode($valueDOM->documentElement, 1));
-
- return $dom->saveXML();
- }
-
- /**
- * Return XML fault response
- *
- * @return string
- */
- public function __toString()
- {
- return $this->saveXML();
- }
-}
diff --git a/libs/Zend/XmlRpc/Request.php b/libs/Zend/XmlRpc/Request.php
deleted file mode 100755
index 9f0205151a..0000000000
--- a/libs/Zend/XmlRpc/Request.php
+++ /dev/null
@@ -1,381 +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_Controller
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_XmlRpc_Exception
- */
-require_once 'Zend/XmlRpc/Exception.php';
-
-/**
- * Zend_XmlRpc_Value
- */
-require_once 'Zend/XmlRpc/Value.php';
-
-/**
- * Zend_XmlRpc_Fault
- */
-require_once 'Zend/XmlRpc/Fault.php';
-
-/**
- * XmlRpc Request object
- *
- * Encapsulates an XmlRpc request, holding the method call and all parameters.
- * Provides accessors for these, as well as the ability to load from XML and to
- * create the XML request string.
- *
- * Additionally, if errors occur setting the method or parsing XML, a fault is
- * generated and stored in {@link $_fault}; developers may check for it using
- * {@link isFault()} and {@link getFault()}.
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-class Zend_XmlRpc_Request
-{
- /**
- * Request character encoding
- * @var string
- */
- protected $_encoding = 'UTF-8';
-
- /**
- * Method to call
- * @var string
- */
- protected $_method;
-
- /**
- * XML request
- * @var string
- */
- protected $_xml;
-
- /**
- * Method parameters
- * @var array
- */
- protected $_params = array();
-
- /**
- * Fault object, if any
- * @var Zend_XmlRpc_Fault
- */
- protected $_fault = null;
-
-
- /**
- * Create a new XML-RPC request
- *
- * @param string method (optional)
- * @param array params (optional)
- */
- public function __construct($method = null, $params = null)
- {
- if ($method !== null) {
- $this->setMethod($method);
- }
-
- if ($params !== null) {
- $this->setParams($params);
- }
- }
-
-
- /**
- * Set encoding to use in request
- *
- * @param string $encoding
- * @return Zend_XmlRpc_Request
- */
- public function setEncoding($encoding)
- {
- $this->_encoding = $encoding;
- return $this;
- }
-
- /**
- * Retrieve current request encoding
- *
- * @return string
- */
- public function getEncoding()
- {
- return $this->_encoding;
- }
-
- /**
- * Set method to call
- *
- * @param string $method
- * @return boolean Returns true on success, false if method name is invalid
- */
- public function setMethod($method)
- {
- if (!is_string($method) || !preg_match('/^[a-z0-9_.:\/]+$/i', $method)) {
- $this->_fault = new Zend_XmlRpc_Fault(634, 'Invalid method name ("' . $method . '")');
- $this->_fault->setEncoding($this->getEncoding());
- return false;
- }
-
- $this->_method = $method;
- return true;
- }
-
- /**
- * Retrieve call method
- *
- * @return string
- */
- public function getMethod()
- {
- return $this->_method;
- }
-
- /**
- * Add a parameter to the parameter stack
- *
- * Adds a parameter to the parameter stack, associating it with the type
- * $type if provided
- *
- * @param mixed $value
- * @param string $type Optional; type hinting
- * @return void
- */
- public function addParam($value, $type = null)
- {
- $this->_params[] = $value;
- $this->_xmlRpcParams[] = array('value' => $value, 'type' => $type);
- }
-
- /**
- * Set the parameters array
- *
- * If called with a single, array value, that array is used to set the
- * parameters stack. If called with multiple values or a single non-array
- * value, the arguments are used to set the parameters stack.
- *
- * Best is to call with array of the format, in order to allow type hinting
- * when creating the XMLRPC values for each parameter:
- * <code>
- * $array = array(
- * array(
- * 'value' => $value,
- * 'type' => $type
- * )[, ... ]
- * );
- * </code>
- *
- * @access public
- * @return void
- */
- public function setParams()
- {
- $argc = func_num_args();
- $argv = func_get_args();
- if (0 == $argc) {
- return;
- }
-
- if ((1 == $argc) && is_array($argv[0])) {
- $params = array();
- $wellFormed = true;
- foreach ($argv[0] as $arg) {
- if (!is_array($arg) || !isset($arg['value'])) {
- $wellFormed = false;
- break;
- }
- $params[] = $arg['value'];
- }
- if ($wellFormed) {
- $this->_xmlRpcParams = $argv[0];
- $this->_params = $params;
- } else {
- $this->_params = $argv[0];
- $xmlRpcParams = array();
- foreach ($argv[0] as $arg) {
- $xmlRpcParams[]= array('value' => $arg, 'type' => null);
- }
- $this->_xmlRpcParams = $xmlRpcParams;
- }
- return;
- }
-
- $this->_params = $argv;
- $xmlRpcParams = array();
- foreach ($argv as $arg) {
- $xmlRpcParams[]= array('value' => $arg, 'type' => null);
- }
- $this->_xmlRpcParams = $xmlRpcParams;
- }
-
- /**
- * Retrieve the array of parameters
- *
- * @return array
- */
- public function getParams()
- {
- return $this->_params;
- }
-
- /**
- * Load XML and parse into request components
- *
- * @param string $request
- * @return boolean True on success, false if an error occurred.
- */
- public function loadXml($request)
- {
- if (!is_string($request)) {
- $this->_fault = new Zend_XmlRpc_Fault(635);
- $this->_fault->setEncoding($this->getEncoding());
- return false;
- }
-
- try {
- $xml = @new SimpleXMLElement($request);
- } catch (Exception $e) {
- // Not valid XML
- $this->_fault = new Zend_XmlRpc_Fault(631);
- $this->_fault->setEncoding($this->getEncoding());
- return false;
- }
-
- // Check for method name
- if (empty($xml->methodName)) {
- // Missing method name
- $this->_fault = new Zend_XmlRpc_Fault(632);
- $this->_fault->setEncoding($this->getEncoding());
- return false;
- }
-
- $this->_method = (string) $xml->methodName;
-
- // Check for parameters
- if (!empty($xml->params)) {
- $argv = array();
- foreach ($xml->params->children() as $param) {
- if (! $param->value instanceof SimpleXMLElement) {
- $this->_fault = new Zend_XmlRpc_Fault(633);
- $this->_fault->setEncoding($this->getEncoding());
- return false;
- }
-
- try {
- $argv[] = Zend_XmlRpc_Value::getXmlRpcValue($param->value, Zend_XmlRpc_Value::XML_STRING)->getValue();
- } catch (Exception $e) {
- $this->_fault = new Zend_XmlRpc_Fault(636);
- $this->_fault->setEncoding($this->getEncoding());
- return false;
- }
- }
-
- $this->_params = $argv;
- }
-
- $this->_xml = $request;
-
- return true;
- }
-
- /**
- * Does the current request contain errors and should it return a fault
- * response?
- *
- * @return boolean
- */
- public function isFault()
- {
- return $this->_fault instanceof Zend_XmlRpc_Fault;
- }
-
- /**
- * Retrieve the fault response, if any
- *
- * @return null|Zend_XmlRpc_Fault
- */
- public function getFault()
- {
- return $this->_fault;
- }
-
- /**
- * Retrieve method parameters as XMLRPC values
- *
- * @return array
- */
- protected function _getXmlRpcParams()
- {
- $params = array();
- if (is_array($this->_xmlRpcParams)) {
- foreach ($this->_xmlRpcParams as $param) {
- $value = $param['value'];
- $type = isset($param['type']) ? $param['type'] : Zend_XmlRpc_Value::AUTO_DETECT_TYPE;
-
- $params[] = Zend_XmlRpc_Value::getXmlRpcValue($value, $type);
- }
- }
-
- return $params;
- }
-
- /**
- * Create XML request
- *
- * @return string
- */
- public function saveXML()
- {
- $args = $this->_getXmlRpcParams();
- $method = $this->getMethod();
-
- $dom = new DOMDocument('1.0', $this->getEncoding());
- $mCall = $dom->appendChild($dom->createElement('methodCall'));
- $mName = $mCall->appendChild($dom->createElement('methodName', $method));
-
- if (is_array($args) && count($args)) {
- $params = $mCall->appendChild($dom->createElement('params'));
-
- foreach ($args as $arg) {
- /* @var $arg Zend_XmlRpc_Value */
- $argDOM = new DOMDocument('1.0', $this->getEncoding());
- $argDOM->loadXML($arg->saveXML());
-
- $param = $params->appendChild($dom->createElement('param'));
- $param->appendChild($dom->importNode($argDOM->documentElement, 1));
- }
- }
-
- return $dom->saveXML();
- }
-
- /**
- * Return XML request
- *
- * @return string
- */
- public function __toString()
- {
- return $this->saveXML();
- }
-}
diff --git a/libs/Zend/XmlRpc/Request/Http.php b/libs/Zend/XmlRpc/Request/Http.php
deleted file mode 100755
index 1702d9c1c7..0000000000
--- a/libs/Zend/XmlRpc/Request/Http.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_Controller
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_XmlRpc_Request
- */
-require_once 'Zend/XmlRpc/Request.php';
-
-/**
- * XmlRpc Request object -- Request via HTTP
- *
- * Extends {@link Zend_XmlRpc_Request} to accept a request via HTTP. Request is
- * built at construction time using a raw POST; if no data is available, the
- * request is declared a fault.
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-class Zend_XmlRpc_Request_Http extends Zend_XmlRpc_Request
-{
- /**
- * Array of headers
- * @var array
- */
- protected $_headers;
-
- /**
- * Raw XML as received via request
- * @var string
- */
- protected $_xml;
-
- /**
- * Constructor
- *
- * Attempts to read from php://input to get raw POST request; if an error
- * occurs in doing so, or if the XML is invalid, the request is declared a
- * fault.
- *
- * @return void
- */
- public function __construct()
- {
- $fh = fopen('php://input', 'r');
- if (!$fh) {
- $this->_fault = new Zend_XmlRpc_Server_Exception(630);
- return;
- }
-
- $xml = '';
- while (!feof($fh)) {
- $xml .= fgets($fh);
- }
- fclose($fh);
-
- $this->_xml = $xml;
-
- $this->loadXml($xml);
- }
-
- /**
- * Retrieve the raw XML request
- *
- * @return string
- */
- public function getRawRequest()
- {
- return $this->_xml;
- }
-
- /**
- * Get headers
- *
- * Gets all headers as key => value pairs and returns them.
- *
- * @return array
- */
- public function getHeaders()
- {
- if (null === $this->_headers) {
- $this->_headers = array();
- foreach ($_SERVER as $key => $value) {
- if ('HTTP_' == substr($key, 0, 5)) {
- $header = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5)))));
- $this->_headers[$header] = $value;
- }
- }
- }
-
- return $this->_headers;
- }
-
- /**
- * Retrieve the full HTTP request, including headers and XML
- *
- * @return string
- */
- public function getFullRequest()
- {
- $request = '';
- foreach ($this->getHeaders() as $key => $value) {
- $request .= $key . ': ' . $value . "\n";
- }
-
- $request .= $this->_xml;
-
- return $request;
- }
-}
diff --git a/libs/Zend/XmlRpc/Request/Stdin.php b/libs/Zend/XmlRpc/Request/Stdin.php
deleted file mode 100755
index 131a74990b..0000000000
--- a/libs/Zend/XmlRpc/Request/Stdin.php
+++ /dev/null
@@ -1,84 +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_Controller
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_XmlRpc_Request
- */
-require_once 'Zend/XmlRpc/Request.php';
-
-/**
- * XmlRpc Request object -- Request via STDIN
- *
- * Extends {@link Zend_XmlRpc_Request} to accept a request via STDIN. Request is
- * built at construction time using data from STDIN; if no data is available, the
- * request is declared a fault.
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-class Zend_XmlRpc_Request_Stdin extends Zend_XmlRpc_Request
-{
- /**
- * Raw XML as received via request
- * @var string
- */
- protected $_xml;
-
- /**
- * Constructor
- *
- * Attempts to read from php://stdin to get raw POST request; if an error
- * occurs in doing so, or if the XML is invalid, the request is declared a
- * fault.
- *
- * @return void
- */
- public function __construct()
- {
- $fh = fopen('php://stdin', 'r');
- if (!$fh) {
- $this->_fault = new Zend_XmlRpc_Server_Exception(630);
- return;
- }
-
- $xml = '';
- while (!feof($fh)) {
- $xml .= fgets($fh);
- }
- fclose($fh);
-
- $this->_xml = $xml;
-
- $this->loadXml($xml);
- }
-
- /**
- * Retrieve the raw XML request
- *
- * @return string
- */
- public function getRawRequest()
- {
- return $this->_xml;
- }
-}
diff --git a/libs/Zend/XmlRpc/Response.php b/libs/Zend/XmlRpc/Response.php
deleted file mode 100755
index b4789de51a..0000000000
--- a/libs/Zend/XmlRpc/Response.php
+++ /dev/null
@@ -1,249 +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_Controller
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_XmlRpc_Value
- */
-require_once 'Zend/XmlRpc/Value.php';
-
-/**
- * Zend_XmlRpc_Fault
- */
-require_once 'Zend/XmlRpc/Fault.php';
-
-/**
- * XmlRpc Response
- *
- * Container for accessing an XMLRPC return value and creating the XML response.
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-class Zend_XmlRpc_Response
-{
- /**
- * Return value
- * @var mixed
- */
- protected $_return;
-
- /**
- * Return type
- * @var string
- */
- protected $_type;
-
- /**
- * Response character encoding
- * @var string
- */
- protected $_encoding = 'UTF-8';
-
- /**
- * Fault, if response is a fault response
- * @var null|Zend_XmlRpc_Fault
- */
- protected $_fault = null;
-
- /**
- * Constructor
- *
- * Can optionally pass in the return value and type hinting; otherwise, the
- * return value can be set via {@link setReturnValue()}.
- *
- * @param mixed $return
- * @param string $type
- * @return void
- */
- public function __construct($return = null, $type = null)
- {
- $this->setReturnValue($return, $type);
- }
-
- /**
- * Set encoding to use in response
- *
- * @param string $encoding
- * @return Zend_XmlRpc_Response
- */
- public function setEncoding($encoding)
- {
- $this->_encoding = $encoding;
- return $this;
- }
-
- /**
- * Retrieve current response encoding
- *
- * @return string
- */
- public function getEncoding()
- {
- return $this->_encoding;
- }
-
- /**
- * Set the return value
- *
- * Sets the return value, with optional type hinting if provided.
- *
- * @param mixed $value
- * @param string $type
- * @return void
- */
- public function setReturnValue($value, $type = null)
- {
- $this->_return = $value;
- $this->_type = (string) $type;
- }
-
- /**
- * Retrieve the return value
- *
- * @return mixed
- */
- public function getReturnValue()
- {
- return $this->_return;
- }
-
- /**
- * Retrieve the XMLRPC value for the return value
- *
- * @return Zend_XmlRpc_Value
- */
- protected function _getXmlRpcReturn()
- {
- return Zend_XmlRpc_Value::getXmlRpcValue($this->_return);
- }
-
- /**
- * Is the response a fault response?
- *
- * @return boolean
- */
- public function isFault()
- {
- return $this->_fault instanceof Zend_XmlRpc_Fault;
- }
-
- /**
- * Returns the fault, if any.
- *
- * @return null|Zend_XmlRpc_Fault
- */
- public function getFault()
- {
- return $this->_fault;
- }
-
- /**
- * Load a response from an XML response
- *
- * Attempts to load a response from an XMLRPC response, autodetecting if it
- * is a fault response.
- *
- * @param string $response
- * @return boolean True if a valid XMLRPC response, false if a fault
- * response or invalid input
- */
- public function loadXml($response)
- {
- if (!is_string($response)) {
- $this->_fault = new Zend_XmlRpc_Fault(650);
- $this->_fault->setEncoding($this->getEncoding());
- return false;
- }
-
- try {
- $xml = @new SimpleXMLElement($response);
- } catch (Exception $e) {
- // Not valid XML
- $this->_fault = new Zend_XmlRpc_Fault(651);
- $this->_fault->setEncoding($this->getEncoding());
- return false;
- }
-
- if (!empty($xml->fault)) {
- // fault response
- $this->_fault = new Zend_XmlRpc_Fault();
- $this->_fault->setEncoding($this->getEncoding());
- $this->_fault->loadXml($response);
- return false;
- }
-
- if (empty($xml->params)) {
- // Invalid response
- $this->_fault = new Zend_XmlRpc_Fault(652);
- $this->_fault->setEncoding($this->getEncoding());
- return false;
- }
-
- try {
- if (!isset($xml->params) || !isset($xml->params->param) || !isset($xml->params->param->value)) {
- throw new Zend_XmlRpc_Value_Exception('Missing XML-RPC value in XML');
- }
- $valueXml = $xml->params->param->value->asXML();
- $valueXml = preg_replace('/<\?xml version=.*?\?>/i', '', $valueXml);
- $value = Zend_XmlRpc_Value::getXmlRpcValue(trim($valueXml), Zend_XmlRpc_Value::XML_STRING);
- } catch (Zend_XmlRpc_Value_Exception $e) {
- $this->_fault = new Zend_XmlRpc_Fault(653);
- $this->_fault->setEncoding($this->getEncoding());
- return false;
- }
-
- $this->setReturnValue($value->getValue());
- return true;
- }
-
- /**
- * Return response as XML
- *
- * @return string
- */
- public function saveXML()
- {
- $value = $this->_getXmlRpcReturn();
- $valueDOM = new DOMDocument('1.0', $this->getEncoding());
- $valueDOM->loadXML($value->saveXML());
-
- $dom = new DOMDocument('1.0', $this->getEncoding());
- $response = $dom->appendChild($dom->createElement('methodResponse'));
- $params = $response->appendChild($dom->createElement('params'));
- $param = $params->appendChild($dom->createElement('param'));
-
- $param->appendChild($dom->importNode($valueDOM->documentElement, true));
-
- return $dom->saveXML();
- }
-
- /**
- * Return XML response
- *
- * @return string
- */
- public function __toString()
- {
- return $this->saveXML();
- }
-}
diff --git a/libs/Zend/XmlRpc/Response/Http.php b/libs/Zend/XmlRpc/Response/Http.php
deleted file mode 100755
index 7a11b36cf6..0000000000
--- a/libs/Zend/XmlRpc/Response/Http.php
+++ /dev/null
@@ -1,51 +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_Controller
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-/**
- * Zend_XmlRpc_Response
- */
-require_once 'Zend/XmlRpc/Response.php';
-
-/**
- * HTTP response
- *
- * @uses Zend_XmlRpc_Response
- * @category Zend
- * @package Zend_XmlRpc
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
-class Zend_XmlRpc_Response_Http extends Zend_XmlRpc_Response
-{
- /**
- * Override __toString() to send HTTP Content-Type header
- *
- * @return string
- */
- public function __toString()
- {
- if (!headers_sent()) {
- header('Content-Type: application/xml; charset=' . strtolower($this->getEncoding()));
- }
-
- return parent::__toString();
- }
-}
diff --git a/libs/Zend/XmlRpc/Server.php b/libs/Zend/XmlRpc/Server.php
deleted file mode 100755
index b33f4a1474..0000000000
--- a/libs/Zend/XmlRpc/Server.php
+++ /dev/null
@@ -1,728 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_XmlRpc
- * @subpackage Server
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-/**
- * Implement Zend_Server_Interface
- */
-require_once 'Zend/Server/Interface.php';
-
-/**
- * Exception this class throws
- */
-require_once 'Zend/XmlRpc/Server/Exception.php';
-
-/**
- * XMLRPC Request
- */
-require_once 'Zend/XmlRpc/Request.php';
-
-/**
- * XMLRPC Response
- */
-require_once 'Zend/XmlRpc/Response.php';
-
-/**
- * XMLRPC HTTP Response
- */
-require_once 'Zend/XmlRpc/Response/Http.php';
-
-/**
- * XMLRPC server fault class
- */
-require_once 'Zend/XmlRpc/Server/Fault.php';
-
-/**
- * Convert PHP to and from xmlrpc native types
- */
-require_once 'Zend/XmlRpc/Value.php';
-
-/**
- * Reflection API for function/method introspection
- */
-require_once 'Zend/Server/Reflection.php';
-
-/**
- * Zend_Server_Reflection_Function_Abstract
- */
-require_once 'Zend/Server/Reflection/Function/Abstract.php';
-
-/**
- * Specifically grab the Zend_Server_Reflection_Method for manually setting up
- * system.* methods and handling callbacks in {@link loadFunctions()}.
- */
-require_once 'Zend/Server/Reflection/Method.php';
-
-/**
- * An XML-RPC server implementation
- *
- * Example:
- * <code>
- * require_once 'Zend/XmlRpc/Server.php';
- * require_once 'Zend/XmlRpc/Server/Cache.php';
- * require_once 'Zend/XmlRpc/Server/Fault.php';
- * require_once 'My/Exception.php';
- * require_once 'My/Fault/Observer.php';
- *
- * // Instantiate server
- * $server = new Zend_XmlRpc_Server();
- *
- * // Allow some exceptions to report as fault responses:
- * Zend_XmlRpc_Server_Fault::attachFaultException('My_Exception');
- * Zend_XmlRpc_Server_Fault::attachObserver('My_Fault_Observer');
- *
- * // Get or build dispatch table:
- * if (!Zend_XmlRpc_Server_Cache::get($filename, $server)) {
- * require_once 'Some/Service/Class.php';
- * require_once 'Another/Service/Class.php';
- *
- * // Attach Some_Service_Class in 'some' namespace
- * $server->setClass('Some_Service_Class', 'some');
- *
- * // Attach Another_Service_Class in 'another' namespace
- * $server->setClass('Another_Service_Class', 'another');
- *
- * // Create dispatch table cache file
- * Zend_XmlRpc_Server_Cache::save($filename, $server);
- * }
- *
- * $response = $server->handle();
- * echo $response;
- * </code>
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Server
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_XmlRpc_Server
-{
- /**
- * Character encoding
- * @var string
- */
- protected $_encoding = 'UTF-8';
-
- /**
- * Array of dispatchables
- * @var array
- */
- protected $_methods = array();
-
- /**
- * Request processed
- * @var null|Zend_XmlRpc_Request
- */
- protected $_request = null;
-
- /**
- * Class to use for responses; defaults to {@link Zend_XmlRpc_Response_Http}
- * @var string
- */
- protected $_responseClass = 'Zend_XmlRpc_Response_Http';
-
- /**
- * Dispatch table of name => method pairs
- * @var array
- */
- protected $_table = array();
-
- /**
- * PHP types => XML-RPC types
- * @var array
- */
- protected $_typeMap = array(
- 'i4' => 'i4',
- 'int' => 'int',
- 'integer' => 'int',
- 'double' => 'double',
- 'float' => 'double',
- 'real' => 'double',
- 'boolean' => 'boolean',
- 'bool' => 'boolean',
- 'true' => 'boolean',
- 'false' => 'boolean',
- 'string' => 'string',
- 'str' => 'string',
- 'base64' => 'base64',
- 'dateTime.iso8601' => 'dateTime.iso8601',
- 'date' => 'dateTime.iso8601',
- 'time' => 'dateTime.iso8601',
- 'time' => 'dateTime.iso8601',
- 'array' => 'array',
- 'struct' => 'struct',
- 'null' => 'void',
- 'void' => 'void',
- 'mixed' => 'struct'
- );
-
- /**
- * Constructor
- *
- * Creates system.* methods.
- *
- * @return void
- */
- public function __construct()
- {
- // Setup system.* methods
- $system = array(
- 'listMethods',
- 'methodHelp',
- 'methodSignature',
- 'multicall'
- );
-
- $class = Zend_Server_Reflection::reflectClass($this);
- foreach ($system as $method) {
- $reflection = new Zend_Server_Reflection_Method($class, new ReflectionMethod($this, $method), 'system');
- $reflection->system = true;
- $this->_methods[] = $reflection;
- }
-
- $this->_buildDispatchTable();
- }
-
- /**
- * Map PHP parameter types to XML-RPC types
- *
- * @param Zend_Server_Reflection_Function_Abstract $method
- * @return void
- */
- protected function _fixTypes(Zend_Server_Reflection_Function_Abstract $method)
- {
- foreach ($method->getPrototypes() as $prototype) {
- foreach ($prototype->getParameters() as $param) {
- $pType = $param->getType();
- if (isset($this->_typeMap[$pType])) {
- $param->setType($this->_typeMap[$pType]);
- } else {
- $param->setType('void');
- }
- }
- }
- }
-
- /**
- * Re/Build the dispatch table
- *
- * The dispatch table consists of a an array of method name =>
- * Zend_Server_Reflection_Function_Abstract pairs
- *
- * @return void
- */
- protected function _buildDispatchTable()
- {
- $table = array();
- foreach ($this->_methods as $dispatchable) {
- if ($dispatchable instanceof Zend_Server_Reflection_Function_Abstract) {
- // function/method call
- $ns = $dispatchable->getNamespace();
- $name = $dispatchable->getName();
- $name = empty($ns) ? $name : $ns . '.' . $name;
-
- if (isset($table[$name])) {
- throw new Zend_XmlRpc_Server_Exception('Duplicate method registered: ' . $name);
- }
- $table[$name] = $dispatchable;
- $this->_fixTypes($dispatchable);
-
- continue;
- }
-
- if ($dispatchable instanceof Zend_Server_Reflection_Class) {
- foreach ($dispatchable->getMethods() as $method) {
- $ns = $method->getNamespace();
- $name = $method->getName();
- $name = empty($ns) ? $name : $ns . '.' . $name;
-
- if (isset($table[$name])) {
- throw new Zend_XmlRpc_Server_Exception('Duplicate method registered: ' . $name);
- }
- $table[$name] = $method;
- $this->_fixTypes($method);
- continue;
- }
- }
- }
-
- $this->_table = $table;
- }
-
- /**
- * Set encoding
- *
- * @param string $encoding
- * @return Zend_XmlRpc_Server
- */
- public function setEncoding($encoding)
- {
- $this->_encoding = $encoding;
- return $this;
- }
-
- /**
- * Retrieve current encoding
- *
- * @return string
- */
- public function getEncoding()
- {
- return $this->_encoding;
- }
-
- /**
- * Attach a callback as an XMLRPC method
- *
- * Attaches a callback as an XMLRPC method, prefixing the XMLRPC method name
- * with $namespace, if provided. Reflection is done on the callback's
- * docblock to create the methodHelp for the XMLRPC method.
- *
- * Additional arguments to pass to the function at dispatch may be passed;
- * any arguments following the namespace will be aggregated and passed at
- * dispatch time.
- *
- * @param string|array $function Valid callback
- * @param string $namespace Optional namespace prefix
- * @return void
- * @throws Zend_XmlRpc_Server_Exception
- */
- public function addFunction($function, $namespace = '')
- {
- if (!is_string($function) && !is_array($function)) {
- throw new Zend_XmlRpc_Server_Exception('Unable to attach function; invalid', 611);
- }
-
- $argv = null;
- if (2 < func_num_args()) {
- $argv = func_get_args();
- $argv = array_slice($argv, 2);
- }
-
- $function = (array) $function;
- foreach ($function as $func) {
- if (!is_string($func) || !function_exists($func)) {
- throw new Zend_XmlRpc_Server_Exception('Unable to attach function; invalid', 611);
- }
- $this->_methods[] = Zend_Server_Reflection::reflectFunction($func, $argv, $namespace);
- }
-
- $this->_buildDispatchTable();
- }
-
- /**
- * Load methods as returned from {@link getFunctions}
- *
- * Typically, you will not use this method; it will be called using the
- * results pulled from {@link Zend_XmlRpc_Server_Cache::get()}.
- *
- * @param array $array
- * @return void
- * @throws Zend_XmlRpc_Server_Exception on invalid input
- */
- public function loadFunctions($array)
- {
- if (!is_array($array)) {
- throw new Zend_XmlRpc_Server_Exception('Unable to load array; not an array', 612);
- }
-
- foreach ($array as $key => $value) {
- if (!$value instanceof Zend_Server_Reflection_Function_Abstract
- && !$value instanceof Zend_Server_Reflection_Class)
- {
- throw new Zend_XmlRpc_Server_Exception('One or more method records are corrupt or otherwise unusable', 613);
- }
-
- if ($value->system) {
- unset($array[$key]);
- }
- }
-
- foreach ($array as $dispatchable) {
- $this->_methods[] = $dispatchable;
- }
-
- $this->_buildDispatchTable();
- }
-
- /**
- * Do nothing; persistence is handled via {@link Zend_XmlRpc_Server_Cache}
- *
- * @param mixed $class
- * @return void
- */
- public function setPersistence($class = null)
- {
- }
-
- /**
- * Attach class methods as XMLRPC method handlers
- *
- * $class may be either a class name or an object. Reflection is done on the
- * class or object to determine the available public methods, and each is
- * attached to the server as an available method; if a $namespace has been
- * provided, that namespace is used to prefix the XMLRPC method names.
- *
- * Any additional arguments beyond $namespace will be passed to a method at
- * invocation.
- *
- * @param string|object $class
- * @param string $namespace Optional
- * @param mixed $argv Optional arguments to pass to methods
- * @return void
- * @throws Zend_XmlRpc_Server_Exception on invalid input
- */
- public function setClass($class, $namespace = '', $argv = null)
- {
- if (is_string($class) && !class_exists($class)) {
- if (!class_exists($class)) {
- throw new Zend_XmlRpc_Server_Exception('Invalid method class', 610);
- }
- }
-
- $argv = null;
- if (3 < func_num_args()) {
- $argv = func_get_args();
- $argv = array_slice($argv, 3);
- }
-
- $this->_methods[] = Zend_Server_Reflection::reflectClass($class, $argv, $namespace);
- $this->_buildDispatchTable();
- }
-
- /**
- * Set the request object
- *
- * @param string|Zend_XmlRpc_Request $request
- * @return Zend_XmlRpc_Server
- * @throws Zend_XmlRpc_Server_Exception on invalid request class or object
- */
- public function setRequest($request)
- {
- if (is_string($request) && class_exists($request)) {
- $request = new $request();
- if (!$request instanceof Zend_XmlRpc_Request) {
- throw new Zend_XmlRpc_Server_Exception('Invalid request class');
- }
- $request->setEncoding($this->getEncoding());
- } elseif (!$request instanceof Zend_XmlRpc_Request) {
- throw new Zend_XmlRpc_Server_Exception('Invalid request object');
- }
-
- $this->_request = $request;
- return $this;
- }
-
- /**
- * Return currently registered request object
- *
- * @return null|Zend_XmlRpc_Request
- */
- public function getRequest()
- {
- return $this->_request;
- }
-
- /**
- * Raise an xmlrpc server fault
- *
- * @param string|Exception $fault
- * @param int $code
- * @return Zend_XmlRpc_Server_Fault
- */
- public function fault($fault, $code = 404)
- {
- if (!$fault instanceof Exception) {
- $fault = (string) $fault;
- $fault = new Zend_XmlRpc_Server_Exception($fault, $code);
- }
-
- return Zend_XmlRpc_Server_Fault::getInstance($fault);
- }
-
- /**
- * Handle an xmlrpc call (actual work)
- *
- * @param Zend_XmlRpc_Request $request
- * @return Zend_XmlRpc_Response
- * @throws Zend_XmlRpcServer_Exception|Exception
- * Zend_XmlRpcServer_Exceptions are thrown for internal errors; otherwise,
- * any other exception may be thrown by the callback
- */
- protected function _handle(Zend_XmlRpc_Request $request)
- {
- $method = $request->getMethod();
-
- // Check for valid method
- if (!isset($this->_table[$method])) {
- throw new Zend_XmlRpc_Server_Exception('Method "' . $method . '" does not exist', 620);
- }
-
- $info = $this->_table[$method];
- $params = $request->getParams();
- $argv = $info->getInvokeArguments();
- if (0 < count($argv)) {
- $params = array_merge($params, $argv);
- }
-
- // Check calling parameters against signatures
- $matched = false;
- $sigCalled = array();
- foreach ($params as $param) {
- $value = Zend_XmlRpc_Value::getXmlRpcValue($param);
- $sigCalled[] = $value->getType();
- }
- $signatures = $info->getPrototypes();
- foreach ($signatures as $signature) {
- $sigParams = $signature->getParameters();
- $tmpParams = array();
- foreach ($sigParams as $param) {
- $tmpParams[] = $param->getType();
- }
- if ($sigCalled === $tmpParams) {
- $matched = true;
- break;
- }
- }
- if (!$matched) {
- throw new Zend_XmlRpc_Server_Exception('Calling parameters do not match signature', 623);
- }
-
- if ($info instanceof Zend_Server_Reflection_Function) {
- $func = $info->getName();
- $return = call_user_func_array($func, $params);
- } elseif (($info instanceof Zend_Server_Reflection_Method) && $info->system) {
- // System methods
- $return = $info->invokeArgs($this, $params);
- } elseif ($info instanceof Zend_Server_Reflection_Method) {
- // Get class
- $class = $info->getDeclaringClass()->getName();
-
- if ('static' == $info->isStatic()) {
- // for some reason, invokeArgs() does not work the same as
- // invoke(), and expects the first argument to be an object.
- // So, using a callback if the method is static.
- $return = call_user_func_array(array($class, $info->getName()), $params);
- } else {
- // Object methods
- try {
- $object = $info->getDeclaringClass()->newInstance();
- } catch (Exception $e) {
- throw new Zend_XmlRpc_Server_Exception('Error instantiating class ' . $class . ' to invoke method ' . $info->getName(), 621);
- }
-
- $return = $info->invokeArgs($object, $params);
- }
- } else {
- throw new Zend_XmlRpc_Server_Exception('Method missing implementation ' . get_class($info), 622);
- }
-
- $response = new ReflectionClass($this->_responseClass);
- return $response->newInstance($return);
- }
-
- /**
- * Handle an xmlrpc call
- *
- * @param Zend_XmlRpc_Request $request Optional
- * @return Zend_XmlRpc_Response|Zend_XmlRpc_Fault
- */
- public function handle(Zend_XmlRpc_Request $request = null)
- {
- // Get request
- if ((null === $request) && (null === ($request = $this->getRequest()))) {
- require_once 'Zend/XmlRpc/Request/Http.php';
- $request = new Zend_XmlRpc_Request_Http();
- $request->setEncoding($this->getEncoding());
- }
-
- $this->setRequest($request);
-
- if ($request->isFault()) {
- $response = $request->getFault();
- } else {
- try {
- $response = $this->_handle($request);
- } catch (Exception $e) {
- $response = $this->fault($e);
- }
- }
-
- // Set output encoding
- $response->setEncoding($this->getEncoding());
-
- return $response;
- }
-
- /**
- * Set the class to use for the response
- *
- * @param string $class
- * @return boolean True if class was set, false if not
- */
- public function setResponseClass($class)
- {
- if (class_exists($class)) {
- $reflection = new ReflectionClass($class);
- if ($reflection->isSubclassOf(new ReflectionClass('Zend_XmlRpc_Response'))) {
- $this->_responseClass = $class;
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Returns a list of registered methods
- *
- * Returns an array of dispatchables (Zend_Server_Reflection_Function,
- * _Method, and _Class items).
- *
- * @return array
- */
- public function getFunctions()
- {
- $return = array();
- foreach ($this->_methods as $method) {
- if ($method instanceof Zend_Server_Reflection_Class
- && ($method->system))
- {
- continue;
- }
-
- $return[] = $method;
- }
-
- return $return;
- }
-
- /**
- * List all available XMLRPC methods
- *
- * Returns an array of methods.
- *
- * @return array
- */
- public function listMethods()
- {
- return array_keys($this->_table);
- }
-
- /**
- * Display help message for an XMLRPC method
- *
- * @param string $method
- * @return string
- */
- public function methodHelp($method)
- {
- if (!isset($this->_table[$method])) {
- throw new Zend_Server_Exception('Method "' . $method . '"does not exist', 640);
- }
-
- return $this->_table[$method]->getDescription();
- }
-
- /**
- * Return a method signature
- *
- * @param string $method
- * @return array
- */
- public function methodSignature($method)
- {
- if (!isset($this->_table[$method])) {
- throw new Zend_Server_Exception('Method "' . $method . '"does not exist', 640);
- }
- $prototypes = $this->_table[$method]->getPrototypes();
-
- $signatures = array();
- foreach ($prototypes as $prototype) {
- $signature = array($prototype->getReturnType());
- foreach ($prototype->getParameters() as $parameter) {
- $signature[] = $parameter->getType();
- }
- $signatures[] = $signature;
- }
-
- return $signatures;
- }
-
- /**
- * Multicall - boxcar feature of XML-RPC for calling multiple methods
- * in a single request.
- *
- * Expects a an array of structs representing method calls, each element
- * having the keys:
- * - methodName
- * - params
- *
- * Returns an array of responses, one for each method called, with the value
- * returned by the method. If an error occurs for a given method, returns a
- * struct with a fault response.
- *
- * @see http://www.xmlrpc.com/discuss/msgReader$1208
- * @param array $methods
- * @return array
- */
- public function multicall($methods)
- {
- $responses = array();
- foreach ($methods as $method) {
- $fault = false;
- if (!is_array($method)) {
- $fault = $this->fault('system.multicall expects each method to be a struct', 601);
- } elseif (!isset($method['methodName'])) {
- $fault = $this->fault('Missing methodName', 602);
- } elseif (!isset($method['params'])) {
- $fault = $this->fault('Missing params', 603);
- } elseif (!is_array($method['params'])) {
- $fault = $this->fault('Params must be an array', 604);
- } else {
- if ('system.multicall' == $method['methodName']) {
- // don't allow recursive calls to multicall
- $fault = $this->fault('Recursive system.multicall forbidden', 605);
- }
- }
-
- if (!$fault) {
- try {
- $request = new Zend_XmlRpc_Request();
- $request->setMethod($method['methodName']);
- $request->setParams($method['params']);
- $response = $this->_handle($request);
- $responses[] = $response->getReturnValue();
- } catch (Exception $e) {
- $fault = $this->fault($e);
- }
- }
-
- if ($fault) {
- $responses[] = array(
- 'faultCode' => $fault->getCode(),
- 'faultString' => $fault->getMessage()
- );
- }
- }
-
- return $responses;
- }
-}
diff --git a/libs/Zend/XmlRpc/Server/Cache.php b/libs/Zend/XmlRpc/Server/Cache.php
deleted file mode 100755
index 1a78edb865..0000000000
--- a/libs/Zend/XmlRpc/Server/Cache.php
+++ /dev/null
@@ -1,140 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_XmlRpc
- * @subpackage Server
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-/**
- * class hinting
- */
-require_once 'Zend/XmlRpc/Server.php';
-
-/**
- * Zend_XmlRpc_Server_Cache: cache Zend_XmlRpc_Server dispatch tables
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Server
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_XmlRpc_Server_Cache
-{
- /**
- * Cache a file containing the dispatch list.
- *
- * Serializes the XMLRPC server callbacks array and stores the information
- * in $filename.
- *
- * Returns false on any error (typically, inability to write to file), true
- * on success.
- *
- * @param string $filename
- * @param Zend_XmlRpc_Server $server
- * @return bool
- */
- public static function save($filename, Zend_XmlRpc_Server $server)
- {
- if (!is_string($filename)
- || (!file_exists($filename) && !is_writable(dirname($filename))))
- {
- return false;
- }
-
- // Remove system.* methods
- $methods = $server->getFunctions();
- foreach ($methods as $name => $method) {
- if ($method->system) {
- unset($methods[$name]);
- }
- }
-
- // Store
- if (0 === @file_put_contents($filename, serialize($methods))) {
- return false;
- }
-
- return true;
- }
-
- /**
- * Add dispatch table from a file
- *
- * Unserializes a stored dispatch table from $filename. Returns false if it
- * fails in any way, true on success.
- *
- * Useful to prevent needing to build the dispatch list on each XMLRPC
- * request. Sample usage:
- *
- * <code>
- * if (!Zend_XmlRpc_Server_Cache::get($filename, $server)) {
- * require_once 'Some/Service/Class.php';
- * require_once 'Another/Service/Class.php';
- *
- * // Attach Some_Service_Class with namespace 'some'
- * $server->attach('Some_Service_Class', 'some');
- *
- * // Attach Another_Service_Class with namespace 'another'
- * $server->attach('Another_Service_Class', 'another');
- *
- * Zend_XmlRpc_Server_Cache::save($filename, $server);
- * }
- *
- * $response = $server->handle();
- * echo $response;
- * </code>
- *
- * @param string $filename
- * @param Zend_XmlRpc_Server $server
- * @return bool
- */
- public static function get($filename, Zend_XmlRpc_Server $server)
- {
- if (!is_string($filename)
- || !file_exists($filename)
- || !is_readable($filename))
- {
- return false;
- }
-
- if (false === ($dispatch = @file_get_contents($filename))) {
- return false;
- }
-
- $dispatchArray = @unserialize($dispatch);
-
- $server->loadFunctions($dispatchArray);
-
- return true;
- }
-
- /**
- * Remove a cache file
- *
- * @param string $filename
- * @return boolean
- */
- public static function delete($filename)
- {
- if (is_string($filename) && file_exists($filename)) {
- unlink($filename);
- return true;
- }
-
- return false;
- }
-}
diff --git a/libs/Zend/XmlRpc/Server/Exception.php b/libs/Zend/XmlRpc/Server/Exception.php
deleted file mode 100755
index 8018c2cbf5..0000000000
--- a/libs/Zend/XmlRpc/Server/Exception.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_XmlRpc
- * @subpackage Server
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-
-/**
- * Zend_XmlRpc_Exception
- */
-require_once 'Zend/XmlRpc/Exception.php';
-
-
-/**
- * Zend_XmlRpc_Server_Exception
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Server
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_XmlRpc_Server_Exception extends Zend_XmlRpc_Exception
-{
-}
-
diff --git a/libs/Zend/XmlRpc/Server/Fault.php b/libs/Zend/XmlRpc/Server/Fault.php
deleted file mode 100755
index e0da7c27f0..0000000000
--- a/libs/Zend/XmlRpc/Server/Fault.php
+++ /dev/null
@@ -1,196 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_XmlRpc
- * @subpackage Server
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-/**
- * Zend_XmlRpc_Fault
- */
-require_once 'Zend/XmlRpc/Fault.php';
-
-
-/**
- * XMLRPC Server Faults
- *
- * Encapsulates an exception for use as an XMLRPC fault response. Valid
- * exception classes that may be used for generating the fault code and fault
- * string can be attached using {@link attachFaultException()}; all others use a
- * generic '404 Unknown error' response.
- *
- * You may also attach fault observers, which would allow you to monitor
- * particular fault cases; this is done via {@link attachObserver()}. Observers
- * need only implement a static 'observe' method.
- *
- * To allow method chaining, you may use the {@link getInstance()} factory
- * to instantiate a Zend_XmlRpc_Server_Fault.
- *
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Server
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_XmlRpc_Server_Fault extends Zend_XmlRpc_Fault
-{
- /**
- * @var Exception
- */
- protected $_exception;
-
- /**
- * @var array Array of exception classes that may define xmlrpc faults
- */
- protected static $_faultExceptionClasses = array('Zend_XmlRpc_Server_Exception' => true);
-
- /**
- * @var array Array of fault observers
- */
- protected static $_observers = array();
-
- /**
- * Constructor
- *
- * @param Exception $e
- * @return Zend_XmlRpc_Server_Fault
- */
- public function __construct(Exception $e)
- {
- $this->_exception = $e;
- $code = 404;
- $message = 'Unknown error';
- $exceptionClass = get_class($e);
-
- if (isset(self::$_faultExceptionClasses[$exceptionClass])) {
- $code = $e->getCode();
- $message = $e->getMessage();
- }
-
- parent::__construct($code, $message);
-
- // Notify exception observers, if present
- if (!empty(self::$_observers)) {
- foreach (array_keys(self::$_observers) as $observer) {
- call_user_func(array($observer, 'observe'), $this);
- }
- }
- }
-
- /**
- * Return Zend_XmlRpc_Server_Fault instance
- *
- * @param Exception $e
- * @return Zend_XmlRpc_Server_Fault
- */
- public static function getInstance(Exception $e)
- {
- return new self($e);
- }
-
- /**
- * Attach valid exceptions that can be used to define xmlrpc faults
- *
- * @param string|array $classes Class name or array of class names
- * @return void
- */
- public static function attachFaultException($classes)
- {
- if (!is_array($classes)) {
- $classes = (array) $classes;
- }
-
- foreach ($classes as $class) {
- if (is_string($class) && class_exists($class)) {
- self::$_faultExceptionClasses[$class] = true;
- }
- }
- }
-
- /**
- * Detach fault exception classes
- *
- * @param string|array $classes Class name or array of class names
- * @return void
- */
- public static function detachFaultException($classes)
- {
- if (!is_array($classes)) {
- $classes = (array) $classes;
- }
-
- foreach ($classes as $class) {
- if (is_string($class) && isset(self::$_faultExceptionClasses[$class])) {
- unset(self::$_faultExceptionClasses[$class]);
- }
- }
- }
-
- /**
- * Attach an observer class
- *
- * Allows observation of xmlrpc server faults, thus allowing logging or mail
- * notification of fault responses on the xmlrpc server.
- *
- * Expects a valid class name; that class must have a public static method
- * 'observe' that accepts an exception as its sole argument.
- *
- * @param string $class
- * @return boolean
- */
- public static function attachObserver($class)
- {
- if (!is_string($class)
- || !class_exists($class)
- || !is_callable(array($class, 'observe')))
- {
- return false;
- }
-
- if (!isset(self::$_observers[$class])) {
- self::$_observers[$class] = true;
- }
-
- return true;
- }
-
- /**
- * Detach an observer
- *
- * @param string $class
- * @return boolean
- */
- public static function detachObserver($class)
- {
- if (!isset(self::$_observers[$class])) {
- return false;
- }
-
- unset(self::$_observers[$class]);
- return true;
- }
-
- /**
- * Retrieve the exception
- *
- * @access public
- * @return Exception
- */
- public function getException()
- {
- return $this->_exception;
- }
-}
diff --git a/libs/Zend/XmlRpc/Value.php b/libs/Zend/XmlRpc/Value.php
deleted file mode 100755
index 8d07686f61..0000000000
--- a/libs/Zend/XmlRpc/Value.php
+++ /dev/null
@@ -1,377 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-
-/** Zend_XmlRpc_Value_Exception */
-require_once 'Zend/XmlRpc/Value/Exception.php';
-
-/** Zend_XmlRpc_Value_Scalar */
-require_once 'Zend/XmlRpc/Value/Scalar.php';
-
-/** Zend_XmlRpc_Value_Base64 */
-require_once 'Zend/XmlRpc/Value/Base64.php';
-
-/** Zend_XmlRpc_Value_Boolean */
-require_once 'Zend/XmlRpc/Value/Boolean.php';
-
-/** Zend_XmlRpc_Value_DateTime */
-require_once 'Zend/XmlRpc/Value/DateTime.php';
-
-/** Zend_XmlRpc_Value_Double */
-require_once 'Zend/XmlRpc/Value/Double.php';
-
-/** Zend_XmlRpc_Value_Integer */
-require_once 'Zend/XmlRpc/Value/Integer.php';
-
-/** Zend_XmlRpc_Value_String */
-require_once 'Zend/XmlRpc/Value/String.php';
-
-/** Zend_XmlRpc_Value_Collection */
-require_once 'Zend/XmlRpc/Value/Collection.php';
-
-/** Zend_XmlRpc_Value_Array */
-require_once 'Zend/XmlRpc/Value/Array.php';
-
-/** Zend_XmlRpc_Value_Struct */
-require_once 'Zend/XmlRpc/Value/Struct.php';
-
-
-/**
- * Represent a native XML-RPC value entity, used as parameters for the methods
- * called by the Zend_XmlRpc_Client object and as the return value for those calls.
- *
- * This object as a very important static function Zend_XmlRpc_Value::getXmlRpcValue, this
- * function acts likes a factory for the Zend_XmlRpc_Value objects
- *
- * Using this function, users/Zend_XmlRpc_Client object can create the Zend_XmlRpc_Value objects
- * from PHP variables, XML string or by specifing the exact XML-RPC natvie type
- *
- * @package Zend_XmlRpc
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-abstract class Zend_XmlRpc_Value
-{
- /**
- * The native XML-RPC representation of this object's value
- *
- * If the native type of this object is array or struct, this will be an array
- * of Zend_XmlRpc_Value objects
- */
- protected $_value;
-
- /**
- * The native XML-RPC type of this object
- * One of the XMLRPC_TYPE_* constants
- */
- protected $_type;
-
- /**
- * XML code representation of this object (will be calculated only once)
- */
- protected $_as_xml;
-
- /**
- * DOMElement representation of object (will be calculated only once)
- */
- protected $_as_dom;
-
- /**
- * Specify that the XML-RPC native type will be auto detected from a PHP variable type
- */
- const AUTO_DETECT_TYPE = 'auto_detect';
-
- /**
- * Specify that the XML-RPC value will be parsed out from a given XML code
- */
- const XML_STRING = 'xml';
-
- /**
- * All the XML-RPC native types
- */
- const XMLRPC_TYPE_I4 = 'i4';
- const XMLRPC_TYPE_INTEGER = 'int';
- const XMLRPC_TYPE_DOUBLE = 'double';
- const XMLRPC_TYPE_BOOLEAN = 'boolean';
- const XMLRPC_TYPE_STRING = 'string';
- const XMLRPC_TYPE_DATETIME = 'dateTime.iso8601';
- const XMLRPC_TYPE_BASE64 = 'base64';
- const XMLRPC_TYPE_ARRAY = 'array';
- const XMLRPC_TYPE_STRUCT = 'struct';
-
-
- /**
- * Get the native XML-RPC type (the type is one of the Zend_XmlRpc_Value::XMLRPC_TYPE_* constants)
- *
- * @return string
- */
- public function getType()
- {
- return $this->_type;
- }
-
-
- /**
- * Return the value of this object, convert the XML-RPC native value into a PHP variable
- *
- * @return mixed
- */
- abstract public function getValue();
-
-
- /**
- * Return the XML code that represent a native MXL-RPC value
- *
- * @return string
- */
- abstract public function saveXML();
-
- /**
- * Return DOMElement representation of object
- *
- * @return DOMElement
- */
- public function getAsDOM()
- {
- if (!$this->_as_dom) {
- $doc = new DOMDocument('1.0');
- $doc->loadXML($this->saveXML());
- $this->_as_dom = $doc->documentElement;
- }
-
- return $this->_as_dom;
- }
-
- protected function _stripXmlDeclaration(DOMDocument $dom)
- {
- return preg_replace('/<\?xml version="1.0"( encoding="[^\"]*")?\?>\n/u', '', $dom->saveXML());
- }
-
- /**
- * Creates a Zend_XmlRpc_Value* object, representing a native XML-RPC value
- * A XmlRpcValue object can be created in 3 ways:
- * 1. Autodetecting the native type out of a PHP variable
- * (if $type is not set or equal to Zend_XmlRpc_Value::AUTO_DETECT_TYPE)
- * 2. By specifing the native type ($type is one of the Zend_XmlRpc_Value::XMLRPC_TYPE_* constants)
- * 3. From a XML string ($type is set to Zend_XmlRpc_Value::XML_STRING)
- *
- * By default the value type is autodetected according to it's PHP type
- *
- * @param mixed $value
- * @param Zend_XmlRpc_Value::constant $type
- *
- * @return Zend_XmlRpc_Value
- * @static
- */
- public static function getXmlRpcValue($value, $type = self::AUTO_DETECT_TYPE)
- {
- switch ($type) {
- case self::AUTO_DETECT_TYPE:
- // Auto detect the XML-RPC native type from the PHP type of $value
- return self::_phpVarToNativeXmlRpc($value);
-
- case self::XML_STRING:
- // Parse the XML string given in $value and get the XML-RPC value in it
- return self::_xmlStringToNativeXmlRpc($value);
-
- case self::XMLRPC_TYPE_I4:
- // fall through to the next case
- case self::XMLRPC_TYPE_INTEGER:
- return new Zend_XmlRpc_Value_Integer($value);
-
- case self::XMLRPC_TYPE_DOUBLE:
- return new Zend_XmlRpc_Value_Double($value);
-
- case self::XMLRPC_TYPE_BOOLEAN:
- return new Zend_XmlRpc_Value_Boolean($value);
-
- case self::XMLRPC_TYPE_STRING:
- return new Zend_XmlRpc_Value_String($value);
-
- case self::XMLRPC_TYPE_BASE64:
- return new Zend_XmlRpc_Value_Base64($value);
-
- case self::XMLRPC_TYPE_DATETIME:
- return new Zend_XmlRpc_Value_DateTime($value);
-
- case self::XMLRPC_TYPE_ARRAY:
- return new Zend_XmlRpc_Value_Array($value);
-
- case self::XMLRPC_TYPE_STRUCT:
- return new Zend_XmlRpc_Value_Struct($value);
-
- default:
- throw new Zend_XmlRpc_Value_Exception('Given type is not a '. __CLASS__ .' constant');
- }
- }
-
-
- /**
- * Transform a PHP native variable into a XML-RPC native value
- *
- * @param mixed $value The PHP variable for convertion
- *
- * @return Zend_XmlRpc_Value
- * @static
- */
- private static function _phpVarToNativeXmlRpc($value)
- {
- switch (gettype($value)) {
- case 'object':
- // We convert the object into a struct
- $value = get_object_vars($value);
- // Break intentionally omitted
- case 'array':
- // Default native type for a PHP array (a simple numeric array) is 'array'
- // If the PHP array is an assosiative array the native type will be 'struct'
- $obj = 'Zend_XmlRpc_Value_Array';
-
- // Go over the elements in the array, if the key is different than the index
- // it means this array has associative keys and it's a struct
- if (is_array($value)) { // If the value is not array, it can't be an associated array
- $i = 0;
- foreach ($value as $key => $element) {
- if ($i !== $key) {
- $obj = 'Zend_XmlRpc_Value_Struct';
- break;
- }
- ++$i;
- }
- }
- return new $obj($value);
-
- case 'integer':
- return new Zend_XmlRpc_Value_Integer($value);
-
- case 'double':
- return new Zend_XmlRpc_Value_Double($value);
-
- case 'boolean':
- return new Zend_XmlRpc_Value_Boolean($value);
-
- case 'string':
- // Fall through to the next case
- default:
- // If type isn't identified (or identified as string), it treated as string
- return new Zend_XmlRpc_Value_String($value);
- }
- }
-
-
- /**
- * Transform an XML string into a XML-RPC native value
- *
- * @param string|SimpleXMLElement $simple_xml A SimpleXMLElement object represent the XML string
- * It can be also a valid XML string for convertion
- *
- * @return Zend_XmlRpc_Value
- * @static
- */
- private static function _xmlStringToNativeXmlRpc($simple_xml)
- {
- if (!$simple_xml instanceof SimpleXMLElement) {
- try {
- $simple_xml = @new SimpleXMLElement($simple_xml);
- } catch (Exception $e) {
- // The given string is not a valid XML
- throw new Zend_XmlRpc_Value_Exception('Failed to create XML-RPC value from XML string: '.$e->getMessage(),$e->getCode());
- }
- }
-
- // Get the key (tag name) and value from the simple xml object and convert the value to an XML-RPC native value
- list($type, $value) = each($simple_xml);
- if (!$type) { // If no type was specified, the default is string
- $type = self::XMLRPC_TYPE_STRING;
- }
-
- switch ($type) {
- // All valid and known XML-RPC native values
- case self::XMLRPC_TYPE_I4:
- // Fall through to the next case
- case self::XMLRPC_TYPE_INTEGER:
- $xmlrpc_val = new Zend_XmlRpc_Value_Integer($value);
- break;
- case self::XMLRPC_TYPE_DOUBLE:
- $xmlrpc_val = new Zend_XmlRpc_Value_Double($value);
- break;
- case self::XMLRPC_TYPE_BOOLEAN:
- $xmlrpc_val = new Zend_XmlRpc_Value_Boolean($value);
- break;
- case self::XMLRPC_TYPE_STRING:
- $xmlrpc_val = new Zend_XmlRpc_Value_String($value);
- break;
- case self::XMLRPC_TYPE_DATETIME: // The value should already be in a iso8601 format
- $xmlrpc_val = new Zend_XmlRpc_Value_DateTime($value);
- break;
- case self::XMLRPC_TYPE_BASE64: // The value should already be base64 encoded
- $xmlrpc_val = new Zend_XmlRpc_Value_Base64($value ,true);
- break;
- case self::XMLRPC_TYPE_ARRAY:
- // If the XML is valid, $value must be an SimpleXML element and contain the <data> tag
- if (!$value instanceof SimpleXMLElement) {
- throw new Zend_XmlRpc_Value_Exception('XML string is invalid for XML-RPC native '. self::XMLRPC_TYPE_ARRAY .' type');
- } elseif (empty($value->data)) {
- throw new Zend_XmlRpc_Value_Exception('Invalid XML for XML-RPC native '. self::XMLRPC_TYPE_ARRAY .' type: ARRAY tag must contain DATA tag');
- }
- $values = array();
- // Parse all the elements of the array from the XML string
- // (simple xml element) to Zend_XmlRpc_Value objects
- foreach ($value->data->value as $element) {
- $values[] = self::_xmlStringToNativeXmlRpc($element);
- }
- $xmlrpc_val = new Zend_XmlRpc_Value_Array($values);
- break;
- case self::XMLRPC_TYPE_STRUCT:
- // If the XML is valid, $value must be an SimpleXML
- if ((!$value instanceof SimpleXMLElement)) {
- throw new Zend_XmlRpc_Value_Exception('XML string is invalid for XML-RPC native '. self::XMLRPC_TYPE_STRUCT .' type');
- }
- $values = array();
- // Parse all the memebers of the struct from the XML string
- // (simple xml element) to Zend_XmlRpc_Value objects
- foreach ($value->member as $member) {
- // @todo? If a member doesn't have a <value> tag, we don't add it to the struct
- // Maybe we want to throw an exception here ?
- if ((!$member->value instanceof SimpleXMLElement) || empty($member->value)) {
- continue;
- //throw new Zend_XmlRpc_Value_Exception('Member of the '. self::XMLRPC_TYPE_STRUCT .' XML-RPC native type must contain a VALUE tag');
- }
- $values[(string)$member->name] = self::_xmlStringToNativeXmlRpc($member->value);
- }
- $xmlrpc_val = new Zend_XmlRpc_Value_Struct($values);
- break;
- default:
- throw new Zend_XmlRpc_Value_Exception('Value type \''. $type .'\' parsed from the XML string is not a known XML-RPC native type');
- break;
- }
- $xmlrpc_val->_setXML($simple_xml->asXML());
-
- return $xmlrpc_val;
- }
-
-
- private function _setXML($xml)
- {
- $this->_as_xml = $xml;
- }
-
-}
-
-
diff --git a/libs/Zend/XmlRpc/Value/Array.php b/libs/Zend/XmlRpc/Value/Array.php
deleted file mode 100755
index c3d012b6d3..0000000000
--- a/libs/Zend/XmlRpc/Value/Array.php
+++ /dev/null
@@ -1,77 +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_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_XmlRpc_Value_Collection
- */
-require_once 'Zend/XmlRpc/Value/Collection.php';
-
-
-/**
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Value_Array extends Zend_XmlRpc_Value_Collection
-{
- /**
- * Set the value of an array native type
- *
- * @param array $value
- */
- public function __construct($value)
- {
- $this->_type = self::XMLRPC_TYPE_ARRAY;
- parent::__construct($value);
- }
-
-
- /**
- * Return the XML code that represent an array native MXL-RPC value
- *
- * @return string
- */
- public function saveXML()
- {
- if (!$this->_as_xml) { // The XML code was not calculated yet
- $dom = new DOMDocument('1.0');
- $value = $dom->appendChild($dom->createElement('value'));
- $array = $value->appendChild($dom->createElement('array'));
- $data = $array->appendChild($dom->createElement('data'));
-
- if (is_array($this->_value)) {
- foreach ($this->_value as $val) {
- /* @var $val Zend_XmlRpc_Value */
- $data->appendChild($dom->importNode($val->getAsDOM(), true));
- }
- }
-
- $this->_as_dom = $value;
- $this->_as_xml = $this->_stripXmlDeclaration($dom);
- }
-
- return $this->_as_xml;
- }
-}
-
diff --git a/libs/Zend/XmlRpc/Value/Base64.php b/libs/Zend/XmlRpc/Value/Base64.php
deleted file mode 100755
index d02b32393c..0000000000
--- a/libs/Zend/XmlRpc/Value/Base64.php
+++ /dev/null
@@ -1,69 +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_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_XmlRpc_Value_Scalar
- */
-require_once 'Zend/XmlRpc/Value/Scalar.php';
-
-
-/**
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Value_Base64 extends Zend_XmlRpc_Value_Scalar
-{
-
- /**
- * Set the value of a base64 native type
- * We keep this value in base64 encoding
- *
- * @param string $value
- * @param bool $already_encoded If set, it means that the given string is already base64 encoded
- */
- public function __construct($value, $already_encoded=false)
- {
- $this->_type = self::XMLRPC_TYPE_BASE64;
-
- $value = (string)$value; // Make sure this value is string
- if (!$already_encoded) {
- $value = base64_encode($value); // We encode it in base64
- }
- $this->_value = $value;
- }
-
- /**
- * Return the value of this object, convert the XML-RPC native base64 value into a PHP string
- * We return this value decoded (a normal string)
- *
- * @return string
- */
- public function getValue()
- {
- return base64_decode($this->_value);
- }
-
-}
-
diff --git a/libs/Zend/XmlRpc/Value/Boolean.php b/libs/Zend/XmlRpc/Value/Boolean.php
deleted file mode 100755
index d4772257a0..0000000000
--- a/libs/Zend/XmlRpc/Value/Boolean.php
+++ /dev/null
@@ -1,83 +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_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_XmlRpc_Value_Scalar
- */
-require_once 'Zend/XmlRpc/Value/Scalar.php';
-
-
-/**
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Value_Boolean extends Zend_XmlRpc_Value_Scalar
-{
-
- /**
- * Set the value of a boolean native type
- * We hold the boolean type as an integer (0 or 1)
- *
- * @param bool $value
- */
- public function __construct($value)
- {
- $this->_type = self::XMLRPC_TYPE_BOOLEAN;
- // Make sure the value is boolean and then convert it into a integer
- // The double convertion is because a bug in the ZendOptimizer in PHP version 5.0.4
- $this->_value = (int)(bool)$value;
- }
-
- /**
- * Return the value of this object, convert the XML-RPC native boolean value into a PHP boolean
- *
- * @return bool
- */
- public function getValue()
- {
- return (bool)$this->_value;
- }
-
- /**
- * Return the XML-RPC serialization of the boolean value
- *
- * @return string
- */
- public function saveXML()
- {
- if (! $this->_as_xml) { // The XML was not generated yet
- $dom = new DOMDocument('1.0', 'UTF-8');
- $value = $dom->appendChild($dom->createElement('value'));
- $type = $value->appendChild($dom->createElement($this->_type));
- $type->appendChild($dom->createTextNode($this->_value));
-
- $this->_as_dom = $value;
- $this->_as_xml = $this->_stripXmlDeclaration($dom);
- }
-
- return $this->_as_xml;
- }
-}
-
diff --git a/libs/Zend/XmlRpc/Value/Collection.php b/libs/Zend/XmlRpc/Value/Collection.php
deleted file mode 100755
index 9e75ff32b0..0000000000
--- a/libs/Zend/XmlRpc/Value/Collection.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_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_XmlRpc_Value
- */
-require_once 'Zend/XmlRpc/Value.php';
-
-
-/**
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-abstract class Zend_XmlRpc_Value_Collection extends Zend_XmlRpc_Value
-{
-
- /**
- * Set the value of a collection type (array and struct) native types
- *
- * @param array $value
- */
- public function __construct($value)
- {
- $values = (array)$value; // Make sure that the value is an array
- foreach ($values as $key => $value) {
- // If the elements of the given array are not Zend_XmlRpc_Value objects,
- // we need to convert them as such (using auto-detection from PHP value)
- if (!$value instanceof parent) {
- $value = self::getXmlRpcValue($value, self::AUTO_DETECT_TYPE);
- }
- $this->_value[$key] = $value;
- }
- }
-
-
- /**
- * Return the value of this object, convert the XML-RPC native collection values into a PHP array
- *
- * @return arary
- */
- public function getValue()
- {
- $values = (array)$this->_value;
- foreach ($values as $key => $value) {
- /* @var $value Zend_XmlRpc_Value */
-
- if (!$value instanceof parent) {
- throw new Zend_Xml_Rpc_Value_Exception('Values of '. get_class($this) .' type must be Zend_XmlRpc_Value objects');
- }
- $values[$key] = $value->getValue();
- }
- return $values;
- }
-
-}
-
diff --git a/libs/Zend/XmlRpc/Value/DateTime.php b/libs/Zend/XmlRpc/Value/DateTime.php
deleted file mode 100755
index ee91dbff80..0000000000
--- a/libs/Zend/XmlRpc/Value/DateTime.php
+++ /dev/null
@@ -1,80 +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_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_XmlRpc_Value_Scalar
- */
-require_once 'Zend/XmlRpc/Value/Scalar.php';
-
-
-/**
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Value_DateTime extends Zend_XmlRpc_Value_Scalar
-{
-
- /**
- * Set the value of a dateTime.iso8601 native type
- *
- * The value is in iso8601 format, minus any timezone information or dashes
- *
- * @param mixed $value Integer of the unix timestamp or any string that can be parsed
- * to a unix timestamp using the PHP strtotime() function
- */
- public function __construct($value)
- {
- $this->_type = self::XMLRPC_TYPE_DATETIME;
-
- // If the value is not numeric, we try to convert it to a timestamp (using the strtotime function)
- if (is_numeric($value)) { // The value is numeric, we make sure it is an integer
- $value = (int)$value;
- } else {
- $value = strtotime($value);
- if ($value === false || $value == -1) { // cannot convert the value to a timestamp
- throw new Zend_XmlRpc_Value_Exception('Cannot convert given value \''. $value .'\' to a timestamp');
- }
- }
- $value = date('c', $value); // Convert the timestamp to iso8601 format
-
- // Strip out TZ information and dashes
- $value = preg_replace('/(\+|-)\d{2}:\d{2}$/', '', $value);
- $value = str_replace('-', '', $value);
-
- $this->_value = $value;
- }
-
- /**
- * Return the value of this object as iso8601 dateTime value
- *
- * @return int As a Unix timestamp
- */
- public function getValue()
- {
- return $this->_value;
- }
-
-}
-
diff --git a/libs/Zend/XmlRpc/Value/Double.php b/libs/Zend/XmlRpc/Value/Double.php
deleted file mode 100755
index 47bc741b0b..0000000000
--- a/libs/Zend/XmlRpc/Value/Double.php
+++ /dev/null
@@ -1,61 +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_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_XmlRpc_Value_Scalar
- */
-require_once 'Zend/XmlRpc/Value/Scalar.php';
-
-
-/**
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Value_Double extends Zend_XmlRpc_Value_Scalar
-{
-
- /**
- * Set the value of a double native type
- *
- * @param float $value
- */
- public function __construct($value)
- {
- $this->_type = self::XMLRPC_TYPE_DOUBLE;
- $this->_value = sprintf('%f',(float)$value); // Make sure this value is float (double) and without the scientific notation
- }
-
- /**
- * Return the value of this object, convert the XML-RPC native double value into a PHP float
- *
- * @return float
- */
- public function getValue()
- {
- return (float)$this->_value;
- }
-
-}
-
diff --git a/libs/Zend/XmlRpc/Value/Exception.php b/libs/Zend/XmlRpc/Value/Exception.php
deleted file mode 100755
index 931a2d150b..0000000000
--- a/libs/Zend/XmlRpc/Value/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_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_XmlRpc_Exception
- */
-require_once 'Zend/XmlRpc/Exception.php';
-
-
-/**
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Value_Exception extends Zend_XmlRpc_Exception
-{}
-
diff --git a/libs/Zend/XmlRpc/Value/Integer.php b/libs/Zend/XmlRpc/Value/Integer.php
deleted file mode 100755
index 4371746f1c..0000000000
--- a/libs/Zend/XmlRpc/Value/Integer.php
+++ /dev/null
@@ -1,61 +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_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_XmlRpc_Value_Scalar
- */
-require_once 'Zend/XmlRpc/Value/Scalar.php';
-
-
-/**
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Value_Integer extends Zend_XmlRpc_Value_Scalar
-{
-
- /**
- * Set the value of an integer native type
- *
- * @param int $value
- */
- public function __construct($value)
- {
- $this->_type = self::XMLRPC_TYPE_INTEGER;
- $this->_value = (int)$value; // Make sure this value is integer
- }
-
- /**
- * Return the value of this object, convert the XML-RPC native integer value into a PHP integer
- *
- * @return int
- */
- public function getValue()
- {
- return $this->_value;
- }
-
-}
-
diff --git a/libs/Zend/XmlRpc/Value/Scalar.php b/libs/Zend/XmlRpc/Value/Scalar.php
deleted file mode 100755
index fc38326d84..0000000000
--- a/libs/Zend/XmlRpc/Value/Scalar.php
+++ /dev/null
@@ -1,59 +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_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_XmlRpc_Value
- */
-require_once 'Zend/XmlRpc/Value.php';
-
-
-/**
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-abstract class Zend_XmlRpc_Value_Scalar extends Zend_XmlRpc_Value
-{
-
- /**
- * Return the XML code that represent a scalar native MXL-RPC value
- *
- * @return string
- */
- public function saveXML()
- {
- if (!$this->_as_xml) { // The XML code was not calculated yet
- $dom = new DOMDocument('1.0');
- $value = $dom->appendChild($dom->createElement('value'));
- $type = $value->appendChild($dom->createElement($this->_type));
- $type->appendChild($dom->createTextNode($this->getValue()));
-
- $this->_as_dom = $value;
- $this->_as_xml = $this->_stripXmlDeclaration($dom);
- }
-
- return $this->_as_xml;
- }
-}
-
diff --git a/libs/Zend/XmlRpc/Value/String.php b/libs/Zend/XmlRpc/Value/String.php
deleted file mode 100755
index df14d43d6d..0000000000
--- a/libs/Zend/XmlRpc/Value/String.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to version 1.0 of the Zend Framework
- * license, that is bundled with this package in the file LICENSE, and
- * is available through the world-wide-web at the following URL:
- * http://www.zend.com/license/framework/1_0.txt. If you did not receive
- * a copy of the Zend Framework license and are unable to obtain it
- * through the world-wide-web, please send a note to license@zend.com
- * so we can mail you a copy immediately.
- *
- * @package Zend_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-
-
-/**
- * Zend_XmlRpc_Value_Scalar
- */
-require_once 'Zend/XmlRpc/Value/Scalar.php';
-
-/**
- * @package Zend_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://www.zend.com/license/framework/1_0.txt Zend Framework License version 1.0
- */
-class Zend_XmlRpc_Value_String extends Zend_XmlRpc_Value_Scalar
-{
-
- /**
- * Set the value of a string native type
- *
- * @param string $value
- */
- public function __construct($value)
- {
- $this->_type = self::XMLRPC_TYPE_STRING;
-
- // Make sure this value is string and all XML characters are encoded
- $this->_value = $this->_xml_entities($value);
- }
-
- /**
- * Return the value of this object, convert the XML-RPC native string value into a PHP string
- * Decode all encoded risky XML entities back to normal characters
- *
- * @return string
- */
- public function getValue()
- {
- return html_entity_decode($this->_value, ENT_QUOTES, 'UTF-8');
- }
-
- /**
- * Make sure a string will be safe for XML, convert risky characters to HTML entities
- *
- * @param string $str
- * @return string
- */
- private function _xml_entities($str)
- {
- return htmlentities($str, ENT_QUOTES, 'UTF-8');
- }
-
-}
-
diff --git a/libs/Zend/XmlRpc/Value/Struct.php b/libs/Zend/XmlRpc/Value/Struct.php
deleted file mode 100755
index ad3d469d2a..0000000000
--- a/libs/Zend/XmlRpc/Value/Struct.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_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-
-
-/**
- * Zend_XmlRpc_Value_Collection
- */
-require_once 'Zend/XmlRpc/Value/Collection.php';
-
-
-/**
- * @category Zend
- * @package Zend_XmlRpc
- * @subpackage Value
- * @copyright Copyright (c) 2005-2007 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
-class Zend_XmlRpc_Value_Struct extends Zend_XmlRpc_Value_Collection
-{
- /**
- * Set the value of an struct native type
- *
- * @param array $value
- */
- public function __construct($value)
- {
- $this->_type = self::XMLRPC_TYPE_STRUCT;
- parent::__construct($value);
- }
-
-
- /**
- * Return the XML code that represent struct native MXL-RPC value
- *
- * @return string
- */
- public function saveXML()
- {
- if (!$this->_as_xml) { // The XML code was not calculated yet
- $dom = new DOMDocument('1.0');
- $value = $dom->appendChild($dom->createElement('value'));
- $struct = $value->appendChild($dom->createElement('struct'));
-
- if (is_array($this->_value)) {
- foreach ($this->_value as $name => $val) {
- /* @var $val Zend_XmlRpc_Value */
- $member = $struct->appendChild($dom->createElement('member'));
- $member->appendChild($dom->createElement('name', $name));
- $member->appendChild($dom->importNode($val->getAsDOM(), 1));
- }
- }
-
- $this->_as_dom = $value;
- $this->_as_xml = $this->_stripXmlDeclaration($dom);
- }
-
- return $this->_as_xml;
- }
-}
-