adding zend project folders into old campcaster.

This commit is contained in:
naomiaro 2010-12-07 14:19:27 -05:00
parent 56abfaf28e
commit 7ef0c18b26
4045 changed files with 1054952 additions and 0 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,131 @@
<?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_Db
* @subpackage Table
* @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: Definition.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Class for SQL table interface.
*
* @category Zend
* @package Zend_Db
* @subpackage Table
* @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_Db_Table_Definition
{
/**
* @var array
*/
protected $_tableConfigs = array();
/**
* __construct()
*
* @param array|Zend_Config $options
*/
public function __construct($options = null)
{
if ($options instanceof Zend_Config) {
$this->setConfig($options);
} elseif (is_array($options)) {
$this->setOptions($options);
}
}
/**
* setConfig()
*
* @param Zend_Config $config
* @return Zend_Db_Table_Definition
*/
public function setConfig(Zend_Config $config)
{
$this->setOptions($config->toArray());
return $this;
}
/**
* setOptions()
*
* @param array $options
* @return Zend_Db_Table_Definition
*/
public function setOptions(Array $options)
{
foreach ($options as $optionName => $optionValue) {
$this->setTableConfig($optionName, $optionValue);
}
return $this;
}
/**
* @param string $tableName
* @param array $tableConfig
* @return Zend_Db_Table_Definition
*/
public function setTableConfig($tableName, array $tableConfig)
{
// @todo logic here
$tableConfig[Zend_Db_Table::DEFINITION_CONFIG_NAME] = $tableName;
$tableConfig[Zend_Db_Table::DEFINITION] = $this;
if (!isset($tableConfig[Zend_Db_Table::NAME])) {
$tableConfig[Zend_Db_Table::NAME] = $tableName;
}
$this->_tableConfigs[$tableName] = $tableConfig;
return $this;
}
/**
* getTableConfig()
*
* @param string $tableName
* @return array
*/
public function getTableConfig($tableName)
{
return $this->_tableConfigs[$tableName];
}
/**
* removeTableConfig()
*
* @param string $tableName
*/
public function removeTableConfig($tableName)
{
unset($this->_tableConfigs[$tableName]);
}
/**
* hasTableConfig()
*
* @param string $tableName
* @return bool
*/
public function hasTableConfig($tableName)
{
return (isset($this->_tableConfigs[$tableName]));
}
}

View file

@ -0,0 +1,38 @@
<?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_Db
* @subpackage Table
* @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 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Exception
*/
require_once 'Zend/Db/Exception.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Table
* @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_Db_Table_Exception extends Zend_Db_Exception
{
}

View file

@ -0,0 +1,42 @@
<?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_Db
* @subpackage Table
* @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: Row.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Table_Row_Abstract
*/
require_once 'Zend/Db/Table/Row/Abstract.php';
/**
* Reference concrete class that extends Zend_Db_Table_Row_Abstract.
* Developers may also create their own classes that extend the abstract class.
*
* @category Zend
* @package Zend_Db
* @subpackage Table
* @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_Db_Table_Row extends Zend_Db_Table_Row_Abstract
{
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,38 @@
<?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_Db
* @subpackage Table
* @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 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Table_Exception
*/
require_once 'Zend/Db/Table/Exception.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Table
* @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_Db_Table_Row_Exception extends Zend_Db_Table_Exception
{
}

View file

@ -0,0 +1,43 @@
<?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_Db
* @subpackage Table
* @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: Rowset.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Table_Rowset_Abstract
*/
require_once 'Zend/Db/Table/Rowset/Abstract.php';
/**
* Reference concrete class that extends Zend_Db_Table_Rowset_Abstract.
* Developers may also create their own classes that extend the abstract class.
*
* @category Zend
* @package Zend_Db
* @subpackage Table
* @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_Db_Table_Rowset extends Zend_Db_Table_Rowset_Abstract
{
}

View file

@ -0,0 +1,419 @@
<?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_Db
* @subpackage Table
* @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: Abstract.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @category Zend
* @package Zend_Db
* @subpackage Table
* @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_Db_Table_Rowset_Abstract implements SeekableIterator, Countable, ArrayAccess
{
/**
* The original data for each row.
*
* @var array
*/
protected $_data = array();
/**
* Zend_Db_Table_Abstract object.
*
* @var Zend_Db_Table_Abstract
*/
protected $_table;
/**
* Connected is true if we have a reference to a live
* Zend_Db_Table_Abstract object.
* This is false after the Rowset has been deserialized.
*
* @var boolean
*/
protected $_connected = true;
/**
* Zend_Db_Table_Abstract class name.
*
* @var string
*/
protected $_tableClass;
/**
* Zend_Db_Table_Row_Abstract class name.
*
* @var string
*/
protected $_rowClass = 'Zend_Db_Table_Row';
/**
* Iterator pointer.
*
* @var integer
*/
protected $_pointer = 0;
/**
* How many data rows there are.
*
* @var integer
*/
protected $_count;
/**
* Collection of instantiated Zend_Db_Table_Row objects.
*
* @var array
*/
protected $_rows = array();
/**
* @var boolean
*/
protected $_stored = false;
/**
* @var boolean
*/
protected $_readOnly = false;
/**
* Constructor.
*
* @param array $config
*/
public function __construct(array $config)
{
if (isset($config['table'])) {
$this->_table = $config['table'];
$this->_tableClass = get_class($this->_table);
}
if (isset($config['rowClass'])) {
$this->_rowClass = $config['rowClass'];
}
if (!class_exists($this->_rowClass)) {
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($this->_rowClass);
}
if (isset($config['data'])) {
$this->_data = $config['data'];
}
if (isset($config['readOnly'])) {
$this->_readOnly = $config['readOnly'];
}
if (isset($config['stored'])) {
$this->_stored = $config['stored'];
}
// set the count of rows
$this->_count = count($this->_data);
$this->init();
}
/**
* Store data, class names, and state in serialized object
*
* @return array
*/
public function __sleep()
{
return array('_data', '_tableClass', '_rowClass', '_pointer', '_count', '_rows', '_stored',
'_readOnly');
}
/**
* Setup to do on wakeup.
* A de-serialized Rowset should not be assumed to have access to a live
* database connection, so set _connected = false.
*
* @return void
*/
public function __wakeup()
{
$this->_connected = false;
}
/**
* Initialize object
*
* Called from {@link __construct()} as final step of object instantiation.
*
* @return void
*/
public function init()
{
}
/**
* Return the connected state of the rowset.
*
* @return boolean
*/
public function isConnected()
{
return $this->_connected;
}
/**
* Returns the table object, or null if this is disconnected rowset
*
* @return Zend_Db_Table_Abstract
*/
public function getTable()
{
return $this->_table;
}
/**
* Set the table object, to re-establish a live connection
* to the database for a Rowset that has been de-serialized.
*
* @param Zend_Db_Table_Abstract $table
* @return boolean
* @throws Zend_Db_Table_Row_Exception
*/
public function setTable(Zend_Db_Table_Abstract $table)
{
$this->_table = $table;
$this->_connected = false;
// @todo This works only if we have iterated through
// the result set once to instantiate the rows.
foreach ($this as $row) {
$connected = $row->setTable($table);
if ($connected == true) {
$this->_connected = true;
}
}
return $this->_connected;
}
/**
* Query the class name of the Table object for which this
* Rowset was created.
*
* @return string
*/
public function getTableClass()
{
return $this->_tableClass;
}
/**
* Rewind the Iterator to the first element.
* Similar to the reset() function for arrays in PHP.
* Required by interface Iterator.
*
* @return Zend_Db_Table_Rowset_Abstract Fluent interface.
*/
public function rewind()
{
$this->_pointer = 0;
return $this;
}
/**
* Return the current element.
* Similar to the current() function for arrays in PHP
* Required by interface Iterator.
*
* @return Zend_Db_Table_Row_Abstract current element from the collection
*/
public function current()
{
if ($this->valid() === false) {
return null;
}
// do we already have a row object for this position?
if (empty($this->_rows[$this->_pointer])) {
$this->_rows[$this->_pointer] = new $this->_rowClass(
array(
'table' => $this->_table,
'data' => $this->_data[$this->_pointer],
'stored' => $this->_stored,
'readOnly' => $this->_readOnly
)
);
}
// return the row object
return $this->_rows[$this->_pointer];
}
/**
* Return the identifying key of the current element.
* Similar to the key() function for arrays in PHP.
* Required by interface Iterator.
*
* @return int
*/
public function key()
{
return $this->_pointer;
}
/**
* Move forward to next element.
* Similar to the next() function for arrays in PHP.
* Required by interface Iterator.
*
* @return void
*/
public function next()
{
++$this->_pointer;
}
/**
* Check if there is a current element after calls to rewind() or next().
* Used to check if we've iterated to the end of the collection.
* Required by interface Iterator.
*
* @return bool False if there's nothing more to iterate over
*/
public function valid()
{
return $this->_pointer < $this->_count;
}
/**
* Returns the number of elements in the collection.
*
* Implements Countable::count()
*
* @return int
*/
public function count()
{
return $this->_count;
}
/**
* Take the Iterator to position $position
* Required by interface SeekableIterator.
*
* @param int $position the position to seek to
* @return Zend_Db_Table_Rowset_Abstract
* @throws Zend_Db_Table_Rowset_Exception
*/
public function seek($position)
{
$position = (int) $position;
if ($position < 0 || $position >= $this->_count) {
require_once 'Zend/Db/Table/Rowset/Exception.php';
throw new Zend_Db_Table_Rowset_Exception("Illegal index $position");
}
$this->_pointer = $position;
return $this;
}
/**
* Check if an offset exists
* Required by the ArrayAccess implementation
*
* @param string $offset
* @return boolean
*/
public function offsetExists($offset)
{
return isset($this->_data[(int) $offset]);
}
/**
* Get the row for the given offset
* Required by the ArrayAccess implementation
*
* @param string $offset
* @return Zend_Db_Table_Row_Abstract
*/
public function offsetGet($offset)
{
$this->_pointer = (int) $offset;
return $this->current();
}
/**
* Does nothing
* Required by the ArrayAccess implementation
*
* @param string $offset
* @param mixed $value
*/
public function offsetSet($offset, $value)
{
}
/**
* Does nothing
* Required by the ArrayAccess implementation
*
* @param string $offset
*/
public function offsetUnset($offset)
{
}
/**
* Returns a Zend_Db_Table_Row from a known position into the Iterator
*
* @param int $position the position of the row expected
* @param bool $seek wether or not seek the iterator to that position after
* @return Zend_Db_Table_Row
* @throws Zend_Db_Table_Rowset_Exception
*/
public function getRow($position, $seek = false)
{
$key = $this->key();
try {
$this->seek($position);
$row = $this->current();
} catch (Zend_Db_Table_Rowset_Exception $e) {
require_once 'Zend/Db/Table/Rowset/Exception.php';
throw new Zend_Db_Table_Rowset_Exception('No row could be found at position ' . (int) $position, 0, $e);
}
if ($seek == false) {
$this->seek($key);
}
return $row;
}
/**
* Returns all data as an array.
*
* Updates the $_data property with current row object values.
*
* @return array
*/
public function toArray()
{
// @todo This works only if we have iterated through
// the result set once to instantiate the rows.
foreach ($this->_rows as $i => $row) {
$this->_data[$i] = $row->toArray();
}
return $this->_data;
}
}

View file

@ -0,0 +1,37 @@
<?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_Db
* @subpackage Table
* @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 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Table_Exception
*/
require_once 'Zend/Db/Table/Exception.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Table
* @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_Db_Table_Rowset_Exception extends Zend_Db_Table_Exception
{
}

View file

@ -0,0 +1,224 @@
<?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_Db
* @subpackage Select
* @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: Select.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Db_Select
*/
require_once 'Zend/Db/Select.php';
/**
* @see Zend_Db_Table_Abstract
*/
require_once 'Zend/Db/Table/Abstract.php';
/**
* Class for SQL SELECT query manipulation for the Zend_Db_Table component.
*
* @category Zend
* @package Zend_Db
* @subpackage Table
* @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_Db_Table_Select extends Zend_Db_Select
{
/**
* Table schema for parent Zend_Db_Table.
*
* @var array
*/
protected $_info;
/**
* Table integrity override.
*
* @var array
*/
protected $_integrityCheck = true;
/**
* Table instance that created this select object
*
* @var Zend_Db_Table_Abstract
*/
protected $_table;
/**
* Class constructor
*
* @param Zend_Db_Table_Abstract $adapter
*/
public function __construct(Zend_Db_Table_Abstract $table)
{
parent::__construct($table->getAdapter());
$this->setTable($table);
}
/**
* Return the table that created this select object
*
* @return Zend_Db_Table_Abstract
*/
public function getTable()
{
return $this->_table;
}
/**
* Sets the primary table name and retrieves the table schema.
*
* @param Zend_Db_Table_Abstract $adapter
* @return Zend_Db_Select This Zend_Db_Select object.
*/
public function setTable(Zend_Db_Table_Abstract $table)
{
$this->_adapter = $table->getAdapter();
$this->_info = $table->info();
$this->_table = $table;
return $this;
}
/**
* Sets the integrity check flag.
*
* Setting this flag to false skips the checks for table joins, allowing
* 'hybrid' table rows to be created.
*
* @param Zend_Db_Table_Abstract $adapter
* @return Zend_Db_Select This Zend_Db_Select object.
*/
public function setIntegrityCheck($flag = true)
{
$this->_integrityCheck = $flag;
return $this;
}
/**
* Tests query to determine if expressions or aliases columns exist.
*
* @return boolean
*/
public function isReadOnly()
{
$readOnly = false;
$fields = $this->getPart(Zend_Db_Table_Select::COLUMNS);
$cols = $this->_info[Zend_Db_Table_Abstract::COLS];
if (!count($fields)) {
return $readOnly;
}
foreach ($fields as $columnEntry) {
$column = $columnEntry[1];
$alias = $columnEntry[2];
if ($alias !== null) {
$column = $alias;
}
switch (true) {
case ($column == self::SQL_WILDCARD):
break;
case ($column instanceof Zend_Db_Expr):
case (!in_array($column, $cols)):
$readOnly = true;
break 2;
}
}
return $readOnly;
}
/**
* Adds a FROM table and optional columns to the query.
*
* The table name can be expressed
*
* @param array|string|Zend_Db_Expr|Zend_Db_Table_Abstract $name The table name or an
associative array relating
table name to correlation
name.
* @param array|string|Zend_Db_Expr $cols The columns to select from this table.
* @param string $schema The schema name to specify, if any.
* @return Zend_Db_Table_Select This Zend_Db_Table_Select object.
*/
public function from($name, $cols = self::SQL_WILDCARD, $schema = null)
{
if ($name instanceof Zend_Db_Table_Abstract) {
$info = $name->info();
$name = $info[Zend_Db_Table_Abstract::NAME];
if (isset($info[Zend_Db_Table_Abstract::SCHEMA])) {
$schema = $info[Zend_Db_Table_Abstract::SCHEMA];
}
}
return $this->joinInner($name, null, $cols, $schema);
}
/**
* Performs a validation on the select query before passing back to the parent class.
* Ensures that only columns from the primary Zend_Db_Table are returned in the result.
*
* @return string|null This object as a SELECT string (or null if a string cannot be produced)
*/
public function assemble()
{
$fields = $this->getPart(Zend_Db_Table_Select::COLUMNS);
$primary = $this->_info[Zend_Db_Table_Abstract::NAME];
$schema = $this->_info[Zend_Db_Table_Abstract::SCHEMA];
if (count($this->_parts[self::UNION]) == 0) {
// If no fields are specified we assume all fields from primary table
if (!count($fields)) {
$this->from($primary, self::SQL_WILDCARD, $schema);
$fields = $this->getPart(Zend_Db_Table_Select::COLUMNS);
}
$from = $this->getPart(Zend_Db_Table_Select::FROM);
if ($this->_integrityCheck !== false) {
foreach ($fields as $columnEntry) {
list($table, $column) = $columnEntry;
// Check each column to ensure it only references the primary table
if ($column) {
if (!isset($from[$table]) || $from[$table]['tableName'] != $primary) {
require_once 'Zend/Db/Table/Select/Exception.php';
throw new Zend_Db_Table_Select_Exception('Select query cannot join with another table');
}
}
}
}
}
return parent::assemble();
}
}

View file

@ -0,0 +1,39 @@
<?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_Db
* @subpackage Select
* @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 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Db_Exception
*/
require_once 'Zend/Db/Select/Exception.php';
/**
* @category Zend
* @package Zend_Db
* @subpackage Table
* @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_Db_Table_Select_Exception extends Zend_Db_Select_Exception
{
}