зеркало из https://github.com/mozilla/pjs.git
Bug 378977 - Migrate to and ship with Cake 1.2 (part 2). r=reed
This commit is contained in:
Родитель
deeee726f1
Коммит
618bfedd7f
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id: apc.php,v 1.1 2007-05-25 06:30:18 rflint%ryanflint.com Exp $ */
|
||||
/**
|
||||
* APC storage engine for cache.
|
||||
*
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.cache
|
||||
* @since CakePHP(tm) v 1.2.0.4933
|
||||
* @version $Revision: 1.1 $
|
||||
* @modifiedby $LastChangedBy: phpnut $
|
||||
* @lastmodified $Date: 2007-05-25 06:30:18 $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
/**
|
||||
* APC storage engine for cache
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.cache
|
||||
*/
|
||||
class APCEngine extends CacheEngine {
|
||||
/**
|
||||
* Set up the cache engine
|
||||
*
|
||||
* Called automatically by the cache frontend
|
||||
*
|
||||
* @param array $params Associative array of parameters for the engine
|
||||
* @return boolean True if the engine has been succesfully initialized, false if not
|
||||
* @access public
|
||||
*/
|
||||
function init(&$params) {
|
||||
return function_exists('apc_cache_info');
|
||||
}
|
||||
/**
|
||||
* Write a value in the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @param mixed $value Data to be cached
|
||||
* @param int $duration How long to cache the data, in seconds
|
||||
* @return boolean True if the data was succesfully cached, false on failure
|
||||
* @access public
|
||||
*/
|
||||
function write($key, &$value, $duration = CACHE_DEFAULT_DURATION) {
|
||||
return apc_store($key, $value, $duration);
|
||||
}
|
||||
/**
|
||||
* Read a value from the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
|
||||
* @access public
|
||||
*/
|
||||
function read($key) {
|
||||
return apc_fetch($key);
|
||||
}
|
||||
/**
|
||||
* Delete a value from the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed
|
||||
* @access public
|
||||
*/
|
||||
function delete($key) {
|
||||
return apc_delete($key);
|
||||
}
|
||||
/**
|
||||
* Delete all values from the cache
|
||||
*
|
||||
* @return boolean True if the cache was succesfully cleared, false otherwise
|
||||
* @access public
|
||||
*/
|
||||
function clear() {
|
||||
return apc_clear_cache('user');
|
||||
}
|
||||
/**
|
||||
* Return the settings for this cache engine
|
||||
*
|
||||
* @return array list of settings for this engine
|
||||
* @access public
|
||||
*/
|
||||
function settings() {
|
||||
return array('class' => get_class($this));
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,279 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id: file.php,v 1.1 2007-05-25 06:30:18 rflint%ryanflint.com Exp $ */
|
||||
/**
|
||||
* File Storage engine for cache
|
||||
*
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.cache
|
||||
* @since CakePHP(tm) v 1.2.0.4933
|
||||
* @version $Revision: 1.1 $
|
||||
* @modifiedby $LastChangedBy: phpnut $
|
||||
* @lastmodified $Date: 2007-05-25 06:30:18 $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
/**
|
||||
* Included libraries.
|
||||
*
|
||||
*/
|
||||
if (!class_exists('Folder')) {
|
||||
uses ('folder');
|
||||
}
|
||||
/**
|
||||
* File Storage engine for cache
|
||||
*
|
||||
* @todo use the File and Folder classes (if it's not a too big performance hit)
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.cache
|
||||
*/
|
||||
class FileEngine extends CacheEngine {
|
||||
/**
|
||||
* Cache directory
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $_dir = '';
|
||||
/**
|
||||
* Cache filename prefix
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $_prefix = '';
|
||||
/**
|
||||
* Use locking
|
||||
*
|
||||
* @var boolean
|
||||
* @access private
|
||||
*/
|
||||
var $_lock = false;
|
||||
/**
|
||||
* Set up the cache engine
|
||||
*
|
||||
* Called automatically by the cache frontend
|
||||
*
|
||||
* @param array $params Associative array of parameters for the engine
|
||||
* @return boolean True if the engine has been succesfully initialized, false if not
|
||||
* @access public
|
||||
*/
|
||||
function init($params) {
|
||||
$dir = CACHE;
|
||||
$prefix = 'cake_';
|
||||
$lock = false;
|
||||
extract($params);
|
||||
$dir = trim($dir);
|
||||
$folder =& new Folder();
|
||||
|
||||
if (!empty($dir)) {
|
||||
$dir = $folder->slashTerm($dir);
|
||||
}
|
||||
|
||||
if(empty($dir) || !$folder->isAbsolute($dir) || !is_writable($dir)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->_dir = $dir;
|
||||
$this->_prefix = strval($prefix);
|
||||
$this->_lock = $lock;
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Garbage collection
|
||||
* Permanently remove all expired and deleted data
|
||||
*
|
||||
* @return boolean True if garbage collection was succesful, false on failure
|
||||
* @access public
|
||||
*/
|
||||
function gc() {
|
||||
return $this->clear(true);
|
||||
}
|
||||
/**
|
||||
* Write a value in the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @param mixed $value Data to be cached
|
||||
* @param mixed $duration How long to cache the data, in seconds
|
||||
* @return boolean True if the data was succesfully cached, false on failure
|
||||
* @access public
|
||||
*/
|
||||
function write($key, &$value, $duration = CACHE_DEFAULT_DURATION) {
|
||||
$serialized = serialize($value);
|
||||
|
||||
if(!$serialized) {
|
||||
return false;
|
||||
}
|
||||
$expires = time() + $duration;
|
||||
return $this->_writeCache($this->_getFilename($key), $serialized, $expires);
|
||||
}
|
||||
/**
|
||||
* Get absolute filename for a key
|
||||
*
|
||||
* @param string $key The key
|
||||
* @return string Absolute cache filename for the given key
|
||||
* @access private
|
||||
*/
|
||||
function _getFilename($key) {
|
||||
return $this->_dir . $this->_prefix . $this->base64url_encode($key);
|
||||
}
|
||||
/**
|
||||
* write serialized data to a file
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $value
|
||||
* @param integer $expires
|
||||
* @return boolean True on success, false on failure
|
||||
* @access private
|
||||
*/
|
||||
function _writeCache(&$filename, &$value, &$expires) {
|
||||
$contents = $expires."\n".$value."\n";
|
||||
return ife(file_put_contents($filename, $contents, ife($this->_lock, LOCK_EX, 0)), true, false);
|
||||
}
|
||||
/**
|
||||
* Read a value from the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
|
||||
* @access public
|
||||
*/
|
||||
function read($key) {
|
||||
$filename = $this->_getFilename($key);
|
||||
|
||||
if(!is_file($filename) || !is_readable($filename)) {
|
||||
return false;
|
||||
}
|
||||
$fp = fopen($filename, 'r');
|
||||
|
||||
if(!$fp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if($this->_lock && !flock($fp, LOCK_SH)) {
|
||||
return false;
|
||||
}
|
||||
$expires = fgets($fp, 11);
|
||||
|
||||
if(intval($expires) < time()) {
|
||||
fclose($fp);
|
||||
unlink($filename);
|
||||
return false;
|
||||
}
|
||||
$data = '';
|
||||
|
||||
while(!feof($fp)) {
|
||||
$data .= fgets($fp, 4096);
|
||||
}
|
||||
$data = trim($data);
|
||||
return unserialize($data);
|
||||
}
|
||||
/**
|
||||
* Get the expiry time for a cache file
|
||||
*
|
||||
* @param string $filename
|
||||
* @return mixed Expiration timestamp, or false on failure
|
||||
* @access private
|
||||
*/
|
||||
function _getExpiry($filename) {
|
||||
$fp = fopen($filename, 'r');
|
||||
|
||||
if(!$fp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if($this->_lock && !flock($fp, LOCK_SH)) {
|
||||
return false;
|
||||
}
|
||||
$expires = intval(fgets($fp, 11));
|
||||
fclose($fp);
|
||||
return $expires;
|
||||
}
|
||||
/**
|
||||
* Delete a value from the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed
|
||||
* @access public
|
||||
*/
|
||||
function delete($key) {
|
||||
$filename = $this->_getFilename($key);
|
||||
return unlink($filename);
|
||||
}
|
||||
/**
|
||||
* Delete all values from the cache
|
||||
*
|
||||
* @param boolean $checkExpiry Optional - only delete expired cache items
|
||||
* @return boolean True if the cache was succesfully cleared, false otherwise
|
||||
* @access public
|
||||
*/
|
||||
function clear($checkExpiry = false) {
|
||||
$dir = dir($this->_dir);
|
||||
|
||||
if ($checkExpiry) {
|
||||
$now = time();
|
||||
$threshold = $now - 86400;
|
||||
}
|
||||
|
||||
while(($entry = $dir->read()) !== false) {
|
||||
if(strpos($entry, $this->_prefix) !== 0) {
|
||||
continue;
|
||||
}
|
||||
$filename = $this->_dir.$entry;
|
||||
|
||||
if($checkExpiry) {
|
||||
$mtime = filemtime($filename);
|
||||
|
||||
if($mtime === false || $mtime > $threshold) {
|
||||
continue;
|
||||
}
|
||||
$expires = $this->_getExpiry($filename);
|
||||
|
||||
if($expires > $now) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
unlink($filename);
|
||||
}
|
||||
$dir->close();
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Return the settings for this cache engine
|
||||
*
|
||||
* @return array list of settings for this engine
|
||||
* @access public
|
||||
*/
|
||||
function settings() {
|
||||
$lock = 'false';
|
||||
if($this->_lock) {
|
||||
$lock = 'true';
|
||||
}
|
||||
return array('class' => get_class($this),
|
||||
'directory' => $this->_dir,
|
||||
'prefix' => $this->_prefix,
|
||||
'lock' => $lock);
|
||||
}
|
||||
/**
|
||||
* Get a filename-safe version of a string
|
||||
*
|
||||
* @param string $str String to encode
|
||||
* @return string Encoded version of the string
|
||||
* @access public
|
||||
*/
|
||||
function base64url_encode($str) {
|
||||
return strtr(base64_encode($str), '+/', '-_');
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,141 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id: memcache.php,v 1.1 2007-05-25 06:30:18 rflint%ryanflint.com Exp $ */
|
||||
/**
|
||||
* Memcache storage engine for cache
|
||||
*
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.cache
|
||||
* @since CakePHP(tm) v 1.2.0.4933
|
||||
* @version $Revision: 1.1 $
|
||||
* @modifiedby $LastChangedBy: phpnut $
|
||||
* @lastmodified $Date: 2007-05-25 06:30:18 $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
/**
|
||||
* Memcache storage engine for cache
|
||||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.cache
|
||||
*/
|
||||
class MemcacheEngine extends CacheEngine {
|
||||
/**
|
||||
* Memcache wrapper.
|
||||
*
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $__Memcache = null;
|
||||
/**
|
||||
* Memcache compress status.
|
||||
*
|
||||
* @var int
|
||||
* @access private
|
||||
*/
|
||||
var $_compress = 0;
|
||||
/**
|
||||
* Set up the cache engine
|
||||
*
|
||||
* Called automatically by the cache frontend
|
||||
*
|
||||
* @param array $params Associative array of parameters for the engine
|
||||
* @return boolean True if the engine has been succesfully initialized, false if not
|
||||
* @access public
|
||||
*/
|
||||
function init(&$params) {
|
||||
if(!class_exists('Memcache')) {
|
||||
return false;
|
||||
}
|
||||
$servers = array('127.0.0.1');
|
||||
$compress = false;
|
||||
extract($params);
|
||||
|
||||
if($compress) {
|
||||
$this->_compress = MEMCACHE_COMPRESSED;
|
||||
} else {
|
||||
$this->_compress = 0;
|
||||
}
|
||||
|
||||
if(!is_array($servers)) {
|
||||
$servers = array($servers);
|
||||
}
|
||||
$this->__Memcache =& new Memcache();
|
||||
$connected = false;
|
||||
|
||||
foreach($servers as $server) {
|
||||
$parts = explode(':', $server);
|
||||
$host = $parts[0];
|
||||
$port = isset($parts[1]) ? $parts[1] : 11211;
|
||||
|
||||
if($this->__Memcache->addServer($host, $port)) {
|
||||
$connected = true;
|
||||
}
|
||||
}
|
||||
return $connected;
|
||||
}
|
||||
/**
|
||||
* Write a value in the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @param mixed $value Data to be cached
|
||||
* @param int $duration How long to cache the data, in seconds
|
||||
* @return boolean True if the data was succesfully cached, false on failure
|
||||
* @access public
|
||||
*/
|
||||
function write($key, &$value, $duration = CACHE_DEFAULT_DURATION) {
|
||||
return $this->__Memcache->set($key, $value, $this->_compress, $duration);
|
||||
}
|
||||
/**
|
||||
* Read a value from the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
|
||||
* @access public
|
||||
*/
|
||||
function read($key) {
|
||||
return $this->__Memcache->get($key);
|
||||
}
|
||||
/**
|
||||
* Delete a value from the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed
|
||||
* @access public
|
||||
*/
|
||||
function delete($key) {
|
||||
return $this->__Memcache->delete($key);
|
||||
}
|
||||
/**
|
||||
* Delete all values from the cache
|
||||
*
|
||||
* @return boolean True if the cache was succesfully cleared, false otherwise
|
||||
* @access public
|
||||
*/
|
||||
function clear() {
|
||||
return $this->__Memcache->flush();
|
||||
}
|
||||
/**
|
||||
* Return the settings for this cache engine
|
||||
*
|
||||
* @return array list of settings for this engine
|
||||
* @access public
|
||||
*/
|
||||
function settings() {
|
||||
return array('class' => get_class($this),
|
||||
'compress' => $this->_compress);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,162 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id: model.php,v 1.1 2007-05-25 06:30:18 rflint%ryanflint.com Exp $ */
|
||||
/**
|
||||
* Database Storage engine for cache
|
||||
*
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.cache
|
||||
* @since CakePHP(tm) v 1.2.0.4933
|
||||
* @version $Revision: 1.1 $
|
||||
* @modifiedby $LastChangedBy: phpnut $
|
||||
* @lastmodified $Date: 2007-05-25 06:30:18 $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
/**
|
||||
* Database Storage engine for cache
|
||||
*
|
||||
* @todo Not Implemented
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.cache
|
||||
*/
|
||||
class ModelEngine extends CacheEngine {
|
||||
/**
|
||||
* Model instance.
|
||||
*
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
var $_Model = null;
|
||||
/**
|
||||
* Fields that holds data.
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $_dataField = '';
|
||||
/**
|
||||
* Field that holds expiration information.
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
|
||||
var $_expiryField = '';
|
||||
/**
|
||||
* Set up the cache engine
|
||||
*
|
||||
* Called automatically by the cache frontend
|
||||
*
|
||||
* @todo does not work will return false
|
||||
* @param array $params Associative array of parameters for the engine
|
||||
* @return boolean True if the engine has been succesfully initialized, false if not
|
||||
*/
|
||||
function init($params) {
|
||||
return false;
|
||||
|
||||
$modelName = 'DbCache';
|
||||
$dataField = 'value';
|
||||
$expiryField = 'expires';
|
||||
extract($params);
|
||||
|
||||
if(!class_exists($modelName) && !loadModel($modelName)) {
|
||||
return false;
|
||||
}
|
||||
$this->_Model = new $modelName;
|
||||
}
|
||||
/**
|
||||
* Garbage collection
|
||||
*
|
||||
* Permanently remove all expired and deleted data
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function gc() {
|
||||
return $this->_Model->deleteAll(array($this->_expiryField => '<= '.time()));
|
||||
}
|
||||
/**
|
||||
* Write a value in the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @param mixed $value Data to be cached
|
||||
* @param mixed $duration How long to cache the data, in seconds
|
||||
* @return boolean True if the data was succesfully cached, false on failure
|
||||
* @access public
|
||||
*/
|
||||
function write($key, &$value, $duration = CACHE_DEFAULT_DURATION) {
|
||||
$serialized = serialize($value);
|
||||
|
||||
if(!$serialized) {
|
||||
return false;
|
||||
}
|
||||
$data = array($this->_Model->name => array(
|
||||
$this->_dataField => $serialized,
|
||||
$this->_expiryField => time() + $duration));
|
||||
|
||||
$oldId = $this->_Model->id;
|
||||
$this->_Model->id = $key;
|
||||
$res = $this->_Model->save($data);
|
||||
$this->_Model->id = $oldId;
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* Read a value from the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
|
||||
* @access public
|
||||
*/
|
||||
function read($key) {
|
||||
$val = $this->_Model->field($this->_expiryField, array($this->_Model->primaryKey => $key, $this->_expiryField => '> '.time()));
|
||||
return ife($val, unserialize($val), false);
|
||||
}
|
||||
/**
|
||||
* Delete a value from the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed
|
||||
* @access public
|
||||
*/
|
||||
function delete($key) {
|
||||
return $this->_Model->del($key);
|
||||
}
|
||||
/**
|
||||
* Delete all values from the cache
|
||||
*
|
||||
* @return boolean True if the cache was succesfully cleared, false otherwise
|
||||
* @access public
|
||||
*/
|
||||
function clear() {
|
||||
return $this->_Model->deleteAll(null);
|
||||
}
|
||||
/**
|
||||
* Return the settings for this cache engine
|
||||
*
|
||||
* @return array list of settings for this engine
|
||||
* @access public
|
||||
*/
|
||||
function settings() {
|
||||
$class = null;
|
||||
if(is_a($this->_Model, 'Model')) {
|
||||
$class = get_class($this->_Model);
|
||||
}
|
||||
return array('class' => get_class($this),
|
||||
'modelName' => $class,
|
||||
'dataField' => $this->_dataField,
|
||||
'expiryField' => $this->_expiryField);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,159 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id: xcache.php,v 1.1 2007-05-25 06:30:18 rflint%ryanflint.com Exp $ */
|
||||
/**
|
||||
* Xcache storage engine for cache.
|
||||
*
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.cache
|
||||
* @since CakePHP(tm) v 1.2.0.4947
|
||||
* @version $Revision: 1.1 $
|
||||
* @modifiedby $LastChangedBy: phpnut $
|
||||
* @lastmodified $Date: 2007-05-25 06:30:18 $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
/**
|
||||
* Xcache storage engine for cache
|
||||
*
|
||||
* @link http://trac.lighttpd.net/xcache/ Xcache
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs.cache
|
||||
*/
|
||||
class XcacheEngine extends CacheEngine {
|
||||
/**
|
||||
* Admin username (xcache.admin.user)
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $_php_auth_user = '';
|
||||
/**
|
||||
* Plaintext password for basic auth (xcache.admin.pass)
|
||||
*
|
||||
* @var string
|
||||
* @access private
|
||||
*/
|
||||
var $_php_auth_pw = '';
|
||||
/**
|
||||
* Set up the cache engine
|
||||
*
|
||||
* Called automatically by the cache frontend
|
||||
*
|
||||
* @param array $params Associative array of parameters for the engine
|
||||
* @return boolean True if the engine has been succesfully initialized, false if not
|
||||
* @access public
|
||||
*/
|
||||
function init($params) {
|
||||
$this->_php_auth_user = $params['user'];
|
||||
$this->_php_auth_pw = $params['password'];
|
||||
return function_exists('xcache_info');
|
||||
}
|
||||
/**
|
||||
* Write a value in the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @param mixed $value Data to be cached
|
||||
* @param int $duration How long to cache the data, in seconds
|
||||
* @return boolean True if the data was succesfully cached, false on failure
|
||||
* @access public
|
||||
*/
|
||||
function write($key, &$value, $duration = CACHE_DEFAULT_DURATION) {
|
||||
return xcache_set($key, $value, $duration);
|
||||
}
|
||||
/**
|
||||
* Read a value from the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it
|
||||
* @access public
|
||||
*/
|
||||
function read($key) {
|
||||
if(xcache_isset($key)) {
|
||||
return xcache_get($key);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Delete a value from the cache
|
||||
*
|
||||
* @param string $key Identifier for the data
|
||||
* @return boolean True if the value was succesfully deleted, false if it didn't exist or couldn't be removed
|
||||
* @access public
|
||||
*/
|
||||
function delete($key) {
|
||||
return xcache_unset($key);
|
||||
}
|
||||
/**
|
||||
* Delete all values from the cache
|
||||
*
|
||||
* @return boolean True if the cache was succesfully cleared, false otherwise
|
||||
* @access public
|
||||
*/
|
||||
function clear() {
|
||||
$result = true;
|
||||
$this->_phpAuth();
|
||||
|
||||
for($i = 0, $max = xcache_count(XC_TYPE_VAR); $i < $max; $i++) {
|
||||
if(!xcache_clear_cache(XC_TYPE_VAR, $i)) {
|
||||
$result = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->_phpAuth(true);
|
||||
return $result;
|
||||
}
|
||||
/**
|
||||
* Return the settings for this cache engine
|
||||
*
|
||||
* @return array list of settings for this engine
|
||||
* @access public
|
||||
*/
|
||||
function settings() {
|
||||
return array('class' => get_class($this));
|
||||
}
|
||||
/**
|
||||
* Makes necessary changes (and reverting them back) in $_SERVER
|
||||
*
|
||||
* This has to be done because xcache_clear_cache() needs pass Basic Auth
|
||||
* (see xcache.admin configuration settings)
|
||||
*
|
||||
* @param boolean Revert changes
|
||||
* @access private
|
||||
*/
|
||||
function _phpAuth($reverse = false) {
|
||||
static $backup = array();
|
||||
$keys = array('PHP_AUTH_USER', 'PHP_AUTH_PW');
|
||||
|
||||
foreach($keys as $key) {
|
||||
if($reverse) {
|
||||
if(isset($backup[$key])) {
|
||||
$_SERVER[$key] = $backup[$key];
|
||||
unset($backup[$key]);
|
||||
} else {
|
||||
unset($_SERVER[$key]);
|
||||
}
|
||||
} else {
|
||||
$value = env($key);
|
||||
if(!empty($value)) {
|
||||
$backup[$key] = $value;
|
||||
}
|
||||
$varName = '_' . low($key);
|
||||
$_SERVER[$key] = $this->{$varName};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1,76 +0,0 @@
|
|||
;<?php die() ?>
|
||||
; SVN FILE: $Id: acl.ini.php,v 1.3 2006-10-08 03:39:21 reed%reedloden.com Exp $
|
||||
;/**
|
||||
; * Short description for file.
|
||||
; *
|
||||
; *
|
||||
; * PHP versions 4 and 5
|
||||
; *
|
||||
; * CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
||||
; * Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
; * 1785 E. Sahara Avenue, Suite 490-204
|
||||
; * Las Vegas, Nevada 89104
|
||||
; *
|
||||
; * Licensed under The MIT License
|
||||
; * Redistributions of files must retain the above copyright notice.
|
||||
; *
|
||||
; * @filesource
|
||||
; * @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
; * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
||||
; * @package cake
|
||||
; * @subpackage cake.app.config
|
||||
; * @since CakePHP v 0.10.0.1076
|
||||
; * @version $Revision: 1.3 $
|
||||
; * @modifiedby $LastChangedBy: phpnut $
|
||||
; * @lastmodified $Date: 2006-10-08 03:39:21 $
|
||||
; * @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
; */
|
||||
|
||||
; acl.ini.php - Cake ACL Configuration
|
||||
; ---------------------------------------------------------------------
|
||||
; Use this file to specify user permissions.
|
||||
; aco = access control object (something in your application)
|
||||
; aro = access request object (something requesting access)
|
||||
;
|
||||
; User records are added as follows:
|
||||
;
|
||||
; [uid]
|
||||
; groups = group1, group2, group3
|
||||
; allow = aco1, aco2, aco3
|
||||
; deny = aco4, aco5, aco6
|
||||
;
|
||||
; Group records are added in a similar manner:
|
||||
;
|
||||
; [gid]
|
||||
; allow = aco1, aco2, aco3
|
||||
; deny = aco4, aco5, aco6
|
||||
;
|
||||
; The allow, deny, and groups sections are all optional.
|
||||
; NOTE: groups names *cannot* ever be the same as usernames!
|
||||
;
|
||||
; ACL permissions are checked in the following order:
|
||||
; 1. Check for user denies (and DENY if specified)
|
||||
; 2. Check for user allows (and ALLOW if specified)
|
||||
; 3. Gather user's groups
|
||||
; 4. Check group denies (and DENY if specified)
|
||||
; 5. Check group allows (and ALLOW if specified)
|
||||
; 6. If no aro, aco, or group information is found, DENY
|
||||
;
|
||||
; ---------------------------------------------------------------------
|
||||
|
||||
;-------------------------------------
|
||||
;Users
|
||||
;-------------------------------------
|
||||
|
||||
[username-goes-here]
|
||||
groups = group1, group2
|
||||
deny = aco1, aco2
|
||||
allow = aco3, aco4
|
||||
|
||||
;-------------------------------------
|
||||
;Groups
|
||||
;-------------------------------------
|
||||
|
||||
[groupname-goes-here]
|
||||
deny = aco5, aco6
|
||||
allow = aco7, aco8
|
|
@ -1,147 +0,0 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id: core.php,v 1.4 2006-10-08 03:39:21 reed%reedloden.com Exp $ */
|
||||
/**
|
||||
* This is core configuration file.
|
||||
*
|
||||
* Use it to configure core behaviour ofCake.
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
||||
* @package cake
|
||||
* @subpackage cake.app.config
|
||||
* @since CakePHP v 0.2.9
|
||||
* @version $Revision: 1.4 $
|
||||
* @modifiedby $LastChangedBy: phpnut $
|
||||
* @lastmodified $Date: 2006-10-08 03:39:21 $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
/**
|
||||
* If you do not have mod rewrite on your system
|
||||
* or if you prefer to use CakePHP pretty urls.
|
||||
* uncomment the line below.
|
||||
* Note: If you do have mod rewrite but prefer the
|
||||
* CakePHP pretty urls, you also have to remove the
|
||||
* .htaccess files
|
||||
* release/.htaccess
|
||||
* release/app/.htaccess
|
||||
* release/app/webroot/.htaccess
|
||||
*/
|
||||
// define ('BASE_URL', env('SCRIPT_NAME'));
|
||||
/**
|
||||
* Set debug level here:
|
||||
* - 0: production
|
||||
* - 1: development
|
||||
* - 2: full debug with sql
|
||||
* - 3: full debug with sql and dump of the current object
|
||||
*
|
||||
* In production, the "flash messages" redirect after a time interval.
|
||||
* With the other debug levels you get to click the "flash message" to continue.
|
||||
*
|
||||
*/
|
||||
define('DEBUG', 0);
|
||||
/**
|
||||
* Turn of caching checking wide.
|
||||
* You must still use the controller var cacheAction inside you controller class.
|
||||
* You can either set it controller wide, or in each controller method.
|
||||
* use var $cacheAction = true; or in the controller method $this->cacheAction = true;
|
||||
*/
|
||||
define('CACHE_CHECK', false);
|
||||
/**
|
||||
* Error constant. Used for differentiating error logging and debugging.
|
||||
* Currently PHP supports LOG_DEBUG
|
||||
*/
|
||||
define('LOG_ERROR', 2);
|
||||
/**
|
||||
* CakePHP includes 3 types of session saves
|
||||
* database or file. Set this to your preferred method.
|
||||
* If you want to use your own save handler place it in
|
||||
* app/config/name.php DO NOT USE file or database as the name.
|
||||
* and use just the name portion below.
|
||||
*
|
||||
* Setting this to cake will save files to /cakedistro/tmp directory
|
||||
* Setting it to php will use the php default save path
|
||||
* Setting it to database will use the database
|
||||
*
|
||||
*
|
||||
*/
|
||||
define('CAKE_SESSION_SAVE', 'database');
|
||||
/**
|
||||
* If using you own table name for storing sessions
|
||||
* set the table name here.
|
||||
* DO NOT INCLUDE PREFIX IF YOU HAVE SET ONE IN database.php
|
||||
*
|
||||
*/
|
||||
define('CAKE_SESSION_TABLE', 'sessions');
|
||||
/**
|
||||
* Set a random string of used in session.
|
||||
*
|
||||
*/
|
||||
define('CAKE_SESSION_STRING', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
|
||||
/**
|
||||
* Set the name of session cookie
|
||||
*
|
||||
*/
|
||||
define('CAKE_SESSION_COOKIE', 'sess');
|
||||
/**
|
||||
* Set level of Cake security.
|
||||
*
|
||||
*/
|
||||
define('CAKE_SECURITY', 'high');
|
||||
/**
|
||||
* Set Cake Session time out.
|
||||
* If CAKE_SECURITY define is set
|
||||
* high: multiplied by 10
|
||||
* medium: is multiplied by 100
|
||||
* low is: multiplied by 300
|
||||
*
|
||||
* Number below is seconds.
|
||||
*/
|
||||
define('CAKE_SESSION_TIMEOUT', '120');
|
||||
/**
|
||||
* Uncomment the define below to use cake built in admin routes.
|
||||
* You can set this value to anything you want.
|
||||
* All methods related to the admin route should be prefixed with the
|
||||
* name you set CAKE_ADMIN to.
|
||||
* For example: admin_index, admin_edit
|
||||
*/
|
||||
// define('CAKE_ADMIN', 'admin');
|
||||
/**
|
||||
* The define below is used to turn cake built webservices
|
||||
* on or off. Default setting is off.
|
||||
*/
|
||||
define('WEBSERVICES', 'off');
|
||||
/**
|
||||
* Compress output CSS (removing comments, whitespace, repeating tags etc.)
|
||||
* This requires a/var/cache directory to be writable by the web server (caching).
|
||||
* To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use Controller::cssTag().
|
||||
*/
|
||||
define('COMPRESS_CSS', false);
|
||||
/**
|
||||
* If set to true, helpers would output data instead of returning it.
|
||||
*/
|
||||
define('AUTO_OUTPUT', false);
|
||||
/**
|
||||
* If set to false, session would not automatically be started.
|
||||
*/
|
||||
define('AUTO_SESSION', true);
|
||||
/**
|
||||
* Set the max size of file to use md5() .
|
||||
*/
|
||||
define('MAX_MD5SIZE', (5 * 1024) * 1024);
|
||||
/**
|
||||
* To use Access Control Lists with Cake...
|
||||
*/
|
||||
define('ACL_CLASSNAME', 'DB_ACL');
|
||||
define('ACL_FILENAME', 'dbacl' . DS . 'db_acl');
|
||||
?>
|
|
@ -1,72 +0,0 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id: inflections.php,v 1.3 2006-10-08 03:39:21 reed%reedloden.com Exp $ */
|
||||
/**
|
||||
* Custom Inflected Words.
|
||||
*
|
||||
* This file is used to hold words that are not matched in the normail Inflector::pluralize() and
|
||||
* Inflector::singularize()
|
||||
*
|
||||
* PHP versions 4 and %
|
||||
*
|
||||
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
||||
* @package cake
|
||||
* @subpackage cake.app.config
|
||||
* @since CakePHP v 1.0.0.2312
|
||||
* @version $Revision: 1.3 $
|
||||
* @modifiedby $LastChangedBy: phpnut $
|
||||
* @lastmodified $Date: 2006-10-08 03:39:21 $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
/**
|
||||
* This is a key => value array of regex used to match words.
|
||||
* If key matches then the value is returned.
|
||||
*
|
||||
* $pluralRules = array('/(s)tatus$/i' => '\1\2tatuses', '/^(ox)$/i' => '\1\2en', '/([m|l])ouse$/i' => '\1ice');
|
||||
*/
|
||||
$pluralRules = array();
|
||||
/**
|
||||
* This is a key only array of plural words that should not be inflected.
|
||||
* Notice the last comma
|
||||
*
|
||||
* $uninflectedPlural = array('.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox');
|
||||
*/
|
||||
$uninflectedPlural = array();
|
||||
/**
|
||||
* This is a key => value array of plural irregular words.
|
||||
* If key matches then the value is returned.
|
||||
*
|
||||
* $irregularPlural = array('atlas' => 'atlases', 'beef' => 'beefs', 'brother' => 'brothers')
|
||||
*/
|
||||
$irregularPlural = array();
|
||||
/**
|
||||
* This is a key => value array of regex used to match words.
|
||||
* If key matches then the value is returned.
|
||||
*
|
||||
* $singularRules = array('/(s)tatuses$/i' => '\1\2tatus', '/(matr)ices$/i' =>'\1ix','/(vert|ind)ices$/i')
|
||||
*/
|
||||
$singularRules = array();
|
||||
/**
|
||||
* This is a key only array of singular words that should not be inflected.
|
||||
* You should not have to change this value below if you do change it use same format
|
||||
* as the $uninflectedPlural above.
|
||||
*/
|
||||
$uninflectedSingular = $uninflectedPlural;
|
||||
/**
|
||||
* This is a key => value array of singular irregular words.
|
||||
* Most of the time this will be a reverse of the above $irregularPlural array
|
||||
* You should not have to change this value below if you do change it use same format
|
||||
*
|
||||
* $irregularSingular = array('atlases' => 'atlas', 'beefs' => 'beef', 'brothers' => 'brother')
|
||||
*/
|
||||
$irregularSingular = array_flip($irregularPlural);
|
||||
?>
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id: routes.php,v 1.5 2006-10-10 20:18:59 reed%reedloden.com Exp $ */
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
* In this file, you set up routes to your controllers and their actions.
|
||||
* Routes are very important mechanism that allows you to freely connect
|
||||
* different urls to chosen controllers and their actions (functions).
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
||||
* @package cake
|
||||
* @subpackage cake.app.config
|
||||
* @since CakePHP v 0.2.9
|
||||
* @version $Revision: 1.5 $
|
||||
* @modifiedby $LastChangedBy: phpnut $
|
||||
* @lastmodified $Date: 2006-10-10 20:18:59 $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
/**
|
||||
* Here, we are connecting '/' (base path) to controller called 'Pages',
|
||||
* its action called 'display', and we pass a param to select the view file
|
||||
* to use (in this case, /app/views/pages/home.thtml)...
|
||||
*/
|
||||
$Route->connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
|
||||
/**
|
||||
* ...and connect the rest of 'Pages' controller's urls.
|
||||
*/
|
||||
$Route->connect('/pages/edit', array('controller' => 'pages', 'action' => 'edit'));
|
||||
$Route->connect('/pages/*', array('controller' => 'pages', 'action' => 'display'));
|
||||
$Route->connect('/privacy-policy', array('controller' => 'pages', 'action' => 'privacy'));
|
||||
?>
|
|
@ -1,101 +0,0 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id: css.php,v 1.4 2006-10-08 03:39:23 reed%reedloden.com Exp $ */
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
* Long description for file
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
||||
* @package cake
|
||||
* @subpackage cake.app.webroot
|
||||
* @since CakePHP v 0.2.9
|
||||
* @version $Revision: 1.4 $
|
||||
* @modifiedby $LastChangedBy: phpnut $
|
||||
* @lastmodified $Date: 2006-10-08 03:39:23 $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
}
|
||||
/**
|
||||
* Enter description here...
|
||||
*/
|
||||
require(LIBS . 'folder.php');
|
||||
require(LIBS . 'legacy.php');
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $path
|
||||
* @param unknown_type $name
|
||||
* @return unknown
|
||||
*/
|
||||
function make_clean_css($path, $name) {
|
||||
require(VENDORS . 'csspp' . DS . 'csspp.php');
|
||||
$data =file_get_contents($path);
|
||||
$csspp =new csspp();
|
||||
$output=$csspp->compress($data);
|
||||
$ratio =100 - (round(strlen($output) / strlen($data), 3) * 100);
|
||||
$output=" /* file: $name, ratio: $ratio% */ " . $output;
|
||||
return $output;
|
||||
}
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
* @param unknown_type $path
|
||||
* @param unknown_type $content
|
||||
* @return unknown
|
||||
*/
|
||||
function write_css_cache($path, $content) {
|
||||
if (!is_dir(dirname($path))) {
|
||||
mkdir(dirname($path));
|
||||
}
|
||||
$cache=new File($path);
|
||||
return $cache->write($content);
|
||||
}
|
||||
|
||||
if (preg_match('|\.\.|', $url) || !preg_match('|^ccss/(.+)$|i', $url, $regs)) {
|
||||
die('Wrong file name.');
|
||||
}
|
||||
|
||||
$filename = 'css/' . $regs[1];
|
||||
$filepath = CSS . $regs[1];
|
||||
$cachepath = CACHE . 'css' . DS . str_replace(array('/','\\'), '-', $regs[1]);
|
||||
|
||||
if (!file_exists($filepath)) {
|
||||
die('Wrong file name.');
|
||||
}
|
||||
|
||||
if (file_exists($cachepath)) {
|
||||
$templateModified=filemtime($filepath);
|
||||
$cacheModified =filemtime($cachepath);
|
||||
|
||||
if ($templateModified > $cacheModified) {
|
||||
$output=make_clean_css($filepath, $filename);
|
||||
write_css_cache($cachepath, $output);
|
||||
} else {
|
||||
$output = file_get_contents($cachepath);
|
||||
}
|
||||
} else {
|
||||
$output=make_clean_css($filepath, $filename);
|
||||
write_css_cache($cachepath, $output);
|
||||
}
|
||||
|
||||
header("Date: " . date("D, j M Y G:i:s ", $templateModified) . 'GMT');
|
||||
header("Content-Type: text/css");
|
||||
header("Expires: " . gmdate("D, j M Y H:i:s", time() + DAY) . " GMT");
|
||||
header("Cache-Control: cache"); // HTTP/1.1
|
||||
header("Pragma: cache"); // HTTP/1.0
|
||||
print $output;
|
||||
?>
|
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id: index.php,v 1.4 2006-10-08 03:39:23 reed%reedloden.com Exp $ */
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
* Long description for file
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
||||
* @package cake
|
||||
* @subpackage cake.app.webroot
|
||||
* @since CakePHP v 0.2.9
|
||||
* @version $Revision: 1.4 $
|
||||
* @modifiedby $LastChangedBy: phpnut $
|
||||
* @lastmodified $Date: 2006-10-08 03:39:23 $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
/**
|
||||
* Do not change
|
||||
*/
|
||||
if (!defined('DS')) {
|
||||
define('DS', DIRECTORY_SEPARATOR);
|
||||
}
|
||||
/**
|
||||
* These defines should only be edited if you have cake installed in
|
||||
* a directory layout other than the way it is distributed.
|
||||
* Each define has a commented line of code that explains what you would change.
|
||||
*
|
||||
*/
|
||||
if (!defined('ROOT')) {
|
||||
//define('ROOT', 'FULL PATH TO DIRECTORY WHERE APP DIRECTORY IS LOCATED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
|
||||
//You should also use the DS define to seperate your directories
|
||||
define('ROOT', dirname(dirname(dirname(__FILE__))));
|
||||
}
|
||||
if (!defined('APP_DIR')) {
|
||||
//define('APP_DIR', 'DIRECTORY NAME OF APPLICATION';
|
||||
define('APP_DIR', basename(dirname(dirname(__FILE__))));
|
||||
}
|
||||
/**
|
||||
* This only needs to be changed if the cake installed libs are located
|
||||
* outside of the distributed directory structure.
|
||||
*/
|
||||
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
||||
//define ('CAKE_CORE_INCLUDE_PATH', FULL PATH TO DIRECTORY WHERE CAKE CORE IS INSTALLED DO NOT ADD A TRAILING DIRECTORY SEPARATOR';
|
||||
//You should also use the DS define to seperate your directories
|
||||
define('CAKE_CORE_INCLUDE_PATH', ROOT);
|
||||
}
|
||||
///////////////////////////////
|
||||
//DO NOT EDIT BELOW THIS LINE//
|
||||
///////////////////////////////
|
||||
if (!defined('WEBROOT_DIR')) {
|
||||
define('WEBROOT_DIR', basename(dirname(__FILE__)));
|
||||
}
|
||||
if (!defined('WWW_ROOT')) {
|
||||
define('WWW_ROOT', dirname(__FILE__) . DS);
|
||||
}
|
||||
if (!defined('CORE_PATH')) {
|
||||
if (function_exists('ini_set')) {
|
||||
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS);
|
||||
define('APP_PATH', null);
|
||||
define('CORE_PATH', null);
|
||||
} else {
|
||||
define('APP_PATH', ROOT . DS . APP_DIR . DS);
|
||||
define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS);
|
||||
}
|
||||
}
|
||||
require CORE_PATH . 'cake' . DS . 'bootstrap.php';
|
||||
if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') {
|
||||
} else {
|
||||
$Dispatcher=new Dispatcher();
|
||||
$Dispatcher->dispatch($url);
|
||||
}
|
||||
if (DEBUG) {
|
||||
echo "<!-- " . round(getMicrotime() - $TIME_START, 4) . "s -->";
|
||||
}
|
||||
?>
|
|
@ -1,43 +0,0 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id: vendors.php,v 1.4 2006-10-08 03:39:24 reed%reedloden.com Exp $ */
|
||||
/**
|
||||
* Short description for file.
|
||||
*
|
||||
* This file includes js vendor-files from /vendor/ directory if they need to
|
||||
* be accessible to the public.
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
||||
* Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* 1785 E. Sahara Avenue, Suite 490-204
|
||||
* Las Vegas, Nevada 89104
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
|
||||
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
||||
* @package cake
|
||||
* @subpackage cake.app.webroot.js
|
||||
* @since CakePHP v 0.2.9
|
||||
* @version $Revision: 1.4 $
|
||||
* @modifiedby $LastChangedBy: phpnut $
|
||||
* @lastmodified $Date: 2006-10-08 03:39:24 $
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
/**
|
||||
* Enter description here...
|
||||
*/
|
||||
$file = $_GET['file'];
|
||||
$pos = strpos($file, '..');
|
||||
if ($pos === false) {
|
||||
if(is_file('../../vendors/javascript/'.$file) && (preg_match('/(\/.+)\\.js/', $file)))
|
||||
{
|
||||
readfile('../../vendors/javascript/'.$file);
|
||||
}
|
||||
} else {
|
||||
header('HTTP/1.1 404 Not Found');
|
||||
}
|
||||
?>
|
Загрузка…
Ссылка в новой задаче