adding a newline before all comment blocks

This commit is contained in:
AD7six 2009-07-24 21:18:37 +02:00
parent a9d98e73c3
commit b2142df2bc
460 changed files with 6739 additions and 334 deletions

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Basic Cake functionality.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Basic defines for timing functions.
*/
@ -34,6 +36,7 @@
define('WEEK', 7 * DAY);
define('MONTH', 30 * DAY);
define('YEAR', 365 * DAY);
/**
* Patch for PHP < 5.0
*/
@ -46,6 +49,7 @@ if (!function_exists('clone')) {
}');
}
}
/**
* Loads configuration files. Receives a set of configuration files
* to load.
@ -75,6 +79,7 @@ if (!function_exists('clone')) {
}
return true;
}
/**
* Loads component/components from LIBS. Takes optional number of parameters.
*
@ -91,6 +96,7 @@ if (!function_exists('clone')) {
require_once(LIBS . strtolower($file) . '.php');
}
}
/**
* Prints out debug information about given variable.
*
@ -118,6 +124,7 @@ if (!function_exists('clone')) {
}
}
if (!function_exists('getMicrotime')) {
/**
* Returns microtime for execution time checking
*
@ -129,6 +136,7 @@ if (!function_exists('getMicrotime')) {
}
}
if (!function_exists('sortByKey')) {
/**
* Sorts given $array by key $sortby.
*
@ -160,6 +168,7 @@ if (!function_exists('sortByKey')) {
}
}
if (!function_exists('array_combine')) {
/**
* Combines given identical arrays by using the first array's values as keys,
* and the second one's values as values. (Implemented for backwards compatibility with PHP4)
@ -188,6 +197,7 @@ if (!function_exists('array_combine')) {
return $output;
}
}
/**
* Convenience method for htmlspecialchars.
*
@ -208,6 +218,7 @@ if (!function_exists('array_combine')) {
}
return htmlspecialchars($text, ENT_QUOTES, $charset);
}
/**
* Returns an array of all the given parameters.
*
@ -228,6 +239,7 @@ if (!function_exists('array_combine')) {
$args = func_get_args();
return $args;
}
/**
* Constructs associative array from pairs of arguments.
*
@ -257,6 +269,7 @@ if (!function_exists('array_combine')) {
}
return $a;
}
/**
* Convenience method for echo().
*
@ -266,6 +279,7 @@ if (!function_exists('array_combine')) {
function e($text) {
echo $text;
}
/**
* Convenience method for strtolower().
*
@ -276,6 +290,7 @@ if (!function_exists('array_combine')) {
function low($str) {
return strtolower($str);
}
/**
* Convenience method for strtoupper().
*
@ -286,6 +301,7 @@ if (!function_exists('array_combine')) {
function up($str) {
return strtoupper($str);
}
/**
* Convenience method for str_replace().
*
@ -298,6 +314,7 @@ if (!function_exists('array_combine')) {
function r($search, $replace, $subject) {
return str_replace($search, $replace, $subject);
}
/**
* Print_r convenience function, which prints out <PRE> tags around
* the output of given array. Similar to debug().
@ -314,6 +331,7 @@ if (!function_exists('array_combine')) {
echo '</pre>';
}
}
/**
* Display parameters.
*
@ -329,6 +347,7 @@ if (!function_exists('array_combine')) {
}
return $p;
}
/**
* Merge a group of arrays
*
@ -350,6 +369,7 @@ if (!function_exists('array_combine')) {
}
return $r;
}
/**
* Gets an environment variable from available sources, and provides emulation
* for unsupported or inconsistent environment variables (i.e. DOCUMENT_ROOT on
@ -426,6 +446,7 @@ if (!function_exists('array_combine')) {
return null;
}
if (!function_exists('file_put_contents')) {
/**
* Writes data into file.
*
@ -453,6 +474,7 @@ if (!function_exists('file_put_contents')) {
return false;
}
}
/**
* Reads/writes temporary data to cache files or session.
*
@ -504,6 +526,7 @@ if (!function_exists('file_put_contents')) {
}
return $data;
}
/**
* Used to delete files in the cache directories, or clear contents of cache directories
*
@ -566,6 +589,7 @@ if (!function_exists('file_put_contents')) {
}
return false;
}
/**
* Recursively strips slashes from all values in an array
*
@ -583,6 +607,7 @@ if (!function_exists('file_put_contents')) {
}
return $values;
}
/**
* Returns a translated string if one is found; Otherwise, the submitted message.
*
@ -605,6 +630,7 @@ if (!function_exists('file_put_contents')) {
return I18n::translate($singular);
}
}
/**
* Returns correct plural form of message identified by $singular and $plural for count $count.
* Some languages have more than one form for plural messages dependent on the count.
@ -629,6 +655,7 @@ if (!function_exists('file_put_contents')) {
return I18n::translate($singular, $plural, null, 6, $count);
}
}
/**
* Allows you to override the current domain for a single message lookup.
*
@ -651,6 +678,7 @@ if (!function_exists('file_put_contents')) {
return I18n::translate($msg, null, $domain);
}
}
/**
* Allows you to override the current domain for a single plural message lookup.
* Returns correct plural form of message identified by $singular and $plural for count $count
@ -677,6 +705,7 @@ if (!function_exists('file_put_contents')) {
return I18n::translate($singular, $plural, $domain, 6, $count);
}
}
/**
* Allows you to override the current domain for a single message lookup.
* It also allows you to specify a category.
@ -713,6 +742,7 @@ if (!function_exists('file_put_contents')) {
return I18n::translate($msg, null, $domain, $category);
}
}
/**
* Allows you to override the current domain for a single plural message lookup.
* It also allows you to specify a category.
@ -753,6 +783,7 @@ if (!function_exists('file_put_contents')) {
return I18n::translate($singular, $plural, $domain, $category, $count);
}
}
/**
* The category argument allows a specific category of the locale settings to be used for fetching a message.
* Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.
@ -785,6 +816,7 @@ if (!function_exists('file_put_contents')) {
return I18n::translate($msg, null, null, $category);
}
}
/**
* Computes the difference of arrays using keys for comparison.
*
@ -819,6 +851,7 @@ if (!function_exists('file_put_contents')) {
return $valuesDiff;
}
}
/**
* Computes the intersection of arrays using keys for comparison
*
@ -837,6 +870,7 @@ if (!function_exists('file_put_contents')) {
return $res;
}
}
/**
* Shortcut to Log::write.
*
@ -850,6 +884,7 @@ if (!function_exists('file_put_contents')) {
$good = ' ';
CakeLog::write('error', str_replace($bad, $good, $message));
}
/**
* Searches include path for files.
*
@ -870,6 +905,7 @@ if (!function_exists('file_put_contents')) {
}
return false;
}
/**
* Convert forward slashes to underscores and removes first and last underscores in a string
*
@ -883,6 +919,7 @@ if (!function_exists('file_put_contents')) {
$string = str_replace('/', '_', $string);
return $string;
}
/**
* Implements http_build_query for PHP4.
*
@ -922,6 +959,7 @@ if (!function_exists('file_put_contents')) {
return implode($argSep, $out);
}
}
/**
* Wraps ternary operations. If $condition is a non-empty value, $val1 is returned, otherwise $val2.
* Don't use for isset() conditions, or wrap your variable with @ operator:

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* 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
@ -36,92 +38,112 @@
if (!defined('WEBROOT_DIR')) {
define('WEBROOT_DIR', 'webroot');
}
/**
* Path to the cake directory.
*/
define('CAKE', CORE_PATH.'cake'.DS);
/**
* Path to the application's directory.
*/
if (!defined('APP')) {
define('APP', ROOT.DS.APP_DIR.DS);
}
/**
* Path to the application's models directory.
*/
define('MODELS', APP.'models'.DS);
/**
* Path to model behaviors directory.
*/
define('BEHAVIORS', MODELS.'behaviors'.DS);
/**
* Path to the application's controllers directory.
*/
define('CONTROLLERS', APP.'controllers'.DS);
/**
* Path to the application's components directory.
*/
define('COMPONENTS', CONTROLLERS.'components'.DS);
/**
* Path to the application's views directory.
*/
define('VIEWS', APP.'views'.DS);
/**
* Path to the application's helpers directory.
*/
define('HELPERS', VIEWS.'helpers'.DS);
/**
* Path to the application's view's layouts directory.
*/
define('LAYOUTS', VIEWS.'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', VIEWS.'elements'.DS);
/**
* Path to the configuration files directory.
*/
if (!defined('CONFIGS')) {
define('CONFIGS', APP.'config'.DS);
}
/**
* Path to the libs directory.
*/
define('INFLECTIONS', CAKE.'config'.DS.'inflections'.DS);
/**
* Path to the libs directory.
*/
define('LIBS', CAKE.'libs'.DS);
/**
* Path to the public CSS directory.
*/
define('CSS', WWW_ROOT.'css'.DS);
/**
* Path to the public JavaScript directory.
*/
define('JS', WWW_ROOT.'js'.DS);
/**
* Path to the public images directory.
*/
define('IMAGES', WWW_ROOT.'img'.DS);
/**
* Path to the console libs direcotry.
*/
define('CONSOLE_LIBS', CAKE.'console'.DS.'libs'.DS);
/**
* Path to the tests directory.
*/
if (!defined('TESTS')) {
define('TESTS', APP.'tests'.DS);
}
/**
* Path to the core tests directory.
*/
if (!defined('CAKE_TESTS')) {
define('CAKE_TESTS', CAKE.'tests'.DS);
}
/**
* Path to the test suite.
*/
@ -131,48 +153,58 @@ if (!defined('CAKE_TESTS')) {
* Path to the controller test directory.
*/
define('CONTROLLER_TESTS', TESTS.'cases'.DS.'controllers'.DS);
/**
* Path to the components test directory.
*/
define('COMPONENT_TESTS', TESTS.'cases'.DS.'components'.DS);
/**
* Path to the helpers test directory.
*/
define('HELPER_TESTS', TESTS.'cases'.DS.'views'.DS.'helpers'.DS);
/**
* Path to the models' test directory.
*/
define('MODEL_TESTS', TESTS.'cases'.DS.'models'.DS);
/**
* Path to the lib test directory.
*/
define('LIB_TESTS', CAKE_TESTS.'cases'.DS.'lib'.DS);
/**
* Path to the temporary files directory.
*/
if (!defined('TMP')) {
define('TMP', APP.'tmp'.DS);
}
/**
* Path to the logs directory.
*/
define('LOGS', TMP.'logs'.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.
*/
if (!defined('VENDORS')) {
define('VENDORS', CAKE_CORE_INCLUDE_PATH.DS.'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
*/
@ -189,18 +221,21 @@ if (!defined('FULL_BASE_URL')) {
}
unset($httpHost, $s);
}
/**
* Web path to the public images directory.
*/
if (!defined('IMAGES_URL')) {
define('IMAGES_URL', 'img/');
}
/**
* Web path to the CSS files directory.
*/
if (!defined('CSS_URL')) {
define('CSS_URL', 'css/');
}
/**
* Web path to the js files directory.
*/

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Case Folding Properties.
*
@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* The upper field is the decimal value of the upper case character
*

View file

@ -1,6 +1,7 @@
#!/usr/bin/php -q
<?php
/* SVN FILE: $Id$ */
/**
* Command-line code generation utility to automate programmer chores.
*
@ -25,6 +26,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Shell dispatcher
*
@ -32,6 +34,7 @@
* @subpackage cake.cake.console
*/
class ShellDispatcher {
/**
* Standard input stream.
*
@ -39,6 +42,7 @@ class ShellDispatcher {
* @access public
*/
var $stdin;
/**
* Standard output stream.
*
@ -46,6 +50,7 @@ class ShellDispatcher {
* @access public
*/
var $stdout;
/**
* Standard error stream.
*
@ -53,6 +58,7 @@ class ShellDispatcher {
* @access public
*/
var $stderr;
/**
* Contains command switches parsed from the command line.
*
@ -60,6 +66,7 @@ class ShellDispatcher {
* @access public
*/
var $params = array();
/**
* Contains arguments parsed from the command line.
*
@ -67,6 +74,7 @@ class ShellDispatcher {
* @access public
*/
var $args = array();
/**
* The file name of the shell that was invoked.
*
@ -74,6 +82,7 @@ class ShellDispatcher {
* @access public
*/
var $shell = null;
/**
* The class name of the shell that was invoked.
*
@ -81,6 +90,7 @@ class ShellDispatcher {
* @access public
*/
var $shellClass = null;
/**
* The command called if public methods are available.
*
@ -88,6 +98,7 @@ class ShellDispatcher {
* @access public
*/
var $shellCommand = null;
/**
* The path locations of shells.
*
@ -95,6 +106,7 @@ class ShellDispatcher {
* @access public
*/
var $shellPaths = array();
/**
* The path to the current shell location.
*
@ -102,6 +114,7 @@ class ShellDispatcher {
* @access public
*/
var $shellPath = null;
/**
* The name of the shell in camelized.
*
@ -109,6 +122,7 @@ class ShellDispatcher {
* @access public
*/
var $shellName = null;
/**
* Constructs this ShellDispatcher instance.
*
@ -117,6 +131,7 @@ class ShellDispatcher {
function ShellDispatcher($args = array()) {
$this->__construct($args);
}
/**
* Constructor
*
@ -130,6 +145,7 @@ class ShellDispatcher {
$this->__buildPaths();
$this->_stop($this->dispatch());
}
/**
* Defines core configuration.
*
@ -154,6 +170,7 @@ class ShellDispatcher {
}
require_once(CORE_PATH . 'cake' . DS . 'basics.php');
}
/**
* Defines current working environment.
*
@ -190,6 +207,7 @@ class ShellDispatcher {
$this->shiftArgs();
}
/**
* Builds the shell paths.
*
@ -224,6 +242,7 @@ class ShellDispatcher {
$this->shellPaths = array_values(array_unique(array_merge($paths, App::path('shells'))));
}
/**
* Initializes the environment and loads the Cake core.
*
@ -266,6 +285,7 @@ class ShellDispatcher {
Configure::write('debug', 1);
return true;
}
/**
* Dispatches a CLI request
*
@ -382,6 +402,7 @@ class ShellDispatcher {
$this->help();
}
}
/**
* Prompts the user for input, and returns it.
*
@ -415,6 +436,7 @@ class ShellDispatcher {
}
return $result;
}
/**
* Outputs to the stdout filehandle.
*
@ -429,6 +451,7 @@ class ShellDispatcher {
fwrite($this->stdout, $string);
}
}
/**
* Outputs to the stderr filehandle.
*
@ -438,6 +461,7 @@ class ShellDispatcher {
function stderr($string) {
fwrite($this->stderr, 'Error: '. $string);
}
/**
* Parses command line options
*
@ -479,6 +503,7 @@ class ShellDispatcher {
$this->params = array_merge($this->params, $params);
}
/**
* Helper for recursively paraing params
*
@ -510,6 +535,7 @@ class ShellDispatcher {
}
}
}
/**
* Removes first argument and shifts other arguments up
*
@ -524,6 +550,7 @@ class ShellDispatcher {
$this->args = array_values($this->args);
return true;
}
/**
* Shows console help
*
@ -570,6 +597,7 @@ class ShellDispatcher {
$this->stdout("To get help on a specific command, type 'cake shell_name help'");
$this->_stop();
}
/**
* Stop execution of the current script
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* ErrorHandler for Console Shells
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Error Handler for Cake console.
*
@ -31,6 +33,7 @@
* @subpackage cake.cake.console
*/
class ErrorHandler extends Object {
/**
* Standard output stream.
*
@ -38,6 +41,7 @@ class ErrorHandler extends Object {
* @access public
*/
var $stdout;
/**
* Standard error stream.
*
@ -45,6 +49,7 @@ class ErrorHandler extends Object {
* @access public
*/
var $stderr;
/**
* Class constructor.
*
@ -60,6 +65,7 @@ class ErrorHandler extends Object {
call_user_func_array(array(&$this, 'error404'), $messages);
}
}
/**
* Displays an error page (e.g. 404 Not found).
*
@ -71,6 +77,7 @@ class ErrorHandler extends Object {
$this->stderr($code . $name . $message."\n");
$this->_stop();
}
/**
* Convenience method to display a 404 page.
*
@ -84,6 +91,7 @@ class ErrorHandler extends Object {
'message' => sprintf(__("The requested address %s was not found on this server.", true), $url, $message)));
$this->_stop();
}
/**
* Renders the Missing Controller web page.
*
@ -96,6 +104,7 @@ class ErrorHandler extends Object {
$this->stderr(sprintf(__("Missing Controller '%s'", true), $controllerName));
$this->_stop();
}
/**
* Renders the Missing Action web page.
*
@ -107,6 +116,7 @@ class ErrorHandler extends Object {
$this->stderr(sprintf(__("Missing Method '%s' in '%s'", true), $action, $className));
$this->_stop();
}
/**
* Renders the Private Action web page.
*
@ -118,6 +128,7 @@ class ErrorHandler extends Object {
$this->stderr(sprintf(__("Trying to access private method '%s' in '%s'", true), $action, $className));
$this->_stop();
}
/**
* Renders the Missing Table web page.
*
@ -129,6 +140,7 @@ class ErrorHandler extends Object {
$this->stderr(sprintf(__("Missing database table '%s' for model '%s'", true), $table, $className));
$this->_stop();
}
/**
* Renders the Missing Database web page.
*
@ -139,6 +151,7 @@ class ErrorHandler extends Object {
$this->stderr(__("Missing Database", true));
$this->_stop();
}
/**
* Renders the Missing View web page.
*
@ -150,6 +163,7 @@ class ErrorHandler extends Object {
$this->stderr(sprintf(__("Missing View '%s' for '%s' in '%s'", true), $file, $action, $className));
$this->_stop();
}
/**
* Renders the Missing Layout web page.
*
@ -161,6 +175,7 @@ class ErrorHandler extends Object {
$this->stderr(sprintf(__("Missing Layout '%s'", true), $file));
$this->_stop();
}
/**
* Renders the Database Connection web page.
*
@ -172,6 +187,7 @@ class ErrorHandler extends Object {
$this->stderr(__("Missing Database Connection. Try 'cake bake'", true));
$this->_stop();
}
/**
* Renders the Missing Helper file web page.
*
@ -183,6 +199,7 @@ class ErrorHandler extends Object {
$this->stderr(sprintf(__("Missing Helper file '%s' for '%s'", true), $file, Inflector::camelize($helper)));
$this->_stop();
}
/**
* Renders the Missing Helper class web page.
*
@ -194,6 +211,7 @@ class ErrorHandler extends Object {
$this->stderr(sprintf(__("Missing Helper class '%s' in '%s'", true), Inflector::camelize($helper), $file));
$this->_stop();
}
/**
* Renders the Missing Component file web page.
*
@ -205,6 +223,7 @@ class ErrorHandler extends Object {
$this->stderr(sprintf(__("Missing Component file '%s' for '%s'", true), $file, Inflector::camelize($component)));
$this->_stop();
}
/**
* Renders the Missing Component class web page.
*
@ -216,6 +235,7 @@ class ErrorHandler extends Object {
$this->stderr(sprintf(__("Missing Component class '%s' in '%s'", true), Inflector::camelize($component), $file));
$this->_stop();
}
/**
* Renders the Missing Model class web page.
*
@ -227,6 +247,7 @@ class ErrorHandler extends Object {
$this->stderr(sprintf(__("Missing model '%s'", true), $className));
$this->_stop();
}
/**
* Outputs to the stdout filehandle.
*
@ -241,6 +262,7 @@ class ErrorHandler extends Object {
fwrite($this->stdout, $string);
}
}
/**
* Outputs to the stderr filehandle.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -26,6 +27,7 @@
*/
App::import('Component', 'Acl');
App::import('Model', 'DbAcl');
/**
* Shell for ACL management.
*
@ -33,6 +35,7 @@ App::import('Model', 'DbAcl');
* @subpackage cake.cake.console.libs
*/
class AclShell extends Shell {
/**
* Contains instance of AclComponent
*
@ -40,6 +43,7 @@ class AclShell extends Shell {
* @access public
*/
var $Acl;
/**
* Contains arguments parsed from the command line.
*
@ -47,6 +51,7 @@ class AclShell extends Shell {
* @access public
*/
var $args;
/**
* Contains database source to use
*
@ -54,6 +59,7 @@ class AclShell extends Shell {
* @access public
*/
var $dataSource = 'default';
/**
* Contains tasks to load and instantiate
*
@ -61,6 +67,7 @@ class AclShell extends Shell {
* @access public
*/
var $tasks = array('DbConfig');
/**
* Override startup of the Shell
*
@ -101,6 +108,7 @@ class AclShell extends Shell {
}
}
}
/**
* Override main() for help message hook
*
@ -122,6 +130,7 @@ class AclShell extends Shell {
$out .= __("For help, run the 'help' command. For help on a specific command, run 'help <command>'", true);
$this->out($out);
}
/**
* Creates an ARO/ACO node
*
@ -179,6 +188,7 @@ class AclShell extends Shell {
$this->err(sprintf(__("There was a problem creating a new %s '%s'.", true), $class, $this->args[2]));
}
}
/**
* Delete an ARO/ACO node.
*
@ -216,6 +226,7 @@ class AclShell extends Shell {
$this->out(sprintf(__("Node parent set to %s", true), $this->args[2]) . "\n", true);
}
}
/**
* Get path to specified ARO/ACO node.
*
@ -234,6 +245,7 @@ class AclShell extends Shell {
$this->out(str_repeat(' ', $i) . "[" . $nodes[$i][$class]['id'] . "]" . $nodes[$i][$class]['alias'] . "\n");
}
}
/**
* Check permission for a given ARO to a given ACO.
*
@ -249,6 +261,7 @@ class AclShell extends Shell {
$this->out(sprintf(__("%s is not allowed.", true), $aro), true);
}
}
/**
* Grant permission for a given ARO to a given ACO.
*
@ -264,6 +277,7 @@ class AclShell extends Shell {
$this->out(__("Permission was not granted.", true), true);
}
}
/**
* Deny access for an ARO to an ACO.
*
@ -279,6 +293,7 @@ class AclShell extends Shell {
$this->out(__("Permission was not denied.", true), true);
}
}
/**
* Set an ARO to inhermit permission to an ACO.
*
@ -294,6 +309,7 @@ class AclShell extends Shell {
$this->out(__("Permission was not inherited.", true), true);
}
}
/**
* Show a specific ARO/ACO node.
*
@ -345,6 +361,7 @@ class AclShell extends Shell {
}
$this->hr();
}
/**
* Initialize ACL database.
*
@ -354,6 +371,7 @@ class AclShell extends Shell {
$this->Dispatch->args = array('schema', 'run', 'create', 'DbAcl');
$this->Dispatch->dispatch();
}
/**
* Show help screen.
*
@ -431,6 +449,7 @@ class AclShell extends Shell {
$this->out(sprintf(__("Command '%s' not found", true), $this->args[0]));
}
}
/**
* Check that first argument specifies a valid Node type (ARO/ACO)
*
@ -444,6 +463,7 @@ class AclShell extends Shell {
$this->error(sprintf(__("Missing/Unknown node type: '%s'", true), $this->args[1]), __('Please specify which ACL object type you wish to create.', true));
}
}
/**
* Checks that given node exists
*
@ -465,6 +485,7 @@ class AclShell extends Shell {
}
return $possibility;
}
/**
* get params for standard Acl methods
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* API shell to get CakePHP core method signatures.
*
@ -32,6 +33,7 @@
* @subpackage cake.cake.console.libs
*/
class ApiShell extends Shell {
/**
* Map between short name for paths and real paths.
*
@ -39,6 +41,7 @@ class ApiShell extends Shell {
* @access public
*/
var $paths = array();
/**
* Override intialize of the Shell
*
@ -56,6 +59,7 @@ class ApiShell extends Shell {
'core' => LIBS
));
}
/**
* Override main() to handle action
*

View file

@ -22,6 +22,7 @@
* @since CakePHP(tm) v 1.2.0.5012
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Bake is a command-line code generation utility for automating programmer chores.
*
@ -30,6 +31,7 @@
* @link http://book.cakephp.org/view/113/Code-Generation-with-Bake
*/
class BakeShell extends Shell {
/**
* Contains tasks to load and instantiate
*
@ -37,6 +39,7 @@ class BakeShell extends Shell {
* @access public
*/
var $tasks = array('Project', 'DbConfig', 'Model', 'Controller', 'View', 'Plugin', 'Fixture', 'Test');
/**
* Override loadTasks() to handle paths
*
@ -62,6 +65,7 @@ class BakeShell extends Shell {
}
}
}
/**
* Override main() to handle action
*
@ -118,6 +122,7 @@ class BakeShell extends Shell {
$this->hr();
$this->main();
}
/**
* Quickly bake the MVC
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -24,11 +25,13 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* @package cake
* @subpackage cake.cake.console.libs
*/
class ConsoleShell extends Shell {
/**
* Available binding types
*
@ -36,6 +39,7 @@ class ConsoleShell extends Shell {
* @access public
*/
var $associations = array('hasOne', 'hasMany', 'belongsTo', 'hasAndBelongsToMany');
/**
* Chars that describe invalid commands
*
@ -43,6 +47,7 @@ class ConsoleShell extends Shell {
* @access public
*/
var $badCommandChars = array('$', ';');
/**
* Available models
*
@ -50,6 +55,7 @@ class ConsoleShell extends Shell {
* @access public
*/
var $models = array();
/**
* Override intialize of the Shell
*
@ -74,6 +80,7 @@ class ConsoleShell extends Shell {
}
$this->_loadRoutes();
}
/**
* Prints the help message
*
@ -136,6 +143,7 @@ class ConsoleShell extends Shell {
$out .= "\tRoutes show";
$this->out($out);
}
/**
* Override main() to handle action
*
@ -320,6 +328,7 @@ class ConsoleShell extends Shell {
$command = '';
}
}
/**
* Tells if the specified model is included in the list of available models
*
@ -330,6 +339,7 @@ class ConsoleShell extends Shell {
function _isValidModel($modelToCheck) {
return in_array($modelToCheck, $this->models);
}
/**
* Reloads the routes configuration from config/routes.php, and compiles
* all routes found

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Shell for I18N management.
*
@ -31,6 +33,7 @@
* @subpackage cake.cake.console.libs
*/
class I18nShell extends Shell {
/**
* Contains database source to use
*
@ -38,6 +41,7 @@ class I18nShell extends Shell {
* @access public
*/
var $dataSource = 'default';
/**
* Contains tasks to load and instantiate
*
@ -45,6 +49,7 @@ class I18nShell extends Shell {
* @access public
*/
var $tasks = array('DbConfig', 'Extract');
/**
* Override startup of the Shell
*
@ -63,6 +68,7 @@ class I18nShell extends Shell {
}
}
}
/**
* Override main() for help message hook
*
@ -96,6 +102,7 @@ class I18nShell extends Shell {
$this->hr();
$this->main();
}
/**
* Initialize I18N database.
*
@ -105,6 +112,7 @@ class I18nShell extends Shell {
$this->Dispatch->args = array('schema', 'run', 'create', 'i18n');
$this->Dispatch->dispatch();
}
/**
* Show help screen.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Command-line database management utility to automate programmer chores.
*
@ -27,6 +28,7 @@
*/
App::import('File');
App::import('Model', 'CakeSchema');
/**
* Schema is a command-line database management utility for automating programmer chores.
*
@ -35,6 +37,7 @@ App::import('Model', 'CakeSchema');
* @link http://book.cakephp.org/view/734/Schema-management-and-migrations
*/
class SchemaShell extends Shell {
/**
* is this a dry run?
*
@ -42,6 +45,7 @@ class SchemaShell extends Shell {
* @access private
*/
var $__dry = null;
/**
* Override initialize
*
@ -52,6 +56,7 @@ class SchemaShell extends Shell {
$this->out('Cake Schema Shell');
$this->hr();
}
/**
* Override startup
*
@ -85,6 +90,7 @@ class SchemaShell extends Shell {
$this->Schema =& new CakeSchema(compact('name', 'path', 'file', 'connection'));
}
/**
* Override main
*
@ -93,6 +99,7 @@ class SchemaShell extends Shell {
function main() {
$this->help();
}
/**
* Read and output contents of schema object
* path to read as second arg
@ -109,6 +116,7 @@ class SchemaShell extends Shell {
$this->_stop();
}
}
/**
* Read database and Write schema object
* accepts a connection as first arg or path to save as second arg
@ -177,6 +185,7 @@ class SchemaShell extends Shell {
$this->_stop();
}
}
/**
* Dump Schema object to sql file
* if first arg == write, file will be written to sql file
@ -217,6 +226,7 @@ class SchemaShell extends Shell {
$this->out($contents);
return $contents;
}
/**
* Run database commands: create, update
*
@ -275,6 +285,7 @@ class SchemaShell extends Shell {
$this->_stop();
}
}
/**
* Create database from Schema object
* Should be called via the run method
@ -318,6 +329,7 @@ class SchemaShell extends Shell {
$this->out(__('End create.', true));
}
/**
* Update database with Schema object
* Should be called via the run method
@ -356,6 +368,7 @@ class SchemaShell extends Shell {
$this->out(__('End update.', true));
}
/**
* Runs sql from __create() or __update()
*
@ -397,6 +410,7 @@ class SchemaShell extends Shell {
}
}
}
/**
* Displays help contents
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Base class for Shells
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Base class for command-line utilities for automating programmer chores.
*
@ -31,6 +33,7 @@
* @subpackage cake.cake.console.libs
*/
class Shell extends Object {
/**
* An instance of the ShellDispatcher object that loaded this script
*
@ -38,6 +41,7 @@ class Shell extends Object {
* @access public
*/
var $Dispatch = null;
/**
* If true, the script will ask for permission to perform actions.
*
@ -45,6 +49,7 @@ class Shell extends Object {
* @access public
*/
var $interactive = true;
/**
* Holds the DATABASE_CONFIG object for the app. Null if database.php could not be found,
* or the app does not exist.
@ -53,6 +58,7 @@ class Shell extends Object {
* @access public
*/
var $DbConfig = null;
/**
* Contains command switches parsed from the command line.
*
@ -60,6 +66,7 @@ class Shell extends Object {
* @access public
*/
var $params = array();
/**
* Contains arguments parsed from the command line.
*
@ -67,6 +74,7 @@ class Shell extends Object {
* @access public
*/
var $args = array();
/**
* The file name of the shell that was invoked.
*
@ -74,6 +82,7 @@ class Shell extends Object {
* @access public
*/
var $shell = null;
/**
* The class name of the shell that was invoked.
*
@ -81,6 +90,7 @@ class Shell extends Object {
* @access public
*/
var $className = null;
/**
* The command called if public methods are available.
*
@ -88,6 +98,7 @@ class Shell extends Object {
* @access public
*/
var $command = null;
/**
* The name of the shell in camelized.
*
@ -95,6 +106,7 @@ class Shell extends Object {
* @access public
*/
var $name = null;
/**
* An alias for the shell
*
@ -102,6 +114,7 @@ class Shell extends Object {
* @access public
*/
var $alias = null;
/**
* Contains tasks to load and instantiate
*
@ -109,6 +122,7 @@ class Shell extends Object {
* @access public
*/
var $tasks = array();
/**
* Contains the loaded tasks
*
@ -116,6 +130,7 @@ class Shell extends Object {
* @access public
*/
var $taskNames = array();
/**
* Contains models to load and instantiate
*
@ -123,6 +138,7 @@ class Shell extends Object {
* @access public
*/
var $uses = array();
/**
* Constructs this Shell instance.
*
@ -159,6 +175,7 @@ class Shell extends Object {
$this->Dispatch =& $dispatch;
}
/**
* Initializes the Shell
* acts as constructor for subclasses
@ -169,6 +186,7 @@ class Shell extends Object {
function initialize() {
$this->_loadModels();
}
/**
* Starts up the the Shell
* allows for checking and configuring prior to command or main execution
@ -179,6 +197,7 @@ class Shell extends Object {
function startup() {
$this->_welcome();
}
/**
* Displays a header for the shell
*
@ -191,6 +210,7 @@ class Shell extends Object {
$this->out('Path: '. $this->params['working']);
$this->hr();
}
/**
* Loads database file and constructs DATABASE_CONFIG class
* makes $this->DbConfig available to subclasses
@ -207,6 +227,7 @@ class Shell extends Object {
$this->out('Run \'bake\' to create the database configuration');
return false;
}
/**
* if var $uses = true
* Loads AppModel file and constructs AppModel class
@ -251,6 +272,7 @@ class Shell extends Object {
}
return false;
}
/**
* Loads tasks defined in var $tasks
*
@ -304,6 +326,7 @@ class Shell extends Object {
return true;
}
/**
* Prompts the user for input, and returns it.
*
@ -337,6 +360,7 @@ class Shell extends Object {
return $in;
}
}
/**
* Outputs to the stdout filehandle.
*
@ -354,6 +378,7 @@ class Shell extends Object {
}
return $this->Dispatch->stdout($string, $newline);
}
/**
* Outputs to the stderr filehandle.
*
@ -370,6 +395,7 @@ class Shell extends Object {
}
return $this->Dispatch->stderr($string."\n");
}
/**
* Outputs a series of minus characters to the standard output, acts as a visual separator.
*
@ -385,6 +411,7 @@ class Shell extends Object {
$this->out("\n");
}
}
/**
* Displays a formatted error message and exits the application
*
@ -399,6 +426,7 @@ class Shell extends Object {
$this->err($out);
$this->_stop();
}
/**
* Will check the number args matches otherwise throw an error
*
@ -414,6 +442,7 @@ class Shell extends Object {
$this->error("Wrong number of parameters: ".count($this->args), "Expected: {$expectedNum}\nPlease type 'cake {$this->shell} help' for help on usage of the {$this->name} {$command}");
}
}
/**
* Creates a file at given path
*
@ -449,6 +478,7 @@ class Shell extends Object {
return false;
}
}
/**
* Outputs usage text on the standard output. Implement it in subclasses.
*
@ -461,6 +491,7 @@ class Shell extends Object {
$this->Dispatch->help();
}
}
/**
* Action to create a Unit Test
*
@ -479,6 +510,7 @@ class Shell extends Object {
}
return $result;
}
/**
* Makes absolute file path easier to read
*
@ -491,6 +523,7 @@ class Shell extends Object {
$shortPath = str_replace('..'.DS, '', $shortPath);
return r(DS.DS, DS, $shortPath);
}
/**
* Creates the proper controller path for the specified controller class name
*
@ -501,6 +534,7 @@ class Shell extends Object {
function _controllerPath($name) {
return low(Inflector::underscore($name));
}
/**
* Creates the proper controller plural name for the specified controller class name
*
@ -511,6 +545,7 @@ class Shell extends Object {
function _controllerName($name) {
return Inflector::pluralize(Inflector::camelize($name));
}
/**
* Creates the proper controller camelized name (singularized) for the specified name
*
@ -521,6 +556,7 @@ class Shell extends Object {
function _modelName($name) {
return Inflector::camelize(Inflector::singularize($name));
}
/**
* Creates the proper singular model key for associations
*
@ -531,6 +567,7 @@ class Shell extends Object {
function _modelKey($name) {
return Inflector::underscore(Inflector::singularize($name)).'_id';
}
/**
* Creates the proper model name from a foreign key
*
@ -542,6 +579,7 @@ class Shell extends Object {
$name = str_replace('_id', '',$key);
return Inflector::camelize($name);
}
/**
* creates the singular name for use in views.
*
@ -552,6 +590,7 @@ class Shell extends Object {
function _singularName($name) {
return Inflector::variable(Inflector::singularize($name));
}
/**
* Creates the plural name for views
*
@ -562,6 +601,7 @@ class Shell extends Object {
function _pluralName($name) {
return Inflector::variable(Inflector::pluralize($name));
}
/**
* Creates the singular human name used in views
*
@ -572,6 +612,7 @@ class Shell extends Object {
function _singularHumanName($name) {
return Inflector::humanize(Inflector::underscore(Inflector::singularize($name)));
}
/**
* Creates the plural human name used in views
*
@ -582,6 +623,7 @@ class Shell extends Object {
function _pluralHumanName($name) {
return Inflector::humanize(Inflector::underscore(Inflector::pluralize($name)));
}
/**
* Find the correct path for a plugin. Scans $pluginPaths for the plugin you want.
*

View file

@ -20,6 +20,7 @@
* @since CakePHP(tm) v 1.2
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Task class for creating and updating controller files.
*
@ -27,6 +28,7 @@
* @subpackage cake.cake.console.libs.tasks
*/
class ControllerTask extends Shell {
/**
* Name of plugin
*
@ -34,6 +36,7 @@ class ControllerTask extends Shell {
* @access public
*/
var $plugin = null;
/**
* Tasks to be loaded by this Task
*
@ -41,6 +44,7 @@ class ControllerTask extends Shell {
* @access public
*/
var $tasks = array('Model', 'Test', 'Template', 'DbConfig', 'Project');
/**
* path to CONTROLLERS directory
*
@ -48,6 +52,7 @@ class ControllerTask extends Shell {
* @access public
*/
var $path = CONTROLLERS;
/**
* Override initialize
*
@ -55,6 +60,7 @@ class ControllerTask extends Shell {
*/
function initialize() {
}
/**
* Execution method always used for tasks
*
@ -97,6 +103,7 @@ class ControllerTask extends Shell {
}
}
}
/**
* Bake All the controllers at once. Will only bake controllers for models that exist.
*
@ -119,6 +126,7 @@ class ControllerTask extends Shell {
}
}
}
/**
* Interactive
*
@ -202,6 +210,7 @@ class ControllerTask extends Shell {
}
}
}
/**
* Confirm a to be baked controller with the user
*
@ -239,6 +248,7 @@ class ControllerTask extends Shell {
}
$this->hr();
}
/**
* Interact with the user and ask about which methods (admin or regular they want to bake)
*
@ -255,6 +265,7 @@ class ControllerTask extends Shell {
);
return array($wannaBakeCrud, $wannaBakeAdminCrud);
}
/**
* Bake scaffold actions
*
@ -286,6 +297,7 @@ class ControllerTask extends Shell {
$actions = $this->Template->generate('actions', 'controller_actions');
return $actions;
}
/**
* Assembles and writes a Controller file
*
@ -314,6 +326,7 @@ class ControllerTask extends Shell {
}
return false;
}
/**
* Assembles and writes a unit test file
*
@ -326,6 +339,7 @@ class ControllerTask extends Shell {
$this->Test->connection = $this->connection;
return $this->Test->bake('Controller', $className);
}
/**
* Interact with the user and get a list of additional helpers
*
@ -349,6 +363,7 @@ class ControllerTask extends Shell {
__("Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'", true)
);
}
/**
* Common code for property choice handling.
*
@ -366,6 +381,7 @@ class ControllerTask extends Shell {
}
return array_filter($property);
}
/**
* Outputs and gets the list of possible controllers from database
*
@ -392,6 +408,7 @@ class ControllerTask extends Shell {
}
return $this->__tables;
}
/**
* Forces the user to specify the controller he wants to bake, and returns the selected controller name.
*
@ -424,6 +441,7 @@ class ControllerTask extends Shell {
}
return $controllerName;
}
/**
* Displays help contents
*

View file

@ -20,6 +20,7 @@
* @since CakePHP(tm) v 1.2
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Task class for creating and updating the database configuration file.
*
@ -27,6 +28,7 @@
* @subpackage cake.cake.console.libs.tasks
*/
class DbConfigTask extends Shell {
/**
* path to CONFIG directory
*
@ -34,6 +36,7 @@ class DbConfigTask extends Shell {
* @access public
*/
var $path = null;
/**
* Default configuration settings to use
*
@ -45,6 +48,7 @@ class DbConfigTask extends Shell {
'login'=> 'root', 'password'=> 'password', 'database'=> 'project_name',
'schema'=> null, 'prefix'=> null, 'encoding' => null, 'port' => null
);
/**
* String name of the database config class name.
* Used for testing.
@ -52,6 +56,7 @@ class DbConfigTask extends Shell {
* @var string
**/
var $databaseClassName = 'DATABASE_CONFIG';
/**
* initialization callback
*
@ -61,6 +66,7 @@ class DbConfigTask extends Shell {
function initialize() {
$this->path = $this->params['working'] . DS . 'config' . DS;
}
/**
* Execution method always used for tasks
*
@ -72,6 +78,7 @@ class DbConfigTask extends Shell {
$this->_stop();
}
}
/**
* Interactive interface
*
@ -187,6 +194,7 @@ class DbConfigTask extends Shell {
config('database');
return true;
}
/**
* Output verification message and bake if it looks good
*
@ -233,6 +241,7 @@ class DbConfigTask extends Shell {
}
return false;
}
/**
* Assembles and writes database.php
*
@ -337,6 +346,7 @@ class DbConfigTask extends Shell {
$filename = $this->path . 'database.php';
return $this->createFile($filename, $out);
}
/**
* Get a user specified Connection name
*

View file

@ -20,6 +20,7 @@
* @since CakePHP(tm) v 1.2.0.5012
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Only used when -debug option
*/
@ -47,6 +48,7 @@
$categoryEcho = __c('Category string lookup line echo __c()', 5);
ob_end_clean();
/**
* Language string extractor
*
@ -54,6 +56,7 @@
* @subpackage cake.cake.console.libs
*/
class ExtractTask extends Shell{
/**
* Path to use when looking for strings
*
@ -61,6 +64,7 @@ class ExtractTask extends Shell{
* @access public
*/
var $path = null;
/**
* Files from where to extract
*
@ -68,6 +72,7 @@ class ExtractTask extends Shell{
* @access public
*/
var $files = array();
/**
* Filename where to deposit translations
*
@ -75,6 +80,7 @@ class ExtractTask extends Shell{
* @access private
*/
var $__filename = 'default';
/**
* True if all strings should be merged into one file
*
@ -82,6 +88,7 @@ class ExtractTask extends Shell{
* @access private
*/
var $__oneFile = true;
/**
* Current file being processed
*
@ -89,6 +96,7 @@ class ExtractTask extends Shell{
* @access private
*/
var $__file = null;
/**
* Extracted tokens
*
@ -96,6 +104,7 @@ class ExtractTask extends Shell{
* @access private
*/
var $__tokens = array();
/**
* Extracted strings
*
@ -103,6 +112,7 @@ class ExtractTask extends Shell{
* @access private
*/
var $__strings = array();
/**
* History of file versions
*
@ -110,6 +120,7 @@ class ExtractTask extends Shell{
* @access private
*/
var $__fileVersions = array();
/**
* Destination path
*
@ -117,6 +128,7 @@ class ExtractTask extends Shell{
* @access private
*/
var $__output = null;
/**
* Execution method always used for tasks
*
@ -176,6 +188,7 @@ class ExtractTask extends Shell{
}
$this->__extract();
}
/**
* Extract text
*
@ -208,6 +221,7 @@ class ExtractTask extends Shell{
}
$this->__extractTokens();
}
/**
* Show help options
*
@ -233,6 +247,7 @@ class ExtractTask extends Shell{
$this->out(__(' -debug: Perform self test.', true));
$this->out('');
}
/**
* Extract tokens out of all files to be processed
*
@ -277,6 +292,7 @@ class ExtractTask extends Shell{
$this->__writeFiles();
$this->out('Done.');
}
/**
* Will parse __(), __c() functions
*
@ -312,6 +328,7 @@ class ExtractTask extends Shell{
$count++;
}
}
/**
* Will parse __d(), __dc(), __n(), __dn(), __dcn()
*
@ -398,6 +415,7 @@ class ExtractTask extends Shell{
$count++;
}
}
/**
* Build the translate template file contents out of obtained strings
*
@ -460,6 +478,7 @@ class ExtractTask extends Shell{
$this->__store($filename, $output, $fileList);
}
}
/**
* Prepare a file to be stored
*
@ -487,6 +506,7 @@ class ExtractTask extends Shell{
return $storage;
}
}
/**
* Write the files that need to be stored
*
@ -535,6 +555,7 @@ class ExtractTask extends Shell{
fclose($fp);
}
}
/**
* Merge output files
*
@ -561,6 +582,7 @@ class ExtractTask extends Shell{
}
return $output;
}
/**
* Build the translation template header
*
@ -586,6 +608,7 @@ class ExtractTask extends Shell{
$output .= "\"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n\"\n\n";
return $output;
}
/**
* Find the version number of a file looking for SVN commands
*
@ -600,6 +623,7 @@ class ExtractTask extends Shell{
$this->__fileVersions[$file] = $version;
}
}
/**
* Format a string to be added as a translateable string
*
@ -618,6 +642,7 @@ class ExtractTask extends Shell{
$string = str_replace("\r\n", "\n", $string);
return addcslashes($string, "\0..\37\\\"");
}
/**
* Indicate an invalid marker on a processed file
*
@ -650,6 +675,7 @@ class ExtractTask extends Shell{
}
$this->out("\n", true);
}
/**
* Search the specified path for files that may contain translateable strings
*

View file

@ -18,6 +18,7 @@
* @since CakePHP(tm) v 1.3
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Task class for creating and updating fixtures files.
*
@ -25,6 +26,7 @@
* @subpackage cake.cake.console.libs.tasks
*/
class FixtureTask extends Shell {
/**
* Name of plugin
*
@ -32,6 +34,7 @@ class FixtureTask extends Shell {
* @access public
*/
var $plugin = null;
/**
* Tasks to be loaded by this Task
*
@ -39,6 +42,7 @@ class FixtureTask extends Shell {
* @access public
*/
var $tasks = array('DbConfig', 'Model', 'Template');
/**
* path to fixtures directory
*
@ -46,18 +50,21 @@ class FixtureTask extends Shell {
* @access public
*/
var $path = null;
/**
* The db connection being used for baking
*
* @var string
**/
var $connection = null;
/**
* Schema instance
*
* @var object
**/
var $_Schema = null;
/**
* Override initialize
*
@ -70,6 +77,7 @@ class FixtureTask extends Shell {
App::import('Model', 'CakeSchema');
}
}
/**
* Execution method always used for tasks
* Handles dispatching to interactive, named, or all processess.
@ -92,6 +100,7 @@ class FixtureTask extends Shell {
$this->bake($model);
}
}
/**
* Bake All the Fixtures at once. Will only bake fixtures for models that exist.
*
@ -106,6 +115,7 @@ class FixtureTask extends Shell {
$this->bake($model);
}
}
/**
* Interactive baking function
*
@ -126,6 +136,7 @@ class FixtureTask extends Shell {
$importOptions = $this->importOptions($modelName);
$this->bake($modelName, $useTable, $importOptions);
}
/**
* Interacts with the User to setup an array of import options. For a fixture.
*
@ -151,6 +162,7 @@ class FixtureTask extends Shell {
}
return $options;
}
/**
* Assembles and writes a Fixture file
*
@ -209,6 +221,7 @@ class FixtureTask extends Shell {
$out = $this->generateFixtureFile($model, compact('records', 'table', 'schema', 'import', 'fields'));
return $out;
}
/**
* Generate the fixture file, and write to disk
*
@ -235,6 +248,7 @@ class FixtureTask extends Shell {
$this->createFile($path . $filename, $content);
return $content;
}
/**
* Generates a string representation of a schema.
*
@ -265,6 +279,7 @@ class FixtureTask extends Shell {
$out .= "\n\t)";
return $out;
}
/**
* Generate String representation of Records
*
@ -333,6 +348,7 @@ class FixtureTask extends Shell {
}
return $records;
}
/**
* Convert a $records array into a a string.
*
@ -353,6 +369,7 @@ class FixtureTask extends Shell {
$out .= "\t)";
return $out;
}
/**
* Interact with the user to get a custom SQL condition and use that to extract data
* to build a fixture.
@ -385,6 +402,7 @@ class FixtureTask extends Shell {
}
return $out;
}
/**
* Displays help contents
*

View file

@ -21,6 +21,7 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Model', 'ConnectionManager');
/**
* Task class for creating and updating model files.
*
@ -28,6 +29,7 @@ App::import('Model', 'ConnectionManager');
* @subpackage cake.cake.console.libs.tasks
*/
class ModelTask extends Shell {
/**
* Name of plugin
*
@ -35,6 +37,7 @@ class ModelTask extends Shell {
* @access public
*/
var $plugin = null;
/**
* Name of the db connection used.
*
@ -42,6 +45,7 @@ class ModelTask extends Shell {
* @access public
*/
var $connection = null;
/**
* path to MODELS directory
*
@ -49,6 +53,7 @@ class ModelTask extends Shell {
* @access public
*/
var $path = MODELS;
/**
* tasks
*
@ -56,18 +61,21 @@ class ModelTask extends Shell {
* @access public
*/
var $tasks = array('DbConfig', 'Fixture', 'Test', 'Template');
/**
* Holds tables found on connection.
*
* @var array
**/
var $__tables = array();
/**
* Holds validation method map.
*
* @var array
**/
var $__validations = array();
/**
* startup method
*
@ -77,6 +85,7 @@ class ModelTask extends Shell {
App::import('Core', 'Model');
parent::startup();
}
/**
* Execution method always used for tasks
*
@ -105,6 +114,7 @@ class ModelTask extends Shell {
}
}
}
/**
* Bake all models at once.
*
@ -123,6 +133,7 @@ class ModelTask extends Shell {
}
}
}
/**
* Get a model object for a class name.
*
@ -133,6 +144,7 @@ class ModelTask extends Shell {
$object = new Model(array('name' => $className, 'ds' => $this->connection));
return $object;
}
/**
* Generate a key value list of options and a prompt.
*
@ -158,6 +170,7 @@ class ModelTask extends Shell {
}
return $choice - 1;
}
/**
* Handles interactive baking
*
@ -250,6 +263,7 @@ class ModelTask extends Shell {
return false;
}
}
/**
* Print out all the associations of a particular type
*
@ -267,6 +281,7 @@ class ModelTask extends Shell {
}
}
}
/**
* Finds a primary Key in a list of fields.
*
@ -282,6 +297,7 @@ class ModelTask extends Shell {
}
return $this->in(__('What is the primaryKey?', true), null, $name);
}
/**
* interact with the user to find the displayField value for a model.
*
@ -299,6 +315,7 @@ class ModelTask extends Shell {
$choice = $this->inOptions($fieldNames, $prompt);
return $fieldNames[$choice];
}
/**
* Handles Generation and user interaction for creating validation.
*
@ -325,6 +342,7 @@ class ModelTask extends Shell {
}
return $validate;
}
/**
* Populate the __validations array
*
@ -347,6 +365,7 @@ class ModelTask extends Shell {
$this->__validations = $choices;
return $choices;
}
/**
* Does individual field validation handling.
*
@ -420,6 +439,7 @@ class ModelTask extends Shell {
}
return $validate;
}
/**
* Handles associations
*
@ -466,6 +486,7 @@ class ModelTask extends Shell {
}
return $associations;
}
/**
* Find belongsTo relations and add them to the associations list.
*
@ -494,6 +515,7 @@ class ModelTask extends Shell {
}
return $associations;
}
/**
* Find the hasOne and HasMany relations and add them to associations list
*
@ -536,6 +558,7 @@ class ModelTask extends Shell {
}
return $associations;
}
/**
* Find the hasAndBelongsToMany relations and add them to associations list
*
@ -575,6 +598,7 @@ class ModelTask extends Shell {
}
return $associations;
}
/**
* Interact with the user and confirm associations.
*
@ -602,6 +626,7 @@ class ModelTask extends Shell {
}
return $associations;
}
/**
* Interact with the user and generate additional non-conventional associations
*
@ -668,6 +693,7 @@ class ModelTask extends Shell {
}
return $associations;
}
/**
* Finds all possible keys to use on custom associations.
*
@ -686,6 +712,7 @@ class ModelTask extends Shell {
}
return $possible;
}
/**
* Assembles and writes a Model file.
*
@ -724,6 +751,7 @@ class ModelTask extends Shell {
$this->createFile($filename, $out);
return $out;
}
/**
* Assembles and writes a unit test file
*
@ -735,6 +763,7 @@ class ModelTask extends Shell {
$this->Test->connection = $this->connection;
return $this->Test->bake('Model', $className);
}
/**
* outputs the a list of possible models or controllers from database
*
@ -755,6 +784,7 @@ class ModelTask extends Shell {
}
return $this->__tables;
}
/**
* Interact with the user to determine the table name of a particular model
*
@ -781,6 +811,7 @@ class ModelTask extends Shell {
}
return $useTable;
}
/**
* Get an Array of all the tables in the supplied connection
* will halt the script if no tables are found.
@ -810,6 +841,7 @@ class ModelTask extends Shell {
}
return $tables;
}
/**
* Forces the user to specify the model he wants to bake, and returns the selected model name.
*
@ -841,6 +873,7 @@ class ModelTask extends Shell {
}
return $currentModelName;
}
/**
* Displays help contents
*
@ -863,6 +896,7 @@ class ModelTask extends Shell {
$this->out("");
$this->_stop();
}
/**
* Interact with FixtureTask to automatically bake fixtures when baking models.
*

View file

@ -28,11 +28,13 @@
* @subpackage cake.cake.console.libs.tasks
*/
class PluginTask extends Shell {
/**
* Tasks
*
*/
var $tasks = array('Model', 'Controller', 'View');
/**
* path to CONTROLLERS directory
*
@ -40,6 +42,7 @@ class PluginTask extends Shell {
* @access public
*/
var $path = null;
/**
* initialize
*
@ -48,6 +51,7 @@ class PluginTask extends Shell {
function initialize() {
$this->path = APP . 'plugins' . DS;
}
/**
* Execution method always used for tasks
*
@ -94,6 +98,7 @@ class PluginTask extends Shell {
}
}
}
/**
* Interactive interface
*
@ -109,6 +114,7 @@ class PluginTask extends Shell {
$this->err(sprintf(__("An error occured trying to bake: %s in %s", true), $plugin, $this->path . $pluginPath));
}
}
/**
* Bake the plugin, create directories and files
*
@ -193,6 +199,7 @@ class PluginTask extends Shell {
return true;
}
/**
* find and change $this->path to the user selection
*
@ -213,6 +220,7 @@ class PluginTask extends Shell {
}
$this->path = $pathOptions[$choice - 1];
}
/**
* Help
*

View file

@ -19,6 +19,7 @@
* @since CakePHP(tm) v 1.2
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Task class for creating new project apps and plugins
*
@ -26,12 +27,14 @@
* @subpackage cake.cake.console.libs.tasks
*/
class ProjectTask extends Shell {
/**
* configs path (used in testing).
*
* @var string
**/
var $configPath = null;
/**
* Checks that given project path does not already exist, and
* finds the app directory in it. Then it calls bake() with that information.
@ -106,6 +109,7 @@ class ProjectTask extends Shell {
return true;
}
}
/**
* Looks for a skeleton template of a Cake application,
* and if not found asks the user for a path. When there is a path
@ -169,6 +173,7 @@ class ProjectTask extends Shell {
return false;
}
}
/**
* Writes a file with a default home page to the project.
*
@ -182,6 +187,7 @@ class ProjectTask extends Shell {
include(CAKE_CORE_INCLUDE_PATH.DS.'cake'.DS.'console'.DS.'libs'.DS.'templates'.DS.'default'.DS.'views'.DS.'home.ctp');
return $this->createFile($path.'home.ctp', $output);
}
/**
* Generates and writes 'Security.salt'
*
@ -205,6 +211,7 @@ class ProjectTask extends Shell {
}
return false;
}
/**
* Generates and writes CAKE_CORE_INCLUDE_PATH
*
@ -238,6 +245,7 @@ class ProjectTask extends Shell {
return true;
}
}
/**
* Enables Configure::read('Routing.admin') in /app/config/core.php
*
@ -261,6 +269,7 @@ class ProjectTask extends Shell {
return false;
}
}
/**
* Checks for Configure::read('Routing.admin') and forces user to input it if not enabled
*
@ -287,6 +296,7 @@ class ProjectTask extends Shell {
}
return $admin . '_';
}
/**
* Help
*

View file

@ -18,12 +18,14 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
class TemplateTask extends Shell {
/**
* variables to add to template scope
*
* @var array
**/
var $templateVars = array();
/**
* Paths to look for templates on.
* Contains a list of $theme => $path
@ -31,6 +33,7 @@ class TemplateTask extends Shell {
* @var array
**/
var $templatePaths = array();
/**
* Initialize callback. Setup paths for the template task.
*
@ -40,6 +43,7 @@ class TemplateTask extends Shell {
function initialize() {
$this->templatePaths = $this->_findThemes();
}
/**
* Find the paths to all the installed shell themes in the app.
*
@ -64,6 +68,7 @@ class TemplateTask extends Shell {
}
return $themes;
}
/**
* Set variable values to the template scope
*
@ -92,6 +97,7 @@ class TemplateTask extends Shell {
$this->templateVars[$name] = $value;
}
}
/**
* Runs the template
*
@ -120,6 +126,7 @@ class TemplateTask extends Shell {
}
return '';
}
/**
* Find the theme name for the current operation.
* If there is only one theme in $templatePaths it will be used.
@ -154,6 +161,7 @@ class TemplateTask extends Shell {
$this->Dispatch->params['theme'] = $themeNames[$index - 1];
return $indexedPaths[$index];
}
/**
* Find a template inside a directory inside a path.
* Will scan all other theme dirs if the template is not found in the first directory.

View file

@ -18,6 +18,7 @@
* @since CakePHP(tm) v 1.3
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Task class for creating and updating test files.
*
@ -25,6 +26,7 @@
* @subpackage cake.cake.console.libs.tasks
*/
class TestTask extends Shell {
/**
* Name of plugin
*
@ -32,6 +34,7 @@ class TestTask extends Shell {
* @access public
*/
var $plugin = null;
/**
* path to TESTS directory
*
@ -46,24 +49,28 @@ class TestTask extends Shell {
* @var array
**/
var $tasks = array('Template');
/**
* class types that methods can be generated for
*
* @var array
**/
var $classTypes = array('Model', 'Controller', 'Component', 'Behavior', 'Helper');
/**
* Internal list of fixtures that have been added so far.
*
* @var string
**/
var $_fixtures = array();
/**
* Flag for interactive mode
*
* @var boolean
**/
var $interactive = false;
/**
* Execution method always used for tasks
*
@ -85,6 +92,7 @@ class TestTask extends Shell {
}
}
}
/**
* Handles interactive baking
*
@ -110,6 +118,7 @@ class TestTask extends Shell {
$className = $this->getClassName($type);
return $this->bake($type, $className);
}
/**
* Completes final steps for generating data to create test case.
*
@ -151,6 +160,7 @@ class TestTask extends Shell {
}
return false;
}
/**
* Interact with the user and get their chosen type. Can exit the script.
*
@ -173,6 +183,7 @@ class TestTask extends Shell {
}
return $this->classTypes[$selection - 1];
}
/**
* Get the user chosen Class name for the chosen type
*
@ -193,6 +204,7 @@ class TestTask extends Shell {
}
return $selection;
}
/**
* Checks whether the chosen type can find its own fixtures.
* Currently only model, and controller are supported
@ -203,6 +215,7 @@ class TestTask extends Shell {
$type = strtolower($type);
return ($type == 'controller' || $type == 'model');
}
/**
* Check if a class with the given type is loaded or can be loaded.
*
@ -211,6 +224,7 @@ class TestTask extends Shell {
function isLoadableClass($type, $class) {
return App::import($type, $class);
}
/**
* Construct an instance of the class to be tested.
* So that fixtures can be detected
@ -228,6 +242,7 @@ class TestTask extends Shell {
}
return $instance;
}
/**
* Gets the real class name from the cake short form.
*
@ -239,6 +254,7 @@ class TestTask extends Shell {
}
return $class . $type;
}
/**
* Get methods declared in the class given.
* No parent methods will be returned
@ -258,6 +274,7 @@ class TestTask extends Shell {
}
return $out;
}
/**
* Generate the list of fixtures that will be required to run this test based on
* loaded models.
@ -274,6 +291,7 @@ class TestTask extends Shell {
}
return array_values($this->_fixtures);
}
/**
* Process a model recursively and pull out all the
* model names converting them to fixture names.
@ -297,6 +315,7 @@ class TestTask extends Shell {
}
}
}
/**
* Process all the models attached to a controller
* and generate a fixture list.
@ -314,6 +333,7 @@ class TestTask extends Shell {
$this->_processModel($subject->{$model});
}
}
/**
* Add classname to the fixture list.
* Sets the app. or plugin.plugin_name. prefix.
@ -331,6 +351,7 @@ class TestTask extends Shell {
$fixture = $prefix . Inflector::underscore($name);
$this->_fixtures[$name] = $fixture;
}
/**
* Interact with the user to get additional fixtures they want to use.
*
@ -347,6 +368,7 @@ class TestTask extends Shell {
$this->_fixtures = array_merge($this->_fixtures, $fixtures);
return $fixtures;
}
/**
* Is a mock class required for this type of test?
* Controllers require a mock class.
@ -357,6 +379,7 @@ class TestTask extends Shell {
$type = strtolower($type);
return $type == 'controller';
}
/**
* Generate a constructor code snippet for the type and classname
*
@ -372,6 +395,7 @@ class TestTask extends Shell {
}
return "new $fullClassName()\n";
}
/**
* make the filename for the test case. resolve the suffixes for controllers
* and get the plugin path if needed.

View file

@ -21,6 +21,7 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', 'Controller');
/**
* Task class for creating and updating view files.
*
@ -28,6 +29,7 @@ App::import('Core', 'Controller');
* @subpackage cake.cake.console.libs.tasks
*/
class ViewTask extends Shell {
/**
* Name of plugin
*
@ -35,6 +37,7 @@ class ViewTask extends Shell {
* @access public
*/
var $plugin = null;
/**
* Tasks to be loaded by this Task
*
@ -42,6 +45,7 @@ class ViewTask extends Shell {
* @access public
*/
var $tasks = array('Project', 'Controller', 'DbConfig', 'Template');
/**
* path to VIEWS directory
*
@ -49,6 +53,7 @@ class ViewTask extends Shell {
* @access public
*/
var $path = VIEWS;
/**
* Name of the controller being used
*
@ -56,6 +61,7 @@ class ViewTask extends Shell {
* @access public
*/
var $controllerName = null;
/**
* Path to controller to put views
*
@ -63,6 +69,7 @@ class ViewTask extends Shell {
* @access public
*/
var $controllerPath = null;
/**
* The template file to use
*
@ -70,6 +77,7 @@ class ViewTask extends Shell {
* @access public
*/
var $template = null;
/**
* Actions to use for scaffolding
*
@ -77,6 +85,7 @@ class ViewTask extends Shell {
* @access public
*/
var $scaffoldActions = array('index', 'view', 'add', 'edit');
/**
* Override initialize
*
@ -84,6 +93,7 @@ class ViewTask extends Shell {
*/
function initialize() {
}
/**
* Execution method always used for tasks
*
@ -153,6 +163,7 @@ class ViewTask extends Shell {
}
}
}
/**
* Get a list of actions that can / should have views baked for them.
*
@ -177,6 +188,7 @@ class ViewTask extends Shell {
}
return $methods;
}
/**
* Bake All views for All controllers.
*
@ -197,6 +209,7 @@ class ViewTask extends Shell {
}
}
}
/**
* Handles interactive baking
*
@ -250,6 +263,7 @@ class ViewTask extends Shell {
$this->customAction();
}
}
/**
* Loads Controller and sets variables for the template
* Available template variables
@ -306,6 +320,7 @@ class ViewTask extends Shell {
return compact('modelClass', 'schema', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
'singularHumanName', 'pluralHumanName', 'fields','associations');
}
/**
* Bake a view file for each of the supplied actions
*
@ -318,6 +333,7 @@ class ViewTask extends Shell {
$this->bake($action, $content);
}
}
/**
* handle creation of baking a custom action view file
*
@ -347,6 +363,7 @@ class ViewTask extends Shell {
$this->out(__('Bake Aborted.', true));
}
}
/**
* Assembles and writes bakes the view file.
*
@ -366,6 +383,7 @@ class ViewTask extends Shell {
$filename = $path . $this->controllerPath . DS . Inflector::underscore($action) . '.ctp';
return $this->createFile($filename, $content);
}
/**
* Builds content from template and variables
*
@ -404,6 +422,7 @@ class ViewTask extends Shell {
$this->err(sprintf(__('Template for %s could not be found', true), $template));
return false;
}
/**
* Displays help contents
*
@ -435,6 +454,7 @@ class ViewTask extends Shell {
$this->out("\tRequires that models and controllers exist.");
$this->_stop();
}
/**
* Returns associations for controllers models.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
*
* PHP versions 4 and 5

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
*
* PHP versions 4 and 5

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
*
* PHP versions 4 and 5

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -25,6 +26,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Short description for class.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -26,6 +27,7 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', 'Helper');
/**
* This is a placeholder class.
* Create the same file in app/app_helper.php

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
*
* This file is loaded automatically by the app/webroot/index.php file after the core bootstrap.php is loaded
@ -31,6 +33,7 @@
* You can also use this to include or require any files in your application.
*
*/
/**
* The settings below can be used to set additional paths to models, views and controllers.
* This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* This is core configuration file.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* CakePHP Debug Level:
*
@ -39,10 +41,12 @@
* In development mode, you need to click the flash message to continue.
*/
Configure::write('debug', 2);
/**
* Application wide charset encoding
*/
Configure::write('App.encoding', 'UTF-8');
/**
* To configure CakePHP *not* to use mod_rewrite and to
* use CakePHP pretty URLs, remove these .htaccess
@ -55,6 +59,7 @@
* And uncomment the App.baseUrl below:
*/
//Configure::write('App.baseUrl', env('SCRIPT_NAME'));
/**
* Uncomment the define below to use CakePHP admin routes.
*
@ -71,6 +76,7 @@
*
*/
//Configure::write('Cache.disable', true);
/**
* Enable cache checking.
*
@ -81,11 +87,13 @@
*
*/
//Configure::write('Cache.check', true);
/**
* Defines the default error type when using the log() function. Used for
* differentiating error logging and debugging. Currently PHP supports LOG_DEBUG.
*/
define('LOG_ERROR', 2);
/**
* The preferred session handling method. Valid values:
*
@ -100,6 +108,7 @@
*
*/
Configure::write('Session.save', 'php');
/**
* The name of the table used to store CakePHP database sessions.
*
@ -108,30 +117,36 @@
* The table name set here should *not* include any table prefix defined elsewhere.
*/
//Configure::write('Session.table', 'cake_sessions');
/**
* The DATABASE_CONFIG::$var to use for database session handling.
*
* 'Session.save' must be set to 'database' in order to utilize this constant.
*/
//Configure::write('Session.database', 'default');
/**
* The name of CakePHP's session cookie.
*/
Configure::write('Session.cookie', 'CAKEPHP');
/**
* Session time out time (in seconds).
* Actual value depends on 'Security.level' setting.
*/
Configure::write('Session.timeout', '120');
/**
* If set to false, sessions are not automatically started.
*/
Configure::write('Session.start', true);
/**
* When set to false, HTTP_USER_AGENT will not be checked
* in the session
*/
Configure::write('Session.checkAgent', true);
/**
* The level of CakePHP security. The session timeout time defined
* in 'Session.timeout' is multiplied according to the settings here.
@ -145,10 +160,12 @@
* 'Security.level' is set to 'high'.
*/
Configure::write('Security.level', 'high');
/**
* A random string used in security hashing methods.
*/
Configure::write('Security.salt', 'DYhG93b0qyJfIxfs2guVoUubWwvniR2G0FgaC9mi');
/**
* Compress CSS output by removing comments, whitespace, repeating tags, etc.
* This requires a/var/cache directory to be writable by the web server for caching.
@ -157,6 +174,7 @@
* To use, prefix the CSS link URL with '/ccss/' instead of '/css/' or use HtmlHelper::css().
*/
//Configure::write('Asset.filter.css', 'css.php');
/**
* Plug in your own custom JavaScript compressor by dropping a script in your webroot to handle the
* output, and setting the config below to the name of the script.
@ -164,12 +182,14 @@
* To use, prefix your JavaScript link URLs with '/cjs/' instead of '/js/' or use JavaScriptHelper::link().
*/
//Configure::write('Asset.filter.js', 'custom_javascript_output_filter.php');
/**
* The classname and database used in CakePHP's
* access control lists.
*/
Configure::write('Acl.classname', 'DbAcl');
Configure::write('Acl.database', 'default');
/**
*
* Cache Engine Configuration

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Custom Inflected Words.
*
@ -25,6 +26,7 @@
* @lastmodified $Date$
* @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.
@ -32,6 +34,7 @@
* $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
@ -39,6 +42,7 @@
* $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.
@ -46,6 +50,7 @@
* $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.
@ -53,12 +58,14 @@
* $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

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -26,12 +27,14 @@
* @lastmodified $Date$
* @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.ctp)...
*/
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/**
* ...and connect the rest of 'Pages' controller's urls.
*/

View file

@ -1,6 +1,8 @@
<?php
/* SVN FILE: $Id$ */
/*DbAcl schema generated on: 2007-11-24 15:11:13 : 1195945453*/
/**
* This is Acl Schema file
*
@ -25,6 +27,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/*
*
* Using the Schema command line utility

View file

@ -1,6 +1,8 @@
<?php
/* SVN FILE: $Id$ */
/*i18n schema generated on: 2007-11-25 07:11:25 : 1196004805*/
/**
* This is i18n Schema file
*
@ -25,6 +27,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/*
*
* Using the Schema command line utility

View file

@ -1,6 +1,8 @@
<?php
/* SVN FILE: $Id$ */
/*Sessions schema generated on: 2007-11-25 07:11:54 : 1196004714*/
/**
* This is Sessions Schema file
*
@ -25,6 +27,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/*
*
* Using the Schema command line utility

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Static content controller.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Static content controller
*
@ -33,6 +35,7 @@
* @subpackage cake.cake.libs.controller
*/
class PagesController extends AppController {
/**
* Controller name
*
@ -40,6 +43,7 @@ class PagesController extends AppController {
* @access public
*/
var $name = 'Pages';
/**
* Default helper
*
@ -47,6 +51,7 @@ class PagesController extends AppController {
* @access public
*/
var $helpers = array('Html');
/**
* This controller does not use a model
*
@ -54,6 +59,7 @@ class PagesController extends AppController {
* @access public
*/
var $uses = array();
/**
* Displays a view
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* PHP versions 4 and 5
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
*
* PHP versions 4 and 5

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
*
* PHP versions 4 and 5

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
*
* PHP versions 4 and 5

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
*
* PHP versions 4 and 5

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
*
* PHP versions 4 and 5

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
*
* PHP versions 4 and 5
@ -26,4 +27,3 @@
<?php echo $content_for_layout;?>
This email was sent using the CakePHP Framework, http://cakephp.org.

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
*
* PHP versions 4 and 5

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -28,12 +29,14 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) {
header('HTTP/1.1 404 Not Found');
exit('File Not Found');
}
/**
* Enter description here...
*/
if (!class_exists('File')) {
uses('file');
}
/**
* Enter description here...
*
@ -50,6 +53,7 @@ if (!class_exists('File')) {
$output = " /* file: $name, ratio: $ratio% */ " . $output;
return $output;
}
/**
* Enter description here...
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -24,12 +25,14 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Use the DS to separate the directories in other defines
*/
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.
@ -43,6 +46,7 @@
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))));
}
/**
* The actual directory name for the "app".
*
@ -50,6 +54,7 @@
if (!defined('APP_DIR')) {
define('APP_DIR', basename(dirname(dirname(__FILE__))));
}
/**
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -25,6 +26,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Enter description here...
*/

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -28,12 +29,14 @@ error_reporting(E_ALL);
set_time_limit(0);
ini_set('memory_limit','128M');
ini_set('display_errors', 1);
/**
* Use the DS to separate the directories in other defines
*/
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.
@ -47,6 +50,7 @@ ini_set('display_errors', 1);
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))));
}
/**
* The actual directory name for the "app".
*
@ -54,6 +58,7 @@ ini_set('display_errors', 1);
if (!defined('APP_DIR')) {
define('APP_DIR', basename(dirname(dirname(__FILE__))));
}
/**
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
*
@ -105,6 +110,7 @@ if (!isset($_SERVER['SERVER_NAME'])) {
if (empty( $_GET['output'])) {
$_GET['output'] = 'html';
}
/**
*
* Used to determine output to display

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Test Suite Shell
*
@ -25,6 +26,7 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
class TestSuiteShell extends Shell {
/**
* The test category, "app", "core" or the name of a plugin
*
@ -32,6 +34,7 @@ class TestSuiteShell extends Shell {
* @access public
*/
var $category = '';
/**
* "group", "case" or "all"
*
@ -39,6 +42,7 @@ class TestSuiteShell extends Shell {
* @access public
*/
var $type = '';
/**
* Path to the test case/group file
*
@ -46,6 +50,7 @@ class TestSuiteShell extends Shell {
* @access public
*/
var $file = '';
/**
* Storage for plugins that have tests
*
@ -53,6 +58,7 @@ class TestSuiteShell extends Shell {
* @access public
*/
var $plugins = array();
/**
* Convenience variable to avoid duplicated code
*
@ -60,6 +66,7 @@ class TestSuiteShell extends Shell {
* @access public
*/
var $isPluginTest = false;
/**
* Stores if the user wishes to get a code coverage analysis report
*
@ -67,6 +74,7 @@ class TestSuiteShell extends Shell {
* @access public
*/
var $doCoverage = false;
/**
* The headline for the test output
*
@ -74,6 +82,7 @@ class TestSuiteShell extends Shell {
* @access public
*/
var $headline = 'CakePHP Test Shell';
/**
* Initialization method installs Simpletest and loads all plugins
*
@ -98,6 +107,7 @@ class TestSuiteShell extends Shell {
$this->plugins[] = Inflector::underscore($p);
}
}
/**
* Main entry point to this shell
*
@ -147,6 +157,7 @@ class TestSuiteShell extends Shell {
exit(1);
}
}
/**
* Help screen
*
@ -184,6 +195,7 @@ class TestSuiteShell extends Shell {
$this->out('Code Coverage Analysis: ');
$this->out("\n\nAppend 'cov' to any of the above in order to enable code coverage analysis");
}
/**
* Checks if the arguments supplied point to a valid test file and thus the shell can be run.
*
@ -237,6 +249,7 @@ class TestSuiteShell extends Shell {
$this->err($this->category.' '.$this->type.' '.$this->file.' is an invalid test identifier');
return false;
}
/**
* Executes the tests depending on our settings
*
@ -298,6 +311,7 @@ class TestSuiteShell extends Shell {
return $result;
}
/**
* Finds the correct folder to look for tests for based on the input category
*
@ -326,6 +340,7 @@ class TestSuiteShell extends Shell {
}
return $folder;
}
/**
* Sets some get vars needed for TestManager
*
@ -344,6 +359,7 @@ class TestSuiteShell extends Shell {
$_GET['group'] = true;
}
}
/**
* tries to install simpletest and exits gracefully if it is not there
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Dispatcher takes the URL information, parses it for paramters and
* tells the involved controllers what to do.
@ -25,10 +26,12 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* List of helpers to include
*/
App::import('Core', array('Router', 'Controller'));
/**
* Dispatcher translates URLs to controller-action-paramter triads.
*
@ -38,6 +41,7 @@ App::import('Core', array('Router', 'Controller'));
* @subpackage cake.cake
*/
class Dispatcher extends Object {
/**
* Base URL
*
@ -45,6 +49,7 @@ class Dispatcher extends Object {
* @access public
*/
var $base = false;
/**
* webroot path
*
@ -52,6 +57,7 @@ class Dispatcher extends Object {
* @access public
*/
var $webroot = '/';
/**
* Current URL
*
@ -59,6 +65,7 @@ class Dispatcher extends Object {
* @access public
*/
var $here = false;
/**
* Admin route (if on it)
*
@ -66,6 +73,7 @@ class Dispatcher extends Object {
* @access public
*/
var $admin = false;
/**
* Plugin being served (if any)
*
@ -73,6 +81,7 @@ class Dispatcher extends Object {
* @access public
*/
var $plugin = null;
/**
* the params for this request
*
@ -80,6 +89,7 @@ class Dispatcher extends Object {
* @access public
*/
var $params = null;
/**
* Constructor.
*/
@ -91,6 +101,7 @@ class Dispatcher extends Object {
return $this->dispatch($url);
}
}
/**
* Dispatches and invokes given URL, handing over control to the involved controllers, and then renders the results (if autoRender is set).
*
@ -193,6 +204,7 @@ class Dispatcher extends Object {
}
return $this->_invoke($controller, $this->params);
}
/**
* Invokes given controller's render action if autoRender option is set. Otherwise the
* contents of the operation are returned as a string.
@ -239,6 +251,7 @@ class Dispatcher extends Object {
}
echo($controller->output);
}
/**
* Sets the params when $url is passed as an array to Object::requestAction();
*
@ -252,6 +265,7 @@ class Dispatcher extends Object {
$this->params = array_merge($defaults, $url, $additionalParams);
return Router::url($url);
}
/**
* Returns array of GET and POST parameters. GET parameters are taken from given URL.
*
@ -325,6 +339,7 @@ class Dispatcher extends Object {
}
return $params;
}
/**
* Returns a base URL and sets the proper webroot
*
@ -382,6 +397,7 @@ class Dispatcher extends Object {
}
return false;
}
/**
* Restructure params in case we're serving a plugin.
*
@ -412,6 +428,7 @@ class Dispatcher extends Object {
}
return $params;
}
/**
* Get controller to use, either plugin controller or application controller
*
@ -454,6 +471,7 @@ class Dispatcher extends Object {
}
return $controller;
}
/**
* Load controller and return controller class
*
@ -481,6 +499,7 @@ class Dispatcher extends Object {
}
return false;
}
/**
* Returns the REQUEST_URI from the server environment, or, failing that,
* constructs a new one, using the PHP_SELF constant and other variables.
@ -526,6 +545,7 @@ class Dispatcher extends Object {
}
return str_replace('//', '/', '/' . $uri);
}
/**
* Returns and sets the $_GET[url] derived from the REQUEST_URI
*
@ -576,6 +596,7 @@ class Dispatcher extends Object {
}
return $url;
}
/**
* Outputs cached dispatch for js, css, img, view cache
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Caching for CakePHP.
*
@ -23,6 +24,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Caching for CakePHP.
*
@ -30,6 +32,7 @@
* @subpackage cake.cake.libs
*/
class Cache extends Object {
/**
* Cache engine to use
*
@ -37,6 +40,7 @@ class Cache extends Object {
* @access protected
*/
var $_Engine = null;
/**
* Cache configuration stack
*
@ -44,6 +48,7 @@ class Cache extends Object {
* @access private
*/
var $__config = array();
/**
* Holds name of the current configuration being used
*
@ -51,6 +56,7 @@ class Cache extends Object {
* @access private
*/
var $__name = 'default';
/**
* whether to reset the settings with the next call to self::set();
*
@ -58,6 +64,7 @@ class Cache extends Object {
* @access private
*/
var $__reset = false;
/**
* Returns a singleton instance
*
@ -72,6 +79,7 @@ class Cache extends Object {
}
return $instance[0];
}
/**
* Tries to find and include a file for a cache engine and returns object instance
*
@ -85,6 +93,7 @@ class Cache extends Object {
}
return true;
}
/**
* Set the cache configuration to use
*
@ -132,6 +141,7 @@ class Cache extends Object {
}
return compact('engine', 'settings');
}
/**
* Set the cache engine to use or modify settings for one instance
*
@ -160,6 +170,7 @@ class Cache extends Object {
$_this->_Engine[$name] = null;
return false;
}
/**
* Temporarily change settings to current config options. if no params are passed, resets settings if needed
* Cache::write() will reset the configuration changes made
@ -197,6 +208,7 @@ class Cache extends Object {
return $_this->settings($engine);
}
/**
* Garbage collection
*
@ -211,6 +223,7 @@ class Cache extends Object {
$config = $_this->config();
$_this->_Engine[$config['engine']]->gc();
}
/**
* Write data for key into cache
*
@ -261,6 +274,7 @@ class Cache extends Object {
$settings = $_this->set();
return $success;
}
/**
* Read a key from the cache
*
@ -297,6 +311,7 @@ class Cache extends Object {
}
return $success;
}
/**
* Delete a key from the cache
*
@ -331,6 +346,7 @@ class Cache extends Object {
$settings = $_this->set();
return $success;
}
/**
* Delete all keys from the cache
*
@ -360,6 +376,7 @@ class Cache extends Object {
$settings = $_this->set();
return $success;
}
/**
* Check if Cache has initialized a working storage engine
*
@ -400,6 +417,7 @@ class Cache extends Object {
return array();
}
}
/**
* Storage engine for CakePHP caching
*
@ -407,6 +425,7 @@ class Cache extends Object {
* @subpackage cake.cake.libs
*/
class CacheEngine extends Object {
/**
* settings of current engine instance
*
@ -414,6 +433,7 @@ class CacheEngine extends Object {
* @access public
*/
var $settings = array();
/**
* Iitialize the cache engine
*
@ -430,6 +450,7 @@ class CacheEngine extends Object {
}
return true;
}
/**
* Garbage collection
*
@ -439,6 +460,7 @@ class CacheEngine extends Object {
*/
function gc() {
}
/**
* Write value for a key into cache
*
@ -451,6 +473,7 @@ class CacheEngine extends Object {
function write($key, &$value, $duration) {
trigger_error(sprintf(__('Method write() not implemented in %s', true), get_class($this)), E_USER_ERROR);
}
/**
* Read a key from the cache
*
@ -461,6 +484,7 @@ class CacheEngine extends Object {
function read($key) {
trigger_error(sprintf(__('Method read() not implemented in %s', true), get_class($this)), E_USER_ERROR);
}
/**
* Delete a key from the cache
*
@ -470,6 +494,7 @@ class CacheEngine extends Object {
*/
function delete($key) {
}
/**
* Delete all keys from the cache
*
@ -479,6 +504,7 @@ class CacheEngine extends Object {
*/
function clear($check) {
}
/**
* Cache Engine settings
*
@ -488,6 +514,7 @@ class CacheEngine extends Object {
function settings() {
return $this->settings;
}
/**
* generates a safe key
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* APC storage engine for cache.
*
@ -23,6 +24,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* APC storage engine for cache
*
@ -30,6 +32,7 @@
* @subpackage cake.cake.libs.cache
*/
class ApcEngine extends CacheEngine {
/**
* Initialize the Cache Engine
*
@ -45,6 +48,7 @@ class ApcEngine extends CacheEngine {
parent::init(array_merge(array('engine' => 'Apc', 'prefix' => Inflector::slug(APP_DIR) . '_'), $settings));
return function_exists('apc_cache_info');
}
/**
* Write data for key into cache
*
@ -59,6 +63,7 @@ class ApcEngine extends CacheEngine {
apc_store($key.'_expires', $expires, $duration);
return apc_store($key, $value, $duration);
}
/**
* Read a key from the cache
*
@ -74,6 +79,7 @@ class ApcEngine extends CacheEngine {
}
return apc_fetch($key);
}
/**
* Delete a key from the cache
*
@ -84,6 +90,7 @@ class ApcEngine extends CacheEngine {
function delete($key) {
return apc_delete($key);
}
/**
* Delete all keys from the cache
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* File Storage engine for cache
*
@ -23,6 +24,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* File Storage engine for cache
*
@ -31,6 +33,7 @@
* @subpackage cake.cake.libs.cache
*/
class FileEngine extends CacheEngine {
/**
* Instance of File class
*
@ -38,6 +41,7 @@ class FileEngine extends CacheEngine {
* @access private
*/
var $__File = null;
/**
* settings
* path = absolute path to cache directory, default => CACHE
@ -50,6 +54,7 @@ class FileEngine extends CacheEngine {
* @access public
*/
var $settings = array();
/**
* Set to true if FileEngine::init(); and FileEngine::__active(); do not fail.
*
@ -57,6 +62,7 @@ class FileEngine extends CacheEngine {
* @access private
*/
var $__active = false;
/**
* True unless FileEngine::__active(); fails
*
@ -64,6 +70,7 @@ class FileEngine extends CacheEngine {
* @access private
*/
var $__init = true;
/**
* Initialize the Cache Engine
*
@ -99,6 +106,7 @@ class FileEngine extends CacheEngine {
}
return $this->__active();
}
/**
* Garbage collection. Permanently remove all expired and deleted data
*
@ -108,6 +116,7 @@ class FileEngine extends CacheEngine {
function gc() {
return $this->clear(true);
}
/**
* Write data for key into cache
*
@ -149,6 +158,7 @@ class FileEngine extends CacheEngine {
$this->__File->close();
return $success;
}
/**
* Read a key from the cache
*
@ -181,6 +191,7 @@ class FileEngine extends CacheEngine {
$this->__File->close();
return $data;
}
/**
* Delete a key from the cache
*
@ -194,6 +205,7 @@ class FileEngine extends CacheEngine {
}
return $this->__File->delete();
}
/**
* Delete all values from the cache
*
@ -233,6 +245,7 @@ class FileEngine extends CacheEngine {
$dir->close();
return true;
}
/**
* Get absolute file for a given key
*
@ -250,6 +263,7 @@ class FileEngine extends CacheEngine {
return false;
}
}
/**
* Determine is cache directory is writable
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Memcache storage engine for cache
*
@ -23,6 +24,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Memcache storage engine for cache
*
@ -30,6 +32,7 @@
* @subpackage cake.cake.libs.cache
*/
class MemcacheEngine extends CacheEngine {
/**
* Memcache wrapper.
*
@ -37,6 +40,7 @@ class MemcacheEngine extends CacheEngine {
* @access private
*/
var $__Memcache = null;
/**
* settings
* servers = string or array of memcache servers, default => 127.0.0.1
@ -46,6 +50,7 @@ class MemcacheEngine extends CacheEngine {
* @access public
*/
var $settings = array();
/**
* Initialize the Cache Engine
*
@ -89,6 +94,7 @@ class MemcacheEngine extends CacheEngine {
}
return true;
}
/**
* Write data for key into cache
*
@ -103,6 +109,7 @@ class MemcacheEngine extends CacheEngine {
$this->__Memcache->set($key.'_expires', $expires, $this->settings['compress'], $expires);
return $this->__Memcache->set($key, $value, $this->settings['compress'], $expires);
}
/**
* Read a key from the cache
*
@ -118,6 +125,7 @@ class MemcacheEngine extends CacheEngine {
}
return $this->__Memcache->get($key);
}
/**
* Delete a key from the cache
*
@ -128,6 +136,7 @@ class MemcacheEngine extends CacheEngine {
function delete($key) {
return $this->__Memcache->delete($key);
}
/**
* Delete all keys from the cache
*
@ -137,6 +146,7 @@ class MemcacheEngine extends CacheEngine {
function clear() {
return $this->__Memcache->flush();
}
/**
* Connects to a server in connection pool
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Xcache storage engine for cache.
*
@ -23,6 +24,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Xcache storage engine for cache
*
@ -31,6 +33,7 @@
* @subpackage cake.cake.libs.cache
*/
class XcacheEngine extends CacheEngine {
/**
* settings
* PHP_AUTH_USER = xcache.admin.user, default cake
@ -40,6 +43,7 @@ class XcacheEngine extends CacheEngine {
* @access public
*/
var $settings = array();
/**
* Initialize the Cache Engine
*
@ -57,6 +61,7 @@ class XcacheEngine extends CacheEngine {
);
return function_exists('xcache_info');
}
/**
* Write data for key into cache
*
@ -71,6 +76,7 @@ class XcacheEngine extends CacheEngine {
xcache_set($key.'_expires', $expires, $duration);
return xcache_set($key, $value, $duration);
}
/**
* Read a key from the cache
*
@ -89,6 +95,7 @@ class XcacheEngine extends CacheEngine {
}
return false;
}
/**
* Delete a key from the cache
*
@ -99,6 +106,7 @@ class XcacheEngine extends CacheEngine {
function delete($key) {
return xcache_unset($key);
}
/**
* Delete all keys from the cache
*
@ -114,6 +122,7 @@ class XcacheEngine extends CacheEngine {
$this->__auth(true);
return true;
}
/**
* Populates and reverses $_SERVER authentication values
* Makes necessary changes (and reverting them back) in $_SERVER

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Logging.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Included libraries.
*
@ -31,6 +33,7 @@
if (!class_exists('File')) {
require LIBS . 'file.php';
}
/**
* Set up error level constants to be used within the framework if they are not defined within the
* system.
@ -48,6 +51,7 @@
if (!defined('LOG_INFO')) {
define('LOG_INFO', 6);
}
/**
* Logs messages to text files
*
@ -55,6 +59,7 @@
* @subpackage cake.cake.libs
*/
class CakeLog {
/**
* Writes given message to a log file in the logs directory.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Session class for Cake.
*
@ -38,6 +39,7 @@
* @subpackage cake.cake.libs
*/
class CakeSession extends Object {
/**
* True if the Session is still valid
*
@ -45,6 +47,7 @@ class CakeSession extends Object {
* @access public
*/
var $valid = false;
/**
* Error messages for this session
*
@ -52,6 +55,7 @@ class CakeSession extends Object {
* @access public
*/
var $error = false;
/**
* User agent string
*
@ -59,6 +63,7 @@ class CakeSession extends Object {
* @access protected
*/
var $_userAgent = '';
/**
* Path to where the session is active.
*
@ -66,6 +71,7 @@ class CakeSession extends Object {
* @access public
*/
var $path = '/';
/**
* Error number of last occurred error
*
@ -73,6 +79,7 @@ class CakeSession extends Object {
* @access public
*/
var $lastError = null;
/**
* 'Security.level' setting, "high", "medium", or "low".
*
@ -80,6 +87,7 @@ class CakeSession extends Object {
* @access public
*/
var $security = null;
/**
* Start time for this session.
*
@ -87,6 +95,7 @@ class CakeSession extends Object {
* @access public
*/
var $time = false;
/**
* Time when this session becomes invalid.
*
@ -94,6 +103,7 @@ class CakeSession extends Object {
* @access public
*/
var $sessionTime = false;
/**
* Keeps track of keys to watch for writes on
*
@ -101,6 +111,7 @@ class CakeSession extends Object {
* @access public
*/
var $watchKeys = array();
/**
* Current Session id
*
@ -108,6 +119,7 @@ class CakeSession extends Object {
* @access public
*/
var $id = null;
/**
* Constructor.
*
@ -167,6 +179,7 @@ class CakeSession extends Object {
}
parent::__construct();
}
/**
* Starts the Session.
*
@ -181,6 +194,7 @@ class CakeSession extends Object {
$this->__initSession();
return $this->__startSession();
}
/**
* Determine if Session has been started.
*
@ -193,6 +207,7 @@ class CakeSession extends Object {
}
return false;
}
/**
* Returns true if given variable is set in session.
*
@ -208,6 +223,7 @@ class CakeSession extends Object {
$result = Set::extract($_SESSION, $var);
return isset($result);
}
/**
* Returns the Session id
*
@ -226,6 +242,7 @@ class CakeSession extends Object {
return $this->id;
}
}
/**
* Removes a variable from session.
*
@ -246,6 +263,7 @@ class CakeSession extends Object {
$this->__setError(2, "$name doesn't exist");
return false;
}
/**
* Used to write new data to _SESSION, since PHP doesn't like us setting the _SESSION var itself
*
@ -265,6 +283,7 @@ class CakeSession extends Object {
$old[$key] = $var;
}
}
/**
* Return error description for given error number.
*
@ -279,6 +298,7 @@ class CakeSession extends Object {
return $this->error[$errorNumber];
}
}
/**
* Returns last occurred error as a string, if any.
*
@ -292,6 +312,7 @@ class CakeSession extends Object {
return false;
}
}
/**
* Returns true if session is valid.
*
@ -311,6 +332,7 @@ class CakeSession extends Object {
}
return $this->valid;
}
/**
* Returns given session variable, or all of them, if no parameters given.
*
@ -333,6 +355,7 @@ class CakeSession extends Object {
$this->__setError(2, "$name doesn't exist");
return null;
}
/**
* Returns all session variables.
*
@ -346,6 +369,7 @@ class CakeSession extends Object {
$this->__setError(2, "No Session vars set");
return false;
}
/**
* Tells Session to write a notification when a certain session path or subpath is written to
*
@ -362,6 +386,7 @@ class CakeSession extends Object {
$this->watchKeys[] = $var;
}
}
/**
* Tells Session to stop watching a given key path
*
@ -382,6 +407,7 @@ class CakeSession extends Object {
}
}
}
/**
* Writes value to given session variable name.
*
@ -402,6 +428,7 @@ class CakeSession extends Object {
$this->__overwrite($_SESSION, Set::insert($_SESSION, $var, $value));
return (Set::extract($_SESSION, $var) === $value);
}
/**
* Helper method to destroy invalid sessions.
*
@ -415,6 +442,7 @@ class CakeSession extends Object {
$this->renew();
$this->_checkValid();
}
/**
* Helper method to initialize a session, based on Cake core settings.
*
@ -532,6 +560,7 @@ class CakeSession extends Object {
break;
}
}
/**
* Helper method to start a session
*
@ -553,6 +582,7 @@ class CakeSession extends Object {
return true;
}
}
/**
* Helper method to create a new session.
*
@ -589,6 +619,7 @@ class CakeSession extends Object {
$this->__setError(1, 'Session is valid');
}
}
/**
* Helper method to restart a session.
*
@ -624,6 +655,7 @@ class CakeSession extends Object {
}
}
}
/**
* Restarts this session.
*
@ -632,6 +664,7 @@ class CakeSession extends Object {
function renew() {
$this->__regenerateId();
}
/**
* Validate that the $name is in correct dot notation
* example: $name = 'ControllerName.key';
@ -647,6 +680,7 @@ class CakeSession extends Object {
$this->__setError(3, "$name is not a string");
return false;
}
/**
* Helper method to set an internal error message.
*
@ -662,6 +696,7 @@ class CakeSession extends Object {
$this->error[$errorNumber] = $errorMessage;
$this->lastError = $errorNumber;
}
/**
* Method called on open of a database session.
*
@ -671,6 +706,7 @@ class CakeSession extends Object {
function __open() {
return true;
}
/**
* Method called on close of a database session.
*
@ -691,6 +727,7 @@ class CakeSession extends Object {
}
return true;
}
/**
* Method used to read from a database session.
*
@ -711,6 +748,7 @@ class CakeSession extends Object {
return $row[$model->alias]['data'];
}
/**
* Helper function called on write for database sessions.
*
@ -740,6 +778,7 @@ class CakeSession extends Object {
return $return;
}
/**
* Method called on the destruction of a database session.
*
@ -753,6 +792,7 @@ class CakeSession extends Object {
return $return;
}
/**
* Helper function called on gc for database sessions.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Cake Socket connection class.
*
@ -23,6 +24,7 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', 'Validation');
/**
* Cake network socket connection class.
*
@ -32,6 +34,7 @@ App::import('Core', 'Validation');
* @subpackage cake.cake.libs
*/
class CakeSocket extends Object {
/**
* Object description
*
@ -39,6 +42,7 @@ class CakeSocket extends Object {
* @access public
*/
var $description = 'Remote DataSource Network Socket Interface';
/**
* Base configuration settings for the socket connection
*
@ -52,6 +56,7 @@ class CakeSocket extends Object {
'port' => 80,
'timeout' => 30
);
/**
* Configuration settings for the socket connection
*
@ -59,6 +64,7 @@ class CakeSocket extends Object {
* @access public
*/
var $config = array();
/**
* Reference to socket connection resource
*
@ -66,6 +72,7 @@ class CakeSocket extends Object {
* @access public
*/
var $connection = null;
/**
* This boolean contains the current state of the CakeSocket class
*
@ -73,6 +80,7 @@ class CakeSocket extends Object {
* @access public
*/
var $connected = false;
/**
* This variable contains an array with the last error number (num) and string (str)
*
@ -80,6 +88,7 @@ class CakeSocket extends Object {
* @access public
*/
var $lastError = array();
/**
* Constructor.
*
@ -93,6 +102,7 @@ class CakeSocket extends Object {
$this->config['protocol'] = getprotobyname($this->config['protocol']);
}
}
/**
* Connect the socket to the given host and port.
*
@ -140,6 +150,7 @@ class CakeSocket extends Object {
return gethostbyaddr($this->address());
}
}
/**
* Get the IP address of the current connection.
*
@ -153,6 +164,7 @@ class CakeSocket extends Object {
return gethostbyname($this->config['host']);
}
}
/**
* Get all IP addresses associated with the current connection.
*
@ -166,6 +178,7 @@ class CakeSocket extends Object {
return gethostbynamel($this->config['host']);
}
}
/**
* Get the last error as a string.
*
@ -179,6 +192,7 @@ class CakeSocket extends Object {
return null;
}
}
/**
* Set the last error.
*
@ -189,6 +203,7 @@ class CakeSocket extends Object {
function setLastError($errNum, $errStr) {
$this->lastError = array('num' => $errNum, 'str' => $errStr);
}
/**
* Write data to the socket.
*
@ -233,6 +248,7 @@ class CakeSocket extends Object {
return false;
}
}
/**
* Abort socket operation.
*
@ -241,6 +257,7 @@ class CakeSocket extends Object {
*/
function abort() {
}
/**
* Disconnect the socket from the current connection.
*
@ -259,6 +276,7 @@ class CakeSocket extends Object {
}
return !$this->connected;
}
/**
* Destructor, used to disconnect from current connection.
*
@ -267,6 +285,7 @@ class CakeSocket extends Object {
function __destruct() {
$this->disconnect();
}
/**
* Resets the state of this Socket instance to it's initial state (before Object::__construct got executed)
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Class collections.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Class Collections.
*
@ -35,6 +37,7 @@
* @subpackage cake.cake.libs
*/
class ClassRegistry {
/**
* Names of classes with their objects.
*
@ -42,6 +45,7 @@ class ClassRegistry {
* @access private
*/
var $__objects = array();
/**
* Names of class names mapped to the object in the registry.
*
@ -49,6 +53,7 @@ class ClassRegistry {
* @access private
*/
var $__map = array();
/**
* Default constructor parameter settings, indexed by type
*
@ -56,6 +61,7 @@ class ClassRegistry {
* @access private
*/
var $__config = array();
/**
* Return a singleton instance of the ClassRegistry.
*
@ -69,6 +75,7 @@ class ClassRegistry {
}
return $instance[0];
}
/**
* Loads a class, registers the object in the registry and returns instance of the object.
*
@ -169,6 +176,7 @@ class ClassRegistry {
}
return ${$class};
}
/**
* Add $object to the registry, associating it with the name $key.
*
@ -187,6 +195,7 @@ class ClassRegistry {
}
return false;
}
/**
* Remove object which corresponds to given key.
*
@ -202,6 +211,7 @@ class ClassRegistry {
unset($_this->__objects[$key]);
}
}
/**
* Returns true if given key is present in the ClassRegistry.
*
@ -220,6 +230,7 @@ class ClassRegistry {
}
return false;
}
/**
* Get all keys from the registry.
*
@ -231,6 +242,7 @@ class ClassRegistry {
$_this =& ClassRegistry::getInstance();
return array_keys($_this->__objects);
}
/**
* Return object which corresponds to given key.
*
@ -253,6 +265,7 @@ class ClassRegistry {
}
return $return;
}
/**
* Sets the default constructor parameter for an object type
*
@ -277,6 +290,7 @@ class ClassRegistry {
}
$_this->__config[$type] = $param;
}
/**
* Checks to see if $alias is a duplicate $class Object
*
@ -297,6 +311,7 @@ class ClassRegistry {
}
return $duplicate;
}
/**
* Add a key name pair to the registry to map name to class in the registry.
*
@ -313,6 +328,7 @@ class ClassRegistry {
$_this->__map[$key] = $name;
}
}
/**
* Get all keys from the map in the registry.
*
@ -324,6 +340,7 @@ class ClassRegistry {
$_this =& ClassRegistry::getInstance();
return array_keys($_this->__map);
}
/**
* Return the name of a class in the registry.
*
@ -337,6 +354,7 @@ class ClassRegistry {
return $this->__map[$key];
}
}
/**
* Flushes all objects from the ClassRegistry.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Configuration class (singleton). Used for managing runtime configuration information.
*
@ -32,6 +34,7 @@
* @link http://book.cakephp.org/view/42/The-Configuration-Class
*/
class Configure extends Object {
/**
* Current debug level.
*
@ -40,6 +43,7 @@ class Configure extends Object {
* @access public
*/
var $debug = null;
/**
* Determines if $__objects cache should be written.
*
@ -47,6 +51,7 @@ class Configure extends Object {
* @access private
*/
var $__cache = false;
/**
* Returns a singleton instance of the Configure class.
*
@ -61,6 +66,7 @@ class Configure extends Object {
}
return $instance[0];
}
/**
* Used to store a dynamic variable in the Configure instance.
*
@ -129,6 +135,7 @@ class Configure extends Object {
}
}
}
/**
* Used to read information stored in the Configure instance.
*
@ -175,6 +182,7 @@ class Configure extends Object {
}
return null;
}
/**
* Used to delete a variable from the Configure instance.
*
@ -197,6 +205,7 @@ class Configure extends Object {
unset($_this->{$name[0]});
}
}
/**
* Loads a file from app/config/configure_file.php.
* Config file variables should be formated like:
@ -241,6 +250,7 @@ class Configure extends Object {
}
return Configure::write($config);
}
/**
* Used to determine the current version of CakePHP.
*
@ -259,6 +269,7 @@ class Configure extends Object {
}
return $_this->Cake['version'];
}
/**
* Used to write a config file to disk.
*
@ -297,6 +308,7 @@ class Configure extends Object {
}
Configure::__writeConfig($content, $name, $write);
}
/**
* Creates a cached version of a configuration file.
* Appends values passed from Configure::store() to the cached file
@ -332,6 +344,7 @@ class Configure extends Object {
}
}
}
/**
* Checks $name for dot notation to create dynamic Configure::$var as an array when needed.
*
@ -348,6 +361,7 @@ class Configure extends Object {
}
return $name;
}
/**
* @deprecated
* @see App::objects()
@ -355,6 +369,7 @@ class Configure extends Object {
function listObjects($type, $path = null, $cache = true) {
return App::objects($type, $path, $cache);
}
/**
* @deprecated
* @see App::core()
@ -362,6 +377,7 @@ class Configure extends Object {
function corePaths($type = null) {
return App::core($type);
}
/**
* @deprecated
* @see App::build()
@ -369,6 +385,7 @@ class Configure extends Object {
function buildPaths($paths) {
return App::build($paths);
}
/**
* Loads app/config/bootstrap.php.
* If the alternative paths are set in this file
@ -434,6 +451,7 @@ class Configure extends Object {
));
}
}
/**
* Caches the object map when the instance of the Configure class is destroyed
*
@ -445,6 +463,7 @@ class Configure extends Object {
}
}
}
/**
* Class and file loader.
*
@ -454,6 +473,7 @@ class Configure extends Object {
* @subpackage cake.cake.libs
*/
class App extends Object {
/**
* List of object types and their properties
*
@ -481,6 +501,7 @@ class App extends Object {
* @access public
*/
var $models = array();
/**
* List of additional path(s) where behavior files reside.
*
@ -488,6 +509,7 @@ class App extends Object {
* @access public
*/
var $behaviors = array();
/**
* List of additional path(s) where controller files reside.
*
@ -495,6 +517,7 @@ class App extends Object {
* @access public
*/
var $controllers = array();
/**
* List of additional path(s) where component files reside.
*
@ -502,6 +525,7 @@ class App extends Object {
* @access public
*/
var $components = array();
/**
* List of additional path(s) where view files reside.
*
@ -509,6 +533,7 @@ class App extends Object {
* @access public
*/
var $views = array();
/**
* List of additional path(s) where helper files reside.
*
@ -516,6 +541,7 @@ class App extends Object {
* @access public
*/
var $helpers = array();
/**
* List of additional path(s) where plugins reside.
*
@ -523,6 +549,7 @@ class App extends Object {
* @access public
*/
var $plugins = array();
/**
* List of additional path(s) where vendor packages reside.
*
@ -530,6 +557,7 @@ class App extends Object {
* @access public
*/
var $vendors = array();
/**
* List of additional path(s) where locale files reside.
*
@ -537,6 +565,7 @@ class App extends Object {
* @access public
*/
var $locales = array();
/**
* List of additional path(s) where console shell files reside.
*
@ -544,6 +573,7 @@ class App extends Object {
* @access public
*/
var $shells = array();
/**
* Paths to search for files.
*
@ -551,6 +581,7 @@ class App extends Object {
* @access public
*/
var $search = array();
/**
* Whether or not to return the file that is loaded.
*
@ -558,6 +589,7 @@ class App extends Object {
* @access public
*/
var $return = false;
/**
* Determines if $__maps and $__paths cache should be written.
*
@ -565,6 +597,7 @@ class App extends Object {
* @access private
*/
var $__cache = false;
/**
* Holds key/value pairs of $type => file path.
*
@ -572,6 +605,7 @@ class App extends Object {
* @access private
*/
var $__map = array();
/**
* Holds paths for deep searching of files.
*
@ -579,6 +613,7 @@ class App extends Object {
* @access private
*/
var $__paths = array();
/**
* Holds loaded files.
*
@ -586,6 +621,7 @@ class App extends Object {
* @access private
*/
var $__loaded = array();
/**
* Holds and key => value array of object types.
*
@ -593,6 +629,7 @@ class App extends Object {
* @access private
*/
var $__objects = array();
/**
* Used to read information stored path
*
@ -610,6 +647,7 @@ class App extends Object {
}
return $_this->{$type};
}
/**
* Build path references. Merges the supplied $paths
* with the base paths and the default core paths.
@ -668,6 +706,7 @@ class App extends Object {
}
}
}
/**
* Returns a key/value list of all paths where core libs are found.
* Passing $type only returns the values for a given value of $key.
@ -719,6 +758,7 @@ class App extends Object {
}
return $paths;
}
/**
* Returns an index of objects of the given type, with the physical path to each object.
*
@ -781,6 +821,7 @@ class App extends Object {
}
return $_this->__objects[$name];
}
/**
* Finds classes based on $name or specific file(s) to search.
*
@ -916,6 +957,7 @@ class App extends Object {
}
return true;
}
/**
* Returns a single instance of App.
*
@ -930,6 +972,7 @@ class App extends Object {
}
return $instance[0];
}
/**
* Locates the $file in $__paths, searches recursively.
*
@ -978,6 +1021,7 @@ class App extends Object {
}
return null;
}
/**
* Attempts to load $file.
*
@ -1001,6 +1045,7 @@ class App extends Object {
}
return false;
}
/**
* Maps the $name to the $file.
*
@ -1017,6 +1062,7 @@ class App extends Object {
$this->__map[$type][$name] = $file;
}
}
/**
* Returns a file's complete path.
*
@ -1039,6 +1085,7 @@ class App extends Object {
}
return false;
}
/**
* Used to overload objects as needed.
*
@ -1051,6 +1098,7 @@ class App extends Object {
Overloadable::overload($name);
}
}
/**
* Loads parent classes based on $type.
* Returns a prefix or suffix needed for loading files.
@ -1135,6 +1183,7 @@ class App extends Object {
}
return array('class' => null, 'suffix' => null, 'path' => null);
}
/**
* Returns default search paths.
*
@ -1174,6 +1223,7 @@ class App extends Object {
return array(APP . 'views' . DS);
}
}
/**
* Removes file location from map if the file has been deleted.
*
@ -1190,6 +1240,7 @@ class App extends Object {
unset($this->__map[$type][$name]);
}
}
/**
* Returns an array of filenames of PHP files in the given directory.
*
@ -1222,6 +1273,7 @@ class App extends Object {
}
return $items;
}
/**
* Object destructor.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -25,6 +26,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* This is a placeholder class.
* Create the same file in app/app_controller.php

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
*
* PHP versions 4 and 5
@ -21,6 +22,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Handler for Controller::$components
*
@ -29,6 +31,7 @@
* @link http://book.cakephp.org/view/62/Components
*/
class Component extends Object {
/**
* Contains various controller variable information (plugin, name, base).
*
@ -36,6 +39,7 @@ class Component extends Object {
* @access private
*/
var $__controllerVars = array('plugin' => null, 'name' => null, 'base' => null);
/**
* List of loaded components.
*
@ -43,6 +47,7 @@ class Component extends Object {
* @access protected
*/
var $_loaded = array();
/**
* List of components attached directly to the controller, which callbacks
* should be executed on.
@ -51,6 +56,7 @@ class Component extends Object {
* @access protected
*/
var $_primary = array();
/**
* Settings for loaded components.
*
@ -58,6 +64,7 @@ class Component extends Object {
* @access private
**/
var $__settings = array();
/**
* Used to initialize the components for current controller.
*
@ -76,6 +83,7 @@ class Component extends Object {
$this->_loadComponents($controller);
}
/**
* Called before the Controller::beforeFilter().
*
@ -97,6 +105,7 @@ class Component extends Object {
}
}
}
/**
* Called after the Controller::beforeFilter() and before the controller action
*
@ -113,6 +122,7 @@ class Component extends Object {
}
}
}
/**
* Called after the Controller::beforeRender(), after the view class is loaded, and before the
* Controller::render()
@ -129,6 +139,7 @@ class Component extends Object {
}
}
}
/**
* Called before Controller::redirect().
*
@ -152,6 +163,7 @@ class Component extends Object {
}
return $response;
}
/**
* Called after Controller::render() and before the output is printed to the browser.
*
@ -167,6 +179,7 @@ class Component extends Object {
}
}
}
/**
* Loads components used by this component.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Access Control List factory class.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Access Control List factory class.
*
@ -33,6 +35,7 @@
* @subpackage cake.cake.libs.controller.components
*/
class AclComponent extends Object {
/**
* Instance of an ACL class
*
@ -40,6 +43,7 @@ class AclComponent extends Object {
* @access protected
*/
var $_Instance = null;
/**
* Constructor. Will return an instance of the correct ACL class.
*
@ -59,6 +63,7 @@ class AclComponent extends Object {
$this->_Instance =& new $name();
$this->_Instance->initialize($this);
}
/**
* Startup is not used
*
@ -69,6 +74,7 @@ class AclComponent extends Object {
function startup(&$controller) {
return true;
}
/**
* Empty class defintion, to be overridden in subclasses.
*
@ -76,6 +82,7 @@ class AclComponent extends Object {
*/
function _initACL() {
}
/**
* Pass-thru function for ACL check instance.
*
@ -88,6 +95,7 @@ class AclComponent extends Object {
function check($aro, $aco, $action = "*") {
return $this->_Instance->check($aro, $aco, $action);
}
/**
* Pass-thru function for ACL allow instance.
*
@ -100,6 +108,7 @@ class AclComponent extends Object {
function allow($aro, $aco, $action = "*") {
return $this->_Instance->allow($aro, $aco, $action);
}
/**
* Pass-thru function for ACL deny instance.
*
@ -112,6 +121,7 @@ class AclComponent extends Object {
function deny($aro, $aco, $action = "*") {
return $this->_Instance->deny($aro, $aco, $action);
}
/**
* Pass-thru function for ACL inherit instance.
*
@ -124,6 +134,7 @@ class AclComponent extends Object {
function inherit($aro, $aco, $action = "*") {
return $this->_Instance->inherit($aro, $aco, $action);
}
/**
* Pass-thru function for ACL grant instance.
*
@ -136,6 +147,7 @@ class AclComponent extends Object {
function grant($aro, $aco, $action = "*") {
return $this->_Instance->grant($aro, $aco, $action);
}
/**
* Pass-thru function for ACL grant instance.
*
@ -149,6 +161,7 @@ class AclComponent extends Object {
return $this->_Instance->revoke($aro, $aco, $action);
}
}
/**
* Access Control List abstract class. Not to be instantiated.
* Subclasses of this class are used by AclComponent to perform ACL checks in Cake.
@ -158,6 +171,7 @@ class AclComponent extends Object {
* @abstract
*/
class AclBase extends Object {
/**
* This class should never be instantiated, just subclassed.
*
@ -168,6 +182,7 @@ class AclBase extends Object {
return NULL;
}
}
/**
* Empty method to be overridden in subclasses
*
@ -178,6 +193,7 @@ class AclBase extends Object {
*/
function check($aro, $aco, $action = "*") {
}
/**
* Empty method to be overridden in subclasses
*
@ -187,6 +203,7 @@ class AclBase extends Object {
function initialize(&$component) {
}
}
/**
* In this file you can extend the AclBase.
*
@ -194,6 +211,7 @@ class AclBase extends Object {
* @subpackage cake.cake.libs.model
*/
class DbAcl extends AclBase {
/**
* Constructor
*
@ -206,6 +224,7 @@ class DbAcl extends AclBase {
$this->Aro =& ClassRegistry::init(array('class' => 'Aro', 'alias' => 'Aro'));
$this->Aco =& ClassRegistry::init(array('class' => 'Aco', 'alias' => 'Aco'));
}
/**
* Enter description here...
*
@ -217,6 +236,7 @@ class DbAcl extends AclBase {
$component->Aro = $this->Aro;
$component->Aco = $this->Aco;
}
/**
* Checks if the given $aro has access to action $action in $aco
*
@ -306,6 +326,7 @@ class DbAcl extends AclBase {
}
return false;
}
/**
* Allow $aro to have access to action $actions in $aco
*
@ -357,6 +378,7 @@ class DbAcl extends AclBase {
}
return ($this->Aro->Permission->save($save) !== false);
}
/**
* Deny access for $aro to action $action in $aco
*
@ -369,6 +391,7 @@ class DbAcl extends AclBase {
function deny($aro, $aco, $action = "*") {
return $this->allow($aro, $aco, $action, -1);
}
/**
* Let access for $aro to action $action in $aco be inherited
*
@ -381,6 +404,7 @@ class DbAcl extends AclBase {
function inherit($aro, $aco, $action = "*") {
return $this->allow($aro, $aco, $action, 0);
}
/**
* Allow $aro to have access to action $actions in $aco
*
@ -394,6 +418,7 @@ class DbAcl extends AclBase {
function grant($aro, $aco, $action = "*") {
return $this->allow($aro, $aco, $action);
}
/**
* Deny access for $aro to action $action in $aco
*
@ -407,6 +432,7 @@ class DbAcl extends AclBase {
function revoke($aro, $aco, $action = "*") {
return $this->deny($aro, $aco, $action);
}
/**
* Get an array of access-control links between the given Aro and Aco
*
@ -433,6 +459,7 @@ class DbAcl extends AclBase {
)))
);
}
/**
* Get the keys used in an ACO
*
@ -451,6 +478,7 @@ class DbAcl extends AclBase {
return $newKeys;
}
}
/**
* In this file you can extend the AclBase.
*
@ -458,6 +486,7 @@ class DbAcl extends AclBase {
* @subpackage cake.cake.libs.model.iniacl
*/
class IniAcl extends AclBase {
/**
* Array with configuration, parsed from ini file
*
@ -465,12 +494,14 @@ class IniAcl extends AclBase {
* @access public
*/
var $config = null;
/**
* The constructor must be overridden, as AclBase is abstract.
*
*/
function __construct() {
}
/**
* Main ACL check function. Checks to see if the ARO (access request object) has access to the ACO (access control object).
* Looks at the acl.ini.php file for permissions (see instructions in /config/acl.ini.php).
@ -528,6 +559,7 @@ class IniAcl extends AclBase {
}
return false;
}
/**
* Parses an INI file and returns an array that reflects the INI file's section structure. Double-quote friendly.
*
@ -570,6 +602,7 @@ class IniAcl extends AclBase {
return $iniSetting;
}
/**
* Removes trailing spaces on all array elements (to prepare for searching)
*

View file

@ -37,6 +37,7 @@ App::import(array('Router', 'Security'));
* @subpackage cake.cake.libs.controller.components
*/
class AuthComponent extends Object {
/**
* Maintains current user login state.
*
@ -44,6 +45,7 @@ class AuthComponent extends Object {
* @access private
*/
var $_loggedIn = false;
/**
* Other components utilized by AuthComponent
*
@ -51,6 +53,7 @@ class AuthComponent extends Object {
* @access public
*/
var $components = array('Session', 'RequestHandler');
/**
* A reference to the object used for authentication
*
@ -58,6 +61,7 @@ class AuthComponent extends Object {
* @access public
*/
var $authenticate = null;
/**
* The name of the component to use for Authorization or set this to
* 'controller' will validate against Controller::isAuthorized()
@ -70,6 +74,7 @@ class AuthComponent extends Object {
* @access public
*/
var $authorize = false;
/**
* The name of an optional view element to render when an Ajax request is made
* with an invalid or expired session
@ -78,6 +83,7 @@ class AuthComponent extends Object {
* @access public
*/
var $ajaxLogin = null;
/**
* The name of the model that represents users which will be authenticated. Defaults to 'User'.
*
@ -85,6 +91,7 @@ class AuthComponent extends Object {
* @access public
*/
var $userModel = 'User';
/**
* Additional query conditions to use when looking up and authenticating users,
* i.e. array('User.is_active' => 1).
@ -93,6 +100,7 @@ class AuthComponent extends Object {
* @access public
*/
var $userScope = array();
/**
* Allows you to specify non-default login name and password fields used in
* $userModel, i.e. array('username' => 'login_name', 'password' => 'passwd').
@ -101,6 +109,7 @@ class AuthComponent extends Object {
* @access public
*/
var $fields = array('username' => 'username', 'password' => 'password');
/**
* The session key name where the record of the current user is stored. If
* unspecified, it will be "Auth.{$userModel name}".
@ -109,6 +118,7 @@ class AuthComponent extends Object {
* @access public
*/
var $sessionKey = null;
/**
* If using action-based access control, this defines how the paths to action
* ACO nodes is computed. If, for example, all controller nodes are nested
@ -119,6 +129,7 @@ class AuthComponent extends Object {
* @access public
*/
var $actionPath = null;
/**
* A URL (defined as a string or array) to the controller action that handles
* logins.
@ -127,6 +138,7 @@ class AuthComponent extends Object {
* @access public
*/
var $loginAction = null;
/**
* Normally, if a user is redirected to the $loginAction page, the location they
* were redirected from will be stored in the session so that they can be
@ -137,6 +149,7 @@ class AuthComponent extends Object {
* @access public
*/
var $loginRedirect = null;
/**
* The the default action to redirect to after the user is logged out. While AuthComponent does
* not handle post-logout redirection, a redirect URL will be returned from AuthComponent::logout().
@ -148,6 +161,7 @@ class AuthComponent extends Object {
* @see AuthComponent::logout()
*/
var $logoutRedirect = null;
/**
* The name of model or model object, or any other object has an isAuthorized method.
*
@ -155,6 +169,7 @@ class AuthComponent extends Object {
* @access public
*/
var $object = null;
/**
* Error to display when user login fails. For security purposes, only one error is used for all
* login failures, so as not to expose information on why the login failed.
@ -163,6 +178,7 @@ class AuthComponent extends Object {
* @access public
*/
var $loginError = null;
/**
* Error to display when user attempts to access an object or action to which they do not have
* acccess.
@ -171,6 +187,7 @@ class AuthComponent extends Object {
* @access public
*/
var $authError = null;
/**
* Determines whether AuthComponent will automatically redirect and exit if login is successful.
*
@ -178,6 +195,7 @@ class AuthComponent extends Object {
* @access public
*/
var $autoRedirect = true;
/**
* Controller actions for which user validation is not required.
*
@ -186,6 +204,7 @@ class AuthComponent extends Object {
* @see AuthComponent::allow()
*/
var $allowedActions = array();
/**
* Maps actions to CRUD operations. Used for controller-based validation ($validate = 'controller').
*
@ -200,6 +219,7 @@ class AuthComponent extends Object {
'view' => 'read',
'remove' => 'delete'
);
/**
* Form data from Controller::$data
*
@ -207,6 +227,7 @@ class AuthComponent extends Object {
* @access public
*/
var $data = array();
/**
* Parameter data from Controller::$params
*
@ -214,6 +235,7 @@ class AuthComponent extends Object {
* @access public
*/
var $params = array();
/**
* Method list for bound controller
*
@ -221,6 +243,7 @@ class AuthComponent extends Object {
* @access protected
*/
var $_methods = array();
/**
* Initializes AuthComponent for use in the controller
*
@ -253,6 +276,7 @@ class AuthComponent extends Object {
Debugger::checkSessionKey();
}
}
/**
* Main execution method. Handles redirecting of invalid users, and processing
* of login form data.
@ -407,6 +431,7 @@ class AuthComponent extends Object {
$controller->redirect($controller->referer(), null, true);
return false;
}
/**
* Attempts to introspect the correct values for object properties including
* $userModel and $sessionKey.
@ -437,6 +462,7 @@ class AuthComponent extends Object {
}
return true;
}
/**
* Determines whether the given user is authorized to perform an action. The type of
* authorization used is based on the value of AuthComponent::$authorize or the
@ -529,6 +555,7 @@ class AuthComponent extends Object {
}
return $valid;
}
/**
* Get authorization type
*
@ -550,6 +577,7 @@ class AuthComponent extends Object {
}
return compact('type', 'object');
}
/**
* Takes a list of actions in the current controller for which authentication is not required, or
* no parameters to allow all actions.
@ -571,6 +599,7 @@ class AuthComponent extends Object {
$this->allowedActions = array_merge($this->allowedActions, $args);
}
}
/**
* Removes items from the list of allowed actions.
*
@ -591,6 +620,7 @@ class AuthComponent extends Object {
}
$this->allowedActions = array_values($this->allowedActions);
}
/**
* Maps action names to CRUD operations. Used for controller-based authentication.
*
@ -610,6 +640,7 @@ class AuthComponent extends Object {
}
}
}
/**
* Manually log-in a user with the given parameter data. The $data provided can be any data
* structure used to identify a user in AuthComponent::identify(). If $data is empty or not
@ -636,6 +667,7 @@ class AuthComponent extends Object {
}
return $this->_loggedIn;
}
/**
* Logs a user out, and returns the login action to redirect to.
*
@ -651,6 +683,7 @@ class AuthComponent extends Object {
$this->_loggedIn = false;
return Router::normalize($this->logoutRedirect);
}
/**
* Get the current user from the session.
*
@ -674,6 +707,7 @@ class AuthComponent extends Object {
return null;
}
}
/**
* If no parameter is passed, gets the authentication redirect URL.
*
@ -697,6 +731,7 @@ class AuthComponent extends Object {
}
return Router::normalize($redir);
}
/**
* Validates a user against an abstract object.
*
@ -719,6 +754,7 @@ class AuthComponent extends Object {
}
return $this->Acl->check($user, $object, $action);
}
/**
* Returns the path to the ACO node bound to a controller/action.
*
@ -735,6 +771,7 @@ class AuthComponent extends Object {
$this->actionPath . $action
);
}
/**
* Returns a reference to the model object specified, and attempts
* to load it if it is not found.
@ -762,6 +799,7 @@ class AuthComponent extends Object {
return $model;
}
/**
* Identifies a user based on specific criteria.
*
@ -837,6 +875,7 @@ class AuthComponent extends Object {
}
return null;
}
/**
* Hash any passwords found in $data using $userModel and $fields['password']
*
@ -856,6 +895,7 @@ class AuthComponent extends Object {
}
return $data;
}
/**
* Hash a password with the application's salt value (as defined with Configure::write('Security.salt');
*
@ -866,6 +906,7 @@ class AuthComponent extends Object {
function password($password) {
return Security::hash($password, null, true);
}
/**
* Component shutdown. If user is logged in, wipe out redirect.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -24,10 +25,12 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Load Security class
*/
App::import('Core', 'Security');
/**
* Cookie Component.
*
@ -38,6 +41,7 @@ App::import('Core', 'Security');
*
*/
class CookieComponent extends Object {
/**
* The name of the cookie.
*
@ -48,6 +52,7 @@ class CookieComponent extends Object {
* @access public
*/
var $name = 'CakeCookie';
/**
* The time a cookie will remain valid.
*
@ -60,6 +65,7 @@ class CookieComponent extends Object {
* @access public
*/
var $time = null;
/**
* Cookie path.
*
@ -75,6 +81,7 @@ class CookieComponent extends Object {
* @access public
*/
var $path = '/';
/**
* Domain path.
*
@ -90,6 +97,7 @@ class CookieComponent extends Object {
* @access public
*/
var $domain = '';
/**
* Secure HTTPS only cookie.
*
@ -103,6 +111,7 @@ class CookieComponent extends Object {
* @access public
*/
var $secure = false;
/**
* Encryption key.
*
@ -113,6 +122,7 @@ class CookieComponent extends Object {
* @access protected
*/
var $key = null;
/**
* Values stored in the cookie.
*
@ -123,6 +133,7 @@ class CookieComponent extends Object {
* @access private
*/
var $__values = array();
/**
* Type of encryption to use.
*
@ -134,6 +145,7 @@ class CookieComponent extends Object {
* @todo add additional encryption methods
*/
var $__type = 'cipher';
/**
* Used to reset cookie time if $expire is passed to CookieComponent::write()
*
@ -141,6 +153,7 @@ class CookieComponent extends Object {
* @access private
*/
var $__reset = null;
/**
* Expire time of the cookie
*
@ -150,6 +163,7 @@ class CookieComponent extends Object {
* @access private
*/
var $__expires = 0;
/**
* Main execution method.
*
@ -160,6 +174,7 @@ class CookieComponent extends Object {
$this->key = Configure::read('Security.salt');
$this->_set($settings);
}
/**
* Start CookieComponent for use in the controller
*
@ -172,6 +187,7 @@ class CookieComponent extends Object {
$this->__values = $this->__decrypt($_COOKIE[$this->name]);
}
}
/**
* Write a value to the $_COOKIE[$key];
*
@ -223,6 +239,7 @@ class CookieComponent extends Object {
}
$this->__encrypted = true;
}
/**
* Read the value of the $_COOKIE[$key];
*
@ -258,6 +275,7 @@ class CookieComponent extends Object {
return null;
}
}
/**
* Delete a cookie value
*
@ -293,6 +311,7 @@ class CookieComponent extends Object {
}
}
}
/**
* Destroy current cookie
*
@ -318,6 +337,7 @@ class CookieComponent extends Object {
$this->__delete("[$name]");
}
}
/**
* Will allow overriding default encryption method.
*
@ -328,6 +348,7 @@ class CookieComponent extends Object {
function type($type = 'cipher') {
$this->__type = 'cipher';
}
/**
* Set the expire time for a session variable.
*
@ -353,6 +374,7 @@ class CookieComponent extends Object {
}
return $this->__expires = strtotime($expires, $now);
}
/**
* Set cookie
*
@ -368,6 +390,7 @@ class CookieComponent extends Object {
$this->__reset = null;
}
}
/**
* Sets a cookie expire time to remove cookie value
*
@ -377,6 +400,7 @@ class CookieComponent extends Object {
function __delete($name) {
setcookie($this->name . $name, '', time() - 42000, $this->path, $this->domain, $this->secure);
}
/**
* Encrypts $value using var $type method in Security class
*
@ -395,6 +419,7 @@ class CookieComponent extends Object {
}
return($value);
}
/**
* Decrypts $value using var $type method in Security class
*
@ -449,6 +474,7 @@ class CookieComponent extends Object {
}
return $name;
}
/**
* Implode method to keep keys are multidimensional arrays
*
@ -463,6 +489,7 @@ class CookieComponent extends Object {
}
return substr($string, 1);
}
/**
* Explode method to return array from string set in CookieComponent::__implode()
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* EmailComponent
*
@ -36,6 +38,7 @@
*/
App::import('Core', 'Multibyte');
class EmailComponent extends Object{
/**
* Recipient of the email
*
@ -43,6 +46,7 @@ class EmailComponent extends Object{
* @access public
*/
var $to = null;
/**
* The mail which the email is sent from
*
@ -50,6 +54,7 @@ class EmailComponent extends Object{
* @access public
*/
var $from = null;
/**
* The email the recipient will reply to
*
@ -57,6 +62,7 @@ class EmailComponent extends Object{
* @access public
*/
var $replyTo = null;
/**
* The read receipt email
*
@ -64,6 +70,7 @@ class EmailComponent extends Object{
* @access public
*/
var $readReceipt = null;
/**
* The mail that will be used in case of any errors like
* - Remote mailserver down
@ -74,6 +81,7 @@ class EmailComponent extends Object{
* @access public
*/
var $return = null;
/**
* Carbon Copy
*
@ -84,6 +92,7 @@ class EmailComponent extends Object{
* @access public
*/
var $cc = array();
/**
* Blind Carbon Copy
*
@ -94,6 +103,7 @@ class EmailComponent extends Object{
* @access public
*/
var $bcc = array();
/**
* The subject of the email
*
@ -101,6 +111,7 @@ class EmailComponent extends Object{
* @access public
*/
var $subject = null;
/**
* Associative array of a user defined headers
* Keys will be prefixed 'X-' as per RFC2822 Section 4.7.5
@ -109,6 +120,7 @@ class EmailComponent extends Object{
* @access public
*/
var $headers = array();
/**
* List of additional headers
*
@ -118,6 +130,7 @@ class EmailComponent extends Object{
* @access public
*/
var $additionalParams = null;
/**
* Layout for the View
*
@ -125,6 +138,7 @@ class EmailComponent extends Object{
* @access public
*/
var $layout = 'default';
/**
* Template for the view
*
@ -132,6 +146,7 @@ class EmailComponent extends Object{
* @access public
*/
var $template = null;
/**
* as per RFC2822 Section 2.1.1
*
@ -139,10 +154,12 @@ class EmailComponent extends Object{
* @access public
*/
var $lineLength = 70;
/**
* @deprecated see lineLength
*/
var $_lineLength = null;
/**
* What format should the email be sent in
*
@ -155,6 +172,7 @@ class EmailComponent extends Object{
* @access public
*/
var $sendAs = 'text';
/**
* What method should the email be sent by
*
@ -167,6 +185,7 @@ class EmailComponent extends Object{
* @access public
*/
var $delivery = 'mail';
/**
* charset the email is sent in
*
@ -174,6 +193,7 @@ class EmailComponent extends Object{
* @access public
*/
var $charset = 'utf-8';
/**
* List of files that should be attached to the email.
*
@ -183,6 +203,7 @@ class EmailComponent extends Object{
* @access public
*/
var $attachments = array();
/**
* What mailer should EmailComponent identify itself as
*
@ -190,6 +211,7 @@ class EmailComponent extends Object{
* @access public
*/
var $xMailer = 'CakePHP Email Component';
/**
* The list of paths to search if an attachment isnt absolute
*
@ -197,6 +219,7 @@ class EmailComponent extends Object{
* @access public
*/
var $filePaths = array();
/**
* List of options to use for smtp mail method
*
@ -213,6 +236,7 @@ class EmailComponent extends Object{
var $smtpOptions = array(
'port'=> 25, 'host' => 'localhost', 'timeout' => 30
);
/**
* Placeholder for any errors that might happen with the
* smtp mail methods
@ -221,6 +245,7 @@ class EmailComponent extends Object{
* @access public
*/
var $smtpError = null;
/**
* If set to true, the mail method will be auto-set to 'debug'
*
@ -228,6 +253,7 @@ class EmailComponent extends Object{
* @access protected
*/
var $_debug = false;
/**
* Temporary store of message header lines
*
@ -235,6 +261,7 @@ class EmailComponent extends Object{
* @access private
*/
var $__header = array();
/**
* If set, boundary to use for multipart mime messages
*
@ -242,6 +269,7 @@ class EmailComponent extends Object{
* @access private
*/
var $__boundary = null;
/**
* Temporary store of message lines
*
@ -249,6 +277,7 @@ class EmailComponent extends Object{
* @access private
*/
var $__message = array();
/**
* Variable that holds SMTP connection
*
@ -256,6 +285,7 @@ class EmailComponent extends Object{
* @access private
*/
var $__smtpConnection = null;
/**
* Initialize component
*
@ -269,6 +299,7 @@ class EmailComponent extends Object{
}
$this->_set($settings);
}
/**
* Startup component
*
@ -276,6 +307,7 @@ class EmailComponent extends Object{
* @access public
*/
function startup(&$controller) {}
/**
* Send an email using the specified content, template and layout
*
@ -330,6 +362,7 @@ class EmailComponent extends Object{
return $sent;
}
/**
* Reset all EmailComponent internal variables to be able to send out a new email.
*
@ -351,6 +384,7 @@ class EmailComponent extends Object{
$this->__boundary = null;
$this->__message = array();
}
/**
* Render the contents using the current layout and template.
*
@ -430,6 +464,7 @@ class EmailComponent extends Object{
return $msg;
}
/**
* Create unique boundary identifier
*
@ -438,6 +473,7 @@ class EmailComponent extends Object{
function __createBoundary() {
$this->__boundary = md5(uniqid(time()));
}
/**
* Create emails headers including (but not limited to) from email address, reply to,
* bcc and cc.
@ -495,6 +531,7 @@ class EmailComponent extends Object{
$this->__header[] = 'Content-Transfer-Encoding: 7bit';
}
/**
* Format the message by seeing if it has attachments.
*
@ -517,6 +554,7 @@ class EmailComponent extends Object{
}
return $message;
}
/**
* Attach files by adding file contents inside boundaries.
*
@ -547,6 +585,7 @@ class EmailComponent extends Object{
$this->__message[] = '';
}
}
/**
* Find the specified attachment in the list of file paths
*
@ -566,6 +605,7 @@ class EmailComponent extends Object{
}
return null;
}
/**
* Wrap the message using EmailComponent::$lineLength
*
@ -593,6 +633,7 @@ class EmailComponent extends Object{
$formatted[] = '';
return $formatted;
}
/**
* Encode the specified string using the current charset
*
@ -609,6 +650,7 @@ class EmailComponent extends Object{
}
return mb_encode_mimeheader($subject, $this->charset, 'B', $nl);
}
/**
* Format a string as an email address
*
@ -627,6 +669,7 @@ class EmailComponent extends Object{
}
return $this->__strip($string);
}
/**
* Remove certain elements (such as bcc:, to:, %0a) from given value
*
@ -648,6 +691,7 @@ class EmailComponent extends Object{
}
return $value;
}
/**
* Wrapper for PHP mail function used for sending out emails
*
@ -662,6 +706,7 @@ class EmailComponent extends Object{
}
return @mail($this->to, $this->__encode($this->subject), $message, $header, $this->additionalParams);
}
/**
* Sends out email via SMTP
*
@ -737,6 +782,7 @@ class EmailComponent extends Object{
$this->__smtpConnection->disconnect();
return true;
}
/**
* Private method for sending data to SMTP connection
*
@ -760,6 +806,7 @@ class EmailComponent extends Object{
}
return true;
}
/**
* Set as controller flash message a debug message showing current settings in component
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Request object for handling alternative HTTP requests
*
@ -37,6 +38,7 @@ if (!defined('REQUEST_MOBILE_UA')) {
*
*/
class RequestHandlerComponent extends Object {
/**
* The layout that will be switched to for Ajax requests
*
@ -45,6 +47,7 @@ class RequestHandlerComponent extends Object {
* @see RequestHandler::setAjax()
*/
var $ajaxLayout = 'ajax';
/**
* Determines whether or not callbacks will be fired on this component
*
@ -52,6 +55,7 @@ class RequestHandlerComponent extends Object {
* @access public
*/
var $enabled = true;
/**
* Holds the content-type of the response that is set when using
* RequestHandler::respondAs()
@ -60,6 +64,7 @@ class RequestHandlerComponent extends Object {
* @access private
*/
var $__responseTypeSet = null;
/**
* Holds the copy of Controller::$params
*
@ -67,6 +72,7 @@ class RequestHandlerComponent extends Object {
* @access public
*/
var $params = array();
/**
* Friendly content-type mappings used to set response types and determine
* request types. Can be modified with RequestHandler::setContent()
@ -104,6 +110,7 @@ class RequestHandlerComponent extends Object {
'zip' => 'application/x-zip',
'tar' => 'application/x-tar'
);
/**
* Content-types accepted by the client. If extension parsing is enabled in the
* Router, and an extension is detected, the corresponding content-type will be
@ -114,6 +121,7 @@ class RequestHandlerComponent extends Object {
* @see Router::parseExtensions()
*/
var $__acceptTypes = array();
/**
* The template to use when rendering the given content type.
*
@ -121,6 +129,7 @@ class RequestHandlerComponent extends Object {
* @access private
*/
var $__renderType = null;
/**
* Contains the file extension parsed out by the Router
*
@ -129,6 +138,7 @@ class RequestHandlerComponent extends Object {
* @see Router::parseExtensions()
*/
var $ext = null;
/**
* Flag set when MIME types have been initialized
*
@ -137,6 +147,7 @@ class RequestHandlerComponent extends Object {
* @see RequestHandler::__initializeTypes()
*/
var $__typesInitialized = false;
/**
* Constructor. Parses the accepted content types accepted by the client using HTTP_ACCEPT
*
@ -152,6 +163,7 @@ class RequestHandlerComponent extends Object {
}
parent::__construct();
}
/**
* Initializes the component, gets a reference to Controller::$parameters, and
* checks to see if a file extension has been parsed by the Router. If yes, the
@ -168,6 +180,7 @@ class RequestHandlerComponent extends Object {
$this->ext = $controller->params['url']['ext'];
}
}
/**
* The startup method of the RequestHandler enables several automatic behaviors
* related to the detection of certain properties of the HTTP request, including:
@ -217,6 +230,7 @@ class RequestHandlerComponent extends Object {
}
}
}
/**
* Handles (fakes) redirects for Ajax requests using requestAction()
*
@ -234,6 +248,7 @@ class RequestHandlerComponent extends Object {
echo $this->requestAction($url, array('return'));
$this->_stop();
}
/**
* Returns true if the current HTTP request is Ajax, false otherwise
*
@ -243,6 +258,7 @@ class RequestHandlerComponent extends Object {
function isAjax() {
return env('HTTP_X_REQUESTED_WITH') === "XMLHttpRequest";
}
/**
* Returns true if the current HTTP request is coming from a Flash-based client
*
@ -252,6 +268,7 @@ class RequestHandlerComponent extends Object {
function isFlash() {
return (preg_match('/^(Shockwave|Adobe) Flash/', env('HTTP_USER_AGENT')) == 1);
}
/**
* Returns true if the current request is over HTTPS, false otherwise.
*
@ -261,6 +278,7 @@ class RequestHandlerComponent extends Object {
function isSSL() {
return env('HTTPS');
}
/**
* Returns true if the current call accepts an XML response, false otherwise
*
@ -270,6 +288,7 @@ class RequestHandlerComponent extends Object {
function isXml() {
return $this->prefers('xml');
}
/**
* Returns true if the current call accepts an RSS response, false otherwise
*
@ -279,6 +298,7 @@ class RequestHandlerComponent extends Object {
function isRss() {
return $this->prefers('rss');
}
/**
* Returns true if the current call accepts an Atom response, false otherwise
*
@ -288,6 +308,7 @@ class RequestHandlerComponent extends Object {
function isAtom() {
return $this->prefers('atom');
}
/**
* Returns true if user agent string matches a mobile web browser, or if the
* client accepts WAP content.
@ -302,6 +323,7 @@ class RequestHandlerComponent extends Object {
}
return false;
}
/**
* Returns true if the client accepts WAP content
*
@ -311,6 +333,7 @@ class RequestHandlerComponent extends Object {
function isWap() {
return $this->prefers('wap');
}
/**
* Returns true if the current call a POST request
*
@ -320,6 +343,7 @@ class RequestHandlerComponent extends Object {
function isPost() {
return (strtolower(env('REQUEST_METHOD')) == 'post');
}
/**
* Returns true if the current call a PUT request
*
@ -329,6 +353,7 @@ class RequestHandlerComponent extends Object {
function isPut() {
return (strtolower(env('REQUEST_METHOD')) == 'put');
}
/**
* Returns true if the current call a GET request
*
@ -338,6 +363,7 @@ class RequestHandlerComponent extends Object {
function isGet() {
return (strtolower(env('REQUEST_METHOD')) == 'get');
}
/**
* Returns true if the current call a DELETE request
*
@ -347,6 +373,7 @@ class RequestHandlerComponent extends Object {
function isDelete() {
return (strtolower(env('REQUEST_METHOD')) == 'delete');
}
/**
* Gets Prototype version if call is Ajax, otherwise empty string.
* The Prototype library sets a special "Prototype version" HTTP header.
@ -360,6 +387,7 @@ class RequestHandlerComponent extends Object {
}
return false;
}
/**
* Adds/sets the Content-type(s) for the given name. This method allows
* content-types to be mapped to friendly aliases (or extensions), which allows
@ -379,6 +407,7 @@ class RequestHandlerComponent extends Object {
}
$this->__requestContent[$name] = $type;
}
/**
* Gets the server name from which this request was referred
*
@ -395,6 +424,7 @@ class RequestHandlerComponent extends Object {
}
return trim(preg_replace('/(?:\:.*)/', '', $sessHost));
}
/**
* Gets remote client IP
*
@ -421,6 +451,7 @@ class RequestHandlerComponent extends Object {
}
return trim($ipaddr);
}
/**
* Determines which content types the client accepts. Acceptance is based on
* the file extension parsed by the Router (if present), and by the HTTP_ACCEPT
@ -469,6 +500,7 @@ class RequestHandlerComponent extends Object {
}
}
}
/**
* Determines the content type of the data the client has sent (i.e. in a POST request)
*
@ -495,6 +527,7 @@ class RequestHandlerComponent extends Object {
return ($type == $this->mapType($contentType));
}
}
/**
* Determines which content-types the client prefers. If no parameters are given,
* the content-type that the client most likely prefers is returned. If $type is
@ -558,6 +591,7 @@ class RequestHandlerComponent extends Object {
$accepts = array_intersect($acceptedTypes, $accepts);
return $accepts[0];
}
/**
* Sets the layout and template paths for the content type defined by $type.
*
@ -607,6 +641,7 @@ class RequestHandlerComponent extends Object {
}
}
}
/**
* Sets the response header based on type map index name. If DEBUG is greater than 2, the header
* is not set.
@ -673,6 +708,7 @@ class RequestHandlerComponent extends Object {
}
return false;
}
/**
* Returns the current response type (Content-type header), or null if none has been set
*
@ -686,6 +722,7 @@ class RequestHandlerComponent extends Object {
}
return $this->mapType($this->__responseTypeSet);
}
/**
* Maps a content-type back to an alias
*
@ -717,6 +754,7 @@ class RequestHandlerComponent extends Object {
return $ctype;
}
}
/**
* Initializes MIME types
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Short description for file.
*
@ -33,6 +35,7 @@
* @subpackage cake.cake.libs.controller.components
*/
class SecurityComponent extends Object {
/**
* The controller method that will be called if this request is black-hole'd
*
@ -40,6 +43,7 @@ class SecurityComponent extends Object {
* @access public
*/
var $blackHoleCallback = null;
/**
* List of controller actions for which a POST request is required
*
@ -48,6 +52,7 @@ class SecurityComponent extends Object {
* @see SecurityComponent::requirePost()
*/
var $requirePost = array();
/**
* List of controller actions for which a GET request is required
*
@ -56,6 +61,7 @@ class SecurityComponent extends Object {
* @see SecurityComponent::requireGet()
*/
var $requireGet = array();
/**
* List of controller actions for which a PUT request is required
*
@ -64,6 +70,7 @@ class SecurityComponent extends Object {
* @see SecurityComponent::requirePut()
*/
var $requirePut = array();
/**
* List of controller actions for which a DELETE request is required
*
@ -72,6 +79,7 @@ class SecurityComponent extends Object {
* @see SecurityComponent::requireDelete()
*/
var $requireDelete = array();
/**
* List of actions that require an SSL-secured connection
*
@ -80,6 +88,7 @@ class SecurityComponent extends Object {
* @see SecurityComponent::requireSecure()
*/
var $requireSecure = array();
/**
* List of actions that require a valid authentication key
*
@ -88,6 +97,7 @@ class SecurityComponent extends Object {
* @see SecurityComponent::requireAuth()
*/
var $requireAuth = array();
/**
* List of actions that require an HTTP-authenticated login (basic or digest)
*
@ -96,6 +106,7 @@ class SecurityComponent extends Object {
* @see SecurityComponent::requireLogin()
*/
var $requireLogin = array();
/**
* Login options for SecurityComponent::requireLogin()
*
@ -104,6 +115,7 @@ class SecurityComponent extends Object {
* @see SecurityComponent::requireLogin()
*/
var $loginOptions = array('type' => '', 'prompt' => null);
/**
* An associative array of usernames/passwords used for HTTP-authenticated logins.
* If using digest authentication, passwords should be MD5-hashed.
@ -113,6 +125,7 @@ class SecurityComponent extends Object {
* @see SecurityComponent::requireLogin()
*/
var $loginUsers = array();
/**
* Controllers from which actions of the current controller are allowed to receive
* requests.
@ -122,6 +135,7 @@ class SecurityComponent extends Object {
* @see SecurityComponent::requireAuth()
*/
var $allowedControllers = array();
/**
* Actions from which actions of the current controller are allowed to receive
* requests.
@ -131,6 +145,7 @@ class SecurityComponent extends Object {
* @see SecurityComponent::requireAuth()
*/
var $allowedActions = array();
/**
* Form fields to disable
*
@ -138,6 +153,7 @@ class SecurityComponent extends Object {
* @access public
*/
var $disabledFields = array();
/**
* Whether to validate POST data. Set to false to disable for data coming from 3rd party
* services, etc.
@ -146,6 +162,7 @@ class SecurityComponent extends Object {
* @access public
*/
var $validatePost = true;
/**
* Other components used by the Security component
*
@ -153,12 +170,14 @@ class SecurityComponent extends Object {
* @access public
*/
var $components = array('RequestHandler', 'Session');
/**
* Holds the current action of the controller
*
* @var string
*/
var $_action = null;
/**
* Component startup. All security checking happens here.
*
@ -187,6 +206,7 @@ class SecurityComponent extends Object {
}
$this->_generateToken($controller);
}
/**
* Sets the actions that require a POST request, or empty for all actions
*
@ -197,6 +217,7 @@ class SecurityComponent extends Object {
$args = func_get_args();
$this->_requireMethod('Post', $args);
}
/**
* Sets the actions that require a GET request, or empty for all actions
*
@ -207,6 +228,7 @@ class SecurityComponent extends Object {
$args = func_get_args();
$this->_requireMethod('Get', $args);
}
/**
* Sets the actions that require a PUT request, or empty for all actions
*
@ -217,6 +239,7 @@ class SecurityComponent extends Object {
$args = func_get_args();
$this->_requireMethod('Put', $args);
}
/**
* Sets the actions that require a DELETE request, or empty for all actions
*
@ -227,6 +250,7 @@ class SecurityComponent extends Object {
$args = func_get_args();
$this->_requireMethod('Delete', $args);
}
/**
* Sets the actions that require a request that is SSL-secured, or empty for all actions
*
@ -237,6 +261,7 @@ class SecurityComponent extends Object {
$args = func_get_args();
$this->_requireMethod('Secure', $args);
}
/**
* Sets the actions that require an authenticated request, or empty for all actions
*
@ -247,6 +272,7 @@ class SecurityComponent extends Object {
$args = func_get_args();
$this->_requireMethod('Auth', $args);
}
/**
* Sets the actions that require an HTTP-authenticated request, or empty for all actions
*
@ -270,6 +296,7 @@ class SecurityComponent extends Object {
$this->loginUsers =& $this->loginOptions['users'];
}
}
/**
* Attempts to validate the login credentials for an HTTP-authenticated request
*
@ -308,6 +335,7 @@ class SecurityComponent extends Object {
}
return null;
}
/**
* Generates the text of an HTTP-authentication request header from an array of options.
*
@ -329,6 +357,7 @@ class SecurityComponent extends Object {
return $auth . ' ' . join(',', $out);
}
/**
* Parses an HTTP digest authentication response, and returns an array of the data, or null on failure.
*
@ -355,6 +384,7 @@ class SecurityComponent extends Object {
}
return null;
}
/**
* Generates a hash to be compared with an HTTP digest-authenticated response
*
@ -370,6 +400,7 @@ class SecurityComponent extends Object {
md5(env('REQUEST_METHOD') . ':' . $data['uri'])
);
}
/**
* Black-hole an invalid request with a 404 error or custom callback. If SecurityComponent::$blackHoleCallback
* is specified, it will use this callback by executing the method indicated in $error
@ -394,6 +425,7 @@ class SecurityComponent extends Object {
return $this->_callback($controller, $this->blackHoleCallback, array($error));
}
}
/**
* Sets the actions that require a $method HTTP request, or empty for all actions
*
@ -405,6 +437,7 @@ class SecurityComponent extends Object {
function _requireMethod($method, $actions = array()) {
$this->{'require' . $method} = (empty($actions)) ? array('*'): $actions;
}
/**
* Check if HTTP methods are required
*
@ -429,6 +462,7 @@ class SecurityComponent extends Object {
}
return true;
}
/**
* Check if access requires secure connection
*
@ -450,6 +484,7 @@ class SecurityComponent extends Object {
}
return true;
}
/**
* Check if authentication is required
*
@ -485,6 +520,7 @@ class SecurityComponent extends Object {
}
return true;
}
/**
* Check if login is required
*
@ -532,6 +568,7 @@ class SecurityComponent extends Object {
}
return true;
}
/**
* Validate submitted form
*
@ -612,6 +649,7 @@ class SecurityComponent extends Object {
$check = Security::hash(serialize($fieldList) . Configure::read('Security.salt'));
return ($token === $check);
}
/**
* Add authentication key for new form posts
*
@ -654,6 +692,7 @@ class SecurityComponent extends Object {
return true;
}
/**
* Sets the default login options for an HTTP-authenticated request
*
@ -670,6 +709,7 @@ class SecurityComponent extends Object {
), array_filter($options));
$options = array_merge(array('opaque' => md5($options['realm'])), $options);
}
/**
* Calls a controller callback method
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -27,6 +28,7 @@
if (!class_exists('cakesession')) {
require LIBS . 'cake_session.php';
}
/**
* Session Component.
*
@ -37,6 +39,7 @@ if (!class_exists('cakesession')) {
*
*/
class SessionComponent extends CakeSession {
/**
* Used to determine if methods implementation is used, or bypassed
*
@ -44,6 +47,7 @@ class SessionComponent extends CakeSession {
* @access private
*/
var $__active = true;
/**
* Used to determine if Session has been started
*
@ -51,6 +55,7 @@ class SessionComponent extends CakeSession {
* @access private
*/
var $__started = false;
/**
* Used to determine if request are from an Ajax request
*
@ -58,6 +63,7 @@ class SessionComponent extends CakeSession {
* @access private
*/
var $__bare = 0;
/**
* Class constructor
*
@ -70,6 +76,7 @@ class SessionComponent extends CakeSession {
$this->__active = false;
}
}
/**
* Initializes the component, gets a reference to Controller::$param['bare'].
*
@ -82,6 +89,7 @@ class SessionComponent extends CakeSession {
$this->__bare = $controller->params['bare'];
}
}
/**
* Startup method.
*
@ -94,6 +102,7 @@ class SessionComponent extends CakeSession {
$this->__start();
}
}
/**
* Starts Session on if 'Session.start' is set to false in core.php
*
@ -108,6 +117,7 @@ class SessionComponent extends CakeSession {
parent::__construct($base);
$this->__active = true;
}
/**
* Used to write a value to a session key.
*
@ -137,6 +147,7 @@ class SessionComponent extends CakeSession {
}
return false;
}
/**
* Used to read a session values for a key or return values for all keys.
*
@ -154,6 +165,7 @@ class SessionComponent extends CakeSession {
}
return false;
}
/**
* Used to delete a session variable.
*
@ -170,6 +182,7 @@ class SessionComponent extends CakeSession {
}
return false;
}
/**
* Wrapper for SessionComponent::del();
*
@ -186,6 +199,7 @@ class SessionComponent extends CakeSession {
}
return false;
}
/**
* Used to check if a session variable is set
*
@ -202,6 +216,7 @@ class SessionComponent extends CakeSession {
}
return false;
}
/**
* Used to determine the last error in a session.
*
@ -217,6 +232,7 @@ class SessionComponent extends CakeSession {
}
return false;
}
/**
* Used to set a session variable that can be used to output messages in the view.
*
@ -236,6 +252,7 @@ class SessionComponent extends CakeSession {
$this->write('Message.' . $key, compact('message', 'layout', 'params'));
}
}
/**
* Used to renew a session id
*
@ -250,6 +267,7 @@ class SessionComponent extends CakeSession {
parent::renew();
}
}
/**
* Used to check for a valid session.
*
@ -265,6 +283,7 @@ class SessionComponent extends CakeSession {
}
return false;
}
/**
* Used to destroy sessions
*
@ -279,6 +298,7 @@ class SessionComponent extends CakeSession {
parent::destroy();
}
}
/**
* Returns Session id
*
@ -292,6 +312,7 @@ class SessionComponent extends CakeSession {
function id($id = null) {
return parent::id($id);
}
/**
* Starts Session if SessionComponent is used in Controller::beforeFilter(),
* or is called from

View file

@ -17,10 +17,12 @@
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Include files
*/
App::import('Core', array('Component', 'View'));
/**
* Controller
*
@ -34,6 +36,7 @@ App::import('Core', array('Component', 'View'));
*
*/
class Controller extends Object {
/**
* The name of this controller. Controller names are plural, named after the model they manipulate.
*
@ -42,6 +45,7 @@ class Controller extends Object {
* @link http://book.cakephp.org/view/52/name
*/
var $name = null;
/**
* Stores the current URL, relative to the webroot of the application.
*
@ -49,6 +53,7 @@ class Controller extends Object {
* @access public
*/
var $here = null;
/**
* The webroot of the application.
*
@ -56,6 +61,7 @@ class Controller extends Object {
* @access public
*/
var $webroot = null;
/**
* The name of the currently requested controller action.
*
@ -63,6 +69,7 @@ class Controller extends Object {
* @access public
*/
var $action = null;
/**
* An array containing the class names of models this controller uses.
*
@ -73,6 +80,7 @@ class Controller extends Object {
* @link http://book.cakephp.org/view/53/components-helpers-and-uses
*/
var $uses = false;
/**
* An array containing the names of helpers this controller uses. The array elements should
* not contain the "Helper" part of the classname.
@ -84,6 +92,7 @@ class Controller extends Object {
* @link http://book.cakephp.org/view/53/components-helpers-and-uses
*/
var $helpers = array('Html', 'Form');
/**
* Parameters received in the current request: GET and POST data, information
* about the request, etc.
@ -93,6 +102,7 @@ class Controller extends Object {
* @link http://book.cakephp.org/view/55/The-Parameters-Attribute-params
*/
var $params = array();
/**
* Data POSTed to the controller using the HtmlHelper. Data here is accessible
* using the $this->data['ModelName']['fieldName'] pattern.
@ -101,6 +111,7 @@ class Controller extends Object {
* @access public
*/
var $data = array();
/**
* Holds pagination defaults for controller actions. The keys that can be included
* in this array are: 'conditions', 'fields', 'order', 'limit', 'page', and 'recursive',
@ -119,6 +130,7 @@ class Controller extends Object {
* @link http://book.cakephp.org/view/164/Pagination
*/
var $paginate = array('limit' => 20, 'page' => 1);
/**
* The name of the views subfolder containing views for this controller.
*
@ -126,6 +138,7 @@ class Controller extends Object {
* @access public
*/
var $viewPath = null;
/**
* The name of the layouts subfolder containing layouts for this controller.
*
@ -133,6 +146,7 @@ class Controller extends Object {
* @access public
*/
var $layoutPath = null;
/**
* Contains variables to be handed to the view.
*
@ -140,6 +154,7 @@ class Controller extends Object {
* @access public
*/
var $viewVars = array();
/**
* Text to be used for the $title_for_layout layout variable (usually
* placed inside <title> tags.)
@ -149,6 +164,7 @@ class Controller extends Object {
* @link http://book.cakephp.org/view/54/Page-related-Attributes-layout-and-pageTitle
*/
var $pageTitle = false;
/**
* An array containing the class names of the models this controller uses.
*
@ -156,6 +172,7 @@ class Controller extends Object {
* @access public
*/
var $modelNames = array();
/**
* Base URL path.
*
@ -163,6 +180,7 @@ class Controller extends Object {
* @access public
*/
var $base = null;
/**
* The name of the layout file to render the view inside of. The name specified
* is the filename of the layout in /app/views/layouts without the .ctp
@ -173,6 +191,7 @@ class Controller extends Object {
* @link http://book.cakephp.org/view/54/Page-related-Attributes-layout-and-pageTitle
*/
var $layout = 'default';
/**
* Set to true to automatically render the view
* after action logic.
@ -181,6 +200,7 @@ class Controller extends Object {
* @access public
*/
var $autoRender = true;
/**
* Set to true to automatically render the layout around views.
*
@ -188,6 +208,7 @@ class Controller extends Object {
* @access public
*/
var $autoLayout = true;
/**
* Instance of Component used to handle callbacks.
*
@ -195,6 +216,7 @@ class Controller extends Object {
* @access public
*/
var $Component = null;
/**
* Array containing the names of components this controller uses. Component names
* should not contain the "Component" portion of the classname.
@ -206,6 +228,7 @@ class Controller extends Object {
* @link http://book.cakephp.org/view/53/components-helpers-and-uses
*/
var $components = array();
/**
* The name of the View class this controller sends output to.
*
@ -213,6 +236,7 @@ class Controller extends Object {
* @access public
*/
var $view = 'View';
/**
* File extension for view templates. Defaults to Cake's conventional ".ctp".
*
@ -220,6 +244,7 @@ class Controller extends Object {
* @access public
*/
var $ext = '.ctp';
/**
* The output of the requested action. Contains either a variable
* returned from the action, or the data of the rendered view;
@ -229,6 +254,7 @@ class Controller extends Object {
* @access public
*/
var $output = null;
/**
* Automatically set to the name of a plugin.
*
@ -236,6 +262,7 @@ class Controller extends Object {
* @access public
*/
var $plugin = null;
/**
* Used to define methods a controller that will be cached. To cache a
* single action, the value is set to an array containing keys that match
@ -254,6 +281,7 @@ class Controller extends Object {
* @link http://book.cakephp.org/view/346/Caching-in-the-Controller
*/
var $cacheAction = false;
/**
* Used to create cached instances of models a controller uses.
* When set to true, all models related to the controller will be cached.
@ -263,6 +291,7 @@ class Controller extends Object {
* @access public
*/
var $persistModel = false;
/**
* Holds all params passed and named.
*
@ -270,6 +299,7 @@ class Controller extends Object {
* @access public
*/
var $passedArgs = array();
/**
* Triggers Scaffolding
*
@ -278,6 +308,7 @@ class Controller extends Object {
* @link http://book.cakephp.org/view/105/Scaffolding
*/
var $scaffold = false;
/**
* Holds current methods of the controller
*
@ -286,6 +317,7 @@ class Controller extends Object {
* @link
*/
var $methods = array();
/**
* This controller's primary model class name, the Inflector::classify()'ed version of
* the controller's $name property.
@ -296,6 +328,7 @@ class Controller extends Object {
* @access public
*/
var $modelClass = null;
/**
* This controller's model key name, an underscored version of the controller's $modelClass property.
*
@ -305,6 +338,7 @@ class Controller extends Object {
* @access public
*/
var $modelKey = null;
/**
* Holds any validation errors produced by the last call of the validateErrors() method/
*
@ -312,6 +346,7 @@ class Controller extends Object {
* @access public
*/
var $validationErrors = null;
/**
* Constructor.
*
@ -346,6 +381,7 @@ class Controller extends Object {
$this->methods = array_diff($childMethods, $parentMethods);
parent::__construct();
}
/**
* Merge components, helpers, and uses vars from AppController and PluginAppController.
*
@ -427,6 +463,7 @@ class Controller extends Object {
}
}
}
/**
* Loads Model classes based on the the uses property
* see Controller::loadModel(); for more info.
@ -464,6 +501,7 @@ class Controller extends Object {
}
return true;
}
/**
* Loads and instantiates models required by this controller.
* If Controller::persistModel; is true, controller will cache model instances on first request,
@ -528,6 +566,7 @@ class Controller extends Object {
$this->modelNames[] = $modelClass;
}
}
/**
* Redirects to given $url, after turning off $this->autoRender.
* Script execution is halted after the redirect.
@ -640,6 +679,7 @@ class Controller extends Object {
$this->_stop();
}
}
/**
* Convenience method for header()
*
@ -650,6 +690,7 @@ class Controller extends Object {
function header($status) {
header($status);
}
/**
* Saves a variable for use inside a view template.
*
@ -681,6 +722,7 @@ class Controller extends Object {
}
}
}
/**
* Internally redirects one action to another. Examples:
*
@ -699,6 +741,7 @@ class Controller extends Object {
unset($args[0]);
return call_user_func_array(array(&$this, $action), $args);
}
/**
* Controller callback to tie into Auth component.
* Only called when AuthComponent::authorize is set to 'controller'.
@ -713,6 +756,7 @@ class Controller extends Object {
), E_USER_WARNING);
return false;
}
/**
* Returns number of errors in a submitted FORM.
*
@ -728,6 +772,7 @@ class Controller extends Object {
}
return count($errors);
}
/**
* Validates models passed by parameters. Example:
*
@ -752,6 +797,7 @@ class Controller extends Object {
return $this->validationErrors = (count($errors) ? $errors : false);
}
/**
* Instantiates the correct view class, hands it its data, and uses it to render the view output.
*
@ -816,6 +862,7 @@ class Controller extends Object {
return $this->output;
}
/**
* Returns the referring URL for this request.
*
@ -846,6 +893,7 @@ class Controller extends Object {
}
return '/';
}
/**
* Forces the user's browser not to cache the results of the current request.
*
@ -860,6 +908,7 @@ class Controller extends Object {
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
}
/**
* Shows a message to the user for $pause seconds, then redirects to $url.
* Uses flash.ctp as the default layout for the message.
@ -880,6 +929,7 @@ class Controller extends Object {
$this->set('page_title', $message);
$this->render(false, 'flash');
}
/**
* Converts POST'ed form data to a model conditions array, suitable for use in a Model::find() call.
*
@ -936,6 +986,7 @@ class Controller extends Object {
}
return $cond;
}
/**
* Handles automatic pagination of model records.
*
@ -1130,6 +1181,7 @@ class Controller extends Object {
}
return $results;
}
/**
* Called before the controller action.
*
@ -1138,6 +1190,7 @@ class Controller extends Object {
*/
function beforeFilter() {
}
/**
* Called after the controller action is run, but before the view is rendered.
*
@ -1146,6 +1199,7 @@ class Controller extends Object {
*/
function beforeRender() {
}
/**
* Called after the controller action is run and rendered.
*
@ -1154,6 +1208,7 @@ class Controller extends Object {
*/
function afterFilter() {
}
/**
* This method should be overridden in child classes.
*
@ -1165,6 +1220,7 @@ class Controller extends Object {
function _beforeScaffold($method) {
return true;
}
/**
* This method should be overridden in child classes.
*
@ -1176,6 +1232,7 @@ class Controller extends Object {
function _afterScaffoldSave($method) {
return true;
}
/**
* This method should be overridden in child classes.
*
@ -1187,6 +1244,7 @@ class Controller extends Object {
function _afterScaffoldSaveError($method) {
return true;
}
/**
* This method should be overridden in child classes.
* If not it will render a scaffold error.

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Static content controller.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Static content controller
*
@ -33,6 +35,7 @@
* @subpackage cake.cake.libs.controller
*/
class PagesController extends AppController {
/**
* Controller name
*
@ -40,6 +43,7 @@ class PagesController extends AppController {
* @access public
*/
var $name = 'Pages';
/**
* Default helper
*
@ -47,6 +51,7 @@ class PagesController extends AppController {
* @access public
*/
var $helpers = array('Html');
/**
* This controller does not use a model
*
@ -54,6 +59,7 @@ class PagesController extends AppController {
* @access public
*/
var $uses = array();
/**
* Displays a view
*

View file

@ -19,6 +19,7 @@
* @since Cake v 0.10.0.1076
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Scaffolding is a set of automatic actions for starting web development work faster.
*
@ -31,6 +32,7 @@
* @subpackage cake.cake.libs.controller
*/
class Scaffold extends Object {
/**
* Controller object
*
@ -38,6 +40,7 @@ class Scaffold extends Object {
* @access public
*/
var $controller = null;
/**
* Name of the controller to scaffold
*
@ -45,6 +48,7 @@ class Scaffold extends Object {
* @access public
*/
var $name = null;
/**
* Action to be performed.
*
@ -52,6 +56,7 @@ class Scaffold extends Object {
* @access public
*/
var $action = null;
/**
* Name of current model this view context is attached to
*
@ -59,6 +64,7 @@ class Scaffold extends Object {
* @access public
*/
var $model = null;
/**
* Path to View.
*
@ -66,6 +72,7 @@ class Scaffold extends Object {
* @access public
*/
var $viewPath;
/**
* Path parts for creating links in views.
*
@ -73,6 +80,7 @@ class Scaffold extends Object {
* @access public
*/
var $base = null;
/**
* Name of layout to use with this View.
*
@ -80,6 +88,7 @@ class Scaffold extends Object {
* @access public
*/
var $layout = 'default';
/**
* Array of parameter data
*
@ -87,6 +96,7 @@ class Scaffold extends Object {
* @access public
*/
var $params;
/**
* File extension. Defaults to Cake's template ".ctp".
*
@ -94,6 +104,7 @@ class Scaffold extends Object {
* @access public
*/
var $ext = '.ctp';
/**
* Sub-directory for this view file.
*
@ -101,6 +112,7 @@ class Scaffold extends Object {
* @access public
*/
var $subDir = null;
/**
* Plugin name.
*
@ -108,6 +120,7 @@ class Scaffold extends Object {
* @access public
*/
var $plugin = null;
/**
* valid session.
*
@ -115,6 +128,7 @@ class Scaffold extends Object {
* @access public
*/
var $_validSession = null;
/**
* List of variables to collect from the associated controller
*
@ -125,6 +139,7 @@ class Scaffold extends Object {
'action', 'base', 'webroot', 'layout', 'name',
'viewPath', 'ext', 'params', 'data', 'plugin', 'cacheAction'
);
/**
* Title HTML element for current scaffolded view
*
@ -132,6 +147,7 @@ class Scaffold extends Object {
* @access public
*/
var $scaffoldTitle = null;
/**
* Construct and set up given controller with given parameters.
*
@ -186,6 +202,7 @@ class Scaffold extends Object {
isset($this->controller->Session) && $this->controller->Session->valid() != false
);
}
/**
* Outputs the content of a scaffold method passing it through the Controller::afterFilter()
*
@ -196,6 +213,7 @@ class Scaffold extends Object {
$this->controller->afterFilter();
echo($this->controller->output);
}
/**
* Renders a view action of scaffolded model.
*
@ -231,6 +249,7 @@ class Scaffold extends Object {
return $this->__scaffoldError();
}
}
/**
* Renders index action of scaffolded model.
*
@ -250,6 +269,7 @@ class Scaffold extends Object {
return $this->__scaffoldError();
}
}
/**
* Renders an add or edit action for scaffolded model.
*
@ -261,6 +281,7 @@ class Scaffold extends Object {
$this->controller->render($action, $this->layout);
$this->_output();
}
/**
* Saves or updates the scaffolded model.
*
@ -354,6 +375,7 @@ class Scaffold extends Object {
return $this->__scaffoldError();
}
}
/**
* Performs a delete on given scaffolded Model.
*
@ -407,6 +429,7 @@ class Scaffold extends Object {
return $this->__scaffoldError();
}
}
/**
* Show a scaffold error
*
@ -417,6 +440,7 @@ class Scaffold extends Object {
return $this->controller->render('error', $this->layout);
$this->_output();
}
/**
* When methods are now present in a controller
* scaffoldView is used to call default Scaffold methods if:
@ -489,6 +513,7 @@ class Scaffold extends Object {
)));
}
}
/**
* Returns associations for controllers models.
*
@ -529,6 +554,7 @@ if (!class_exists('ThemeView')) {
}
class ScaffoldView extends ThemeView {
/**
* Override _getViewFileName
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Error handler
*
@ -25,6 +26,7 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Controller', 'App');
/**
* Error Handling Controller
*
@ -35,12 +37,14 @@ App::import('Controller', 'App');
*/
class CakeErrorController extends AppController {
var $name = 'CakeError';
/**
* Uses Property
*
* @var array
*/
var $uses = array();
/**
* __construct
*
@ -56,6 +60,7 @@ class CakeErrorController extends AppController {
$this->_set(array('cacheAction' => false, 'viewPath' => 'errors'));
}
}
/**
* Error Handler.
*
@ -67,6 +72,7 @@ class CakeErrorController extends AppController {
* @subpackage cake.cake.libs
*/
class ErrorHandler extends Object {
/**
* Controller instance.
*
@ -74,6 +80,7 @@ class ErrorHandler extends Object {
* @access public
*/
var $controller = null;
/**
* Class constructor.
*
@ -118,6 +125,7 @@ class ErrorHandler extends Object {
$this->dispatchMethod($method, $messages);
$this->_stop();
}
/**
* Displays an error page (e.g. 404 Not found).
*
@ -134,6 +142,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('error404');
}
/**
* Convenience method to display a 404 page.
*
@ -156,6 +165,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('error404');
}
/**
* Renders the Missing Controller web page.
*
@ -173,6 +183,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('missingController');
}
/**
* Renders the Missing Action web page.
*
@ -191,6 +202,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('missingAction');
}
/**
* Renders the Private Action web page.
*
@ -207,6 +219,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('privateAction');
}
/**
* Renders the Missing Table web page.
*
@ -223,6 +236,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('missingTable');
}
/**
* Renders the Missing Database web page.
*
@ -235,6 +249,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('missingScaffolddb');
}
/**
* Renders the Missing View web page.
*
@ -252,6 +267,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('missingView');
}
/**
* Renders the Missing Layout web page.
*
@ -268,6 +284,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('missingLayout');
}
/**
* Renders the Database Connection web page.
*
@ -283,6 +300,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('missingConnection');
}
/**
* Renders the Missing Helper file web page.
*
@ -299,6 +317,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('missingHelperFile');
}
/**
* Renders the Missing Helper class web page.
*
@ -315,6 +334,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('missingHelperClass');
}
/**
* Renders the Missing Component file web page.
*
@ -332,6 +352,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('missingComponentFile');
}
/**
* Renders the Missing Component class web page.
*
@ -349,6 +370,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('missingComponentClass');
}
/**
* Renders the Missing Model class web page.
*
@ -364,6 +386,7 @@ class ErrorHandler extends Object {
));
$this->_outputMessage('missingModel');
}
/**
* Output message
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Convenience class for reading, writing and appending to files.
*
@ -22,6 +23,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Included libraries.
*
@ -32,6 +34,7 @@ if (!class_exists('Object')) {
if (!class_exists('Folder')) {
require LIBS . 'folder.php';
}
/**
* Convenience class for reading, writing and appending to files.
*
@ -39,6 +42,7 @@ if (!class_exists('Folder')) {
* @subpackage cake.cake.libs
*/
class File extends Object {
/**
* Folder object of the File
*
@ -46,6 +50,7 @@ class File extends Object {
* @access public
*/
var $Folder = null;
/**
* Filename
*
@ -53,6 +58,7 @@ class File extends Object {
* @access public
*/
var $name = null;
/**
* file info
*
@ -60,6 +66,7 @@ class File extends Object {
* @access public
*/
var $info = array();
/**
* Holds the file handler resource if the file is opened
*
@ -67,6 +74,7 @@ class File extends Object {
* @access public
*/
var $handle = null;
/**
* enable locking for file reading and writing
*
@ -74,6 +82,7 @@ class File extends Object {
* @access public
*/
var $lock = null;
/**
* path property
*
@ -83,6 +92,7 @@ class File extends Object {
* @access public
*/
var $path = null;
/**
* Constructor
*
@ -109,6 +119,7 @@ class File extends Object {
}
}
}
/**
* Closes the current file if it is opened
*
@ -117,6 +128,7 @@ class File extends Object {
function __destruct() {
$this->close();
}
/**
* Creates the File.
*
@ -134,6 +146,7 @@ class File extends Object {
}
return false;
}
/**
* Opens the current file with a given $mode
*
@ -159,6 +172,7 @@ class File extends Object {
}
return false;
}
/**
* Return the contents of this File as a string.
*
@ -196,6 +210,7 @@ class File extends Object {
}
return $data;
}
/**
* Sets or gets the offset for the currently opened file.
*
@ -214,6 +229,7 @@ class File extends Object {
}
return false;
}
/**
* Prepares a ascii string for writing
* fixes line endings
@ -257,6 +273,7 @@ class File extends Object {
}
return $success;
}
/**
* Append given data string to this File.
*
@ -268,6 +285,7 @@ class File extends Object {
function append($data, $force = false) {
return $this->write($data, 'a', $force);
}
/**
* Closes the current file if it is opened.
*
@ -280,6 +298,7 @@ class File extends Object {
}
return fclose($this->handle);
}
/**
* Deletes the File.
*
@ -293,6 +312,7 @@ class File extends Object {
}
return false;
}
/**
* Returns the File extension.
*
@ -308,6 +328,7 @@ class File extends Object {
}
return $this->info;
}
/**
* Returns the File extension.
*
@ -323,6 +344,7 @@ class File extends Object {
}
return false;
}
/**
* Returns the File name without extension.
*
@ -340,6 +362,7 @@ class File extends Object {
}
return false;
}
/**
* makes filename safe for saving
*
@ -356,6 +379,7 @@ class File extends Object {
}
return preg_replace( "/(?:[^\w\.-]+)/", "_", basename($name, $ext));
}
/**
* Get md5 Checksum of file with previous check of Filesize
*
@ -375,6 +399,7 @@ class File extends Object {
return false;
}
/**
* Returns the full path of the File.
*
@ -387,6 +412,7 @@ class File extends Object {
}
return $this->path;
}
/**
* Returns true if the File exists.
*
@ -396,6 +422,7 @@ class File extends Object {
function exists() {
return (file_exists($this->path) && is_file($this->path));
}
/**
* Returns the "chmod" (permissions) of the File.
*
@ -408,6 +435,7 @@ class File extends Object {
}
return false;
}
/**
* Returns the Filesize
*
@ -420,6 +448,7 @@ class File extends Object {
}
return false;
}
/**
* Returns true if the File is writable.
*
@ -429,6 +458,7 @@ class File extends Object {
function writable() {
return is_writable($this->path);
}
/**
* Returns true if the File is executable.
*
@ -438,6 +468,7 @@ class File extends Object {
function executable() {
return is_executable($this->path);
}
/**
* Returns true if the File is readable.
*
@ -447,6 +478,7 @@ class File extends Object {
function readable() {
return is_readable($this->path);
}
/**
* Returns the File's owner.
*
@ -459,6 +491,7 @@ class File extends Object {
}
return false;
}
/**
* Returns the File group.
*
@ -471,6 +504,7 @@ class File extends Object {
}
return false;
}
/**
* Returns last access time.
*
@ -483,6 +517,7 @@ class File extends Object {
}
return false;
}
/**
* Returns last modified time.
*
@ -495,6 +530,7 @@ class File extends Object {
}
return false;
}
/**
* Returns the current folder.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Convenience class for handling directories.
*
@ -22,6 +23,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Included libraries.
*
@ -29,6 +31,7 @@
if (!class_exists('Object')) {
uses('object');
}
/**
* Folder structure browser, lists folders and files.
*
@ -38,6 +41,7 @@ if (!class_exists('Object')) {
* @subpackage cake.cake.libs
*/
class Folder extends Object {
/**
* Path to Folder.
*
@ -45,6 +49,7 @@ class Folder extends Object {
* @access public
*/
var $path = null;
/**
* Sortedness.
*
@ -52,6 +57,7 @@ class Folder extends Object {
* @access public
*/
var $sort = false;
/**
* mode to be used on create.
*
@ -59,6 +65,7 @@ class Folder extends Object {
* @access public
*/
var $mode = 0755;
/**
* holds messages from last method.
*
@ -66,6 +73,7 @@ class Folder extends Object {
* @access private
*/
var $__messages = array();
/**
* holds errors from last method.
*
@ -73,6 +81,7 @@ class Folder extends Object {
* @access private
*/
var $__errors = false;
/**
* holds array of complete directory paths.
*
@ -80,6 +89,7 @@ class Folder extends Object {
* @access private
*/
var $__directories;
/**
* holds array of complete file paths.
*
@ -87,6 +97,7 @@ class Folder extends Object {
* @access private
*/
var $__files;
/**
* Constructor.
*
@ -113,6 +124,7 @@ class Folder extends Object {
$this->cd($path);
}
}
/**
* Return current path.
*
@ -122,6 +134,7 @@ class Folder extends Object {
function pwd() {
return $this->path;
}
/**
* Change directory to $path.
*
@ -136,6 +149,7 @@ class Folder extends Object {
}
return false;
}
/**
* Returns an array of the contents of the current directory.
* The returned array holds two arrays: One of directories and one of files.
@ -179,6 +193,7 @@ class Folder extends Object {
closedir($dir);
return array($dirs, $files);
}
/**
* Returns an array of all matching files in current directory.
*
@ -190,6 +205,7 @@ class Folder extends Object {
list($dirs, $files) = $this->read($sort);
return array_values(preg_grep('/^' . $regexpPattern . '$/i', $files)); ;
}
/**
* Returns an array of all matching files in and below current directory.
*
@ -203,6 +219,7 @@ class Folder extends Object {
$this->cd($startsOn);
return $out;
}
/**
* Private helper function for findRecursive.
*
@ -227,6 +244,7 @@ class Folder extends Object {
}
return $found;
}
/**
* Returns true if given $path is a Windows path.
*
@ -241,6 +259,7 @@ class Folder extends Object {
}
return false;
}
/**
* Returns true if given $path is an absolute path.
*
@ -253,6 +272,7 @@ class Folder extends Object {
$match = preg_match('/^\\//', $path) || preg_match('/^[A-Z]:\\\\/i', $path);
return $match;
}
/**
* Returns a correct set of slashes for given $path. (\\ for Windows paths and / for other paths.)
*
@ -264,6 +284,7 @@ class Folder extends Object {
function normalizePath($path) {
return Folder::correctSlashFor($path);
}
/**
* Returns a correct set of slashes for given $path. (\\ for Windows paths and / for other paths.)
*
@ -278,6 +299,7 @@ class Folder extends Object {
}
return '/';
}
/**
* Returns $path with added terminating slash (corrected for Windows or other OS).
*
@ -292,6 +314,7 @@ class Folder extends Object {
}
return $path . Folder::correctSlashFor($path);
}
/**
* Returns $path with $element added, with correct slash in-between.
*
@ -304,6 +327,7 @@ class Folder extends Object {
function addPathElement($path, $element) {
return Folder::slashTerm($path) . $element;
}
/**
* Returns true if the File is in a given CakePath.
*
@ -316,6 +340,7 @@ class Folder extends Object {
return $this->inPath($newdir);
}
/**
* Returns true if the File is in given path.
*
@ -337,6 +362,7 @@ class Folder extends Object {
return false;
}
}
/**
* Change the mode on a directory structure recursively. This includes changing the mode on files as well.
*
@ -388,6 +414,7 @@ class Folder extends Object {
}
return false;
}
/**
* Returns an array of nested directories and files in each directory
*
@ -423,6 +450,7 @@ class Folder extends Object {
return $this->__files;
}
/**
* Private method to list directories and files in each directory
*
@ -437,6 +465,7 @@ class Folder extends Object {
$this->__files = array_merge($this->__files, $files);
}
}
/**
* Create a directory structure recursively.
*
@ -476,6 +505,7 @@ class Folder extends Object {
}
return true;
}
/**
* Returns the size in bytes of this Folder.
*
@ -512,6 +542,7 @@ class Folder extends Object {
}
return $size;
}
/**
* Recursively Remove directories if system allow.
*
@ -558,6 +589,7 @@ class Folder extends Object {
}
return true;
}
/**
* Recursive directory copy.
*
@ -633,6 +665,7 @@ class Folder extends Object {
}
return true;
}
/**
* Recursive directory move.
*
@ -655,6 +688,7 @@ class Folder extends Object {
}
return false;
}
/**
* get messages from latest method
*
@ -664,6 +698,7 @@ class Folder extends Object {
function messages() {
return $this->__messages;
}
/**
* get error from latest method
*
@ -673,6 +708,7 @@ class Folder extends Object {
function errors() {
return $this->__errors;
}
/**
* nix flavored alias
*
@ -682,6 +718,7 @@ class Folder extends Object {
function ls($sort = true, $exceptions = false) {
return $this->read($sort, $exceptions);
}
/**
* nix flavored alias
*
@ -691,6 +728,7 @@ class Folder extends Object {
function mkdir($pathname, $mode = 0755) {
return $this->create($pathname, $mode);
}
/**
* nix flavored alias
*
@ -700,6 +738,7 @@ class Folder extends Object {
function cp($options) {
return $this->copy($options);
}
/**
* nix flavored alias
*
@ -709,6 +748,7 @@ class Folder extends Object {
function mv($options) {
return $this->move($options);
}
/**
* nix flavored alias
*
@ -718,6 +758,7 @@ class Folder extends Object {
function rm($path) {
return $this->delete($path);
}
/**
* Get the real path (taking ".." and such into account)
*
@ -757,6 +798,7 @@ class Folder extends Object {
return Folder::slashTerm($newpath);
}
/**
* Returns true if given $path ends in a slash (i.e. is slash-terminated).
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* HTTP Socket connection class.
*
@ -23,6 +24,7 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
App::import('Core', array('CakeSocket', 'Set', 'Router'));
/**
* Cake network socket connection class.
*
@ -32,6 +34,7 @@ App::import('Core', array('CakeSocket', 'Set', 'Router'));
* @subpackage cake.cake.libs
*/
class HttpSocket extends CakeSocket {
/**
* Object description
*
@ -39,6 +42,7 @@ class HttpSocket extends CakeSocket {
* @access public
*/
var $description = 'HTTP-based DataSource Interface';
/**
* When one activates the $quirksMode by setting it to true, all checks meant to
* enforce RFC 2616 (HTTP/1.1 specs).
@ -48,6 +52,7 @@ class HttpSocket extends CakeSocket {
* @access public
*/
var $quirksMode = false;
/**
* The default values to use for a request
*
@ -81,6 +86,7 @@ class HttpSocket extends CakeSocket {
'raw' => null,
'cookies' => array()
);
/**
* The default structure for storing the response
*
@ -103,6 +109,7 @@ class HttpSocket extends CakeSocket {
'body' => '',
'cookies' => array()
);
/**
* Default configuration settings for the HttpSocket
*
@ -129,6 +136,7 @@ class HttpSocket extends CakeSocket {
'cookies' => array()
)
);
/**
* String that represents a line break.
*
@ -154,6 +162,7 @@ class HttpSocket extends CakeSocket {
}
parent::__construct($this->config);
}
/**
* Issue the specified request.
*
@ -263,6 +272,7 @@ class HttpSocket extends CakeSocket {
return $this->response['body'];
}
/**
* Issues a GET request to the specified URI, query, and request.
*
@ -300,6 +310,7 @@ class HttpSocket extends CakeSocket {
$request = Set::merge(array('method' => 'POST', 'uri' => $uri, 'body' => $data), $request);
return $this->request($request);
}
/**
* Issues a PUT request to the specified URI, query, and request.
*
@ -313,6 +324,7 @@ class HttpSocket extends CakeSocket {
$request = Set::merge(array('method' => 'PUT', 'uri' => $uri, 'body' => $data), $request);
return $this->request($request);
}
/**
* Issues a DELETE request to the specified URI, query, and request.
*
@ -326,6 +338,7 @@ class HttpSocket extends CakeSocket {
$request = Set::merge(array('method' => 'DELETE', 'uri' => $uri, 'body' => $data), $request);
return $this->request($request);
}
/**
* undocumented function
*
@ -361,6 +374,7 @@ class HttpSocket extends CakeSocket {
}
return $this->_buildUri($url);
}
/**
* Parses the given message and breaks it down in parts.
*
@ -422,6 +436,7 @@ class HttpSocket extends CakeSocket {
return $response;
}
/**
* Generic function to decode a $body with a given $encoding. Returns either an array with the keys
* 'body' and 'header' or false on failure.
@ -448,6 +463,7 @@ class HttpSocket extends CakeSocket {
}
return $this->{$decodeMethod}($body);
}
/**
* Decodes a chunked message $body and returns either an array with the keys 'body' and 'header' or false as
* a result.
@ -510,6 +526,7 @@ class HttpSocket extends CakeSocket {
}
return array('body' => $decodedBody, 'header' => $entityHeader);
}
/**
* Parses and sets the specified URI into current request configuration.
*
@ -542,6 +559,7 @@ class HttpSocket extends CakeSocket {
$this->config = Set::merge($this->config, array_intersect_key($this->config['request']['uri'], $this->config));
return $this->config;
}
/**
* Takes a $uri array and turns it into a fully qualified URL string
*
@ -588,6 +606,7 @@ class HttpSocket extends CakeSocket {
}
return $uriTemplate;
}
/**
* Parses the given URI and breaks it down into pieces as an indexed array with elements
* such as 'scheme', 'port', 'query'.
@ -647,6 +666,7 @@ class HttpSocket extends CakeSocket {
}
return $uri;
}
/**
* This function can be thought of as a reverse to PHP5's http_build_query(). It takes a given query string and turns it into an array and
* supports nesting by using the php bracket syntax. So this menas you can parse queries like:
@ -710,6 +730,7 @@ class HttpSocket extends CakeSocket {
}
return $parsedQuery;
}
/**
* Builds a request line according to HTTP/1.1 specs. Activate quirks mode to work outside specs.
*
@ -744,6 +765,7 @@ class HttpSocket extends CakeSocket {
}
return $request['method'].' '.$request['uri'].' '.$versionToken.$this->lineBreak;
}
/**
* Serializes an array for transport.
*
@ -760,6 +782,7 @@ class HttpSocket extends CakeSocket {
}
return substr(Router::queryString($data), 1);
}
/**
* Builds the header.
*
@ -838,6 +861,7 @@ class HttpSocket extends CakeSocket {
}
return $header;
}
/**
* undocumented function
*
@ -872,6 +896,7 @@ class HttpSocket extends CakeSocket {
}
return $cookies;
}
/**
* undocumented function
*
@ -888,6 +913,7 @@ class HttpSocket extends CakeSocket {
$header = $this->_buildHeader(array('Cookie' => $header), 'pragmatic');
return $header;
}
/**
* Unescapes a given $token according to RFC 2616 (HTTP 1.1 specs)
*
@ -901,6 +927,7 @@ class HttpSocket extends CakeSocket {
$token = preg_replace($regex, '\\1', $token);
return $token;
}
/**
* Escapes a given $token according to RFC 2616 (HTTP 1.1 specs)
*
@ -914,6 +941,7 @@ class HttpSocket extends CakeSocket {
$token = preg_replace($regex, '"\\1"', $token);
return $token;
}
/**
* Gets escape chars according to RFC 2616 (HTTP 1.1 specs).
*
@ -942,6 +970,7 @@ class HttpSocket extends CakeSocket {
}
return $escape;
}
/**
* Resets the state of this HttpSocket instance to it's initial state (before Object::__construct got executed) or does
* the same thing partially for the request and the response property only.

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -24,10 +25,12 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Included libraries.
*/
App::import('Core', 'l10n');
/**
* Short description for file.
*
@ -37,6 +40,7 @@ App::import('Core', 'l10n');
* @subpackage cake.cake.libs
*/
class I18n extends Object {
/**
* Instance of the I10n class for localization
*
@ -44,6 +48,7 @@ class I18n extends Object {
* @access public
*/
var $l10n = null;
/**
* Current domain of translation
*
@ -51,6 +56,7 @@ class I18n extends Object {
* @access public
*/
var $domain = null;
/**
* Current category of translation
*
@ -58,6 +64,7 @@ class I18n extends Object {
* @access public
*/
var $category = 'LC_MESSAGES';
/**
* Current language used for translations
*
@ -65,6 +72,7 @@ class I18n extends Object {
* @access private
*/
var $__lang = null;
/**
* Translation strings for a specific domain read from the .mo or .po files
*
@ -72,6 +80,7 @@ class I18n extends Object {
* @access private
*/
var $__domains = array();
/**
* Set to true when I18N::__bindTextDomain() is called for the first time.
* If a translation file is found it is set to false again
@ -80,6 +89,7 @@ class I18n extends Object {
* @access private
*/
var $__noLocale = false;
/**
* Determine if $__domains cache should be wrote
*
@ -87,6 +97,7 @@ class I18n extends Object {
* @access private
*/
var $__cache = false;
/**
* Set to true when I18N::__bindTextDomain() is called for the first time.
* If a translation file is found it is set to false again
@ -97,6 +108,7 @@ class I18n extends Object {
var $__categories = array(
'LC_ALL', 'LC_COLLATE', 'LC_CTYPE', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME', 'LC_MESSAGES'
);
/**
* Return a static instance of the I18n class
*
@ -111,6 +123,7 @@ class I18n extends Object {
}
return $instance[0];
}
/**
* Used by the translation functions in basics.php
* Can also be used like I18n::translate(); but only if the App::import('I18n'); has been used to load the class.
@ -193,6 +206,7 @@ class I18n extends Object {
}
return($singular);
}
/**
* Attempts to find the plural form of a string.
*
@ -242,6 +256,7 @@ class I18n extends Object {
return $n == 1 ? 0 : ($n == 2 ? 1 : ($n >= 3 && $n <= 6 ? 2 : ($n >= 7 && $n <= 10 ? 3 : 4)));
}
}
/**
* Binds the given domain to a file in the specified directory.
*
@ -327,6 +342,7 @@ class I18n extends Object {
}
return($domain);
}
/**
* Loads the binary .mo file for translation and sets the values for this translation in the var I18n::__domains
*
@ -366,6 +382,7 @@ class I18n extends Object {
}
}
}
/**
* Loads the text .po file for translation and sets the values for this translation in the var I18n::__domains
*
@ -436,6 +453,7 @@ class I18n extends Object {
$merge[""] = $header;
return $this->__domains[$this->category][$this->__lang][$domain] = array_merge($merge ,$translations);
}
/**
* Object destructor
*

View file

@ -19,6 +19,7 @@
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Included libraries.
*
@ -26,6 +27,7 @@
if (!class_exists('Object')) {
require_once(LIBS . 'object.php');
}
/**
* Pluralize and singularize English words.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Short description for file.
*
@ -33,6 +35,7 @@
* @subpackage cake.cake.libs
*/
class L10n extends Object {
/**
* The language for current locale
*
@ -40,6 +43,7 @@ class L10n extends Object {
* @access public
*/
var $language = 'English (United States)';
/**
* Locale search paths
*
@ -47,6 +51,7 @@ class L10n extends Object {
* @access public
*/
var $languagePath = array('eng');
/**
* ISO 639-3 for current locale
*
@ -54,6 +59,7 @@ class L10n extends Object {
* @access public
*/
var $lang = 'eng';
/**
* Locale
*
@ -61,6 +67,7 @@ class L10n extends Object {
* @access public
*/
var $locale = 'en_us';
/**
* Default ISO 639-3 language.
*
@ -70,6 +77,7 @@ class L10n extends Object {
* @access public
*/
var $default = null;
/**
* Encoding used for current locale
*
@ -77,6 +85,7 @@ class L10n extends Object {
* @access public
*/
var $charset = 'utf-8';
/**
* Set to true if a locale is found
*
@ -84,6 +93,7 @@ class L10n extends Object {
* @access public
*/
var $found = false;
/**
* Maps ISO 639-3 to I10n::__l10nCatalog
*
@ -167,6 +177,7 @@ class L10n extends Object {
/* Xhosa */ 'xho' => 'xh',
/* Yiddish */ 'yid' => 'yi',
/* Zulu */ 'zul' => 'zu');
/**
* HTTP_ACCEPT_LANGUAGE catalog
*
@ -314,6 +325,7 @@ class L10n extends Object {
'zh-sg' => array('language' => 'Chinese (Singapore)', 'locale' => 'zh_sg', 'localeFallback' => 'chi', 'charset' => 'utf-8'),
'zh-tw' => array('language' => 'Chinese (Taiwan)', 'locale' => 'zh_tw', 'localeFallback' => 'chi', 'charset' => 'utf-8'),
'zu' => array('language' => 'Zulu', 'locale' => 'zul', 'localeFallback' => 'zul', 'charset' => 'utf-8'));
/**
* Class constructor
*/
@ -323,6 +335,7 @@ class L10n extends Object {
}
parent::__construct();
}
/**
* Gets the settings for $language.
* If $language is null it attempt to get settings from I10n::__autoLanguage(); if this fails
@ -338,6 +351,7 @@ class L10n extends Object {
return $this->__setLanguage();
}
}
/**
* Sets the class vars to correct values for $language.
* If $language is null it will use the DEFAULT_LANGUAGE if defined
@ -386,6 +400,7 @@ class L10n extends Object {
return $language;
}
}
/**
* Attempts to find the locale settings based on the HTTP_ACCEPT_LANGUAGE variable
*
@ -413,6 +428,7 @@ class L10n extends Object {
}
return false;
}
/**
* Attempts to find locale for language, or language for locale
*
@ -439,6 +455,7 @@ class L10n extends Object {
}
return $this->__l10nMap;
}
/**
* Attempts to find catalog record for requested language
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* MagicDb parser and file analyzer
*
@ -25,6 +26,7 @@
if (!class_exists('File')) {
uses('object', 'file');
}
/**
* A class to parse and use the MagicDb for file type analysis
*
@ -32,6 +34,7 @@ if (!class_exists('File')) {
* @subpackage cake.tests.cases.libs
*/
class MagicDb extends Object {
/**
* Holds the parsed MagicDb for this class instance
*
@ -179,6 +182,7 @@ class MagicDb extends Object {
* @subpackage cake.tests.cases.libs
*/
class MagicFileResource extends Object{
/**
* undocumented variable
*
@ -186,6 +190,7 @@ class MagicFileResource extends Object{
* @access public
*/
var $resource = null;
/**
* undocumented variable
*
@ -193,6 +198,7 @@ class MagicFileResource extends Object{
* @access public
*/
var $offset = 0;
/**
* undocumented function
*
@ -207,6 +213,7 @@ class MagicFileResource extends Object{
$this->resource = $file;
}
}
/**
* undocumented function
*
@ -234,6 +241,7 @@ class MagicFileResource extends Object{
$val = $this->extract($offset, $type, $expected);
return $val == $expected;
}
/**
* undocumented function
*
@ -248,6 +256,7 @@ class MagicFileResource extends Object{
}
return $this->resource->read($length);
}
/**
* undocumented function
*
@ -267,6 +276,7 @@ class MagicFileResource extends Object{
break;
}
}
/**
* undocumented function
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Application model for Cake.
*
@ -25,6 +26,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Application model for Cake.
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* ACL behavior class.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Short description for file
*
@ -33,6 +35,7 @@
* @subpackage cake.cake.libs.model.behaviors
*/
class AclBehavior extends ModelBehavior {
/**
* Maps ACL type options to ACL models
*
@ -40,6 +43,7 @@ class AclBehavior extends ModelBehavior {
* @access protected
*/
var $__typeMaps = array('requester' => 'Aro', 'controlled' => 'Aco');
/**
* Sets up the configuation for the model, and loads ACL models if they haven't been already
*
@ -62,6 +66,7 @@ class AclBehavior extends ModelBehavior {
trigger_error("Callback parentNode() not defined in {$model->alias}", E_USER_WARNING);
}
}
/**
* Retrieves the Aro/Aco node for this model
*
@ -76,6 +81,7 @@ class AclBehavior extends ModelBehavior {
}
return $model->{$type}->node($ref);
}
/**
* Creates a new ARO/ACO node bound to this record
*
@ -101,6 +107,7 @@ class AclBehavior extends ModelBehavior {
));
}
}
/**
* Destroys the ARO/ACO node bound to the deleted record
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Behavior for binding management.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Behavior to allow for dynamic and atomic manipulation of a Model's associations used for a find call. Most useful for limiting
* the amount of associations and data returned.
@ -32,6 +34,7 @@
* @subpackage cake.cake.console.libs
*/
class ContainableBehavior extends ModelBehavior {
/**
* Types of relationships available for models
*
@ -39,6 +42,7 @@ class ContainableBehavior extends ModelBehavior {
* @access private
*/
var $types = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
/**
* Runtime configuration for this behavior
*
@ -46,6 +50,7 @@ class ContainableBehavior extends ModelBehavior {
* @access private
*/
var $runtime = array();
/**
* Initiate behavior for the model using specified settings.
*
@ -73,6 +78,7 @@ class ContainableBehavior extends ModelBehavior {
}
$this->settings[$Model->alias] = array_merge($this->settings[$Model->alias], $settings);
}
/**
* Runs before a find() operation. Used to allow 'contain' setting
* as part of the find call, like this:
@ -200,6 +206,7 @@ class ContainableBehavior extends ModelBehavior {
$query['fields'] = array_unique($query['fields']);
return $query;
}
/**
* Resets original associations on models that may have receive multiple,
* subsequent unbindings.
@ -217,6 +224,7 @@ class ContainableBehavior extends ModelBehavior {
}
}
}
/**
* Unbinds all relations from a model except the specified ones. Calling this function without
* parameters unbinds all related models.
@ -230,6 +238,7 @@ class ContainableBehavior extends ModelBehavior {
$contain = call_user_func_array('am', array_slice($args, 1));
$this->runtime[$Model->alias]['contain'] = $contain;
}
/**
* Permanently restore the original binding settings of given model, useful
* for restoring the bindings after using 'reset' => false as part of the
@ -253,6 +262,7 @@ class ContainableBehavior extends ModelBehavior {
}
}
}
/**
* Process containments for model.
*
@ -357,6 +367,7 @@ class ContainableBehavior extends ModelBehavior {
$containments['depth'] = empty($depths) ? 0 : max($depths);
return $containments;
}
/**
* Calculate needed fields to fetch the required bindings for the given model.
*
@ -404,6 +415,7 @@ class ContainableBehavior extends ModelBehavior {
}
return array_unique($fields);
}
/**
* Build the map of containments
*

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Short description for file.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Short description for file.
*
@ -33,10 +35,12 @@
* @subpackage cake.cake.libs.model.behaviors
*/
class TranslateBehavior extends ModelBehavior {
/**
* Used for runtime configuration of model
*/
var $runtime = array();
/**
* Callback
*
@ -69,6 +73,7 @@ class TranslateBehavior extends ModelBehavior {
$this->translateModel($model);
return $this->bindTranslation($model, $config, false);
}
/**
* Callback
*
@ -80,6 +85,7 @@ class TranslateBehavior extends ModelBehavior {
unset($this->settings[$model->alias]);
unset($this->runtime[$model->alias]);
}
/**
* beforeFind Callback
*
@ -200,6 +206,7 @@ class TranslateBehavior extends ModelBehavior {
$this->runtime[$model->alias]['beforeFind'] = $addFields;
return $query;
}
/**
* afterFind Callback
*
@ -244,6 +251,7 @@ class TranslateBehavior extends ModelBehavior {
}
return $results;
}
/**
* beforeValidate Callback
*
@ -276,6 +284,7 @@ class TranslateBehavior extends ModelBehavior {
$this->runtime[$model->alias]['beforeSave'] = $tempData;
return true;
}
/**
* afterSave Callback
*
@ -319,6 +328,7 @@ class TranslateBehavior extends ModelBehavior {
}
}
}
/**
* afterDelete Callback
*
@ -330,6 +340,7 @@ class TranslateBehavior extends ModelBehavior {
$conditions = array('model' => $model->alias, 'foreign_key' => $model->id);
$RuntimeModel->deleteAll($conditions);
}
/**
* Get selected locale for model
*
@ -348,6 +359,7 @@ class TranslateBehavior extends ModelBehavior {
return $model->locale;
}
/**
* Get instance of model for translations
*
@ -375,6 +387,7 @@ class TranslateBehavior extends ModelBehavior {
}
return $this->runtime[$model->alias]['model'];
}
/**
* Bind translation for fields, optionally with hasMany association for
* fake field
@ -447,6 +460,7 @@ class TranslateBehavior extends ModelBehavior {
}
return true;
}
/**
* Unbind translation for fields, optionally unbinds hasMany association for
* fake field
@ -499,6 +513,7 @@ class TranslateBehavior extends ModelBehavior {
}
}
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
/**
* @package cake
* @subpackage cake.cake.libs.model.behaviors

View file

@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
/**
* Tree behavior class.
*
@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Tree Behavior.
*
@ -34,12 +36,14 @@
* @subpackage cake.cake.libs.model.behaviors
*/
class TreeBehavior extends ModelBehavior {
/**
* Errors
*
* @var array
*/
var $errors = array();
/**
* Defaults
*
@ -50,6 +54,7 @@ class TreeBehavior extends ModelBehavior {
'parent' => 'parent_id', 'left' => 'lft', 'right' => 'rght',
'scope' => '1 = 1', 'type' => 'nested', '__parentChange' => false, 'recursive' => -1
);
/**
* Initiate Tree behavior
*
@ -72,6 +77,7 @@ class TreeBehavior extends ModelBehavior {
}
$this->settings[$Model->alias] = $settings;
}
/**
* After save method. Called after all saves
*
@ -94,6 +100,7 @@ class TreeBehavior extends ModelBehavior {
return $this->_setParent($Model, $Model->data[$Model->alias][$parent]);
}
}
/**
* Before delete method. Called before all deletes
*
@ -123,6 +130,7 @@ class TreeBehavior extends ModelBehavior {
$this->__sync($Model, $diff, '-', '> ' . $data[$right]);
return true;
}
/**
* Before save method. Called before all saves
*
@ -196,6 +204,7 @@ class TreeBehavior extends ModelBehavior {
}
return true;
}
/**
* Get the number of child nodes
*
@ -236,6 +245,7 @@ class TreeBehavior extends ModelBehavior {
}
return ($data[$right] - $data[$left] - 1) / 2;
}
/**
* Get the child nodes of the current model
*
@ -297,6 +307,7 @@ class TreeBehavior extends ModelBehavior {
}
return $Model->find('all', compact('conditions', 'fields', 'order', 'limit', 'page', 'recursive'));
}
/**
* A convenience method for returning a hierarchical array used for HTML select boxes
*
@ -352,6 +363,7 @@ class TreeBehavior extends ModelBehavior {
}
return Set::combine($results, $keyPath, $valuePath);
}
/**
* Get the parent node
*
@ -385,6 +397,7 @@ class TreeBehavior extends ModelBehavior {
}
return false;
}
/**
* Get the path to the given node
*
@ -420,6 +433,7 @@ class TreeBehavior extends ModelBehavior {
));
return $results;
}
/**
* Reorder the node without changing the parent.
*
@ -477,6 +491,7 @@ class TreeBehavior extends ModelBehavior {
}
return true;
}
/**
* Reorder the node without changing the parent.
*
@ -535,6 +550,7 @@ class TreeBehavior extends ModelBehavior {
}
return true;
}
/**
* Recover a corrupted tree
*
@ -609,6 +625,7 @@ class TreeBehavior extends ModelBehavior {
}
return true;
}
/**
* Reorder method.
*
@ -651,6 +668,7 @@ class TreeBehavior extends ModelBehavior {
}
return true;
}
/**
* Remove the current node from the tree, and reparent all children up one level.
*
@ -720,6 +738,7 @@ class TreeBehavior extends ModelBehavior {
);
}
}
/**
* Check if the current tree is valid.
*
@ -789,6 +808,7 @@ class TreeBehavior extends ModelBehavior {
}
return true;
}
/**
* Sets the parent of the given node
*
@ -858,6 +878,7 @@ class TreeBehavior extends ModelBehavior {
}
return true;
}
/**
* get the maximum index value in the table.
*
@ -885,6 +906,7 @@ class TreeBehavior extends ModelBehavior {
)));
return (empty($edge[$right])) ? 0 : $edge[$right];
}
/**
* get the minimum index value in the table.
*
@ -904,6 +926,7 @@ class TreeBehavior extends ModelBehavior {
)));
return (empty($edge[$left])) ? 0 : $edge[$left];
}
/**
* Table sync method.
*

Some files were not shown because too many files have changed in this diff Show more