CC-2166: Packaging Improvements. Moved the Zend app into airtime_mvc. It is now installed to /var/www/airtime. Storage is now set to /srv/airtime/stor. Utils are now installed to /usr/lib/airtime/utils/. Added install/airtime-dircheck.php as a simple test to see if everything is install/uninstalled correctly.
This commit is contained in:
parent
514777e8d2
commit
b11cbd8159
4546 changed files with 138 additions and 51 deletions
112
airtime_mvc/library/Zend/Serializer/Adapter/AdapterAbstract.php
Normal file
112
airtime_mvc/library/Zend/Serializer/Adapter/AdapterAbstract.php
Normal file
|
@ -0,0 +1,112 @@
|
|||
<?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_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: AdapterAbstract.php 20575 2010-01-24 17:48:27Z mabe $
|
||||
*/
|
||||
|
||||
/** @see Zend_Serializer_Adapter_AdapterInterface */
|
||||
require_once 'Zend/Serializer/Adapter/AdapterInterface.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Serializer_Adapter_AdapterAbstract implements Zend_Serializer_Adapter_AdapterInterface
|
||||
{
|
||||
/**
|
||||
* Serializer options
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_options = array();
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array|Zend_Config $opts Serializer options
|
||||
*/
|
||||
public function __construct($opts = array())
|
||||
{
|
||||
$this->setOptions($opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set serializer options
|
||||
*
|
||||
* @param array|Zend_Config $opts Serializer options
|
||||
* @return Zend_Serializer_Adapter_AdapterAbstract
|
||||
*/
|
||||
public function setOptions($opts)
|
||||
{
|
||||
if ($opts instanceof Zend_Config) {
|
||||
$opts = $opts->toArray();
|
||||
} else {
|
||||
$opts = (array) $opts;
|
||||
}
|
||||
|
||||
foreach ($opts as $k => $v) {
|
||||
$this->setOption($k, $v);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a serializer option
|
||||
*
|
||||
* @param string $name Option name
|
||||
* @param mixed $value Option value
|
||||
* @return Zend_Serializer_Adapter_AdapterAbstract
|
||||
*/
|
||||
public function setOption($name, $value)
|
||||
{
|
||||
$this->_options[(string) $name] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get serializer options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions()
|
||||
{
|
||||
return $this->_options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a serializer option
|
||||
*
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
* @throws Zend_Serializer_Exception
|
||||
*/
|
||||
public function getOption($name)
|
||||
{
|
||||
$name = (string) $name;
|
||||
if (!array_key_exists($name, $this->_options)) {
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception('Unknown option name "'.$name.'"');
|
||||
}
|
||||
|
||||
return $this->_options[$name];
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
<?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_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: AdapterInterface.php 20575 2010-01-24 17:48:27Z mabe $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
interface Zend_Serializer_Adapter_AdapterInterface
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array|Zend_Config $opts Serializer options
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($opts = array());
|
||||
|
||||
/**
|
||||
* Set serializer options
|
||||
*
|
||||
* @param array|Zend_Config $opts Serializer options
|
||||
* @return Zend_Serializer_Adapter_AdapterInterface
|
||||
*/
|
||||
public function setOptions($opts);
|
||||
|
||||
/**
|
||||
* Set a serializer option
|
||||
*
|
||||
* @param string $name Option name
|
||||
* @param mixed $value Option value
|
||||
* @return Zend_Serializer_Adapter_AdapterInterface
|
||||
*/
|
||||
public function setOption($name, $value);
|
||||
|
||||
/**
|
||||
* Get serializer options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getOptions();
|
||||
|
||||
/**
|
||||
* Get a serializer option
|
||||
*
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
* @throws Zend_Serializer_Exception
|
||||
*/
|
||||
public function getOption($name);
|
||||
|
||||
/**
|
||||
* Generates a storable representation of a value.
|
||||
*
|
||||
* @param mixed $value Data to serialize
|
||||
* @param array $options Serialize options
|
||||
* @return string
|
||||
* @throws Zend_Serializer_Exception
|
||||
*/
|
||||
public function serialize($value, array $options = array());
|
||||
|
||||
/**
|
||||
* Creates a PHP value from a stored representation.
|
||||
*
|
||||
* @param string $serialized Serialized string
|
||||
* @param array $options Unserialize options
|
||||
* @return mixed
|
||||
* @throws Zend_Serializer_Exception
|
||||
*/
|
||||
public function unserialize($serialized, array $options = array());
|
||||
}
|
88
airtime_mvc/library/Zend/Serializer/Adapter/Amf0.php
Normal file
88
airtime_mvc/library/Zend/Serializer/Adapter/Amf0.php
Normal file
|
@ -0,0 +1,88 @@
|
|||
<?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_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Amf0.php 20575 2010-01-24 17:48:27Z mabe $
|
||||
*/
|
||||
|
||||
/** @see Zend_Serializer_Adapter_AdapterAbstract */
|
||||
require_once 'Zend/Serializer/Adapter/AdapterAbstract.php';
|
||||
|
||||
/** @see Zend_Amf_Parse_OutputStream */
|
||||
require_once 'Zend/Amf/Parse/OutputStream.php';
|
||||
|
||||
/** @see Zend_Amf_Parse_Amf0_Serializer */
|
||||
require_once 'Zend/Amf/Parse/Amf0/Serializer.php';
|
||||
|
||||
/** @see Zend_Amf_Parse_InputStream */
|
||||
require_once 'Zend/Amf/Parse/InputStream.php';
|
||||
|
||||
/** @see Zend_Amf_Parse_Amf0_Deserializer */
|
||||
require_once 'Zend/Amf/Parse/Amf0/Deserializer.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Serializer_Adapter_Amf0 extends Zend_Serializer_Adapter_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* Serialize a PHP value to AMF0 format
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param array $opts
|
||||
* @return string
|
||||
* @throws Zend_Serializer_Exception
|
||||
*/
|
||||
public function serialize($value, array $opts = array())
|
||||
{
|
||||
try {
|
||||
$stream = new Zend_Amf_Parse_OutputStream();
|
||||
$serializer = new Zend_Amf_Parse_Amf0_Serializer($stream);
|
||||
$serializer->writeTypeMarker($value);
|
||||
return $stream->getStream();
|
||||
} catch (Exception $e) {
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception('Serialization failed by previous error', 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserialize an AMF0 value to PHP
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param array $opts
|
||||
* @return void
|
||||
* @throws Zend_Serializer_Exception
|
||||
*/
|
||||
public function unserialize($value, array $opts = array())
|
||||
{
|
||||
try {
|
||||
$stream = new Zend_Amf_Parse_InputStream($value);
|
||||
$deserializer = new Zend_Amf_Parse_Amf0_Deserializer($stream);
|
||||
return $deserializer->readTypeMarker();
|
||||
} catch (Exception $e) {
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception('Unserialization failed by previous error', 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
87
airtime_mvc/library/Zend/Serializer/Adapter/Amf3.php
Normal file
87
airtime_mvc/library/Zend/Serializer/Adapter/Amf3.php
Normal file
|
@ -0,0 +1,87 @@
|
|||
<?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_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Amf3.php 20575 2010-01-24 17:48:27Z mabe $
|
||||
*/
|
||||
|
||||
/** @see Zend_Serializer_Adapter_AdapterAbstract */
|
||||
require_once 'Zend/Serializer/Adapter/AdapterAbstract.php';
|
||||
|
||||
/** @see Zend_Amf_Parse_OutputStream */
|
||||
require_once 'Zend/Amf/Parse/OutputStream.php';
|
||||
|
||||
/** @see Zend_Amf_Parse_Amf3_Serializer */
|
||||
require_once 'Zend/Amf/Parse/Amf3/Serializer.php';
|
||||
|
||||
/** @see Zend_Amf_Parse_InputStream */
|
||||
require_once 'Zend/Amf/Parse/InputStream.php';
|
||||
|
||||
/** @see Zend_Amf_Parse_Amf3_Deserializer */
|
||||
require_once 'Zend/Amf/Parse/Amf3/Deserializer.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Serializer_Adapter_Amf3 extends Zend_Serializer_Adapter_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* Serialize a PHP value to AMF3 format
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param array $opts
|
||||
* @return string
|
||||
* @throws Zend_Serializer_Exception
|
||||
*/
|
||||
public function serialize($value, array $opts = array())
|
||||
{
|
||||
try {
|
||||
$stream = new Zend_Amf_Parse_OutputStream();
|
||||
$serializer = new Zend_Amf_Parse_Amf3_Serializer($stream);
|
||||
$serializer->writeTypeMarker($value);
|
||||
return $stream->getStream();
|
||||
} catch (Exception $e) {
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception('Serialization failed by previous error', 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize an AMF3 value to PHP
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param array $opts
|
||||
* @return string
|
||||
* @throws Zend_Serializer_Exception
|
||||
*/
|
||||
public function unserialize($value, array $opts = array())
|
||||
{
|
||||
try {
|
||||
$stream = new Zend_Amf_Parse_InputStream($value);
|
||||
$deserializer = new Zend_Amf_Parse_Amf3_Deserializer($stream);
|
||||
return $deserializer->readTypeMarker();
|
||||
} catch (Exception $e) {
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception('Unserialization failed by previous error', 0, $e);
|
||||
}
|
||||
}
|
||||
}
|
98
airtime_mvc/library/Zend/Serializer/Adapter/Igbinary.php
Normal file
98
airtime_mvc/library/Zend/Serializer/Adapter/Igbinary.php
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?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_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Igbinary.php 20575 2010-01-24 17:48:27Z mabe $
|
||||
*/
|
||||
|
||||
/** @see Zend_Serializer_Adapter_AdapterAbstract */
|
||||
require_once 'Zend/Serializer/Adapter/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Serializer_Adapter_Igbinary extends Zend_Serializer_Adapter_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* @var string Serialized null value
|
||||
*/
|
||||
private static $_serializedNull = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array|Zend_Config $opts
|
||||
* @return void
|
||||
* @throws Zend_Serializer_Exception If igbinary extension is not present
|
||||
*/
|
||||
public function __construct($opts = array())
|
||||
{
|
||||
if (!extension_loaded('igbinary')) {
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception('PHP extension "igbinary" is required for this adapter');
|
||||
}
|
||||
|
||||
parent::__construct($opts);
|
||||
|
||||
if (self::$_serializedNull === null) {
|
||||
self::$_serializedNull = igbinary_serialize(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize PHP value to igbinary
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param array $opts
|
||||
* @return string
|
||||
* @throws Zend_Serializer_Exception on igbinary error
|
||||
*/
|
||||
public function serialize($value, array $opts = array())
|
||||
{
|
||||
$ret = igbinary_serialize($value);
|
||||
if ($ret === false) {
|
||||
$lastErr = error_get_last();
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception($lastErr['message']);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize igbinary string to PHP value
|
||||
*
|
||||
* @param string|binary $serialized
|
||||
* @param array $opts
|
||||
* @return mixed
|
||||
* @throws Zend_Serializer_Exception on igbinary error
|
||||
*/
|
||||
public function unserialize($serialized, array $opts = array())
|
||||
{
|
||||
$ret = igbinary_unserialize($serialized);
|
||||
if ($ret === null && $serialized !== self::$_serializedNull) {
|
||||
$lastErr = error_get_last();
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception($lastErr['message']);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
93
airtime_mvc/library/Zend/Serializer/Adapter/Json.php
Normal file
93
airtime_mvc/library/Zend/Serializer/Adapter/Json.php
Normal file
|
@ -0,0 +1,93 @@
|
|||
<?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_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Json.php 20575 2010-01-24 17:48:27Z mabe $
|
||||
*/
|
||||
|
||||
/** @see Zend_Serializer_Adapter_AdapterAbstract */
|
||||
require_once 'Zend/Serializer/Adapter/AdapterAbstract.php';
|
||||
|
||||
/** @see Zend_Json */
|
||||
require_once 'Zend/Json.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Serializer_Adapter_Json extends Zend_Serializer_Adapter_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* @var array Default options
|
||||
*/
|
||||
protected $_options = array(
|
||||
'cycleCheck' => false,
|
||||
'enableJsonExprFinder' => false,
|
||||
'objectDecodeType' => Zend_Json::TYPE_ARRAY,
|
||||
);
|
||||
|
||||
/**
|
||||
* Serialize PHP value to JSON
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param array $opts
|
||||
* @return string
|
||||
* @throws Zend_Serializer_Exception on JSON encoding exception
|
||||
*/
|
||||
public function serialize($value, array $opts = array())
|
||||
{
|
||||
$opts = $opts + $this->_options;
|
||||
|
||||
try {
|
||||
return Zend_Json::encode($value, $opts['cycleCheck'], $opts);
|
||||
} catch (Exception $e) {
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception('Serialization failed', 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize JSON to PHP value
|
||||
*
|
||||
* @param string $json
|
||||
* @param array $opts
|
||||
* @return mixed
|
||||
*/
|
||||
public function unserialize($json, array $opts = array())
|
||||
{
|
||||
$opts = $opts + $this->_options;
|
||||
|
||||
try {
|
||||
$ret = Zend_Json::decode($json, $opts['objectDecodeType']);
|
||||
} catch (Exception $e) {
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception('Unserialization failed by previous error', 0, $e);
|
||||
}
|
||||
|
||||
// json_decode returns null for invalid JSON
|
||||
if ($ret === null && $json !== 'null') {
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception('Invalid json data');
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
67
airtime_mvc/library/Zend/Serializer/Adapter/PhpCode.php
Normal file
67
airtime_mvc/library/Zend/Serializer/Adapter/PhpCode.php
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?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_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: PhpCode.php 20575 2010-01-24 17:48:27Z mabe $
|
||||
*/
|
||||
|
||||
/** @see Zend_Serializer_Adapter_AdapterAbstract */
|
||||
require_once 'Zend/Serializer/Adapter/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Serializer_Adapter_PhpCode extends Zend_Serializer_Adapter_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* Serialize PHP using var_export
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param array $opts
|
||||
* @return string
|
||||
*/
|
||||
public function serialize($value, array $opts = array())
|
||||
{
|
||||
return var_export($value, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserialize PHP string
|
||||
*
|
||||
* Warning: this uses eval(), and should likely be avoided.
|
||||
*
|
||||
* @param string $code
|
||||
* @param array $opts
|
||||
* @return mixed
|
||||
* @throws Zend_Serializer_Exception on eval error
|
||||
*/
|
||||
public function unserialize($code, array $opts = array())
|
||||
{
|
||||
$eval = @eval('$ret=' . $code . ';');
|
||||
if ($eval === false) {
|
||||
$lastErr = error_get_last();
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception('eval failed: ' . $lastErr['message']);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
94
airtime_mvc/library/Zend/Serializer/Adapter/PhpSerialize.php
Normal file
94
airtime_mvc/library/Zend/Serializer/Adapter/PhpSerialize.php
Normal file
|
@ -0,0 +1,94 @@
|
|||
<?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_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: PhpSerialize.php 20575 2010-01-24 17:48:27Z mabe $
|
||||
*/
|
||||
|
||||
/** @see Zend_Serializer_Adapter_AdapterAbstract */
|
||||
require_once 'Zend/Serializer/Adapter/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Serializer_Adapter_PhpSerialize extends Zend_Serializer_Adapter_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* @var null|string Serialized boolean false value
|
||||
*/
|
||||
private static $_serializedFalse = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array|Zend_Config $opts
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($opts = array())
|
||||
{
|
||||
parent::__construct($opts);
|
||||
|
||||
if (self::$_serializedFalse === null) {
|
||||
self::$_serializedFalse = serialize(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize using serialize()
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param array $opts
|
||||
* @return string
|
||||
* @throws Zend_Serializer_Exception On serialize error
|
||||
*/
|
||||
public function serialize($value, array $opts = array())
|
||||
{
|
||||
$ret = serialize($value);
|
||||
if ($ret === false) {
|
||||
$lastErr = error_get_last();
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception($lastErr['message']);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserialize
|
||||
*
|
||||
* @todo Allow integration with unserialize_callback_func
|
||||
* @param string $serialized
|
||||
* @param array $opts
|
||||
* @return mixed
|
||||
* @throws Zend_Serializer_Exception on unserialize error
|
||||
*/
|
||||
public function unserialize($serialized, array $opts = array())
|
||||
{
|
||||
// TODO: @see php.ini directive "unserialize_callback_func"
|
||||
$ret = @unserialize($serialized);
|
||||
if ($ret === false && $serialized !== self::$_serializedFalse) {
|
||||
$lastErr = error_get_last();
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception($lastErr['message']);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
1494
airtime_mvc/library/Zend/Serializer/Adapter/PythonPickle.php
Normal file
1494
airtime_mvc/library/Zend/Serializer/Adapter/PythonPickle.php
Normal file
File diff suppressed because it is too large
Load diff
118
airtime_mvc/library/Zend/Serializer/Adapter/Wddx.php
Normal file
118
airtime_mvc/library/Zend/Serializer/Adapter/Wddx.php
Normal file
|
@ -0,0 +1,118 @@
|
|||
<?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_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Wddx.php 20575 2010-01-24 17:48:27Z mabe $
|
||||
*/
|
||||
|
||||
/** @see Zend_Serializer_Adapter_AdapterAbstract */
|
||||
require_once 'Zend/Serializer/Adapter/AdapterAbstract.php';
|
||||
|
||||
/**
|
||||
* @link http://www.infoloom.com/gcaconfs/WEB/chicago98/simeonov.HTM
|
||||
* @link http://en.wikipedia.org/wiki/WDDX
|
||||
* @category Zend
|
||||
* @package Zend_Serializer
|
||||
* @subpackage Adapter
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Serializer_Adapter_Wddx extends Zend_Serializer_Adapter_AdapterAbstract
|
||||
{
|
||||
/**
|
||||
* @var array Default options
|
||||
*/
|
||||
protected $_options = array(
|
||||
'comment' => null,
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $opts
|
||||
* @return void
|
||||
* @throws Zend_Serializer_Exception if wddx extension not found
|
||||
*/
|
||||
public function __construct($opts = array())
|
||||
{
|
||||
if (!extension_loaded('wddx')) {
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception('PHP extension "wddx" is required for this adapter');
|
||||
}
|
||||
|
||||
parent::__construct($opts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize PHP to WDDX
|
||||
*
|
||||
* @param mixed $value
|
||||
* @param array $opts
|
||||
* @return string
|
||||
* @throws Zend_Serializer_Exception on wddx error
|
||||
*/
|
||||
public function serialize($value, array $opts = array())
|
||||
{
|
||||
$opts = $opts + $this->_options;
|
||||
|
||||
if (isset($opts['comment']) && $opts['comment']) {
|
||||
$wddx = wddx_serialize_value($value, (string)$opts['comment']);
|
||||
} else {
|
||||
$wddx = wddx_serialize_value($value);
|
||||
}
|
||||
|
||||
if ($wddx === false) {
|
||||
$lastErr = error_get_last();
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception($lastErr['message']);
|
||||
}
|
||||
return $wddx;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserialize from WDDX to PHP
|
||||
*
|
||||
* @param string $wddx
|
||||
* @param array $opts
|
||||
* @return mixed
|
||||
* @throws Zend_Serializer_Exception on wddx error
|
||||
*/
|
||||
public function unserialize($wddx, array $opts = array())
|
||||
{
|
||||
$ret = wddx_deserialize($wddx);
|
||||
|
||||
if ($ret === null) {
|
||||
// check if the returned NULL is valid
|
||||
// or based on an invalid wddx string
|
||||
try {
|
||||
$simpleXml = new SimpleXMLElement($wddx);
|
||||
if (isset($simpleXml->data[0]->null[0])) {
|
||||
return null; // valid null
|
||||
}
|
||||
$errMsg = 'Can\'t unserialize wddx string';
|
||||
} catch (Exception $e) {
|
||||
$errMsg = $e->getMessage();
|
||||
}
|
||||
|
||||
require_once 'Zend/Serializer/Exception.php';
|
||||
throw new Zend_Serializer_Exception($errMsg);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
33
airtime_mvc/library/Zend/Serializer/Exception.php
Normal file
33
airtime_mvc/library/Zend/Serializer/Exception.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?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_Serializer
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Exception.php 20575 2010-01-24 17:48:27Z mabe $
|
||||
*/
|
||||
|
||||
/** @see Zend_Exception */
|
||||
require_once 'Zend/Exception.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Serializer
|
||||
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Serializer_Exception extends Zend_Exception
|
||||
{
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue