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

View file

@ -1,5 +1,6 @@
<?php <?php
/* SVN FILE: $Id$ */ /* SVN FILE: $Id$ */
/** /**
* Short description for file. * Short description for file.
* *
@ -24,6 +25,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* If the index.php file is used instead of an .htaccess file * 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 * or if the user can not set the web root to use the public
@ -36,92 +38,112 @@
if (!defined('WEBROOT_DIR')) { if (!defined('WEBROOT_DIR')) {
define('WEBROOT_DIR', 'webroot'); define('WEBROOT_DIR', 'webroot');
} }
/** /**
* Path to the cake directory. * Path to the cake directory.
*/ */
define('CAKE', CORE_PATH.'cake'.DS); define('CAKE', CORE_PATH.'cake'.DS);
/** /**
* Path to the application's directory. * Path to the application's directory.
*/ */
if (!defined('APP')) { if (!defined('APP')) {
define('APP', ROOT.DS.APP_DIR.DS); define('APP', ROOT.DS.APP_DIR.DS);
} }
/** /**
* Path to the application's models directory. * Path to the application's models directory.
*/ */
define('MODELS', APP.'models'.DS); define('MODELS', APP.'models'.DS);
/** /**
* Path to model behaviors directory. * Path to model behaviors directory.
*/ */
define('BEHAVIORS', MODELS.'behaviors'.DS); define('BEHAVIORS', MODELS.'behaviors'.DS);
/** /**
* Path to the application's controllers directory. * Path to the application's controllers directory.
*/ */
define('CONTROLLERS', APP.'controllers'.DS); define('CONTROLLERS', APP.'controllers'.DS);
/** /**
* Path to the application's components directory. * Path to the application's components directory.
*/ */
define('COMPONENTS', CONTROLLERS.'components'.DS); define('COMPONENTS', CONTROLLERS.'components'.DS);
/** /**
* Path to the application's views directory. * Path to the application's views directory.
*/ */
define('VIEWS', APP.'views'.DS); define('VIEWS', APP.'views'.DS);
/** /**
* Path to the application's helpers directory. * Path to the application's helpers directory.
*/ */
define('HELPERS', VIEWS.'helpers'.DS); define('HELPERS', VIEWS.'helpers'.DS);
/** /**
* Path to the application's view's layouts directory. * Path to the application's view's layouts directory.
*/ */
define('LAYOUTS', VIEWS.'layouts'.DS); define('LAYOUTS', VIEWS.'layouts'.DS);
/** /**
* Path to the application's view's elements directory. * Path to the application's view's elements directory.
* It's supposed to hold pieces of PHP/HTML that are used on multiple pages * 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). * and are not linked to a particular layout (like polls, footers and so on).
*/ */
define('ELEMENTS', VIEWS.'elements'.DS); define('ELEMENTS', VIEWS.'elements'.DS);
/** /**
* Path to the configuration files directory. * Path to the configuration files directory.
*/ */
if (!defined('CONFIGS')) { if (!defined('CONFIGS')) {
define('CONFIGS', APP.'config'.DS); define('CONFIGS', APP.'config'.DS);
} }
/** /**
* Path to the libs directory. * Path to the libs directory.
*/ */
define('INFLECTIONS', CAKE.'config'.DS.'inflections'.DS); define('INFLECTIONS', CAKE.'config'.DS.'inflections'.DS);
/** /**
* Path to the libs directory. * Path to the libs directory.
*/ */
define('LIBS', CAKE.'libs'.DS); define('LIBS', CAKE.'libs'.DS);
/** /**
* Path to the public CSS directory. * Path to the public CSS directory.
*/ */
define('CSS', WWW_ROOT.'css'.DS); define('CSS', WWW_ROOT.'css'.DS);
/** /**
* Path to the public JavaScript directory. * Path to the public JavaScript directory.
*/ */
define('JS', WWW_ROOT.'js'.DS); define('JS', WWW_ROOT.'js'.DS);
/** /**
* Path to the public images directory. * Path to the public images directory.
*/ */
define('IMAGES', WWW_ROOT.'img'.DS); define('IMAGES', WWW_ROOT.'img'.DS);
/** /**
* Path to the console libs direcotry. * Path to the console libs direcotry.
*/ */
define('CONSOLE_LIBS', CAKE.'console'.DS.'libs'.DS); define('CONSOLE_LIBS', CAKE.'console'.DS.'libs'.DS);
/** /**
* Path to the tests directory. * Path to the tests directory.
*/ */
if (!defined('TESTS')) { if (!defined('TESTS')) {
define('TESTS', APP.'tests'.DS); define('TESTS', APP.'tests'.DS);
} }
/** /**
* Path to the core tests directory. * Path to the core tests directory.
*/ */
if (!defined('CAKE_TESTS')) { if (!defined('CAKE_TESTS')) {
define('CAKE_TESTS', CAKE.'tests'.DS); define('CAKE_TESTS', CAKE.'tests'.DS);
} }
/** /**
* Path to the test suite. * Path to the test suite.
*/ */
@ -131,48 +153,58 @@ if (!defined('CAKE_TESTS')) {
* Path to the controller test directory. * Path to the controller test directory.
*/ */
define('CONTROLLER_TESTS', TESTS.'cases'.DS.'controllers'.DS); define('CONTROLLER_TESTS', TESTS.'cases'.DS.'controllers'.DS);
/** /**
* Path to the components test directory. * Path to the components test directory.
*/ */
define('COMPONENT_TESTS', TESTS.'cases'.DS.'components'.DS); define('COMPONENT_TESTS', TESTS.'cases'.DS.'components'.DS);
/** /**
* Path to the helpers test directory. * Path to the helpers test directory.
*/ */
define('HELPER_TESTS', TESTS.'cases'.DS.'views'.DS.'helpers'.DS); define('HELPER_TESTS', TESTS.'cases'.DS.'views'.DS.'helpers'.DS);
/** /**
* Path to the models' test directory. * Path to the models' test directory.
*/ */
define('MODEL_TESTS', TESTS.'cases'.DS.'models'.DS); define('MODEL_TESTS', TESTS.'cases'.DS.'models'.DS);
/** /**
* Path to the lib test directory. * Path to the lib test directory.
*/ */
define('LIB_TESTS', CAKE_TESTS.'cases'.DS.'lib'.DS); define('LIB_TESTS', CAKE_TESTS.'cases'.DS.'lib'.DS);
/** /**
* Path to the temporary files directory. * Path to the temporary files directory.
*/ */
if (!defined('TMP')) { if (!defined('TMP')) {
define('TMP', APP.'tmp'.DS); define('TMP', APP.'tmp'.DS);
} }
/** /**
* Path to the logs directory. * Path to the logs directory.
*/ */
define('LOGS', TMP.'logs'.DS); define('LOGS', TMP.'logs'.DS);
/** /**
* Path to the cache files directory. It can be shared between hosts in a multi-server setup. * Path to the cache files directory. It can be shared between hosts in a multi-server setup.
*/ */
define('CACHE', TMP.'cache'.DS); define('CACHE', TMP.'cache'.DS);
/** /**
* Path to the vendors directory. * Path to the vendors directory.
*/ */
if (!defined('VENDORS')) { if (!defined('VENDORS')) {
define('VENDORS', CAKE_CORE_INCLUDE_PATH.DS.'vendors'.DS); define('VENDORS', CAKE_CORE_INCLUDE_PATH.DS.'vendors'.DS);
} }
/** /**
* Path to the Pear directory * Path to the Pear directory
* The purporse is to make it easy porting Pear libs into Cake * The purporse is to make it easy porting Pear libs into Cake
* without setting the include_path PHP variable. * without setting the include_path PHP variable.
*/ */
define('PEAR', VENDORS.'Pear'.DS); define('PEAR', VENDORS.'Pear'.DS);
/** /**
* Full url prefix * Full url prefix
*/ */
@ -189,18 +221,21 @@ if (!defined('FULL_BASE_URL')) {
} }
unset($httpHost, $s); unset($httpHost, $s);
} }
/** /**
* Web path to the public images directory. * Web path to the public images directory.
*/ */
if (!defined('IMAGES_URL')) { if (!defined('IMAGES_URL')) {
define('IMAGES_URL', 'img/'); define('IMAGES_URL', 'img/');
} }
/** /**
* Web path to the CSS files directory. * Web path to the CSS files directory.
*/ */
if (!defined('CSS_URL')) { if (!defined('CSS_URL')) {
define('CSS_URL', 'css/'); define('CSS_URL', 'css/');
} }
/** /**
* Web path to the js files directory. * Web path to the js files directory.
*/ */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,6 @@
<?php <?php
/* SVN FILE: $Id$ */ /* SVN FILE: $Id$ */
/** /**
* Base class for Shells * Base class for Shells
* *
@ -24,6 +25,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* Base class for command-line utilities for automating programmer chores. * Base class for command-line utilities for automating programmer chores.
* *
@ -31,6 +33,7 @@
* @subpackage cake.cake.console.libs * @subpackage cake.cake.console.libs
*/ */
class Shell extends Object { class Shell extends Object {
/** /**
* An instance of the ShellDispatcher object that loaded this script * An instance of the ShellDispatcher object that loaded this script
* *
@ -38,6 +41,7 @@ class Shell extends Object {
* @access public * @access public
*/ */
var $Dispatch = null; var $Dispatch = null;
/** /**
* If true, the script will ask for permission to perform actions. * If true, the script will ask for permission to perform actions.
* *
@ -45,6 +49,7 @@ class Shell extends Object {
* @access public * @access public
*/ */
var $interactive = true; var $interactive = true;
/** /**
* Holds the DATABASE_CONFIG object for the app. Null if database.php could not be found, * Holds the DATABASE_CONFIG object for the app. Null if database.php could not be found,
* or the app does not exist. * or the app does not exist.
@ -53,6 +58,7 @@ class Shell extends Object {
* @access public * @access public
*/ */
var $DbConfig = null; var $DbConfig = null;
/** /**
* Contains command switches parsed from the command line. * Contains command switches parsed from the command line.
* *
@ -60,6 +66,7 @@ class Shell extends Object {
* @access public * @access public
*/ */
var $params = array(); var $params = array();
/** /**
* Contains arguments parsed from the command line. * Contains arguments parsed from the command line.
* *
@ -67,6 +74,7 @@ class Shell extends Object {
* @access public * @access public
*/ */
var $args = array(); var $args = array();
/** /**
* The file name of the shell that was invoked. * The file name of the shell that was invoked.
* *
@ -74,6 +82,7 @@ class Shell extends Object {
* @access public * @access public
*/ */
var $shell = null; var $shell = null;
/** /**
* The class name of the shell that was invoked. * The class name of the shell that was invoked.
* *
@ -81,6 +90,7 @@ class Shell extends Object {
* @access public * @access public
*/ */
var $className = null; var $className = null;
/** /**
* The command called if public methods are available. * The command called if public methods are available.
* *
@ -88,6 +98,7 @@ class Shell extends Object {
* @access public * @access public
*/ */
var $command = null; var $command = null;
/** /**
* The name of the shell in camelized. * The name of the shell in camelized.
* *
@ -95,6 +106,7 @@ class Shell extends Object {
* @access public * @access public
*/ */
var $name = null; var $name = null;
/** /**
* An alias for the shell * An alias for the shell
* *
@ -102,6 +114,7 @@ class Shell extends Object {
* @access public * @access public
*/ */
var $alias = null; var $alias = null;
/** /**
* Contains tasks to load and instantiate * Contains tasks to load and instantiate
* *
@ -109,6 +122,7 @@ class Shell extends Object {
* @access public * @access public
*/ */
var $tasks = array(); var $tasks = array();
/** /**
* Contains the loaded tasks * Contains the loaded tasks
* *
@ -116,6 +130,7 @@ class Shell extends Object {
* @access public * @access public
*/ */
var $taskNames = array(); var $taskNames = array();
/** /**
* Contains models to load and instantiate * Contains models to load and instantiate
* *
@ -123,6 +138,7 @@ class Shell extends Object {
* @access public * @access public
*/ */
var $uses = array(); var $uses = array();
/** /**
* Constructs this Shell instance. * Constructs this Shell instance.
* *
@ -159,6 +175,7 @@ class Shell extends Object {
$this->Dispatch =& $dispatch; $this->Dispatch =& $dispatch;
} }
/** /**
* Initializes the Shell * Initializes the Shell
* acts as constructor for subclasses * acts as constructor for subclasses
@ -169,6 +186,7 @@ class Shell extends Object {
function initialize() { function initialize() {
$this->_loadModels(); $this->_loadModels();
} }
/** /**
* Starts up the the Shell * Starts up the the Shell
* allows for checking and configuring prior to command or main execution * allows for checking and configuring prior to command or main execution
@ -179,6 +197,7 @@ class Shell extends Object {
function startup() { function startup() {
$this->_welcome(); $this->_welcome();
} }
/** /**
* Displays a header for the shell * Displays a header for the shell
* *
@ -191,6 +210,7 @@ class Shell extends Object {
$this->out('Path: '. $this->params['working']); $this->out('Path: '. $this->params['working']);
$this->hr(); $this->hr();
} }
/** /**
* Loads database file and constructs DATABASE_CONFIG class * Loads database file and constructs DATABASE_CONFIG class
* makes $this->DbConfig available to subclasses * makes $this->DbConfig available to subclasses
@ -207,6 +227,7 @@ class Shell extends Object {
$this->out('Run \'bake\' to create the database configuration'); $this->out('Run \'bake\' to create the database configuration');
return false; return false;
} }
/** /**
* if var $uses = true * if var $uses = true
* Loads AppModel file and constructs AppModel class * Loads AppModel file and constructs AppModel class
@ -251,6 +272,7 @@ class Shell extends Object {
} }
return false; return false;
} }
/** /**
* Loads tasks defined in var $tasks * Loads tasks defined in var $tasks
* *
@ -304,6 +326,7 @@ class Shell extends Object {
return true; return true;
} }
/** /**
* Prompts the user for input, and returns it. * Prompts the user for input, and returns it.
* *
@ -337,6 +360,7 @@ class Shell extends Object {
return $in; return $in;
} }
} }
/** /**
* Outputs to the stdout filehandle. * Outputs to the stdout filehandle.
* *
@ -354,6 +378,7 @@ class Shell extends Object {
} }
return $this->Dispatch->stdout($string, $newline); return $this->Dispatch->stdout($string, $newline);
} }
/** /**
* Outputs to the stderr filehandle. * Outputs to the stderr filehandle.
* *
@ -370,6 +395,7 @@ class Shell extends Object {
} }
return $this->Dispatch->stderr($string."\n"); return $this->Dispatch->stderr($string."\n");
} }
/** /**
* Outputs a series of minus characters to the standard output, acts as a visual separator. * 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"); $this->out("\n");
} }
} }
/** /**
* Displays a formatted error message and exits the application * Displays a formatted error message and exits the application
* *
@ -399,6 +426,7 @@ class Shell extends Object {
$this->err($out); $this->err($out);
$this->_stop(); $this->_stop();
} }
/** /**
* Will check the number args matches otherwise throw an error * 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}"); $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 * Creates a file at given path
* *
@ -449,6 +478,7 @@ class Shell extends Object {
return false; return false;
} }
} }
/** /**
* Outputs usage text on the standard output. Implement it in subclasses. * Outputs usage text on the standard output. Implement it in subclasses.
* *
@ -461,6 +491,7 @@ class Shell extends Object {
$this->Dispatch->help(); $this->Dispatch->help();
} }
} }
/** /**
* Action to create a Unit Test * Action to create a Unit Test
* *
@ -479,6 +510,7 @@ class Shell extends Object {
} }
return $result; return $result;
} }
/** /**
* Makes absolute file path easier to read * Makes absolute file path easier to read
* *
@ -491,6 +523,7 @@ class Shell extends Object {
$shortPath = str_replace('..'.DS, '', $shortPath); $shortPath = str_replace('..'.DS, '', $shortPath);
return r(DS.DS, DS, $shortPath); return r(DS.DS, DS, $shortPath);
} }
/** /**
* Creates the proper controller path for the specified controller class name * Creates the proper controller path for the specified controller class name
* *
@ -501,6 +534,7 @@ class Shell extends Object {
function _controllerPath($name) { function _controllerPath($name) {
return low(Inflector::underscore($name)); return low(Inflector::underscore($name));
} }
/** /**
* Creates the proper controller plural name for the specified controller class name * Creates the proper controller plural name for the specified controller class name
* *
@ -511,6 +545,7 @@ class Shell extends Object {
function _controllerName($name) { function _controllerName($name) {
return Inflector::pluralize(Inflector::camelize($name)); return Inflector::pluralize(Inflector::camelize($name));
} }
/** /**
* Creates the proper controller camelized name (singularized) for the specified name * Creates the proper controller camelized name (singularized) for the specified name
* *
@ -521,6 +556,7 @@ class Shell extends Object {
function _modelName($name) { function _modelName($name) {
return Inflector::camelize(Inflector::singularize($name)); return Inflector::camelize(Inflector::singularize($name));
} }
/** /**
* Creates the proper singular model key for associations * Creates the proper singular model key for associations
* *
@ -531,6 +567,7 @@ class Shell extends Object {
function _modelKey($name) { function _modelKey($name) {
return Inflector::underscore(Inflector::singularize($name)).'_id'; return Inflector::underscore(Inflector::singularize($name)).'_id';
} }
/** /**
* Creates the proper model name from a foreign key * Creates the proper model name from a foreign key
* *
@ -542,6 +579,7 @@ class Shell extends Object {
$name = str_replace('_id', '',$key); $name = str_replace('_id', '',$key);
return Inflector::camelize($name); return Inflector::camelize($name);
} }
/** /**
* creates the singular name for use in views. * creates the singular name for use in views.
* *
@ -552,6 +590,7 @@ class Shell extends Object {
function _singularName($name) { function _singularName($name) {
return Inflector::variable(Inflector::singularize($name)); return Inflector::variable(Inflector::singularize($name));
} }
/** /**
* Creates the plural name for views * Creates the plural name for views
* *
@ -562,6 +601,7 @@ class Shell extends Object {
function _pluralName($name) { function _pluralName($name) {
return Inflector::variable(Inflector::pluralize($name)); return Inflector::variable(Inflector::pluralize($name));
} }
/** /**
* Creates the singular human name used in views * Creates the singular human name used in views
* *
@ -572,6 +612,7 @@ class Shell extends Object {
function _singularHumanName($name) { function _singularHumanName($name) {
return Inflector::humanize(Inflector::underscore(Inflector::singularize($name))); return Inflector::humanize(Inflector::underscore(Inflector::singularize($name)));
} }
/** /**
* Creates the plural human name used in views * Creates the plural human name used in views
* *
@ -582,6 +623,7 @@ class Shell extends Object {
function _pluralHumanName($name) { function _pluralHumanName($name) {
return Inflector::humanize(Inflector::underscore(Inflector::pluralize($name))); return Inflector::humanize(Inflector::underscore(Inflector::pluralize($name)));
} }
/** /**
* Find the correct path for a plugin. Scans $pluginPaths for the plugin you want. * 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 * @since CakePHP(tm) v 1.2
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* Task class for creating and updating controller files. * Task class for creating and updating controller files.
* *
@ -27,6 +28,7 @@
* @subpackage cake.cake.console.libs.tasks * @subpackage cake.cake.console.libs.tasks
*/ */
class ControllerTask extends Shell { class ControllerTask extends Shell {
/** /**
* Name of plugin * Name of plugin
* *
@ -34,6 +36,7 @@ class ControllerTask extends Shell {
* @access public * @access public
*/ */
var $plugin = null; var $plugin = null;
/** /**
* Tasks to be loaded by this Task * Tasks to be loaded by this Task
* *
@ -41,6 +44,7 @@ class ControllerTask extends Shell {
* @access public * @access public
*/ */
var $tasks = array('Model', 'Test', 'Template', 'DbConfig', 'Project'); var $tasks = array('Model', 'Test', 'Template', 'DbConfig', 'Project');
/** /**
* path to CONTROLLERS directory * path to CONTROLLERS directory
* *
@ -48,6 +52,7 @@ class ControllerTask extends Shell {
* @access public * @access public
*/ */
var $path = CONTROLLERS; var $path = CONTROLLERS;
/** /**
* Override initialize * Override initialize
* *
@ -55,6 +60,7 @@ class ControllerTask extends Shell {
*/ */
function initialize() { function initialize() {
} }
/** /**
* Execution method always used for tasks * 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. * Bake All the controllers at once. Will only bake controllers for models that exist.
* *
@ -119,6 +126,7 @@ class ControllerTask extends Shell {
} }
} }
} }
/** /**
* Interactive * Interactive
* *
@ -202,6 +210,7 @@ class ControllerTask extends Shell {
} }
} }
} }
/** /**
* Confirm a to be baked controller with the user * Confirm a to be baked controller with the user
* *
@ -239,6 +248,7 @@ class ControllerTask extends Shell {
} }
$this->hr(); $this->hr();
} }
/** /**
* Interact with the user and ask about which methods (admin or regular they want to bake) * 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); return array($wannaBakeCrud, $wannaBakeAdminCrud);
} }
/** /**
* Bake scaffold actions * Bake scaffold actions
* *
@ -286,6 +297,7 @@ class ControllerTask extends Shell {
$actions = $this->Template->generate('actions', 'controller_actions'); $actions = $this->Template->generate('actions', 'controller_actions');
return $actions; return $actions;
} }
/** /**
* Assembles and writes a Controller file * Assembles and writes a Controller file
* *
@ -314,6 +326,7 @@ class ControllerTask extends Shell {
} }
return false; return false;
} }
/** /**
* Assembles and writes a unit test file * Assembles and writes a unit test file
* *
@ -326,6 +339,7 @@ class ControllerTask extends Shell {
$this->Test->connection = $this->connection; $this->Test->connection = $this->connection;
return $this->Test->bake('Controller', $className); return $this->Test->bake('Controller', $className);
} }
/** /**
* Interact with the user and get a list of additional helpers * 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) __("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. * Common code for property choice handling.
* *
@ -366,6 +381,7 @@ class ControllerTask extends Shell {
} }
return array_filter($property); return array_filter($property);
} }
/** /**
* Outputs and gets the list of possible controllers from database * Outputs and gets the list of possible controllers from database
* *
@ -392,6 +408,7 @@ class ControllerTask extends Shell {
} }
return $this->__tables; return $this->__tables;
} }
/** /**
* Forces the user to specify the controller he wants to bake, and returns the selected controller name. * 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; return $controllerName;
} }
/** /**
* Displays help contents * Displays help contents
* *

View file

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

View file

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

View file

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

View file

@ -21,6 +21,7 @@
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Model', 'ConnectionManager'); App::import('Model', 'ConnectionManager');
/** /**
* Task class for creating and updating model files. * Task class for creating and updating model files.
* *
@ -28,6 +29,7 @@ App::import('Model', 'ConnectionManager');
* @subpackage cake.cake.console.libs.tasks * @subpackage cake.cake.console.libs.tasks
*/ */
class ModelTask extends Shell { class ModelTask extends Shell {
/** /**
* Name of plugin * Name of plugin
* *
@ -35,6 +37,7 @@ class ModelTask extends Shell {
* @access public * @access public
*/ */
var $plugin = null; var $plugin = null;
/** /**
* Name of the db connection used. * Name of the db connection used.
* *
@ -42,6 +45,7 @@ class ModelTask extends Shell {
* @access public * @access public
*/ */
var $connection = null; var $connection = null;
/** /**
* path to MODELS directory * path to MODELS directory
* *
@ -49,6 +53,7 @@ class ModelTask extends Shell {
* @access public * @access public
*/ */
var $path = MODELS; var $path = MODELS;
/** /**
* tasks * tasks
* *
@ -56,18 +61,21 @@ class ModelTask extends Shell {
* @access public * @access public
*/ */
var $tasks = array('DbConfig', 'Fixture', 'Test', 'Template'); var $tasks = array('DbConfig', 'Fixture', 'Test', 'Template');
/** /**
* Holds tables found on connection. * Holds tables found on connection.
* *
* @var array * @var array
**/ **/
var $__tables = array(); var $__tables = array();
/** /**
* Holds validation method map. * Holds validation method map.
* *
* @var array * @var array
**/ **/
var $__validations = array(); var $__validations = array();
/** /**
* startup method * startup method
* *
@ -77,6 +85,7 @@ class ModelTask extends Shell {
App::import('Core', 'Model'); App::import('Core', 'Model');
parent::startup(); parent::startup();
} }
/** /**
* Execution method always used for tasks * Execution method always used for tasks
* *
@ -105,6 +114,7 @@ class ModelTask extends Shell {
} }
} }
} }
/** /**
* Bake all models at once. * Bake all models at once.
* *
@ -123,6 +133,7 @@ class ModelTask extends Shell {
} }
} }
} }
/** /**
* Get a model object for a class name. * Get a model object for a class name.
* *
@ -133,9 +144,10 @@ class ModelTask extends Shell {
$object = new Model(array('name' => $className, 'ds' => $this->connection)); $object = new Model(array('name' => $className, 'ds' => $this->connection));
return $object; return $object;
} }
/** /**
* Generate a key value list of options and a prompt. * Generate a key value list of options and a prompt.
* *
* @param array $options Array of options to use for the selections. indexes must start at 0 * @param array $options Array of options to use for the selections. indexes must start at 0
* @param string $prompt Prompt to use for options list. * @param string $prompt Prompt to use for options list.
* @param integer $default The default option for the given prompt. * @param integer $default The default option for the given prompt.
@ -158,6 +170,7 @@ class ModelTask extends Shell {
} }
return $choice - 1; return $choice - 1;
} }
/** /**
* Handles interactive baking * Handles interactive baking
* *
@ -250,6 +263,7 @@ class ModelTask extends Shell {
return false; return false;
} }
} }
/** /**
* Print out all the associations of a particular type * 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. * 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); return $this->in(__('What is the primaryKey?', true), null, $name);
} }
/** /**
* interact with the user to find the displayField value for a model. * 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); $choice = $this->inOptions($fieldNames, $prompt);
return $fieldNames[$choice]; return $fieldNames[$choice];
} }
/** /**
* Handles Generation and user interaction for creating validation. * Handles Generation and user interaction for creating validation.
* *
@ -325,8 +342,9 @@ class ModelTask extends Shell {
} }
return $validate; return $validate;
} }
/** /**
* Populate the __validations array * Populate the __validations array
* *
* @return void * @return void
**/ **/
@ -347,6 +365,7 @@ class ModelTask extends Shell {
$this->__validations = $choices; $this->__validations = $choices;
return $choices; return $choices;
} }
/** /**
* Does individual field validation handling. * Does individual field validation handling.
* *
@ -357,7 +376,7 @@ class ModelTask extends Shell {
function fieldValidation($fieldName, $metaData, $primaryKey = 'id') { function fieldValidation($fieldName, $metaData, $primaryKey = 'id') {
$defaultChoice = count($this->__validations); $defaultChoice = count($this->__validations);
$validate = $alreadyChosen = array(); $validate = $alreadyChosen = array();
$anotherValidator = 'y'; $anotherValidator = 'y';
while ($anotherValidator == 'y') { while ($anotherValidator == 'y') {
if ($this->interactive) { if ($this->interactive) {
@ -368,7 +387,7 @@ class ModelTask extends Shell {
$this->out(__('Please select one of the following validation options:', true)); $this->out(__('Please select one of the following validation options:', true));
$this->hr(); $this->hr();
} }
$prompt = ''; $prompt = '';
for ($i = 1; $i < $defaultChoice; $i++) { for ($i = 1; $i < $defaultChoice; $i++) {
$prompt .= $i . ' - ' . $this->__validations[$i] . "\n"; $prompt .= $i . ' - ' . $this->__validations[$i] . "\n";
@ -420,6 +439,7 @@ class ModelTask extends Shell {
} }
return $validate; return $validate;
} }
/** /**
* Handles associations * Handles associations
* *
@ -466,6 +486,7 @@ class ModelTask extends Shell {
} }
return $associations; return $associations;
} }
/** /**
* Find belongsTo relations and add them to the associations list. * Find belongsTo relations and add them to the associations list.
* *
@ -494,10 +515,11 @@ class ModelTask extends Shell {
} }
return $associations; return $associations;
} }
/** /**
* Find the hasOne and HasMany relations and add them to associations list * Find the hasOne and HasMany relations and add them to associations list
* *
* @param object $model Model instance being generated * @param object $model Model instance being generated
* @param array $associations Array of inprogress associations * @param array $associations Array of inprogress associations
* @return array $associations with hasOne and hasMany added in. * @return array $associations with hasOne and hasMany added in.
**/ **/
@ -531,15 +553,16 @@ class ModelTask extends Shell {
$associations['hasOne'][] = $assoc; $associations['hasOne'][] = $assoc;
$associations['hasMany'][] = $assoc; $associations['hasMany'][] = $assoc;
} }
} }
} }
return $associations; return $associations;
} }
/** /**
* Find the hasAndBelongsToMany relations and add them to associations list * Find the hasAndBelongsToMany relations and add them to associations list
* *
* @param object $model Model instance being generated * @param object $model Model instance being generated
* @param array $associations Array of inprogress associations * @param array $associations Array of inprogress associations
* @return array $associations with hasAndBelongsToMany added in. * @return array $associations with hasAndBelongsToMany added in.
**/ **/
@ -575,6 +598,7 @@ class ModelTask extends Shell {
} }
return $associations; return $associations;
} }
/** /**
* Interact with the user and confirm associations. * Interact with the user and confirm associations.
* *
@ -602,6 +626,7 @@ class ModelTask extends Shell {
} }
return $associations; return $associations;
} }
/** /**
* Interact with the user and generate additional non-conventional associations * Interact with the user and generate additional non-conventional associations
* *
@ -668,6 +693,7 @@ class ModelTask extends Shell {
} }
return $associations; return $associations;
} }
/** /**
* Finds all possible keys to use on custom associations. * Finds all possible keys to use on custom associations.
* *
@ -686,6 +712,7 @@ class ModelTask extends Shell {
} }
return $possible; return $possible;
} }
/** /**
* Assembles and writes a Model file. * Assembles and writes a Model file.
* *
@ -707,7 +734,7 @@ class ModelTask extends Shell {
} else { } else {
$data['name'] = $name; $data['name'] = $name;
} }
$defaults = array('associations' => array(), 'validate' => array(), 'primaryKey' => 'id', $defaults = array('associations' => array(), 'validate' => array(), 'primaryKey' => 'id',
'useTable' => null, 'useDbConfig' => 'default', 'displayField' => null); 'useTable' => null, 'useDbConfig' => 'default', 'displayField' => null);
$data = array_merge($defaults, $data); $data = array_merge($defaults, $data);
@ -724,6 +751,7 @@ class ModelTask extends Shell {
$this->createFile($filename, $out); $this->createFile($filename, $out);
return $out; return $out;
} }
/** /**
* Assembles and writes a unit test file * Assembles and writes a unit test file
* *
@ -735,6 +763,7 @@ class ModelTask extends Shell {
$this->Test->connection = $this->connection; $this->Test->connection = $this->connection;
return $this->Test->bake('Model', $className); return $this->Test->bake('Model', $className);
} }
/** /**
* outputs the a list of possible models or controllers from database * outputs the a list of possible models or controllers from database
* *
@ -755,9 +784,10 @@ class ModelTask extends Shell {
} }
return $this->__tables; return $this->__tables;
} }
/** /**
* Interact with the user to determine the table name of a particular model * Interact with the user to determine the table name of a particular model
* *
* @param string $modelName Name of the model you want a table for. * @param string $modelName Name of the model you want a table for.
* @param string $useDbConfig Name of the database config you want to get tables from. * @param string $useDbConfig Name of the database config you want to get tables from.
* @return void * @return void
@ -781,10 +811,11 @@ class ModelTask extends Shell {
} }
return $useTable; return $useTable;
} }
/** /**
* Get an Array of all the tables in the supplied connection * Get an Array of all the tables in the supplied connection
* will halt the script if no tables are found. * will halt the script if no tables are found.
* *
* @param string $useDbConfig Connection name to scan. * @param string $useDbConfig Connection name to scan.
* @return array Array of tables in the database. * @return array Array of tables in the database.
**/ **/
@ -810,6 +841,7 @@ class ModelTask extends Shell {
} }
return $tables; return $tables;
} }
/** /**
* Forces the user to specify the model he wants to bake, and returns the selected model name. * 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; return $currentModelName;
} }
/** /**
* Displays help contents * Displays help contents
* *
@ -863,6 +896,7 @@ class ModelTask extends Shell {
$this->out(""); $this->out("");
$this->_stop(); $this->_stop();
} }
/** /**
* Interact with FixtureTask to automatically bake fixtures when baking models. * Interact with FixtureTask to automatically bake fixtures when baking models.
* *

View file

@ -28,11 +28,13 @@
* @subpackage cake.cake.console.libs.tasks * @subpackage cake.cake.console.libs.tasks
*/ */
class PluginTask extends Shell { class PluginTask extends Shell {
/** /**
* Tasks * Tasks
* *
*/ */
var $tasks = array('Model', 'Controller', 'View'); var $tasks = array('Model', 'Controller', 'View');
/** /**
* path to CONTROLLERS directory * path to CONTROLLERS directory
* *
@ -40,6 +42,7 @@ class PluginTask extends Shell {
* @access public * @access public
*/ */
var $path = null; var $path = null;
/** /**
* initialize * initialize
* *
@ -48,6 +51,7 @@ class PluginTask extends Shell {
function initialize() { function initialize() {
$this->path = APP . 'plugins' . DS; $this->path = APP . 'plugins' . DS;
} }
/** /**
* Execution method always used for tasks * Execution method always used for tasks
* *
@ -94,6 +98,7 @@ class PluginTask extends Shell {
} }
} }
} }
/** /**
* Interactive interface * 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)); $this->err(sprintf(__("An error occured trying to bake: %s in %s", true), $plugin, $this->path . $pluginPath));
} }
} }
/** /**
* Bake the plugin, create directories and files * Bake the plugin, create directories and files
* *
@ -137,18 +143,18 @@ class PluginTask extends Shell {
$Folder =& new Folder($this->path . $pluginPath); $Folder =& new Folder($this->path . $pluginPath);
$directories = array( $directories = array(
'config' . DS . 'sql', 'config' . DS . 'sql',
'models' . DS . 'behaviors', 'models' . DS . 'behaviors',
'controllers' . DS . 'components', 'controllers' . DS . 'components',
'views' . DS . 'helpers', 'views' . DS . 'helpers',
'tests' . DS . 'cases' . DS . 'components', 'tests' . DS . 'cases' . DS . 'components',
'tests' . DS . 'cases' . DS . 'helpers', 'tests' . DS . 'cases' . DS . 'helpers',
'tests' . DS . 'cases' . DS . 'behaviors', 'tests' . DS . 'cases' . DS . 'behaviors',
'tests' . DS . 'cases' . DS . 'controllers', 'tests' . DS . 'cases' . DS . 'controllers',
'tests' . DS . 'cases' . DS . 'models', 'tests' . DS . 'cases' . DS . 'models',
'tests' . DS . 'groups', 'tests' . DS . 'groups',
'tests' . DS . 'fixtures', 'tests' . DS . 'fixtures',
'vendors' . DS . 'img', 'vendors' . DS . 'img',
'vendors' . DS . 'js', 'vendors' . DS . 'js',
'vendors' . DS . 'css', 'vendors' . DS . 'css',
'vendors' . DS . 'shells' 'vendors' . DS . 'shells'
); );
@ -193,6 +199,7 @@ class PluginTask extends Shell {
return true; return true;
} }
/** /**
* find and change $this->path to the user selection * find and change $this->path to the user selection
* *
@ -213,6 +220,7 @@ class PluginTask extends Shell {
} }
$this->path = $pathOptions[$choice - 1]; $this->path = $pathOptions[$choice - 1];
} }
/** /**
* Help * Help
* *

View file

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

View file

@ -18,12 +18,14 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
class TemplateTask extends Shell { class TemplateTask extends Shell {
/** /**
* variables to add to template scope * variables to add to template scope
* *
* @var array * @var array
**/ **/
var $templateVars = array(); var $templateVars = array();
/** /**
* Paths to look for templates on. * Paths to look for templates on.
* Contains a list of $theme => $path * Contains a list of $theme => $path
@ -31,6 +33,7 @@ class TemplateTask extends Shell {
* @var array * @var array
**/ **/
var $templatePaths = array(); var $templatePaths = array();
/** /**
* Initialize callback. Setup paths for the template task. * Initialize callback. Setup paths for the template task.
* *
@ -40,6 +43,7 @@ class TemplateTask extends Shell {
function initialize() { function initialize() {
$this->templatePaths = $this->_findThemes(); $this->templatePaths = $this->_findThemes();
} }
/** /**
* Find the paths to all the installed shell themes in the app. * Find the paths to all the installed shell themes in the app.
* *
@ -64,6 +68,7 @@ class TemplateTask extends Shell {
} }
return $themes; return $themes;
} }
/** /**
* Set variable values to the template scope * Set variable values to the template scope
* *
@ -92,6 +97,7 @@ class TemplateTask extends Shell {
$this->templateVars[$name] = $value; $this->templateVars[$name] = $value;
} }
} }
/** /**
* Runs the template * Runs the template
* *
@ -120,6 +126,7 @@ class TemplateTask extends Shell {
} }
return ''; return '';
} }
/** /**
* Find the theme name for the current operation. * Find the theme name for the current operation.
* If there is only one theme in $templatePaths it will be used. * If there is only one theme in $templatePaths it will be used.
@ -136,7 +143,7 @@ class TemplateTask extends Shell {
if (!empty($this->params['theme']) && isset($this->templatePaths[$this->params['theme']])) { if (!empty($this->params['theme']) && isset($this->templatePaths[$this->params['theme']])) {
return $this->templatePaths[$this->params['theme']]; return $this->templatePaths[$this->params['theme']];
} }
$this->hr(); $this->hr();
$this->out(__('You have more than one set of templates installed.', true)); $this->out(__('You have more than one set of templates installed.', true));
$this->out(__('Please choose the template set you wish to use:', true)); $this->out(__('Please choose the template set you wish to use:', true));
@ -154,6 +161,7 @@ class TemplateTask extends Shell {
$this->Dispatch->params['theme'] = $themeNames[$index - 1]; $this->Dispatch->params['theme'] = $themeNames[$index - 1];
return $indexedPaths[$index]; return $indexedPaths[$index];
} }
/** /**
* Find a template inside a directory inside a path. * 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. * 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 * @since CakePHP(tm) v 1.3
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* Task class for creating and updating test files. * Task class for creating and updating test files.
* *
@ -25,6 +26,7 @@
* @subpackage cake.cake.console.libs.tasks * @subpackage cake.cake.console.libs.tasks
*/ */
class TestTask extends Shell { class TestTask extends Shell {
/** /**
* Name of plugin * Name of plugin
* *
@ -32,6 +34,7 @@ class TestTask extends Shell {
* @access public * @access public
*/ */
var $plugin = null; var $plugin = null;
/** /**
* path to TESTS directory * path to TESTS directory
* *
@ -46,24 +49,28 @@ class TestTask extends Shell {
* @var array * @var array
**/ **/
var $tasks = array('Template'); var $tasks = array('Template');
/** /**
* class types that methods can be generated for * class types that methods can be generated for
* *
* @var array * @var array
**/ **/
var $classTypes = array('Model', 'Controller', 'Component', 'Behavior', 'Helper'); var $classTypes = array('Model', 'Controller', 'Component', 'Behavior', 'Helper');
/** /**
* Internal list of fixtures that have been added so far. * Internal list of fixtures that have been added so far.
* *
* @var string * @var string
**/ **/
var $_fixtures = array(); var $_fixtures = array();
/** /**
* Flag for interactive mode * Flag for interactive mode
* *
* @var boolean * @var boolean
**/ **/
var $interactive = false; var $interactive = false;
/** /**
* Execution method always used for tasks * Execution method always used for tasks
* *
@ -85,6 +92,7 @@ class TestTask extends Shell {
} }
} }
} }
/** /**
* Handles interactive baking * Handles interactive baking
* *
@ -110,11 +118,12 @@ class TestTask extends Shell {
$className = $this->getClassName($type); $className = $this->getClassName($type);
return $this->bake($type, $className); return $this->bake($type, $className);
} }
/** /**
* Completes final steps for generating data to create test case. * Completes final steps for generating data to create test case.
* *
* @param string $type Type of object to bake test case for ie. Model, Controller * @param string $type Type of object to bake test case for ie. Model, Controller
* @param string $className the 'cake name' for the class ie. Posts for the PostsController * @param string $className the 'cake name' for the class ie. Posts for the PostsController
* @access public * @access public
*/ */
function bake($type, $className) { function bake($type, $className) {
@ -151,6 +160,7 @@ class TestTask extends Shell {
} }
return false; return false;
} }
/** /**
* Interact with the user and get their chosen type. Can exit the script. * 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]; return $this->classTypes[$selection - 1];
} }
/** /**
* Get the user chosen Class name for the chosen type * Get the user chosen Class name for the chosen type
* *
@ -193,6 +204,7 @@ class TestTask extends Shell {
} }
return $selection; return $selection;
} }
/** /**
* Checks whether the chosen type can find its own fixtures. * Checks whether the chosen type can find its own fixtures.
* Currently only model, and controller are supported * Currently only model, and controller are supported
@ -203,6 +215,7 @@ class TestTask extends Shell {
$type = strtolower($type); $type = strtolower($type);
return ($type == 'controller' || $type == 'model'); return ($type == 'controller' || $type == 'model');
} }
/** /**
* Check if a class with the given type is loaded or can be loaded. * 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) { function isLoadableClass($type, $class) {
return App::import($type, $class); return App::import($type, $class);
} }
/** /**
* Construct an instance of the class to be tested. * Construct an instance of the class to be tested.
* So that fixtures can be detected * So that fixtures can be detected
@ -228,6 +242,7 @@ class TestTask extends Shell {
} }
return $instance; return $instance;
} }
/** /**
* Gets the real class name from the cake short form. * Gets the real class name from the cake short form.
* *
@ -239,6 +254,7 @@ class TestTask extends Shell {
} }
return $class . $type; return $class . $type;
} }
/** /**
* Get methods declared in the class given. * Get methods declared in the class given.
* No parent methods will be returned * No parent methods will be returned
@ -258,6 +274,7 @@ class TestTask extends Shell {
} }
return $out; return $out;
} }
/** /**
* Generate the list of fixtures that will be required to run this test based on * Generate the list of fixtures that will be required to run this test based on
* loaded models. * loaded models.
@ -274,6 +291,7 @@ class TestTask extends Shell {
} }
return array_values($this->_fixtures); return array_values($this->_fixtures);
} }
/** /**
* Process a model recursively and pull out all the * Process a model recursively and pull out all the
* model names converting them to fixture names. * model names converting them to fixture names.
@ -297,6 +315,7 @@ class TestTask extends Shell {
} }
} }
} }
/** /**
* Process all the models attached to a controller * Process all the models attached to a controller
* and generate a fixture list. * and generate a fixture list.
@ -314,6 +333,7 @@ class TestTask extends Shell {
$this->_processModel($subject->{$model}); $this->_processModel($subject->{$model});
} }
} }
/** /**
* Add classname to the fixture list. * Add classname to the fixture list.
* Sets the app. or plugin.plugin_name. prefix. * Sets the app. or plugin.plugin_name. prefix.
@ -331,6 +351,7 @@ class TestTask extends Shell {
$fixture = $prefix . Inflector::underscore($name); $fixture = $prefix . Inflector::underscore($name);
$this->_fixtures[$name] = $fixture; $this->_fixtures[$name] = $fixture;
} }
/** /**
* Interact with the user to get additional fixtures they want to use. * 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); $this->_fixtures = array_merge($this->_fixtures, $fixtures);
return $fixtures; return $fixtures;
} }
/** /**
* Is a mock class required for this type of test? * Is a mock class required for this type of test?
* Controllers require a mock class. * Controllers require a mock class.
@ -357,6 +379,7 @@ class TestTask extends Shell {
$type = strtolower($type); $type = strtolower($type);
return $type == 'controller'; return $type == 'controller';
} }
/** /**
* Generate a constructor code snippet for the type and classname * Generate a constructor code snippet for the type and classname
* *
@ -372,6 +395,7 @@ class TestTask extends Shell {
} }
return "new $fullClassName()\n"; return "new $fullClassName()\n";
} }
/** /**
* make the filename for the test case. resolve the suffixes for controllers * make the filename for the test case. resolve the suffixes for controllers
* and get the plugin path if needed. * 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 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
App::import('Core', 'Controller'); App::import('Core', 'Controller');
/** /**
* Task class for creating and updating view files. * Task class for creating and updating view files.
* *
@ -28,6 +29,7 @@ App::import('Core', 'Controller');
* @subpackage cake.cake.console.libs.tasks * @subpackage cake.cake.console.libs.tasks
*/ */
class ViewTask extends Shell { class ViewTask extends Shell {
/** /**
* Name of plugin * Name of plugin
* *
@ -35,6 +37,7 @@ class ViewTask extends Shell {
* @access public * @access public
*/ */
var $plugin = null; var $plugin = null;
/** /**
* Tasks to be loaded by this Task * Tasks to be loaded by this Task
* *
@ -42,6 +45,7 @@ class ViewTask extends Shell {
* @access public * @access public
*/ */
var $tasks = array('Project', 'Controller', 'DbConfig', 'Template'); var $tasks = array('Project', 'Controller', 'DbConfig', 'Template');
/** /**
* path to VIEWS directory * path to VIEWS directory
* *
@ -49,6 +53,7 @@ class ViewTask extends Shell {
* @access public * @access public
*/ */
var $path = VIEWS; var $path = VIEWS;
/** /**
* Name of the controller being used * Name of the controller being used
* *
@ -56,6 +61,7 @@ class ViewTask extends Shell {
* @access public * @access public
*/ */
var $controllerName = null; var $controllerName = null;
/** /**
* Path to controller to put views * Path to controller to put views
* *
@ -63,6 +69,7 @@ class ViewTask extends Shell {
* @access public * @access public
*/ */
var $controllerPath = null; var $controllerPath = null;
/** /**
* The template file to use * The template file to use
* *
@ -70,6 +77,7 @@ class ViewTask extends Shell {
* @access public * @access public
*/ */
var $template = null; var $template = null;
/** /**
* Actions to use for scaffolding * Actions to use for scaffolding
* *
@ -77,6 +85,7 @@ class ViewTask extends Shell {
* @access public * @access public
*/ */
var $scaffoldActions = array('index', 'view', 'add', 'edit'); var $scaffoldActions = array('index', 'view', 'add', 'edit');
/** /**
* Override initialize * Override initialize
* *
@ -84,6 +93,7 @@ class ViewTask extends Shell {
*/ */
function initialize() { function initialize() {
} }
/** /**
* Execution method always used for tasks * 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. * Get a list of actions that can / should have views baked for them.
* *
@ -177,6 +188,7 @@ class ViewTask extends Shell {
} }
return $methods; return $methods;
} }
/** /**
* Bake All views for All controllers. * Bake All views for All controllers.
* *
@ -197,6 +209,7 @@ class ViewTask extends Shell {
} }
} }
} }
/** /**
* Handles interactive baking * Handles interactive baking
* *
@ -250,6 +263,7 @@ class ViewTask extends Shell {
$this->customAction(); $this->customAction();
} }
} }
/** /**
* Loads Controller and sets variables for the template * Loads Controller and sets variables for the template
* Available template variables * Available template variables
@ -306,6 +320,7 @@ class ViewTask extends Shell {
return compact('modelClass', 'schema', 'primaryKey', 'displayField', 'singularVar', 'pluralVar', return compact('modelClass', 'schema', 'primaryKey', 'displayField', 'singularVar', 'pluralVar',
'singularHumanName', 'pluralHumanName', 'fields','associations'); 'singularHumanName', 'pluralHumanName', 'fields','associations');
} }
/** /**
* Bake a view file for each of the supplied actions * Bake a view file for each of the supplied actions
* *
@ -318,6 +333,7 @@ class ViewTask extends Shell {
$this->bake($action, $content); $this->bake($action, $content);
} }
} }
/** /**
* handle creation of baking a custom action view file * handle creation of baking a custom action view file
* *
@ -347,6 +363,7 @@ class ViewTask extends Shell {
$this->out(__('Bake Aborted.', true)); $this->out(__('Bake Aborted.', true));
} }
} }
/** /**
* Assembles and writes bakes the view file. * Assembles and writes bakes the view file.
* *
@ -366,6 +383,7 @@ class ViewTask extends Shell {
$filename = $path . $this->controllerPath . DS . Inflector::underscore($action) . '.ctp'; $filename = $path . $this->controllerPath . DS . Inflector::underscore($action) . '.ctp';
return $this->createFile($filename, $content); return $this->createFile($filename, $content);
} }
/** /**
* Builds content from template and variables * 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)); $this->err(sprintf(__('Template for %s could not be found', true), $template));
return false; return false;
} }
/** /**
* Displays help contents * Displays help contents
* *
@ -435,6 +454,7 @@ class ViewTask extends Shell {
$this->out("\tRequires that models and controllers exist."); $this->out("\tRequires that models and controllers exist.");
$this->_stop(); $this->_stop();
} }
/** /**
* Returns associations for controllers models. * Returns associations for controllers models.
* *

View file

@ -139,4 +139,4 @@
$this->flash(__('<?php echo $singularHumanName; ?> was not deleted', true), array('action' => 'index')); $this->flash(__('<?php echo $singularHumanName; ?> was not deleted', true), array('action' => 'index'));
<?php endif; ?> <?php endif; ?>
$this->redirect(array('action' => 'index')); $this->redirect(array('action' => 'index'));
} }

View file

@ -127,4 +127,4 @@ if (!empty($associations['hasAndBelongsToMany'])):
endif; endif;
?> ?>
} }
<?php echo '?>'; ?> <?php echo '?>'; ?>

View file

@ -49,7 +49,7 @@ class <?php echo $fullClassName; ?>TestCase extends CakeTestCase {
<?php foreach ($methods as $method): ?> <?php foreach ($methods as $method): ?>
function test<?php echo Inflector::classify($method); ?>() { function test<?php echo Inflector::classify($method); ?>() {
} }
<?php endforeach;?> <?php endforeach;?>

View file

@ -1,5 +1,6 @@
<?php <?php
/* SVN FILE: $Id$ */ /* SVN FILE: $Id$ */
/** /**
* *
* PHP versions 4 and 5 * PHP versions 4 and 5
@ -66,4 +67,4 @@
} }
?> ?>
</ul> </ul>
</div> </div>

View file

@ -79,4 +79,4 @@ $output .= "\t\tYou can also add some CSS styles for your pages at: %s', true),\
$output .= "\t\tAPP . 'views' . DS . 'pages' . DS . 'home.ctp.<br />', APP . 'views' . DS . 'layouts' . DS . 'default.ctp.<br />', APP . 'webroot' . DS . 'css');\n"; $output .= "\t\tAPP . 'views' . DS . 'pages' . DS . 'home.ctp.<br />', APP . 'views' . DS . 'layouts' . DS . 'default.ctp.<br />', APP . 'webroot' . DS . 'css');\n";
$output .= "?>\n"; $output .= "?>\n";
$output .= "</p>\n"; $output .= "</p>\n";
?> ?>

View file

@ -1,5 +1,6 @@
<?php <?php
/* SVN FILE: $Id$ */ /* SVN FILE: $Id$ */
/** /**
* *
* PHP versions 4 and 5 * PHP versions 4 and 5
@ -96,4 +97,4 @@ echo "<?php endforeach; ?>\n";
} }
?> ?>
</ul> </ul>
</div> </div>

View file

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

View file

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

View file

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

View file

@ -71,4 +71,4 @@ allow = aco3, aco4
[groupname-goes-here] [groupname-goes-here]
deny = aco5, aco6 deny = aco5, aco6
allow = aco7, aco8 allow = aco7, aco8

View file

@ -1,5 +1,6 @@
<?php <?php
/* SVN FILE: $Id$ */ /* SVN FILE: $Id$ */
/** /**
* Short description for file. * Short description for file.
* *
@ -24,6 +25,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @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 * 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. * 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. * 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) * This is related to Ticket #470 (https://trac.cakephp.org/ticket/470)

View file

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

View file

@ -1,5 +1,6 @@
<?php <?php
/* SVN FILE: $Id$ */ /* SVN FILE: $Id$ */
/** /**
* Custom Inflected Words. * Custom Inflected Words.
* *
@ -25,6 +26,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* This is a key => value array of regex used to match words. * This is a key => value array of regex used to match words.
* If key matches then the value is returned. * 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('/(s)tatus$/i' => '\1\2tatuses', '/^(ox)$/i' => '\1\2en', '/([m|l])ouse$/i' => '\1ice');
*/ */
$pluralRules = array(); $pluralRules = array();
/** /**
* This is a key only array of plural words that should not be inflected. * This is a key only array of plural words that should not be inflected.
* Notice the last comma * Notice the last comma
@ -39,6 +42,7 @@
* $uninflectedPlural = array('.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox'); * $uninflectedPlural = array('.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox');
*/ */
$uninflectedPlural = array(); $uninflectedPlural = array();
/** /**
* This is a key => value array of plural irregular words. * This is a key => value array of plural irregular words.
* If key matches then the value is returned. * If key matches then the value is returned.
@ -46,6 +50,7 @@
* $irregularPlural = array('atlas' => 'atlases', 'beef' => 'beefs', 'brother' => 'brothers') * $irregularPlural = array('atlas' => 'atlases', 'beef' => 'beefs', 'brother' => 'brothers')
*/ */
$irregularPlural = array(); $irregularPlural = array();
/** /**
* This is a key => value array of regex used to match words. * This is a key => value array of regex used to match words.
* If key matches then the value is returned. * 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('/(s)tatuses$/i' => '\1\2tatus', '/(matr)ices$/i' =>'\1ix','/(vert|ind)ices$/i')
*/ */
$singularRules = array(); $singularRules = array();
/** /**
* This is a key only array of singular words that should not be inflected. * 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 * You should not have to change this value below if you do change it use same format
* as the $uninflectedPlural above. * as the $uninflectedPlural above.
*/ */
$uninflectedSingular = $uninflectedPlural; $uninflectedSingular = $uninflectedPlural;
/** /**
* This is a key => value array of singular irregular words. * This is a key => value array of singular irregular words.
* Most of the time this will be a reverse of the above $irregularPlural array * Most of the time this will be a reverse of the above $irregularPlural array

View file

@ -1,5 +1,6 @@
<?php <?php
/* SVN FILE: $Id$ */ /* SVN FILE: $Id$ */
/** /**
* Short description for file. * Short description for file.
* *
@ -26,12 +27,14 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* Here, we are connecting '/' (base path) to controller called 'Pages', * Here, we are connecting '/' (base path) to controller called 'Pages',
* its action called 'display', and we pass a param to select the view file * its action called 'display', and we pass a param to select the view file
* to use (in this case, /app/views/pages/home.ctp)... * to use (in this case, /app/views/pages/home.ctp)...
*/ */
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home')); Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
/** /**
* ...and connect the rest of 'Pages' controller's urls. * ...and connect the rest of 'Pages' controller's urls.
*/ */

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,6 @@
<?php <?php
/* SVN FILE: $Id$ */ /* SVN FILE: $Id$ */
/** /**
* *
* PHP versions 4 and 5 * PHP versions 4 and 5
@ -34,4 +35,4 @@
<p>This email was sent using the <a href="http://cakephp.org">CakePHP Framework</a></p> <p>This email was sent using the <a href="http://cakephp.org">CakePHP Framework</a></p>
</body> </body>
</html> </html>

View file

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

View file

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

View file

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

View file

@ -1,5 +1,6 @@
<?php <?php
/* SVN FILE: $Id$ */ /* SVN FILE: $Id$ */
/** /**
* Short description for file. * Short description for file.
* *
@ -24,12 +25,14 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* Use the DS to separate the directories in other defines * Use the DS to separate the directories in other defines
*/ */
if (!defined('DS')) { if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR); define('DS', DIRECTORY_SEPARATOR);
} }
/** /**
* These defines should only be edited if you have cake installed in * These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed. * a directory layout other than the way it is distributed.
@ -43,6 +46,7 @@
if (!defined('ROOT')) { if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__)))); define('ROOT', dirname(dirname(dirname(__FILE__))));
} }
/** /**
* The actual directory name for the "app". * The actual directory name for the "app".
* *
@ -50,6 +54,7 @@
if (!defined('APP_DIR')) { if (!defined('APP_DIR')) {
define('APP_DIR', basename(dirname(dirname(__FILE__)))); define('APP_DIR', basename(dirname(dirname(__FILE__))));
} }
/** /**
* The absolute path to the "cake" directory, WITHOUT a trailing DS. * The absolute path to the "cake" directory, WITHOUT a trailing DS.
* *

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,5 +1,6 @@
<?php <?php
/* SVN FILE: $Id$ */ /* SVN FILE: $Id$ */
/** /**
* Access Control List factory class. * Access Control List factory class.
* *
@ -24,6 +25,7 @@
* @lastmodified $Date$ * @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License * @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/ */
/** /**
* Access Control List factory class. * Access Control List factory class.
* *
@ -33,6 +35,7 @@
* @subpackage cake.cake.libs.controller.components * @subpackage cake.cake.libs.controller.components
*/ */
class AclComponent extends Object { class AclComponent extends Object {
/** /**
* Instance of an ACL class * Instance of an ACL class
* *
@ -40,6 +43,7 @@ class AclComponent extends Object {
* @access protected * @access protected
*/ */
var $_Instance = null; var $_Instance = null;
/** /**
* Constructor. Will return an instance of the correct ACL class. * Constructor. Will return an instance of the correct ACL class.
* *
@ -59,6 +63,7 @@ class AclComponent extends Object {
$this->_Instance =& new $name(); $this->_Instance =& new $name();
$this->_Instance->initialize($this); $this->_Instance->initialize($this);
} }
/** /**
* Startup is not used * Startup is not used
* *
@ -69,6 +74,7 @@ class AclComponent extends Object {
function startup(&$controller) { function startup(&$controller) {
return true; return true;
} }
/** /**
* Empty class defintion, to be overridden in subclasses. * Empty class defintion, to be overridden in subclasses.
* *
@ -76,6 +82,7 @@ class AclComponent extends Object {
*/ */
function _initACL() { function _initACL() {
} }
/** /**
* Pass-thru function for ACL check instance. * Pass-thru function for ACL check instance.
* *
@ -88,6 +95,7 @@ class AclComponent extends Object {
function check($aro, $aco, $action = "*") { function check($aro, $aco, $action = "*") {
return $this->_Instance->check($aro, $aco, $action); return $this->_Instance->check($aro, $aco, $action);
} }
/** /**
* Pass-thru function for ACL allow instance. * Pass-thru function for ACL allow instance.
* *
@ -100,6 +108,7 @@ class AclComponent extends Object {
function allow($aro, $aco, $action = "*") { function allow($aro, $aco, $action = "*") {
return $this->_Instance->allow($aro, $aco, $action); return $this->_Instance->allow($aro, $aco, $action);
} }
/** /**
* Pass-thru function for ACL deny instance. * Pass-thru function for ACL deny instance.
* *
@ -112,6 +121,7 @@ class AclComponent extends Object {
function deny($aro, $aco, $action = "*") { function deny($aro, $aco, $action = "*") {
return $this->_Instance->deny($aro, $aco, $action); return $this->_Instance->deny($aro, $aco, $action);
} }
/** /**
* Pass-thru function for ACL inherit instance. * Pass-thru function for ACL inherit instance.
* *
@ -124,6 +134,7 @@ class AclComponent extends Object {
function inherit($aro, $aco, $action = "*") { function inherit($aro, $aco, $action = "*") {
return $this->_Instance->inherit($aro, $aco, $action); return $this->_Instance->inherit($aro, $aco, $action);
} }
/** /**
* Pass-thru function for ACL grant instance. * Pass-thru function for ACL grant instance.
* *
@ -136,6 +147,7 @@ class AclComponent extends Object {
function grant($aro, $aco, $action = "*") { function grant($aro, $aco, $action = "*") {
return $this->_Instance->grant($aro, $aco, $action); return $this->_Instance->grant($aro, $aco, $action);
} }
/** /**
* Pass-thru function for ACL grant instance. * Pass-thru function for ACL grant instance.
* *
@ -149,6 +161,7 @@ class AclComponent extends Object {
return $this->_Instance->revoke($aro, $aco, $action); return $this->_Instance->revoke($aro, $aco, $action);
} }
} }
/** /**
* Access Control List abstract class. Not to be instantiated. * Access Control List abstract class. Not to be instantiated.
* Subclasses of this class are used by AclComponent to perform ACL checks in Cake. * Subclasses of this class are used by AclComponent to perform ACL checks in Cake.
@ -158,6 +171,7 @@ class AclComponent extends Object {
* @abstract * @abstract
*/ */
class AclBase extends Object { class AclBase extends Object {
/** /**
* This class should never be instantiated, just subclassed. * This class should never be instantiated, just subclassed.
* *
@ -168,6 +182,7 @@ class AclBase extends Object {
return NULL; return NULL;
} }
} }
/** /**
* Empty method to be overridden in subclasses * Empty method to be overridden in subclasses
* *
@ -178,6 +193,7 @@ class AclBase extends Object {
*/ */
function check($aro, $aco, $action = "*") { function check($aro, $aco, $action = "*") {
} }
/** /**
* Empty method to be overridden in subclasses * Empty method to be overridden in subclasses
* *
@ -187,6 +203,7 @@ class AclBase extends Object {
function initialize(&$component) { function initialize(&$component) {
} }
} }
/** /**
* In this file you can extend the AclBase. * In this file you can extend the AclBase.
* *
@ -194,6 +211,7 @@ class AclBase extends Object {
* @subpackage cake.cake.libs.model * @subpackage cake.cake.libs.model
*/ */
class DbAcl extends AclBase { class DbAcl extends AclBase {
/** /**
* Constructor * Constructor
* *
@ -206,6 +224,7 @@ class DbAcl extends AclBase {
$this->Aro =& ClassRegistry::init(array('class' => 'Aro', 'alias' => 'Aro')); $this->Aro =& ClassRegistry::init(array('class' => 'Aro', 'alias' => 'Aro'));
$this->Aco =& ClassRegistry::init(array('class' => 'Aco', 'alias' => 'Aco')); $this->Aco =& ClassRegistry::init(array('class' => 'Aco', 'alias' => 'Aco'));
} }
/** /**
* Enter description here... * Enter description here...
* *
@ -217,6 +236,7 @@ class DbAcl extends AclBase {
$component->Aro = $this->Aro; $component->Aro = $this->Aro;
$component->Aco = $this->Aco; $component->Aco = $this->Aco;
} }
/** /**
* Checks if the given $aro has access to action $action in $aco * Checks if the given $aro has access to action $action in $aco
* *
@ -306,6 +326,7 @@ class DbAcl extends AclBase {
} }
return false; return false;
} }
/** /**
* Allow $aro to have access to action $actions in $aco * 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); return ($this->Aro->Permission->save($save) !== false);
} }
/** /**
* Deny access for $aro to action $action in $aco * Deny access for $aro to action $action in $aco
* *
@ -369,6 +391,7 @@ class DbAcl extends AclBase {
function deny($aro, $aco, $action = "*") { function deny($aro, $aco, $action = "*") {
return $this->allow($aro, $aco, $action, -1); return $this->allow($aro, $aco, $action, -1);
} }
/** /**
* Let access for $aro to action $action in $aco be inherited * Let access for $aro to action $action in $aco be inherited
* *
@ -381,6 +404,7 @@ class DbAcl extends AclBase {
function inherit($aro, $aco, $action = "*") { function inherit($aro, $aco, $action = "*") {
return $this->allow($aro, $aco, $action, 0); return $this->allow($aro, $aco, $action, 0);
} }
/** /**
* Allow $aro to have access to action $actions in $aco * Allow $aro to have access to action $actions in $aco
* *
@ -394,6 +418,7 @@ class DbAcl extends AclBase {
function grant($aro, $aco, $action = "*") { function grant($aro, $aco, $action = "*") {
return $this->allow($aro, $aco, $action); return $this->allow($aro, $aco, $action);
} }
/** /**
* Deny access for $aro to action $action in $aco * Deny access for $aro to action $action in $aco
* *
@ -407,6 +432,7 @@ class DbAcl extends AclBase {
function revoke($aro, $aco, $action = "*") { function revoke($aro, $aco, $action = "*") {
return $this->deny($aro, $aco, $action); return $this->deny($aro, $aco, $action);
} }
/** /**
* Get an array of access-control links between the given Aro and Aco * 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 * Get the keys used in an ACO
* *
@ -451,6 +478,7 @@ class DbAcl extends AclBase {
return $newKeys; return $newKeys;
} }
} }
/** /**
* In this file you can extend the AclBase. * In this file you can extend the AclBase.
* *
@ -458,6 +486,7 @@ class DbAcl extends AclBase {
* @subpackage cake.cake.libs.model.iniacl * @subpackage cake.cake.libs.model.iniacl
*/ */
class IniAcl extends AclBase { class IniAcl extends AclBase {
/** /**
* Array with configuration, parsed from ini file * Array with configuration, parsed from ini file
* *
@ -465,12 +494,14 @@ class IniAcl extends AclBase {
* @access public * @access public
*/ */
var $config = null; var $config = null;
/** /**
* The constructor must be overridden, as AclBase is abstract. * The constructor must be overridden, as AclBase is abstract.
* *
*/ */
function __construct() { function __construct() {
} }
/** /**
* Main ACL check function. Checks to see if the ARO (access request object) has access to the ACO (access control object). * 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). * 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; return false;
} }
/** /**
* Parses an INI file and returns an array that reflects the INI file's section structure. Double-quote friendly. * 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; return $iniSetting;
} }
/** /**
* Removes trailing spaces on all array elements (to prepare for searching) * 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 * @subpackage cake.cake.libs.controller.components
*/ */
class AuthComponent extends Object { class AuthComponent extends Object {
/** /**
* Maintains current user login state. * Maintains current user login state.
* *
@ -44,6 +45,7 @@ class AuthComponent extends Object {
* @access private * @access private
*/ */
var $_loggedIn = false; var $_loggedIn = false;
/** /**
* Other components utilized by AuthComponent * Other components utilized by AuthComponent
* *
@ -51,6 +53,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $components = array('Session', 'RequestHandler'); var $components = array('Session', 'RequestHandler');
/** /**
* A reference to the object used for authentication * A reference to the object used for authentication
* *
@ -58,6 +61,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $authenticate = null; var $authenticate = null;
/** /**
* The name of the component to use for Authorization or set this to * The name of the component to use for Authorization or set this to
* 'controller' will validate against Controller::isAuthorized() * 'controller' will validate against Controller::isAuthorized()
@ -70,6 +74,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $authorize = false; var $authorize = false;
/** /**
* The name of an optional view element to render when an Ajax request is made * The name of an optional view element to render when an Ajax request is made
* with an invalid or expired session * with an invalid or expired session
@ -78,6 +83,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $ajaxLogin = null; var $ajaxLogin = null;
/** /**
* The name of the model that represents users which will be authenticated. Defaults to 'User'. * 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 * @access public
*/ */
var $userModel = 'User'; var $userModel = 'User';
/** /**
* Additional query conditions to use when looking up and authenticating users, * Additional query conditions to use when looking up and authenticating users,
* i.e. array('User.is_active' => 1). * i.e. array('User.is_active' => 1).
@ -93,6 +100,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $userScope = array(); var $userScope = array();
/** /**
* Allows you to specify non-default login name and password fields used in * Allows you to specify non-default login name and password fields used in
* $userModel, i.e. array('username' => 'login_name', 'password' => 'passwd'). * $userModel, i.e. array('username' => 'login_name', 'password' => 'passwd').
@ -101,6 +109,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $fields = array('username' => 'username', 'password' => 'password'); var $fields = array('username' => 'username', 'password' => 'password');
/** /**
* The session key name where the record of the current user is stored. If * The session key name where the record of the current user is stored. If
* unspecified, it will be "Auth.{$userModel name}". * unspecified, it will be "Auth.{$userModel name}".
@ -109,6 +118,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $sessionKey = null; var $sessionKey = null;
/** /**
* If using action-based access control, this defines how the paths to action * 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 * ACO nodes is computed. If, for example, all controller nodes are nested
@ -119,6 +129,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $actionPath = null; var $actionPath = null;
/** /**
* A URL (defined as a string or array) to the controller action that handles * A URL (defined as a string or array) to the controller action that handles
* logins. * logins.
@ -127,6 +138,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $loginAction = null; var $loginAction = null;
/** /**
* Normally, if a user is redirected to the $loginAction page, the location they * 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 * were redirected from will be stored in the session so that they can be
@ -137,6 +149,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $loginRedirect = null; var $loginRedirect = null;
/** /**
* The the default action to redirect to after the user is logged out. While AuthComponent does * 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(). * 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() * @see AuthComponent::logout()
*/ */
var $logoutRedirect = null; var $logoutRedirect = null;
/** /**
* The name of model or model object, or any other object has an isAuthorized method. * 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 * @access public
*/ */
var $object = null; var $object = null;
/** /**
* Error to display when user login fails. For security purposes, only one error is used for all * 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. * login failures, so as not to expose information on why the login failed.
@ -163,6 +178,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $loginError = null; var $loginError = null;
/** /**
* Error to display when user attempts to access an object or action to which they do not have * Error to display when user attempts to access an object or action to which they do not have
* acccess. * acccess.
@ -171,6 +187,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $authError = null; var $authError = null;
/** /**
* Determines whether AuthComponent will automatically redirect and exit if login is successful. * Determines whether AuthComponent will automatically redirect and exit if login is successful.
* *
@ -178,6 +195,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $autoRedirect = true; var $autoRedirect = true;
/** /**
* Controller actions for which user validation is not required. * Controller actions for which user validation is not required.
* *
@ -186,6 +204,7 @@ class AuthComponent extends Object {
* @see AuthComponent::allow() * @see AuthComponent::allow()
*/ */
var $allowedActions = array(); var $allowedActions = array();
/** /**
* Maps actions to CRUD operations. Used for controller-based validation ($validate = 'controller'). * Maps actions to CRUD operations. Used for controller-based validation ($validate = 'controller').
* *
@ -200,6 +219,7 @@ class AuthComponent extends Object {
'view' => 'read', 'view' => 'read',
'remove' => 'delete' 'remove' => 'delete'
); );
/** /**
* Form data from Controller::$data * Form data from Controller::$data
* *
@ -207,6 +227,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $data = array(); var $data = array();
/** /**
* Parameter data from Controller::$params * Parameter data from Controller::$params
* *
@ -214,6 +235,7 @@ class AuthComponent extends Object {
* @access public * @access public
*/ */
var $params = array(); var $params = array();
/** /**
* Method list for bound controller * Method list for bound controller
* *
@ -221,6 +243,7 @@ class AuthComponent extends Object {
* @access protected * @access protected
*/ */
var $_methods = array(); var $_methods = array();
/** /**
* Initializes AuthComponent for use in the controller * Initializes AuthComponent for use in the controller
* *
@ -253,6 +276,7 @@ class AuthComponent extends Object {
Debugger::checkSessionKey(); Debugger::checkSessionKey();
} }
} }
/** /**
* Main execution method. Handles redirecting of invalid users, and processing * Main execution method. Handles redirecting of invalid users, and processing
* of login form data. * of login form data.
@ -407,6 +431,7 @@ class AuthComponent extends Object {
$controller->redirect($controller->referer(), null, true); $controller->redirect($controller->referer(), null, true);
return false; return false;
} }
/** /**
* Attempts to introspect the correct values for object properties including * Attempts to introspect the correct values for object properties including
* $userModel and $sessionKey. * $userModel and $sessionKey.
@ -437,6 +462,7 @@ class AuthComponent extends Object {
} }
return true; return true;
} }
/** /**
* Determines whether the given user is authorized to perform an action. The type of * 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 * authorization used is based on the value of AuthComponent::$authorize or the
@ -529,6 +555,7 @@ class AuthComponent extends Object {
} }
return $valid; return $valid;
} }
/** /**
* Get authorization type * Get authorization type
* *
@ -550,6 +577,7 @@ class AuthComponent extends Object {
} }
return compact('type', 'object'); return compact('type', 'object');
} }
/** /**
* Takes a list of actions in the current controller for which authentication is not required, or * Takes a list of actions in the current controller for which authentication is not required, or
* no parameters to allow all actions. * no parameters to allow all actions.
@ -571,6 +599,7 @@ class AuthComponent extends Object {
$this->allowedActions = array_merge($this->allowedActions, $args); $this->allowedActions = array_merge($this->allowedActions, $args);
} }
} }
/** /**
* Removes items from the list of allowed actions. * Removes items from the list of allowed actions.
* *
@ -591,6 +620,7 @@ class AuthComponent extends Object {
} }
$this->allowedActions = array_values($this->allowedActions); $this->allowedActions = array_values($this->allowedActions);
} }
/** /**
* Maps action names to CRUD operations. Used for controller-based authentication. * 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 * 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 * 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; return $this->_loggedIn;
} }
/** /**
* Logs a user out, and returns the login action to redirect to. * Logs a user out, and returns the login action to redirect to.
* *
@ -651,6 +683,7 @@ class AuthComponent extends Object {
$this->_loggedIn = false; $this->_loggedIn = false;
return Router::normalize($this->logoutRedirect); return Router::normalize($this->logoutRedirect);
} }
/** /**
* Get the current user from the session. * Get the current user from the session.
* *
@ -674,6 +707,7 @@ class AuthComponent extends Object {
return null; return null;
} }
} }
/** /**
* If no parameter is passed, gets the authentication redirect URL. * If no parameter is passed, gets the authentication redirect URL.
* *
@ -697,6 +731,7 @@ class AuthComponent extends Object {
} }
return Router::normalize($redir); return Router::normalize($redir);
} }
/** /**
* Validates a user against an abstract object. * Validates a user against an abstract object.
* *
@ -719,6 +754,7 @@ class AuthComponent extends Object {
} }
return $this->Acl->check($user, $object, $action); return $this->Acl->check($user, $object, $action);
} }
/** /**
* Returns the path to the ACO node bound to a controller/action. * Returns the path to the ACO node bound to a controller/action.
* *
@ -735,6 +771,7 @@ class AuthComponent extends Object {
$this->actionPath . $action $this->actionPath . $action
); );
} }
/** /**
* Returns a reference to the model object specified, and attempts * Returns a reference to the model object specified, and attempts
* to load it if it is not found. * to load it if it is not found.
@ -762,6 +799,7 @@ class AuthComponent extends Object {
return $model; return $model;
} }
/** /**
* Identifies a user based on specific criteria. * Identifies a user based on specific criteria.
* *
@ -837,6 +875,7 @@ class AuthComponent extends Object {
} }
return null; return null;
} }
/** /**
* Hash any passwords found in $data using $userModel and $fields['password'] * Hash any passwords found in $data using $userModel and $fields['password']
* *
@ -856,6 +895,7 @@ class AuthComponent extends Object {
} }
return $data; return $data;
} }
/** /**
* Hash a password with the application's salt value (as defined with Configure::write('Security.salt'); * 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) { function password($password) {
return Security::hash($password, null, true); return Security::hash($password, null, true);
} }
/** /**
* Component shutdown. If user is logged in, wipe out redirect. * Component shutdown. If user is logged in, wipe out redirect.
* *

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

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