setting proper mime-type on files in the trunk

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@292 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2005-06-30 02:09:47 +00:00
parent 217e177abf
commit 55da45ec77
14 changed files with 2345 additions and 2345 deletions

View file

@ -1,25 +1,25 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
//////////////////////////////////////////////////////////////////////////
/**
* This file is application-wide controller file. You can put all
* application-wide controller-related methods here.
*
* Add your application-wide methods in the class below, your controllers
* will inherit them.
*
* @package cake
* @subpackage cake.app
*/
class AppController extends Controller {
}
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
//////////////////////////////////////////////////////////////////////////
/**
* This file is application-wide controller file. You can put all
* application-wide controller-related methods here.
*
* Add your application-wide methods in the class below, your controllers
* will inherit them.
*
* @package cake
* @subpackage cake.app
*/
class AppController extends Controller {
}
?>

View file

@ -1,25 +1,25 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
//////////////////////////////////////////////////////////////////////////
/**
* This file is application-wide model file. You can put all
* application-wide model-related methods here.
*
* Add your application-wide methods in the class below, your models
* will inherit them.
*
* @package cake
* @subpackage cake.app
*/
class AppModel extends Model {
}
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
//////////////////////////////////////////////////////////////////////////
/**
* This file is application-wide model file. You can put all
* application-wide model-related methods here.
*
* Add your application-wide methods in the class below, your models
* will inherit them.
*
* @package cake
* @subpackage cake.app
*/
class AppModel extends Model {
}
?>

View file

@ -1,164 +1,164 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
//////////////////////////////////////////////////////////////////////////
/**
* In this file you set paths to different directories used by Cake.
*
* @package cake
* @subpackage cake.config
*/
/**
* If the index.php file is used instead of an .htaccess file
* or if the user can not set the web root to use the public
* directory we will define ROOT there, otherwise we set it
* here.
*/
if(!defined('ROOT'))
{
define ('ROOT', '../');
}
/**
* Path to the application's directory.
*/
define ('APP', ROOT.'app'.DS);
/**
* Path to the application's models directory.
*/
define ('MODELS', APP.'models'.DS);
/**
* Path to the application's controllers directory.
*/
define ('CONTROLLERS', APP.'controllers'.DS);
/**
* Path to the application's helpers directory.
*/
define ('HELPERS', APP.'helpers'.DS);
/**
* Path to the application's views directory.
*/
define ('VIEWS', APP.'views'.DS);
/**
* Path to the application's view's layouts directory.
*/
define ('LAYOUTS', APP.'views'.DS.'layouts'.DS);
/**
* Path to the application's view's elements directory.
* It's supposed to hold pieces of PHP/HTML that are used on multiple pages
* and are not linked to a particular layout (like polls, footers and so on).
*/
define ('ELEMENTS', APP.'views'.DS.'elements'.DS);
/**
* Path to the configuration files directory.
*/
define ('CONFIGS', ROOT.'config'.DS);
/**
* Path to the libs directory.
*/
define ('LIBS', ROOT.'libs'.DS);
/**
* Path to the logs directory.
*/
define ('LOGS', ROOT.'logs'.DS);
/**
* Path to the modules directory.
*/
define ('MODULES', ROOT.'modules'.DS);
/**
* Path to the public directory.
*/
define ('WWW_ROOT', ROOT.'public'.DS);
/**
* Path to the public directory.
*/
define ('CSS', WWW_ROOT.'css'.DS);
/**
* Path to the scripts direcotry.
*/
define('SCRIPTS', ROOT.'scripts'.DS);
/**
* Path to the tests directory.
*/
define ('TESTS', ROOT.'tests'.DS);
/**
* Path to the controller test directory.
*/
define ('CONTROLLER_TESTS',TESTS.'app'.DS.'controllers'.DS);
/**
* Path to the helpers test directory.
*/
define ('HELPER_TESTS', TESTS.'app'.DS.'helpers'.DS);
/**
* Path to the models' test directory.
*/
define ('MODEL_TESTS', TESTS.'app'.DS.'models'.DS);
/**
* Path to the lib test directory.
*/
define ('LIB_TESTS', TESTS.'libs'.DS);
/**
* Path to the temporary files directory.
*/
define ('TMP', ROOT.'tmp'.DS);
/**
* Path to the cache files directory. It can be shared between hosts in a multi-server setup.
*/
define('CACHE', TMP.'cache'.DS);
/**
* Path to the vendors directory.
*/
define ('VENDORS', ROOT.'vendors'.DS);
/**
* Path to the Pear directory
* The purporse is to make it easy porting Pear libs into Cake
* without setting the include_path PHP variable.
*/
define ('PEAR', VENDORS.'Pear'.DS);
/**
* Full url prefix
*/
define('FULL_BASE_URL', 'http://'.$_SERVER['HTTP_HOST']);
/**
* Web path to the public images directory.
*/
define ('IMAGES_URL', '/img/');
/**
* Web path to the CSS files directory.
*/
define ('CSS_URL', '/css/');
?>
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
//////////////////////////////////////////////////////////////////////////
/**
* In this file you set paths to different directories used by Cake.
*
* @package cake
* @subpackage cake.config
*/
/**
* If the index.php file is used instead of an .htaccess file
* or if the user can not set the web root to use the public
* directory we will define ROOT there, otherwise we set it
* here.
*/
if(!defined('ROOT'))
{
define ('ROOT', '../');
}
/**
* Path to the application's directory.
*/
define ('APP', ROOT.'app'.DS);
/**
* Path to the application's models directory.
*/
define ('MODELS', APP.'models'.DS);
/**
* Path to the application's controllers directory.
*/
define ('CONTROLLERS', APP.'controllers'.DS);
/**
* Path to the application's helpers directory.
*/
define ('HELPERS', APP.'helpers'.DS);
/**
* Path to the application's views directory.
*/
define ('VIEWS', APP.'views'.DS);
/**
* Path to the application's view's layouts directory.
*/
define ('LAYOUTS', APP.'views'.DS.'layouts'.DS);
/**
* Path to the application's view's elements directory.
* It's supposed to hold pieces of PHP/HTML that are used on multiple pages
* and are not linked to a particular layout (like polls, footers and so on).
*/
define ('ELEMENTS', APP.'views'.DS.'elements'.DS);
/**
* Path to the configuration files directory.
*/
define ('CONFIGS', ROOT.'config'.DS);
/**
* Path to the libs directory.
*/
define ('LIBS', ROOT.'libs'.DS);
/**
* Path to the logs directory.
*/
define ('LOGS', ROOT.'logs'.DS);
/**
* Path to the modules directory.
*/
define ('MODULES', ROOT.'modules'.DS);
/**
* Path to the public directory.
*/
define ('WWW_ROOT', ROOT.'public'.DS);
/**
* Path to the public directory.
*/
define ('CSS', WWW_ROOT.'css'.DS);
/**
* Path to the scripts direcotry.
*/
define('SCRIPTS', ROOT.'scripts'.DS);
/**
* Path to the tests directory.
*/
define ('TESTS', ROOT.'tests'.DS);
/**
* Path to the controller test directory.
*/
define ('CONTROLLER_TESTS',TESTS.'app'.DS.'controllers'.DS);
/**
* Path to the helpers test directory.
*/
define ('HELPER_TESTS', TESTS.'app'.DS.'helpers'.DS);
/**
* Path to the models' test directory.
*/
define ('MODEL_TESTS', TESTS.'app'.DS.'models'.DS);
/**
* Path to the lib test directory.
*/
define ('LIB_TESTS', TESTS.'libs'.DS);
/**
* Path to the temporary files directory.
*/
define ('TMP', ROOT.'tmp'.DS);
/**
* Path to the cache files directory. It can be shared between hosts in a multi-server setup.
*/
define('CACHE', TMP.'cache'.DS);
/**
* Path to the vendors directory.
*/
define ('VENDORS', ROOT.'vendors'.DS);
/**
* Path to the Pear directory
* The purporse is to make it easy porting Pear libs into Cake
* without setting the include_path PHP variable.
*/
define ('PEAR', VENDORS.'Pear'.DS);
/**
* Full url prefix
*/
define('FULL_BASE_URL', 'http://'.$_SERVER['HTTP_HOST']);
/**
* Web path to the public images directory.
*/
define ('IMAGES_URL', '/img/');
/**
* Web path to the CSS files directory.
*/
define ('CSS_URL', '/css/');
?>

View file

@ -1,139 +1,139 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
//////////////////////////////////////////////////////////////////////////
/**
* In this file, you can set up 'templates' for every tag generated by the tag
* generator.
*
* @package cake
* @subpackage cake.config
*/
/**
* Tag template for a link.
*/
define('TAG_LINK', '<a href="%s"%s>%s</a>');
/**
* Tag template for a mailto: link.
*/
define('TAG_MAILTO', '<a href="mailto:%s"%s>%s</a>');
/**
* Tag template for opening form tag.
*/
define('TAG_FORM', '<form %s>');
/**
* Tag template for an input type='text' tag.
*/
define('TAG_INPUT', '<input name="data[%s]" %s/>');
/**
* Tag template for an input type='hidden' tag.
*/
define('TAG_HIDDEN', '<input type="hidden" name="data[%s]" %s/>');
/**
* Tag template for a textarea tag.
*/
define('TAG_AREA', '<textarea name="data[%s]"%s>%s</textarea>');
/**
* Tag template for a input type='checkbox ' tag.
*/
define('TAG_CHECKBOX', '<label for="tag_%s"><input type="checkbox" name="data[%s]" id="tag_%s" %s/>%s</label>');
/**
* Tag template for a input type='radio' tag.
*/
define('TAG_RADIOS', '<label for="tag_%s"><input type="radio" name="data[%s]" id="tag_%s" %s/>%s</label>');
/**
* Tag template for a select opening tag.
*/
define('TAG_SELECT_START', '<select name="data[%s]"%s>');
/**
* Tag template for an empty select option tag.
*/
define('TAG_SELECT_EMPTY', '<option value=""%s></option>');
/**
* Tag template for a select option tag.
*/
define('TAG_SELECT_OPTION','<option value="%s"%s>%s</option>');
/**
* Tag template for a closing select tag.
*/
define('TAG_SELECT_END', '</select>');
/**
* Tag template for a password tag.
*/
define('TAG_PASSWORD', '<input type="password" name="data[%s]" %s/>');
/**
* Tag template for a file input tag.
*/
define('TAG_FILE', '<input type="file" name="%s" %s/>');
/**
* Tag template for a submit button tag.
*/
define('TAG_SUBMIT', '<input type="submit" %s/>');
/**
* Tag template for an image tag.
*/
define('TAG_IMAGE', '<img src="%s" alt="%s" %s/>');
/**
* Tag template for a table header tag.
*/
define('TAG_TABLE_HEADER', '<th%s>%s</th>');
/**
* Tag template for table headers row tag.
*/
define('TAG_TABLE_HEADERS','<tr%s>%s</tr>');
/**
* Tag template for a table cell tag.
*/
define('TAG_TABLE_CELL', '<td%s>%s</td>');
/**
* Tag template for a table row tag.
*/
define('TAG_TABLE_ROW', '<tr%s>%s</tr>');
/**
* Tag template for a CSS link tag.
*/
define('TAG_CSS', '<link rel="%s" type="text/css" href="%s" />');
/**
* Tag template for a charset meta-tag.
*/
define('TAG_CHARSET', '<meta http-equiv="Content-Type" content="text/html; charset=%s" />');
/**
* Tag template for inline JavaScript.
*/
define('TAG_JAVASCRIPT', '<script language="javascript" type="text/javascript">%s</script>');
/**
* Tag template for included JavaScript.
*/
define('TAG_JAVASCRIPT_INCLUDE', '<script language="javascript" type="text/javascript" src="%s"></script>');
?>
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
//////////////////////////////////////////////////////////////////////////
/**
* In this file, you can set up 'templates' for every tag generated by the tag
* generator.
*
* @package cake
* @subpackage cake.config
*/
/**
* Tag template for a link.
*/
define('TAG_LINK', '<a href="%s"%s>%s</a>');
/**
* Tag template for a mailto: link.
*/
define('TAG_MAILTO', '<a href="mailto:%s"%s>%s</a>');
/**
* Tag template for opening form tag.
*/
define('TAG_FORM', '<form %s>');
/**
* Tag template for an input type='text' tag.
*/
define('TAG_INPUT', '<input name="data[%s]" %s/>');
/**
* Tag template for an input type='hidden' tag.
*/
define('TAG_HIDDEN', '<input type="hidden" name="data[%s]" %s/>');
/**
* Tag template for a textarea tag.
*/
define('TAG_AREA', '<textarea name="data[%s]"%s>%s</textarea>');
/**
* Tag template for a input type='checkbox ' tag.
*/
define('TAG_CHECKBOX', '<label for="tag_%s"><input type="checkbox" name="data[%s]" id="tag_%s" %s/>%s</label>');
/**
* Tag template for a input type='radio' tag.
*/
define('TAG_RADIOS', '<label for="tag_%s"><input type="radio" name="data[%s]" id="tag_%s" %s/>%s</label>');
/**
* Tag template for a select opening tag.
*/
define('TAG_SELECT_START', '<select name="data[%s]"%s>');
/**
* Tag template for an empty select option tag.
*/
define('TAG_SELECT_EMPTY', '<option value=""%s></option>');
/**
* Tag template for a select option tag.
*/
define('TAG_SELECT_OPTION','<option value="%s"%s>%s</option>');
/**
* Tag template for a closing select tag.
*/
define('TAG_SELECT_END', '</select>');
/**
* Tag template for a password tag.
*/
define('TAG_PASSWORD', '<input type="password" name="data[%s]" %s/>');
/**
* Tag template for a file input tag.
*/
define('TAG_FILE', '<input type="file" name="%s" %s/>');
/**
* Tag template for a submit button tag.
*/
define('TAG_SUBMIT', '<input type="submit" %s/>');
/**
* Tag template for an image tag.
*/
define('TAG_IMAGE', '<img src="%s" alt="%s" %s/>');
/**
* Tag template for a table header tag.
*/
define('TAG_TABLE_HEADER', '<th%s>%s</th>');
/**
* Tag template for table headers row tag.
*/
define('TAG_TABLE_HEADERS','<tr%s>%s</tr>');
/**
* Tag template for a table cell tag.
*/
define('TAG_TABLE_CELL', '<td%s>%s</td>');
/**
* Tag template for a table row tag.
*/
define('TAG_TABLE_ROW', '<tr%s>%s</tr>');
/**
* Tag template for a CSS link tag.
*/
define('TAG_CSS', '<link rel="%s" type="text/css" href="%s" />');
/**
* Tag template for a charset meta-tag.
*/
define('TAG_CHARSET', '<meta http-equiv="Content-Type" content="text/html; charset=%s" />');
/**
* Tag template for inline JavaScript.
*/
define('TAG_JAVASCRIPT', '<script language="javascript" type="text/javascript">%s</script>');
/**
* Tag template for included JavaScript.
*/
define('TAG_JAVASCRIPT_INCLUDE', '<script language="javascript" type="text/javascript" src="%s"></script>');
?>

File diff suppressed because it is too large Load diff

View file

@ -1,150 +1,150 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Cache
* Description:
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Enter description here...
*
*/
uses('model');
/**
* Enter description here...
*
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
*/
class Cache extends Model {
/**
* Identifier. Either an MD5 string or NULL.
*
* @var unknown_type
*/
var $id = null;
/**
* Content container for cache data.
*
* @var unknown_type
*/
var $data = null;
/**
* Content to be cached.
*
* @var unknown_type
*/
var $for_caching = null;
/**
* Name of the database table used for caching.
*
* @var unknown_type
*/
var $use_table = 'cache';
/**
* Constructor. Generates an md5'ed id for internal use. Calls the constructor on Model as well.
*
* @param unknown_type $id
*/
function __construct ($id) {
$this->id = (md5($id));
parent::__construct($this->id);
}
/**
* Returns this object's id after setting it. If no $id is given then $this->id is returned.
*
* @param unknown_type $id
* @return unknown
*/
function id ($id=null) {
if (!$id) return $this->id;
return ($this->id = $id);
}
/**
* Save $content in cache for $keep_for seconds.
*
* @param string $content Content to keep in cache.
* @param int $keep_for Number of seconds to keep data in cache.
* @return unknown
*/
function remember ($content, $keep_for=CACHE_PAGES_FOR) {
$data = addslashes($this->for_caching.$content);
$expire = date("Y-m-d H:i:s",time()+($keep_for>0? $keep_for: 999999999));
return $this->query("REPLACE {$this->use_table} (id,data,expire) VALUES ('{$this->id}', '{$data}', '{$expire}')");
}
/**
* Returns content from the Cache object itself, if the Cache object has a non-empty data property. Else from the database cache.
*
* @return unknown
*/
function restore() {
if (empty($this->data['data']))
return $this->find("id='{$this->id}' AND expire>NOW()");
return $this->data['data'];
}
/**
* Returns true if the cache data property has current (non-stale) content for given id.
*
* @return boolean
*/
function has() {
return is_array($this->data = $this->find("id='{$this->id}' AND expire>NOW()"));
}
/**
* Appends $string to the for_caching property of the Cache object.
*
* @param string $string
*/
function append($string) {
$this->for_caching .= $string;
}
/**
* Clears the cache database table.
*
* @return unknown
*/
function clear() {
return $this->query("DELETE FROM {$this->use_table}");
}
}
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Cache
* Description:
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Enter description here...
*
*/
uses('model');
/**
* Enter description here...
*
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
*/
class Cache extends Model {
/**
* Identifier. Either an MD5 string or NULL.
*
* @var unknown_type
*/
var $id = null;
/**
* Content container for cache data.
*
* @var unknown_type
*/
var $data = null;
/**
* Content to be cached.
*
* @var unknown_type
*/
var $for_caching = null;
/**
* Name of the database table used for caching.
*
* @var unknown_type
*/
var $use_table = 'cache';
/**
* Constructor. Generates an md5'ed id for internal use. Calls the constructor on Model as well.
*
* @param unknown_type $id
*/
function __construct ($id) {
$this->id = (md5($id));
parent::__construct($this->id);
}
/**
* Returns this object's id after setting it. If no $id is given then $this->id is returned.
*
* @param unknown_type $id
* @return unknown
*/
function id ($id=null) {
if (!$id) return $this->id;
return ($this->id = $id);
}
/**
* Save $content in cache for $keep_for seconds.
*
* @param string $content Content to keep in cache.
* @param int $keep_for Number of seconds to keep data in cache.
* @return unknown
*/
function remember ($content, $keep_for=CACHE_PAGES_FOR) {
$data = addslashes($this->for_caching.$content);
$expire = date("Y-m-d H:i:s",time()+($keep_for>0? $keep_for: 999999999));
return $this->query("REPLACE {$this->use_table} (id,data,expire) VALUES ('{$this->id}', '{$data}', '{$expire}')");
}
/**
* Returns content from the Cache object itself, if the Cache object has a non-empty data property. Else from the database cache.
*
* @return unknown
*/
function restore() {
if (empty($this->data['data']))
return $this->find("id='{$this->id}' AND expire>NOW()");
return $this->data['data'];
}
/**
* Returns true if the cache data property has current (non-stale) content for given id.
*
* @return boolean
*/
function has() {
return is_array($this->data = $this->find("id='{$this->id}' AND expire>NOW()"));
}
/**
* Appends $string to the for_caching property of the Cache object.
*
* @param string $string
*/
function append($string) {
$this->for_caching .= $string;
}
/**
* Clears the cache database table.
*
* @return unknown
*/
function clear() {
return $this->query("DELETE FROM {$this->use_table}");
}
}
?>

View file

@ -1,112 +1,112 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Error Messages Defines
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Error string for when the specified database driver can not be found.
*/
define ('ERROR_UNKNOWN_DATABASE_DRIVER', '[DbFactory] Specified database driver (%s) not found');
/**
* Error string for when the dispatcher can not find a default controller.
*/
define ('ERROR_NO_CONTROLLER_SET', '[Dispatcher] No default controller, can\'t continue, check routes config');
/**
* Error string for when the dispatcher can not find a default action.
*/
define ('ERROR_NO_ACTION_SET', '[Dispatcher] No default action, can\'t continue, check routes config');
/**
* Error string for when the dispatcher can not find given controller.
*/
define ('ERROR_UNKNOWN_CONTROLLER', '[Dispatcher] Specified controller "%s" doesn\'t exist, create it first');
/**
* Error string for when the dispatcher can not find expected action in controller.
*/
define ('ERROR_NO_ACTION', '[Dispatcher] Action "%s" is not defined in the "%s" controller, create it first');
/**
* Error string for errors in view.
*/
define ('ERROR_IN_VIEW', '[Controller] Error in view "%s", got: <blockquote>%s</blockquote>');
/**
* Error string for when the controller can not find expected view.
*/
define ('ERROR_NO_VIEW', '[Controller] No template file for view "%s" (expected "%s"), create it first');
/**
* Error string for errors in layout.
*/
define ('ERROR_IN_LAYOUT', '[Controller] Error in layout "%s", got: <blockquote>"%s"</blockquote>');
/**
* Error string for when the controller can not find expected layout.
*/
define ('ERROR_NO_LAYOUT', '[Controller] Couln\'t find layout "%s" (expected "%s"), create it first');
/**
* Error string for database not being able to access the table list.
*/
define ('ERROR_NO_TABLE_LIST', '[Database] Couldn\'t get table list, check database config');
/**
* Error string for no corresponding database table found for model.
*/
define ('ERROR_NO_MODEL_TABLE', '[Model] No DB table for model "%s" (expected "%s"), create it first');
/**
* Error string for Field not present in table.
*/
define ('ERROR_NO_FIELD_IN_MODEL_DB', '[Model::set()] Field "%s" is not present in table "%s", check database schema');
/**
* Error string short short error message.
*/
define ('SHORT_ERROR_MESSAGE', '<div class="error_message"><i>%s</i></div>');
/**
* Error string for when original image can not be loaded.
*/
define ('ERROR_CANT_GET_ORIGINAL_IMAGE', '[Image] Couldn\'t load original image %s (tried from "%s")');
/**
* Error string for error 404.
*/
define ('ERROR_404', "The requested address /%s was not found on this server."); // second %s contains short error message
/**
* Error string for error 500.
*/
define ('ERROR_500', "Application error, sorry.");
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Error Messages Defines
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Error string for when the specified database driver can not be found.
*/
define ('ERROR_UNKNOWN_DATABASE_DRIVER', '[DbFactory] Specified database driver (%s) not found');
/**
* Error string for when the dispatcher can not find a default controller.
*/
define ('ERROR_NO_CONTROLLER_SET', '[Dispatcher] No default controller, can\'t continue, check routes config');
/**
* Error string for when the dispatcher can not find a default action.
*/
define ('ERROR_NO_ACTION_SET', '[Dispatcher] No default action, can\'t continue, check routes config');
/**
* Error string for when the dispatcher can not find given controller.
*/
define ('ERROR_UNKNOWN_CONTROLLER', '[Dispatcher] Specified controller "%s" doesn\'t exist, create it first');
/**
* Error string for when the dispatcher can not find expected action in controller.
*/
define ('ERROR_NO_ACTION', '[Dispatcher] Action "%s" is not defined in the "%s" controller, create it first');
/**
* Error string for errors in view.
*/
define ('ERROR_IN_VIEW', '[Controller] Error in view "%s", got: <blockquote>%s</blockquote>');
/**
* Error string for when the controller can not find expected view.
*/
define ('ERROR_NO_VIEW', '[Controller] No template file for view "%s" (expected "%s"), create it first');
/**
* Error string for errors in layout.
*/
define ('ERROR_IN_LAYOUT', '[Controller] Error in layout "%s", got: <blockquote>"%s"</blockquote>');
/**
* Error string for when the controller can not find expected layout.
*/
define ('ERROR_NO_LAYOUT', '[Controller] Couln\'t find layout "%s" (expected "%s"), create it first');
/**
* Error string for database not being able to access the table list.
*/
define ('ERROR_NO_TABLE_LIST', '[Database] Couldn\'t get table list, check database config');
/**
* Error string for no corresponding database table found for model.
*/
define ('ERROR_NO_MODEL_TABLE', '[Model] No DB table for model "%s" (expected "%s"), create it first');
/**
* Error string for Field not present in table.
*/
define ('ERROR_NO_FIELD_IN_MODEL_DB', '[Model::set()] Field "%s" is not present in table "%s", check database schema');
/**
* Error string short short error message.
*/
define ('SHORT_ERROR_MESSAGE', '<div class="error_message"><i>%s</i></div>');
/**
* Error string for when original image can not be loaded.
*/
define ('ERROR_CANT_GET_ORIGINAL_IMAGE', '[Image] Couldn\'t load original image %s (tried from "%s")');
/**
* Error string for error 404.
*/
define ('ERROR_404', "The requested address /%s was not found on this server."); // second %s contains short error message
/**
* Error string for error 500.
*/
define ('ERROR_500', "Application error, sorry.");
?>

View file

@ -1,321 +1,321 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Flay
* Text-to-html parser, similar to Textile or RedCloth, only with somehow different syntax.
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Enter description here...
*/
uses('object');
/**
* Text-to-html parser, similar to Textile or RedCloth, only with a little different syntax.
*
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
*/
class Flay extends Object
{
/**
* Enter description here...
*
* @var string
*/
var $text = null;
/**
* Enter description here...
*
* @var boolean
*/
var $allow_html = false;
/**
* Constructor.
*
* @param unknown_type $text
*/
function __construct ($text=null) {
$this->text = $text;
parent::__construct();
}
/**
* Returns $text translated to HTML using the Flay syntax.
*
* @param string $text Text to format
* @param boolean $bare
* @param boolean $allowHtml Set this to trim whitespace and disable all HTML
* @return string Formatted text
*/
function toHtml ($text=null, $bare=false, $allowHtml=false) {
if (empty($text) && empty($this->text))
return false;
$text = $text? $text: $this->text;
// trim whitespace and disable all HTML
if ($allowHtml)
$text = trim($text);
else
$text = str_replace('<', '&lt;', str_replace('>', '&gt;', trim($text)));
if (!$bare) {
// multi-paragraph functions
$text = preg_replace('#(?:[\n]{0,2})"""(.*)"""(?:[\n]{0,2})#s', "\n\n%BLOCKQUOTE%\n\n\\1\n\n%ENDBLOCKQUOTE%\n\n", $text);
$text = preg_replace('#(?:[\n]{0,2})===(.*)===(?:[\n]{0,2})#s', "\n\n%CENTER%\n\n\\1\n\n%ENDCENTER%\n\n", $text);
}
// pre-parse newlines
$text = preg_replace("#\r\n#", "\n", $text);
$text = preg_replace("#[\n]{2,}#", "%PARAGRAPH%", $text);
$text = preg_replace('#[\n]{1}#', "%LINEBREAK%", $text);
// split into paragraphs and parse
$out = '';
foreach (split('%PARAGRAPH%', $text) as $line) {
if ($line) {
if (!$bare) {
// pre-parse links
$links = array();
$regs = null;
if (preg_match_all('#\[([^\[]{4,})\]#', $line, $regs)) {
foreach ($regs[1] as $reg) {
$links[] = $reg;
$line = str_replace("[{$reg}]",'%LINK'.(count($links)-1).'%', $line);
}
}
// MAIN TEXT FUNCTIONS
// bold
$line = ereg_replace("\*([^\*]*)\*", "<strong>\\1</strong>", $line);
// italic
$line = ereg_replace("_([^_]*)_", "<em>\\1</em>", $line);
}
// entities
$line = str_replace(' - ', ' &ndash; ', $line);
$line = str_replace(' -- ', ' &mdash; ', $line);
$line = str_replace('(C)', '&copy;', $line);
$line = str_replace('(R)', '&reg;', $line);
$line = str_replace('(TM)', '&trade;', $line);
// guess e-mails
$emails = null;
if (preg_match_all("#([_A-Za-z0-9+-+]+(?:\.[_A-Za-z0-9+-]+)*@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*)#", $line, $emails)) {
foreach ($emails[1] as $email) {
$line = str_replace($email, "<a href=\"mailto:{$email}\">{$email}</a>", $line);
}
}
if (!$bare) {
// guess links
$urls = null;
if (preg_match_all("#((?:http|https|ftp|nntp)://[^ ]+)#", $line, $urls))
{
foreach ($urls[1] as $url)
{
$line = str_replace($url, "<a href=\"{$url}\">{$url}</a>", $line);
}
}
if (preg_match_all("#(www\.[^\n\%\ ]+[^\n\%\,\.\ ])#", $line, $urls))
{
foreach ($urls[1] as $url)
{
$line = str_replace($url, "<a href=\"http://{$url}\">{$url}</a>", $line);
}
}
// re-parse links
if (count($links)) {
for ($ii=0; $ii<count($links); $ii++) {
if (preg_match("#^(http|https|ftp|nntp)://#", $links[$ii]))
{
$prefix = null;
}
else
{
$prefix = 'http://';
}
if (preg_match('#^[^\ ]+\.(jpg|jpeg|gif|png)$#', $links[$ii]))
{
$with = "<img src=\"{$prefix}{$links[$ii]}\" alt=\"\" />";
}
elseif (preg_match('#^([^\]\ ]+)(?:\ ([^\]]+))?$#', $links[$ii], $regs))
{
if (isset($regs[2]))
{
if (preg_match('#\.(jpg|jpeg|gif|png)$#', $regs[2]))
$body = "<img src=\"{$prefix}{$regs[2]}\" alt=\"\" />";
else
$body = $regs[2];
}
else
{
$body = $links[$ii];
}
$with = "<a href=\"{$prefix}{$regs[1]}\" target=\"_blank\">{$body}</a>";
}
else
{
$with = $prefix.$links[$ii];
}
$line = str_replace("%LINK{$ii}%", $with, $line);
}
}
}
// re-parse newlines
$out .= str_replace('%LINEBREAK%', "<br />\n", "<p>{$line}</p>\n");
}
}
if (!$bare) {
// re-parse multilines
$out = str_replace('<p>%BLOCKQUOTE%</p>', "<blockquote>", $out);
$out = str_replace('<p>%ENDBLOCKQUOTE%</p>', "</blockquote>", $out);
$out = str_replace('<p>%CENTER%</p>', "<center>", $out);
$out = str_replace('<p>%ENDCENTER%</p>', "</center>", $out);
}
return $out;
}
/**
* Enter description here...
*
* @param unknown_type $string
* @return unknown
*/
function extractWords ($string) {
return preg_split('/[\s,\.:\/="!\(\)<>~\[\]]+/', $string);
}
/**
* Enter description here...
*
* @param unknown_type $words
* @param unknown_type $string
* @param unknown_type $max_snippets
* @return unknown
*/
function markedSnippets ($words, $string, $max_snippets=5) {
$string = strip_tags($string);
$snips = array();
$rest = $string;
foreach ($words as $word) {
if (preg_match_all("/[\s,]+.{0,40}{$word}.{0,40}[\s,]+/i", $rest, $r)) {
foreach ($r as $result)
$rest = str_replace($result, '', $rest);
$snips = array_merge($snips, $r[0]);
}
}
if (count($snips) > $max_snippets) $snips = array_slice($snips, 0, $max_snippets);
$joined = join(' <b>...</b> ', $snips);
$snips = $joined? "<b>...</b> {$joined} <b>...</b>": substr($string, 0, 80).'<b>...</b>';
return Flay::colorMark($words, $snips);
}
/**
* Enter description here...
*
* @param unknown_type $words
* @param unknown_type $string
* @return unknown
*/
function colorMark($words, $string)
{
$colors = array('yl','gr','rd','bl','fu','cy');
$nextColorIndex = 0;
foreach ($words as $word)
{
$string = preg_replace("/({$word})/i", '<em class="'.$colors[$nextColorIndex%count($colors)]."\">\\1</em>", $string);
$nextColorIndex++;
}
return $string;
}
/**
* Enter description here...
*
* @param unknown_type $text
* @return unknown
*/
function toClean ($text)
{
return strip_tags(html_entity_decode($text, ENT_QUOTES));
}
function toParsedAndClean ($text)
{
return Flay::toClean(Flay::toHtml($text));
}
/**
* Enter description here...
*
* @param unknown_type $text
* @param unknown_type $length
* @param unknown_type $elipsis
* @return unknown
*/
function fragment ($text, $length, $elipsis='...') {
$soft=$length-5;
$hard=$length+5;
$rx = '/(.{'.$soft.','.$hard.'})[\s,\.:\/="!\(\)<>~\[\]]+.*/';
if (preg_match($rx, $text, $r)) {
$out = $r[1];
}
else {
$out = substr($text,0,$length);
}
$out = $out.(strlen($out)<strlen($text)? $elipsis: null);
return $out;
}
}
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Flay
* Text-to-html parser, similar to Textile or RedCloth, only with somehow different syntax.
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Enter description here...
*/
uses('object');
/**
* Text-to-html parser, similar to Textile or RedCloth, only with a little different syntax.
*
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
*/
class Flay extends Object
{
/**
* Enter description here...
*
* @var string
*/
var $text = null;
/**
* Enter description here...
*
* @var boolean
*/
var $allow_html = false;
/**
* Constructor.
*
* @param unknown_type $text
*/
function __construct ($text=null) {
$this->text = $text;
parent::__construct();
}
/**
* Returns $text translated to HTML using the Flay syntax.
*
* @param string $text Text to format
* @param boolean $bare
* @param boolean $allowHtml Set this to trim whitespace and disable all HTML
* @return string Formatted text
*/
function toHtml ($text=null, $bare=false, $allowHtml=false) {
if (empty($text) && empty($this->text))
return false;
$text = $text? $text: $this->text;
// trim whitespace and disable all HTML
if ($allowHtml)
$text = trim($text);
else
$text = str_replace('<', '&lt;', str_replace('>', '&gt;', trim($text)));
if (!$bare) {
// multi-paragraph functions
$text = preg_replace('#(?:[\n]{0,2})"""(.*)"""(?:[\n]{0,2})#s', "\n\n%BLOCKQUOTE%\n\n\\1\n\n%ENDBLOCKQUOTE%\n\n", $text);
$text = preg_replace('#(?:[\n]{0,2})===(.*)===(?:[\n]{0,2})#s', "\n\n%CENTER%\n\n\\1\n\n%ENDCENTER%\n\n", $text);
}
// pre-parse newlines
$text = preg_replace("#\r\n#", "\n", $text);
$text = preg_replace("#[\n]{2,}#", "%PARAGRAPH%", $text);
$text = preg_replace('#[\n]{1}#', "%LINEBREAK%", $text);
// split into paragraphs and parse
$out = '';
foreach (split('%PARAGRAPH%', $text) as $line) {
if ($line) {
if (!$bare) {
// pre-parse links
$links = array();
$regs = null;
if (preg_match_all('#\[([^\[]{4,})\]#', $line, $regs)) {
foreach ($regs[1] as $reg) {
$links[] = $reg;
$line = str_replace("[{$reg}]",'%LINK'.(count($links)-1).'%', $line);
}
}
// MAIN TEXT FUNCTIONS
// bold
$line = ereg_replace("\*([^\*]*)\*", "<strong>\\1</strong>", $line);
// italic
$line = ereg_replace("_([^_]*)_", "<em>\\1</em>", $line);
}
// entities
$line = str_replace(' - ', ' &ndash; ', $line);
$line = str_replace(' -- ', ' &mdash; ', $line);
$line = str_replace('(C)', '&copy;', $line);
$line = str_replace('(R)', '&reg;', $line);
$line = str_replace('(TM)', '&trade;', $line);
// guess e-mails
$emails = null;
if (preg_match_all("#([_A-Za-z0-9+-+]+(?:\.[_A-Za-z0-9+-]+)*@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*)#", $line, $emails)) {
foreach ($emails[1] as $email) {
$line = str_replace($email, "<a href=\"mailto:{$email}\">{$email}</a>", $line);
}
}
if (!$bare) {
// guess links
$urls = null;
if (preg_match_all("#((?:http|https|ftp|nntp)://[^ ]+)#", $line, $urls))
{
foreach ($urls[1] as $url)
{
$line = str_replace($url, "<a href=\"{$url}\">{$url}</a>", $line);
}
}
if (preg_match_all("#(www\.[^\n\%\ ]+[^\n\%\,\.\ ])#", $line, $urls))
{
foreach ($urls[1] as $url)
{
$line = str_replace($url, "<a href=\"http://{$url}\">{$url}</a>", $line);
}
}
// re-parse links
if (count($links)) {
for ($ii=0; $ii<count($links); $ii++) {
if (preg_match("#^(http|https|ftp|nntp)://#", $links[$ii]))
{
$prefix = null;
}
else
{
$prefix = 'http://';
}
if (preg_match('#^[^\ ]+\.(jpg|jpeg|gif|png)$#', $links[$ii]))
{
$with = "<img src=\"{$prefix}{$links[$ii]}\" alt=\"\" />";
}
elseif (preg_match('#^([^\]\ ]+)(?:\ ([^\]]+))?$#', $links[$ii], $regs))
{
if (isset($regs[2]))
{
if (preg_match('#\.(jpg|jpeg|gif|png)$#', $regs[2]))
$body = "<img src=\"{$prefix}{$regs[2]}\" alt=\"\" />";
else
$body = $regs[2];
}
else
{
$body = $links[$ii];
}
$with = "<a href=\"{$prefix}{$regs[1]}\" target=\"_blank\">{$body}</a>";
}
else
{
$with = $prefix.$links[$ii];
}
$line = str_replace("%LINK{$ii}%", $with, $line);
}
}
}
// re-parse newlines
$out .= str_replace('%LINEBREAK%', "<br />\n", "<p>{$line}</p>\n");
}
}
if (!$bare) {
// re-parse multilines
$out = str_replace('<p>%BLOCKQUOTE%</p>', "<blockquote>", $out);
$out = str_replace('<p>%ENDBLOCKQUOTE%</p>', "</blockquote>", $out);
$out = str_replace('<p>%CENTER%</p>', "<center>", $out);
$out = str_replace('<p>%ENDCENTER%</p>', "</center>", $out);
}
return $out;
}
/**
* Enter description here...
*
* @param unknown_type $string
* @return unknown
*/
function extractWords ($string) {
return preg_split('/[\s,\.:\/="!\(\)<>~\[\]]+/', $string);
}
/**
* Enter description here...
*
* @param unknown_type $words
* @param unknown_type $string
* @param unknown_type $max_snippets
* @return unknown
*/
function markedSnippets ($words, $string, $max_snippets=5) {
$string = strip_tags($string);
$snips = array();
$rest = $string;
foreach ($words as $word) {
if (preg_match_all("/[\s,]+.{0,40}{$word}.{0,40}[\s,]+/i", $rest, $r)) {
foreach ($r as $result)
$rest = str_replace($result, '', $rest);
$snips = array_merge($snips, $r[0]);
}
}
if (count($snips) > $max_snippets) $snips = array_slice($snips, 0, $max_snippets);
$joined = join(' <b>...</b> ', $snips);
$snips = $joined? "<b>...</b> {$joined} <b>...</b>": substr($string, 0, 80).'<b>...</b>';
return Flay::colorMark($words, $snips);
}
/**
* Enter description here...
*
* @param unknown_type $words
* @param unknown_type $string
* @return unknown
*/
function colorMark($words, $string)
{
$colors = array('yl','gr','rd','bl','fu','cy');
$nextColorIndex = 0;
foreach ($words as $word)
{
$string = preg_replace("/({$word})/i", '<em class="'.$colors[$nextColorIndex%count($colors)]."\">\\1</em>", $string);
$nextColorIndex++;
}
return $string;
}
/**
* Enter description here...
*
* @param unknown_type $text
* @return unknown
*/
function toClean ($text)
{
return strip_tags(html_entity_decode($text, ENT_QUOTES));
}
function toParsedAndClean ($text)
{
return Flay::toClean(Flay::toHtml($text));
}
/**
* Enter description here...
*
* @param unknown_type $text
* @param unknown_type $length
* @param unknown_type $elipsis
* @return unknown
*/
function fragment ($text, $length, $elipsis='...') {
$soft=$length-5;
$hard=$length+5;
$rx = '/(.{'.$soft.','.$hard.'})[\s,\.:\/="!\(\)<>~\[\]]+.*/';
if (preg_match($rx, $text, $r)) {
$out = $r[1];
}
else {
$out = substr($text,0,$length);
}
$out = $out.(strlen($out)<strlen($text)? $elipsis: null);
return $out;
}
}
?>

View file

@ -1,255 +1,255 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Folder
* Folder structure browser, lists folders and files.
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
uses('object');
/**
* Folder structure browser, lists folders and files.
*
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
*/
class Folder extends Object {
/**
* Enter description here...
*
* @var string
*/
var $path = null;
/**
* Enter description here...
*
* @var boolean
*/
var $sort = false;
/**
* Constructor.
*
* @param string $path
*/
function __construct ($path=false) {
if (empty($path)) $path = getcwd();
$this->cd($path);
}
/**
* Return current path.
*
* @return string Current path
*/
function pwd () {
return $this->path;
}
/**
* Change directory to $desired_path.
*
* @param string $desired_path Path to the directory to change to
* @return string The new path. Returns false on failure
*/
function cd ($desired_path) {
$desired_path = realpath($desired_path);
$new_path = Folder::isAbsolute($desired_path)?
$desired_path:
Folder::addPathElement($this->path, $desired_path);
return is_dir($new_path)? $this->path = $new_path: false;
}
/**
* Returns an array of the contents of the current directory, or false on failure.
* The returned array holds two arrays: one of dirs and one of files.
*
* @param boolean $sort
* @return array
*/
function ls($sort=true) {
$dir = opendir($this->path);
if ($dir) {
$dirs = $files = array();
while (false !== ($n = readdir($dir))) {
if (!preg_match('#^\.+$#', $n)) {
if (is_dir($this->addPathElement($this->path, $n)))
$dirs[] = $n;
else
$files[] = $n;
}
}
if ($sort || $this->sort) {
sort($dirs);
sort($files);
}
return array($dirs,$files);
}
else {
return false;
}
}
/**
* Returns an array of all matching files in current directory
*
* @param string $pattern Preg_match pattern (Defaults to: .*)
* @return array
*/
function find ($regexp_pattern='.*')
{
$data = $this->ls();
if (!is_array($data))
return array();
list($dirs, $files) = $data;
$found = array();
foreach ($files as $file)
{
if (preg_match("/^{$regexp_pattern}$/i", $file))
{
$found[] = $file;
}
}
return $found;
}
/**
* Returns an array of all matching files in and below current directory
*
* @param string $pattern Preg_match pattern (Defaults to: .*)
* @return array Files matching $pattern
*/
function findRecursive ($pattern='.*') {
$starts_on = $this->path;
$out = $this->_findRecursive($pattern);
$this->cd($starts_on);
return $out;
}
/**
* Private helper function for findRecursive.
*
* @param string $pattern
* @return array Files matching pattern
*/
function _findRecursive ($pattern) {
list($dirs, $files) = $this->ls();
$found = array();
foreach ($files as $file) {
if (preg_match("/^{$pattern}$/i", $file)) {
$found[] = $this->addPathElement($this->path, $file);
}
}
$start = $this->path;
foreach ($dirs as $dir) {
$this->cd($this->addPathElement($start, $dir));
$found = array_merge($found, $this->findRecursive($pattern));
}
return $found;
}
/**
* Returns true if given $path is a Windows path.
*
* @param string $path Path to check
* @return boolean
*/
function isWindowsPath ($path) {
return preg_match('#^[A-Z]:\\\#i', $path)? true: false;
}
/**
* Returns true if given $path is an absolute path.
*
* @param string $path Path to check
* @return boolean
*/
function isAbsolute ($path) {
return preg_match('#^\/#', $path) || preg_match('#^[A-Z]:\\\#i', $path);
}
/**
* Returns true if given $path ends in a slash (i.e. is slash-terminated).
*
* @param string $path Path to check
* @return boolean
*/
function isSlashTerm ($path) {
return preg_match('#[\\\/]$#', $path)? true: false;
}
/**
* Returns a correct set of slashes for given $path. (\\ for Windows paths and / for other paths.)
*
* @param string $path Path to check
* @return string Set of slashes ("\\" or "/")
*/
function correctSlashFor ($path) {
return Folder::isWindowsPath($path)? '\\': '/';
}
/**
* Returns $path with added terminating slash (corrected for Windows or other OS).
*
* @param string $path Path to check
* @return string
*/
function slashTerm ($path) {
return $path . (Folder::isSlashTerm($path)? null: Folder::correctSlashFor($path));
}
/**
* Returns $path with $element added, with correct slash in-between.
*
* @param string $path
* @param string $element
* @return string
*/
function addPathElement ($path, $element) {
return Folder::slashTerm($path).$element;
}
}
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Folder
* Folder structure browser, lists folders and files.
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
uses('object');
/**
* Folder structure browser, lists folders and files.
*
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
*/
class Folder extends Object {
/**
* Enter description here...
*
* @var string
*/
var $path = null;
/**
* Enter description here...
*
* @var boolean
*/
var $sort = false;
/**
* Constructor.
*
* @param string $path
*/
function __construct ($path=false) {
if (empty($path)) $path = getcwd();
$this->cd($path);
}
/**
* Return current path.
*
* @return string Current path
*/
function pwd () {
return $this->path;
}
/**
* Change directory to $desired_path.
*
* @param string $desired_path Path to the directory to change to
* @return string The new path. Returns false on failure
*/
function cd ($desired_path) {
$desired_path = realpath($desired_path);
$new_path = Folder::isAbsolute($desired_path)?
$desired_path:
Folder::addPathElement($this->path, $desired_path);
return is_dir($new_path)? $this->path = $new_path: false;
}
/**
* Returns an array of the contents of the current directory, or false on failure.
* The returned array holds two arrays: one of dirs and one of files.
*
* @param boolean $sort
* @return array
*/
function ls($sort=true) {
$dir = opendir($this->path);
if ($dir) {
$dirs = $files = array();
while (false !== ($n = readdir($dir))) {
if (!preg_match('#^\.+$#', $n)) {
if (is_dir($this->addPathElement($this->path, $n)))
$dirs[] = $n;
else
$files[] = $n;
}
}
if ($sort || $this->sort) {
sort($dirs);
sort($files);
}
return array($dirs,$files);
}
else {
return false;
}
}
/**
* Returns an array of all matching files in current directory
*
* @param string $pattern Preg_match pattern (Defaults to: .*)
* @return array
*/
function find ($regexp_pattern='.*')
{
$data = $this->ls();
if (!is_array($data))
return array();
list($dirs, $files) = $data;
$found = array();
foreach ($files as $file)
{
if (preg_match("/^{$regexp_pattern}$/i", $file))
{
$found[] = $file;
}
}
return $found;
}
/**
* Returns an array of all matching files in and below current directory
*
* @param string $pattern Preg_match pattern (Defaults to: .*)
* @return array Files matching $pattern
*/
function findRecursive ($pattern='.*') {
$starts_on = $this->path;
$out = $this->_findRecursive($pattern);
$this->cd($starts_on);
return $out;
}
/**
* Private helper function for findRecursive.
*
* @param string $pattern
* @return array Files matching pattern
*/
function _findRecursive ($pattern) {
list($dirs, $files) = $this->ls();
$found = array();
foreach ($files as $file) {
if (preg_match("/^{$pattern}$/i", $file)) {
$found[] = $this->addPathElement($this->path, $file);
}
}
$start = $this->path;
foreach ($dirs as $dir) {
$this->cd($this->addPathElement($start, $dir));
$found = array_merge($found, $this->findRecursive($pattern));
}
return $found;
}
/**
* Returns true if given $path is a Windows path.
*
* @param string $path Path to check
* @return boolean
*/
function isWindowsPath ($path) {
return preg_match('#^[A-Z]:\\\#i', $path)? true: false;
}
/**
* Returns true if given $path is an absolute path.
*
* @param string $path Path to check
* @return boolean
*/
function isAbsolute ($path) {
return preg_match('#^\/#', $path) || preg_match('#^[A-Z]:\\\#i', $path);
}
/**
* Returns true if given $path ends in a slash (i.e. is slash-terminated).
*
* @param string $path Path to check
* @return boolean
*/
function isSlashTerm ($path) {
return preg_match('#[\\\/]$#', $path)? true: false;
}
/**
* Returns a correct set of slashes for given $path. (\\ for Windows paths and / for other paths.)
*
* @param string $path Path to check
* @return string Set of slashes ("\\" or "/")
*/
function correctSlashFor ($path) {
return Folder::isWindowsPath($path)? '\\': '/';
}
/**
* Returns $path with added terminating slash (corrected for Windows or other OS).
*
* @param string $path Path to check
* @return string
*/
function slashTerm ($path) {
return $path . (Folder::isSlashTerm($path)? null: Folder::correctSlashFor($path));
}
/**
* Returns $path with $element added, with correct slash in-between.
*
* @param string $path
* @param string $element
* @return string
*/
function addPathElement ($path, $element) {
return Folder::slashTerm($path).$element;
}
}
?>

View file

@ -1,224 +1,224 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Inflector
* I'm trying to port RoR Inflector class here.
* Inflector pluralizes and singularizes English nouns.
* Test with $i = new Inflector(); $i->test();
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* This is a port of Ruby on Rails' Inflector class.
* Inflector pluralizes and singularizes English nouns.
* Test with $i = new Inflector(); $i->test();
*
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
*/
class Inflector extends Object
{
/**
* Constructor.
*
*/
function __construct () {
parent::__construct();
}
/**
* Return $word in plural form.
*
* @param string $word Word in singular
* @return string Word in plural
*/
function pluralize ($word) {
$plural_rules = array(
'/(x|ch|ss|sh)$/' => '\1es', # search, switch, fix, box, process, address
'/series$/' => '\1series',
'/([^aeiouy]|qu)ies$/' => '\1y',
'/([^aeiouy]|qu)y$/' => '\1ies', # query, ability, agency
'/(?:([^f])fe|([lr])f)$/' => '\1\2ves', # half, safe, wife
'/sis$/' => 'ses', # basis, diagnosis
'/([ti])um$/' => '\1a', # datum, medium
'/person$/' => 'people', # person, salesperson
'/man$/' => 'men', # man, woman, spokesman
'/child$/' => 'children', # child
'/s$/' => 's', # no change (compatibility)
'/$/' => 's'
);
foreach ($plural_rules as $rule => $replacement) {
if (preg_match($rule, $word)) {
return preg_replace($rule, $replacement, $word);
}
}
return false;
}
/**
* Return $word in singular form.
*
* @param string $word Word in plural
* @return string Word in singular
*/
function singularize ($word) {
$singular_rules = array(
'/(x|ch|ss)es$/' => '\1',
'/movies$/' => 'movie',
'/series$/' => 'series',
'/([^aeiouy]|qu)ies$/' => '\1y',
'/([lr])ves$/' => '\1f',
'/([^f])ves$/' => '\1fe',
'/(analy|ba|diagno|parenthe|progno|synop|the)ses$/' => '\1sis',
'/([ti])a$/' => '\1um',
'/people$/' => 'person',
'/men$/' => 'man',
'/status$/' => 'status',
'/children$/' => 'child',
'/news$/' => 'news',
'/s$/' => ''
);
foreach ($singular_rules as $rule => $replacement) {
if (preg_match($rule, $word)) {
return preg_replace($rule, $replacement, $word);
}
}
return false;
}
/**
* Returns given $lower_case_and_underscored_word as a camelCased word.
*
* @param string $lower_case_and_underscored_word Word to camelize
* @return string Camelized word. likeThis.
*/
function camelize($lower_case_and_underscored_word) {
return str_replace(" ","",ucwords(str_replace("_"," ",$lower_case_and_underscored_word)));
}
/**
* Returns an underscore-syntaxed ($like_this_dear_reader) version of the $camel_cased_word.
*
* @param string $camel_cased_word Camel-cased word to be "underscorized"
* @return string Underscore-syntaxed version of the $camel_cased_word
*/
function underscore($camel_cased_word) {
$camel_cased_word = preg_replace('/([A-Z]+)([A-Z])/','\1_\2',$camel_cased_word);
return strtolower(preg_replace('/([a-z])([A-Z])/','\1_\2',$camel_cased_word));
}
/**
* Returns a human-readable string from $lower_case_and_underscored_word,
* by replacing underscores with a space, and by upper-casing the initial characters.
*
* @param string $lower_case_and_underscored_word String to be made more readable
* @return string Human-readable string
*/
function humanize($lower_case_and_underscored_word) {
return ucwords(str_replace("_"," ",$lower_case_and_underscored_word));
}
/**
* Returns corresponding table name for given $class_name.
*
* @param string $class_name Name of class to get database table name for
* @return string Name of the database table for given class
*/
function tableize($class_name) {
return Inflector::pluralize(Inflector::underscore($class_name));
}
/**
* Returns Cake class name ("Post" for the database table "posts".) for given database table.
*
* @param string $table_name Name of database table to get class name for
* @return string
*/
function classify($table_name)
{
return Inflector::camelize(Inflector::singularize($table_name));
}
/**
* Returns $class_name in underscored form, with "_id" tacked on at the end.
* This is for use in dealing with the database.
*
* @param string $class_name
* @return string
*/
function foreignKey($class_name)
{
return Inflector::underscore($class_name) . "_id";
}
function toControllerFilename($name)
{
return CONTROLLERS.Inflector::underscore($name).'.php';
}
function toHelperFilename($name)
{
return HELPERS.Inflector::underscore($name).'.php';
}
function toFullName($name, $correct)
{
if (strstr($name, '_') && (strtolower($name) == $name))
{
return Inflector::camelize($name);
}
if (preg_match("/^(.*)({$correct})$/i", $name, $reg))
{
if ($reg[2] == $correct)
{
return $name;
}
else
{
return ucfirst($reg[1].$correct);
}
}
else
{
return ucfirst($name.$correct);
}
}
function toLibraryFilename ($name)
{
return LIBS.Inflector::underscore($name).'.php';
}
}
?>
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Inflector
* I'm trying to port RoR Inflector class here.
* Inflector pluralizes and singularizes English nouns.
* Test with $i = new Inflector(); $i->test();
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* This is a port of Ruby on Rails' Inflector class.
* Inflector pluralizes and singularizes English nouns.
* Test with $i = new Inflector(); $i->test();
*
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
*/
class Inflector extends Object
{
/**
* Constructor.
*
*/
function __construct () {
parent::__construct();
}
/**
* Return $word in plural form.
*
* @param string $word Word in singular
* @return string Word in plural
*/
function pluralize ($word) {
$plural_rules = array(
'/(x|ch|ss|sh)$/' => '\1es', # search, switch, fix, box, process, address
'/series$/' => '\1series',
'/([^aeiouy]|qu)ies$/' => '\1y',
'/([^aeiouy]|qu)y$/' => '\1ies', # query, ability, agency
'/(?:([^f])fe|([lr])f)$/' => '\1\2ves', # half, safe, wife
'/sis$/' => 'ses', # basis, diagnosis
'/([ti])um$/' => '\1a', # datum, medium
'/person$/' => 'people', # person, salesperson
'/man$/' => 'men', # man, woman, spokesman
'/child$/' => 'children', # child
'/s$/' => 's', # no change (compatibility)
'/$/' => 's'
);
foreach ($plural_rules as $rule => $replacement) {
if (preg_match($rule, $word)) {
return preg_replace($rule, $replacement, $word);
}
}
return false;
}
/**
* Return $word in singular form.
*
* @param string $word Word in plural
* @return string Word in singular
*/
function singularize ($word) {
$singular_rules = array(
'/(x|ch|ss)es$/' => '\1',
'/movies$/' => 'movie',
'/series$/' => 'series',
'/([^aeiouy]|qu)ies$/' => '\1y',
'/([lr])ves$/' => '\1f',
'/([^f])ves$/' => '\1fe',
'/(analy|ba|diagno|parenthe|progno|synop|the)ses$/' => '\1sis',
'/([ti])a$/' => '\1um',
'/people$/' => 'person',
'/men$/' => 'man',
'/status$/' => 'status',
'/children$/' => 'child',
'/news$/' => 'news',
'/s$/' => ''
);
foreach ($singular_rules as $rule => $replacement) {
if (preg_match($rule, $word)) {
return preg_replace($rule, $replacement, $word);
}
}
return false;
}
/**
* Returns given $lower_case_and_underscored_word as a camelCased word.
*
* @param string $lower_case_and_underscored_word Word to camelize
* @return string Camelized word. likeThis.
*/
function camelize($lower_case_and_underscored_word) {
return str_replace(" ","",ucwords(str_replace("_"," ",$lower_case_and_underscored_word)));
}
/**
* Returns an underscore-syntaxed ($like_this_dear_reader) version of the $camel_cased_word.
*
* @param string $camel_cased_word Camel-cased word to be "underscorized"
* @return string Underscore-syntaxed version of the $camel_cased_word
*/
function underscore($camel_cased_word) {
$camel_cased_word = preg_replace('/([A-Z]+)([A-Z])/','\1_\2',$camel_cased_word);
return strtolower(preg_replace('/([a-z])([A-Z])/','\1_\2',$camel_cased_word));
}
/**
* Returns a human-readable string from $lower_case_and_underscored_word,
* by replacing underscores with a space, and by upper-casing the initial characters.
*
* @param string $lower_case_and_underscored_word String to be made more readable
* @return string Human-readable string
*/
function humanize($lower_case_and_underscored_word) {
return ucwords(str_replace("_"," ",$lower_case_and_underscored_word));
}
/**
* Returns corresponding table name for given $class_name.
*
* @param string $class_name Name of class to get database table name for
* @return string Name of the database table for given class
*/
function tableize($class_name) {
return Inflector::pluralize(Inflector::underscore($class_name));
}
/**
* Returns Cake class name ("Post" for the database table "posts".) for given database table.
*
* @param string $table_name Name of database table to get class name for
* @return string
*/
function classify($table_name)
{
return Inflector::camelize(Inflector::singularize($table_name));
}
/**
* Returns $class_name in underscored form, with "_id" tacked on at the end.
* This is for use in dealing with the database.
*
* @param string $class_name
* @return string
*/
function foreignKey($class_name)
{
return Inflector::underscore($class_name) . "_id";
}
function toControllerFilename($name)
{
return CONTROLLERS.Inflector::underscore($name).'.php';
}
function toHelperFilename($name)
{
return HELPERS.Inflector::underscore($name).'.php';
}
function toFullName($name, $correct)
{
if (strstr($name, '_') && (strtolower($name) == $name))
{
return Inflector::camelize($name);
}
if (preg_match("/^(.*)({$correct})$/i", $name, $reg))
{
if ($reg[2] == $correct)
{
return $name;
}
else
{
return ucfirst($reg[1].$correct);
}
}
else
{
return ucfirst($name.$correct);
}
}
function toLibraryFilename ($name)
{
return LIBS.Inflector::underscore($name).'.php';
}
}
?>

View file

@ -1,78 +1,78 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* with this hack you can use clone() in PHP4 code
* use "clone($object)" not "clone $object"! the former works in both PHP4 and PHP5
*
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
if (version_compare(phpversion(), '5.0') < 0) {
eval('
function clone($object) {
return $object;
}
');
}
/**
* Replace file_get_contents()
*
* @category PHP
* @package PHP_Compat
* @link http://php.net/function.file_get_contents
* @author Aidan Lister <aidan@php.net>
* @internal resource_context is not supported
* @since PHP 5
* @require PHP 4.0.0 (user_error)
*/
if (!function_exists('file_get_contents')) {
function file_get_contents($filename, $incpath = false)
{
if (false === $fh = fopen($filename, 'rb', $incpath)) {
user_error('file_get_contents() failed to open stream: No such file or directory',
E_USER_WARNING);
return false;
}
clearstatcache();
if ($fsize = @filesize($filename)) {
$data = fread($fh, $fsize);
} else {
$data = '';
while (!feof($fh)) {
$data .= fread($fh, 8192);
}
}
fclose($fh);
return $data;
}
}
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* with this hack you can use clone() in PHP4 code
* use "clone($object)" not "clone $object"! the former works in both PHP4 and PHP5
*
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
if (version_compare(phpversion(), '5.0') < 0) {
eval('
function clone($object) {
return $object;
}
');
}
/**
* Replace file_get_contents()
*
* @category PHP
* @package PHP_Compat
* @link http://php.net/function.file_get_contents
* @author Aidan Lister <aidan@php.net>
* @internal resource_context is not supported
* @since PHP 5
* @require PHP 4.0.0 (user_error)
*/
if (!function_exists('file_get_contents')) {
function file_get_contents($filename, $incpath = false)
{
if (false === $fh = fopen($filename, 'rb', $incpath)) {
user_error('file_get_contents() failed to open stream: No such file or directory',
E_USER_WARNING);
return false;
}
clearstatcache();
if ($fsize = @filesize($filename)) {
$data = fread($fh, $fsize);
} else {
$data = '';
while (!feof($fh)) {
$data .= fread($fh, 8192);
}
}
fclose($fh);
return $data;
}
}
?>

View file

@ -1,173 +1,173 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Router
* Parses the request URL into controller, action, and parameters.
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
uses('object', 'narray');
/**
* Parses the request URL into controller, action, and parameters.
*
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
*
*/
class Router extends Object {
/**
* Array of routes
*
* @var array
*/
var $routes = array();
/**
* TODO: Better description. Returns this object's routes array. Returns false if there are no routes available.
*
* @param string $route An empty string, or a route string "/"
* @param array $default NULL or an array describing the default route
* @see routes
* @return array Array of routes
*/
function connect ($route, $default=null) {
$parsed = $names = array ();
$r = null;
if (($route == '') || ($route == '/')) {
$regexp = '/^[\/]*$/';
$this->routes[] = array($route, $regexp, array(), $default);
}
else {
$elements = array();
foreach (explode('/', $route) as $element)
if (trim($element)) $elements[] = $element;
if (!count($elements))
return false;
foreach ($elements as $element) {
if (preg_match('/^:(.+)$/', $element, $r)) {
$parsed[] = '(?:\/([^\/]+))?';
$names[] = $r[1];
}
elseif (preg_match('/^\*$/', $element, $r)) {
$parsed[] = '(?:\/(.*))?';
}
else {
$parsed[] = '/'.$element;
}
}
$regexp = '#^'.join('', $parsed).'[\/]*$#';
$this->routes[] = array($route, $regexp, $names, $default);
}
return $this->routes;
}
/**
* TODO: Better description. Returns an array of routes.
*
* @param string $url URL to be parsed
* @return array
*/
function parse ($url)
{
// An URL should start with a '/', mod_rewrite doesn't respect that, but no-mod_rewrite version does.
// Here's the fix.
if ($url && ('/' != $url[0]))
{
$url = '/'.$url;
}
$out = array();
$r = null;
$default_route = array
(
'/:controller/:action/* (default)',
"#^(?:\/(?:([a-z0-9_\-]+)(?:\/([a-z0-9_\-]+)(?:\/(.*))?)?))[\/]*$#",
array('controller', 'action'),
array()
);
$this->routes[] = $default_route;
foreach ($this->routes as $route)
{
list($route, $regexp, $names, $defaults) = $route;
if (preg_match($regexp, $url, $r))
{
// $this->log($url.' matched '.$regexp, 'note');
// remove the first element, which is the url
array_shift($r);
// hack, pre-fill the default route names
foreach ($names as $name)
$out[$name] = null;
$ii = 0;
if (is_array($defaults))
{
foreach ($defaults as $name=>$value)
{
if (preg_match('#[a-z_\-]#i', $name))
$out[$name] = $value;
else
$out['pass'][] = $value;
}
}
foreach ($r as $found) {
// if $found is a named url element (i.e. ':action')
if (isset($names[$ii]))
{
$out[$names[$ii]] = $found;
}
// unnamed elements go in as 'pass'
else
{
$pass = new Narray(explode('/', $found));
$pass->cleanup();
$out['pass'] = $pass->value;
}
$ii++;
}
break;
}
}
return $out;
}
}
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Router
* Parses the request URL into controller, action, and parameters.
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
uses('object', 'narray');
/**
* Parses the request URL into controller, action, and parameters.
*
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
*
*/
class Router extends Object {
/**
* Array of routes
*
* @var array
*/
var $routes = array();
/**
* TODO: Better description. Returns this object's routes array. Returns false if there are no routes available.
*
* @param string $route An empty string, or a route string "/"
* @param array $default NULL or an array describing the default route
* @see routes
* @return array Array of routes
*/
function connect ($route, $default=null) {
$parsed = $names = array ();
$r = null;
if (($route == '') || ($route == '/')) {
$regexp = '/^[\/]*$/';
$this->routes[] = array($route, $regexp, array(), $default);
}
else {
$elements = array();
foreach (explode('/', $route) as $element)
if (trim($element)) $elements[] = $element;
if (!count($elements))
return false;
foreach ($elements as $element) {
if (preg_match('/^:(.+)$/', $element, $r)) {
$parsed[] = '(?:\/([^\/]+))?';
$names[] = $r[1];
}
elseif (preg_match('/^\*$/', $element, $r)) {
$parsed[] = '(?:\/(.*))?';
}
else {
$parsed[] = '/'.$element;
}
}
$regexp = '#^'.join('', $parsed).'[\/]*$#';
$this->routes[] = array($route, $regexp, $names, $default);
}
return $this->routes;
}
/**
* TODO: Better description. Returns an array of routes.
*
* @param string $url URL to be parsed
* @return array
*/
function parse ($url)
{
// An URL should start with a '/', mod_rewrite doesn't respect that, but no-mod_rewrite version does.
// Here's the fix.
if ($url && ('/' != $url[0]))
{
$url = '/'.$url;
}
$out = array();
$r = null;
$default_route = array
(
'/:controller/:action/* (default)',
"#^(?:\/(?:([a-z0-9_\-]+)(?:\/([a-z0-9_\-]+)(?:\/(.*))?)?))[\/]*$#",
array('controller', 'action'),
array()
);
$this->routes[] = $default_route;
foreach ($this->routes as $route)
{
list($route, $regexp, $names, $defaults) = $route;
if (preg_match($regexp, $url, $r))
{
// $this->log($url.' matched '.$regexp, 'note');
// remove the first element, which is the url
array_shift($r);
// hack, pre-fill the default route names
foreach ($names as $name)
$out[$name] = null;
$ii = 0;
if (is_array($defaults))
{
foreach ($defaults as $name=>$value)
{
if (preg_match('#[a-z_\-]#i', $name))
$out[$name] = $value;
else
$out['pass'][] = $value;
}
}
foreach ($r as $found) {
// if $found is a named url element (i.e. ':action')
if (isset($names[$ii]))
{
$out[$names[$ii]] = $found;
}
// unnamed elements go in as 'pass'
else
{
$pass = new Narray(explode('/', $found));
$pass->cleanup();
$out['pass'] = $pass->value;
}
$ii++;
}
break;
}
}
return $out;
}
}
?>

View file

@ -1,53 +1,53 @@
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Tort Validators
* Used to validate data in Models.
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Not empty.
*/
define('VALID_NOT_EMPTY', '/.+/');
/**
* Numbers [0-9] only.
*/
define('VALID_NUMBER', '/^[0-9]+$/');
/**
* A valid email address.
*/
define('VALID_EMAIL', '/^([a-z0-9][a-z0-9_\-\.\+]*)@([a-z0-9][a-z0-9\.\-]{0,63}\.[a-z]{2,3})$/i');
/**
* A valid year (1000-2999).
*/
define('VALID_YEAR', '/^[12][0-9]{3}$/');
<?PHP
//////////////////////////////////////////////////////////////////////////
// + $Id$
// +------------------------------------------------------------------+ //
// + Cake <https://developers.nextco.com/cake/> + //
// + Copyright: (c) 2005, Cake Authors/Developers + //
// + Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com> + //
// + Larry E. Masters aka PhpNut <nut@phpnut.com> + //
// + Kamil Dzielinski aka Brego <brego.dk@gmail.com> + //
// +------------------------------------------------------------------+ //
// + Licensed under The MIT License + //
// + Redistributions of files must retain the above copyright notice. + //
// + See: http://www.opensource.org/licenses/mit-license.php + //
//////////////////////////////////////////////////////////////////////////
/**
* Purpose: Tort Validators
* Used to validate data in Models.
*
* @filesource
* @author Cake Authors/Developers
* @copyright Copyright (c) 2005, Cake Authors/Developers
* @link https://developers.nextco.com/cake/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.libs
* @since Cake v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Not empty.
*/
define('VALID_NOT_EMPTY', '/.+/');
/**
* Numbers [0-9] only.
*/
define('VALID_NUMBER', '/^[0-9]+$/');
/**
* A valid email address.
*/
define('VALID_EMAIL', '/^([a-z0-9][a-z0-9_\-\.\+]*)@([a-z0-9][a-z0-9\.\-]{0,63}\.[a-z]{2,3})$/i');
/**
* A valid year (1000-2999).
*/
define('VALID_YEAR', '/^[12][0-9]{3}$/');
?>

View file

@ -1,110 +1,110 @@
BODY {
font-size: 76%;
}
BODY, INPUT, TEXTAREA {
font-family:sans-serif;
}
H1 {
font-size:2.1em;
color: #fff;
text-align: left;
position: absolute;
padding-left: 15%;
top: 0.35em;
left: 0;
height: 4em;
}
H2 {
font-size:1.7em;
color: #383;
}
H3 {
font-size:1.4em;
color: #553;
}
H4 {
font-size:1.15em;
color: #338;
}
P {
font-size:1em;
margin-bottom:.5em;
}
A {
white-space:nowrap;
text-decoration:underline;
}
A:HOVER {
background-color:#EEE;
}
CODE, PRE {
font-family:monospace;
font-size:1.1em !important;
font-size:.95em;
color:#44A;
margin:0;
}
CODE {
color:#227;
white-space:nowrap;
margin:0 .2em;
}
PRE {
margin-left:1em;
}
ACRONYM {
border-bottom:1px dotted;
}
HR {
height:0;
border-top:1px solid #AAA;
}
#container {
margin: 0 auto;
border-top: solid 5em #69c;
color: #333;
font: normal 1.1em Verdana;
padding: 0 15%;
}
#content {
padding-top: 1em;
width: 100%;
text-align: left;
line-height: 170%;
}
.notice {
padding: 1em;
background: #ffd;
border: solid 2px #eeb;
display: block;
font-family: Verdana;
}
.tip {
background: #efe;
padding: 1em;
border: solid 2px #cdc;
}
.error {
background: #fee;
padding: 1em;
border: solid 2px #dcc;
}
BODY {
font-size: 76%;
}
BODY, INPUT, TEXTAREA {
font-family:sans-serif;
}
H1 {
font-size:2.1em;
color: #fff;
text-align: left;
position: absolute;
padding-left: 15%;
top: 0.35em;
left: 0;
height: 4em;
}
H2 {
font-size:1.7em;
color: #383;
}
H3 {
font-size:1.4em;
color: #553;
}
H4 {
font-size:1.15em;
color: #338;
}
P {
font-size:1em;
margin-bottom:.5em;
}
A {
white-space:nowrap;
text-decoration:underline;
}
A:HOVER {
background-color:#EEE;
}
CODE, PRE {
font-family:monospace;
font-size:1.1em !important;
font-size:.95em;
color:#44A;
margin:0;
}
CODE {
color:#227;
white-space:nowrap;
margin:0 .2em;
}
PRE {
margin-left:1em;
}
ACRONYM {
border-bottom:1px dotted;
}
HR {
height:0;
border-top:1px solid #AAA;
}
#container {
margin: 0 auto;
border-top: solid 5em #69c;
color: #333;
font: normal 1.1em Verdana;
padding: 0 15%;
}
#content {
padding-top: 1em;
width: 100%;
text-align: left;
line-height: 170%;
}
.notice {
padding: 1em;
background: #ffd;
border: solid 2px #eeb;
display: block;
font-family: Verdana;
}
.tip {
background: #efe;
padding: 1em;
border: solid 2px #cdc;
}
.error {
background: #fee;
padding: 1em;
border: solid 2px #dcc;
}