Permalink
Browse files

Merge branch '1.3' into 1.3-bake

  • Loading branch information...
2 parents 737740d + cfb4602 commit e9afb63d1933f3d76c26f598b608c63dcf5f0c2d @markstory markstory committed Jul 25, 2009
Showing with 2,676 additions and 271 deletions.
  1. +1 −1 app/webroot/test.php
  2. +51 −13 cake/basics.php
  3. +35 −0 cake/config/paths.php
  4. +2 −0 cake/config/unicode/casefolding/0080_00ff.php
  5. +2 −0 cake/config/unicode/casefolding/0100_017f.php
  6. +2 −0 cake/config/unicode/casefolding/0180_024F.php
  7. +2 −0 cake/config/unicode/casefolding/0250_02af.php
  8. +2 −0 cake/config/unicode/casefolding/0370_03ff.php
  9. +2 −0 cake/config/unicode/casefolding/0400_04ff.php
  10. +2 −0 cake/config/unicode/casefolding/0500_052f.php
  11. +2 −0 cake/config/unicode/casefolding/0530_058f.php
  12. +2 −0 cake/config/unicode/casefolding/1e00_1eff.php
  13. +2 −0 cake/config/unicode/casefolding/1f00_1fff.php
  14. +2 −0 cake/config/unicode/casefolding/2100_214f.php
  15. +2 −0 cake/config/unicode/casefolding/2150_218f.php
  16. +2 −0 cake/config/unicode/casefolding/2460_24ff.php
  17. +2 −0 cake/config/unicode/casefolding/2c00_2c5f.php
  18. +2 −0 cake/config/unicode/casefolding/2c60_2c7f.php
  19. +2 −0 cake/config/unicode/casefolding/2c80_2cff.php
  20. +2 −0 cake/config/unicode/casefolding/ff00_ffef.php
  21. +0 −2 cake/console/cake
  22. +47 −2 cake/console/cake.php
  23. +22 −0 cake/console/error.php
  24. +21 −0 cake/console/libs/acl.php
  25. +6 −2 cake/console/libs/api.php
  26. +5 −0 cake/console/libs/bake.php
  27. +11 −2 cake/console/libs/console.php
  28. +8 −0 cake/console/libs/i18n.php
  29. +16 −2 cake/console/libs/schema.php
  30. +52 −9 cake/console/libs/shell.php
  31. +18 −0 cake/console/libs/tasks/controller.php
  32. +10 −0 cake/console/libs/tasks/db_config.php
  33. +26 −0 cake/console/libs/tasks/extract.php
  34. +19 −1 cake/console/libs/tasks/fixture.php
  35. +44 −10 cake/console/libs/tasks/model.php
  36. +8 −0 cake/console/libs/tasks/plugin.php
  37. +10 −0 cake/console/libs/tasks/project.php
  38. +8 −0 cake/console/libs/tasks/template.php
  39. +25 −1 cake/console/libs/tasks/test.php
  40. +20 −0 cake/console/libs/tasks/view.php
  41. +1 −1 cake/console/libs/templates/default/actions/controller_actions.ctp
  42. +1 −1 cake/console/libs/templates/default/classes/model.ctp
  43. +1 −1 cake/console/libs/templates/default/classes/test.ctp
  44. +2 −1 cake/console/libs/templates/default/views/form.ctp
  45. +1 −1 cake/console/libs/templates/default/views/home.ctp
  46. +2 −1 cake/console/libs/templates/default/views/index.ctp
  47. +1 −0 cake/console/libs/templates/default/views/view.ctp
  48. +2 −0 cake/console/libs/templates/skel/app_controller.php
  49. +2 −0 cake/console/libs/templates/skel/app_helper.php
  50. +1 −1 cake/console/libs/templates/skel/config/acl.ini.php
  51. +3 −0 cake/console/libs/templates/skel/config/bootstrap.php
  52. +20 −0 cake/console/libs/templates/skel/config/core.php
  53. +7 −0 cake/console/libs/templates/skel/config/inflections.php
  54. +3 −0 cake/console/libs/templates/skel/config/routes.php
  55. +3 −0 cake/console/libs/templates/skel/config/sql/db_acl.php
  56. +3 −0 cake/console/libs/templates/skel/config/sql/i18n.php
  57. +3 −0 cake/console/libs/templates/skel/config/sql/sessions.php
  58. +6 −0 cake/console/libs/templates/skel/controllers/pages_controller.php
  59. +1 −0 cake/console/libs/templates/skel/index.php
  60. +1 −0 cake/console/libs/templates/skel/views/elements/email/html/default.ctp
  61. +1 −0 cake/console/libs/templates/skel/views/elements/email/text/default.ctp
  62. +1 −0 cake/console/libs/templates/skel/views/layouts/ajax.ctp
  63. +1 −0 cake/console/libs/templates/skel/views/layouts/default.ctp
  64. +2 −1 cake/console/libs/templates/skel/views/layouts/email/html/default.ctp
  65. +1 −1 cake/console/libs/templates/skel/views/layouts/email/text/default.ctp
  66. +1 −0 cake/console/libs/templates/skel/views/layouts/flash.ctp
  67. +4 −0 cake/console/libs/templates/skel/webroot/css.php
  68. +5 −0 cake/console/libs/templates/skel/webroot/index.php
  69. +2 −0 cake/console/libs/templates/skel/webroot/js/vendors.php
  70. +7 −1 cake/console/libs/templates/skel/webroot/test.php
  71. +17 −1 cake/console/libs/testsuite.php
  72. +23 −2 cake/dispatcher.php
  73. +28 −1 cake/libs/cache.php
  74. +7 −0 cake/libs/cache/apc.php
  75. +14 −0 cake/libs/cache/file.php
  76. +11 −1 cake/libs/cache/memcache.php
  77. +9 −0 cake/libs/cache/xcache.php
  78. +5 −0 cake/libs/cake_log.php
  79. +42 −2 cake/libs/cake_session.php
  80. +31 −2 cake/libs/cake_socket.php
  81. +21 −3 cake/libs/class_registry.php
  82. +90 −71 cake/libs/configure.php
  83. +2 −0 cake/libs/controller/app_controller.php
  84. +13 −0 cake/libs/controller/component.php
  85. +33 −0 cake/libs/controller/components/acl.php
  86. +41 −0 cake/libs/controller/components/auth.php
  87. +27 −0 cake/libs/controller/components/cookie.php
  88. +58 −7 cake/libs/controller/components/email.php
  89. +40 −2 cake/libs/controller/components/request_handler.php
  90. +40 −0 cake/libs/controller/components/security.php
  91. +21 −0 cake/libs/controller/components/session.php
  92. +58 −0 cake/libs/controller/controller.php
  93. +6 −0 cake/libs/controller/pages_controller.php
  94. +26 −0 cake/libs/controller/scaffold.php
  95. +4 −2 cake/libs/debugger.php
  96. +23 −0 cake/libs/error.php
  97. +36 −0 cake/libs/file.php
  98. +42 −0 cake/libs/folder.php
  99. +39 −3 cake/libs/http_socket.php
  100. +24 −4 cake/libs/i18n.php
  101. +2 −0 cake/libs/inflector.php
  102. +17 −0 cake/libs/l10n.php
  103. +10 −0 cake/libs/magic_db.php
  104. +2 −0 cake/libs/model/app_model.php
  105. +7 −0 cake/libs/model/behaviors/acl.php
  106. +13 −1 cake/libs/model/behaviors/containable.php
  107. +15 −0 cake/libs/model/behaviors/translate.php
  108. +26 −3 cake/libs/model/behaviors/tree.php
  109. +19 −1 cake/libs/model/cake_schema.php
  110. +15 −1 cake/libs/model/connection_manager.php
  111. +45 −0 cake/libs/model/datasources/datasource.php
  112. +27 −0 cake/libs/model/datasources/dbo/dbo_adodb.php
  113. +28 −0 cake/libs/model/datasources/dbo/dbo_db2.php
  114. +30 −0 cake/libs/model/datasources/dbo/dbo_firebird.php
  115. +35 −0 cake/libs/model/datasources/dbo/dbo_mssql.php
  116. +38 −4 cake/libs/model/datasources/dbo/dbo_mysql.php
  117. +23 −2 cake/libs/model/datasources/dbo/dbo_mysqli.php
  118. +19 −0 cake/libs/model/datasources/dbo/dbo_odbc.php
  119. +50 −3 cake/libs/model/datasources/dbo/dbo_oracle.php
  120. +41 −8 cake/libs/model/datasources/dbo/dbo_postgres.php
  121. +32 −1 cake/libs/model/datasources/dbo/dbo_sqlite.php
  122. +23 −0 cake/libs/model/datasources/dbo/dbo_sybase.php
  123. +85 −9 cake/libs/model/datasources/dbo_source.php
  124. +23 −0 cake/libs/model/db_acl.php
  125. +121 −16 cake/libs/model/model.php
  126. +31 −0 cake/libs/model/model_behavior.php
  127. +39 −1 cake/libs/multibyte.php
  128. +14 −0 cake/libs/object.php
  129. +2 −0 cake/libs/overloadable.php
  130. +9 −0 cake/libs/overloadable_php4.php
  131. +8 −0 cake/libs/overloadable_php5.php
  132. +50 −5 cake/libs/router.php
  133. +13 −1 cake/libs/sanitize.php
  134. +10 −0 cake/libs/security.php
  135. +27 −0 cake/libs/set.php
  136. +6 −0 cake/libs/string.php
  137. +45 −1 cake/libs/validation.php
  138. +1 −0 cake/libs/view/elements/dump.ctp
  139. +1 −0 cake/libs/view/elements/email/html/default.ctp
  140. +1 −0 cake/libs/view/elements/email/text/default.ctp
  141. +1 −0 cake/libs/view/errors/error404.ctp
  142. +1 −0 cake/libs/view/errors/missing_action.ctp
  143. +1 −0 cake/libs/view/errors/missing_component_class.ctp
  144. +1 −0 cake/libs/view/errors/missing_component_file.ctp
  145. +1 −0 cake/libs/view/errors/missing_connection.ctp
  146. +1 −0 cake/libs/view/errors/missing_controller.ctp
  147. +1 −0 cake/libs/view/errors/missing_helper_class.ctp
  148. +2 −1 cake/libs/view/errors/missing_helper_file.ctp
  149. +1 −0 cake/libs/view/errors/missing_layout.ctp
  150. +1 −0 cake/libs/view/errors/missing_model.ctp
  151. +1 −0 cake/libs/view/errors/missing_scaffolddb.ctp
  152. +1 −0 cake/libs/view/errors/missing_table.ctp
  153. +1 −0 cake/libs/view/errors/missing_view.ctp
  154. +1 −0 cake/libs/view/errors/private_action.ctp
  155. +1 −0 cake/libs/view/errors/scaffold_error.ctp
  156. +40 −0 cake/libs/view/helper.php
  157. +41 −4 cake/libs/view/helpers/ajax.php
  158. +2 −0 cake/libs/view/helpers/app_helper.php
  159. +10 −0 cake/libs/view/helpers/cache.php
  160. +41 −4 cake/libs/view/helpers/form.php
  161. +36 −4 cake/libs/view/helpers/html.php
  162. +56 −45 cake/libs/view/helpers/javascript.php
  163. +7 −0 cake/libs/view/helpers/js.php
  164. +7 −0 cake/libs/view/helpers/number.php
Sorry, we could not display the entire diff because too many files (471) changed.
View
2 app/webroot/test.php
@@ -86,7 +86,7 @@
trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
}
-$corePath = Configure::corePaths('cake');
+$corePath = App::core('cake');
if (isset($corePath[0])) {
define('TEST_CAKE_CORE_INCLUDE_PATH', rtrim($corePath[0], DS) . DS);
} else {
View
64 cake/basics.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Basic Cake functionality.
*
@@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* Basic defines for timing functions.
*/
@@ -34,6 +36,7 @@
define('WEEK', 7 * DAY);
define('MONTH', 30 * DAY);
define('YEAR', 365 * DAY);
+
/**
* Patch for PHP < 5.0
*/
@@ -46,6 +49,7 @@ function clone($object)
}');
}
}
+
/**
* Loads configuration files. Receives a set of configuration files
* to load.
@@ -75,6 +79,7 @@ function config() {
}
return true;
}
+
/**
* Loads component/components from LIBS. Takes optional number of parameters.
*
@@ -91,6 +96,7 @@ function uses() {
require_once(LIBS . strtolower($file) . '.php');
}
}
+
/**
* Prints out debug information about given variable.
*
@@ -118,6 +124,7 @@ function debug($var = false, $showHtml = false, $showFrom = true) {
}
}
if (!function_exists('getMicrotime')) {
+
/**
* Returns microtime for execution time checking
*
@@ -129,6 +136,7 @@ function getMicrotime() {
}
}
if (!function_exists('sortByKey')) {
+
/**
* Sorts given $array by key $sortby.
*
@@ -160,6 +168,7 @@ function sortByKey(&$array, $sortby, $order = 'asc', $type = SORT_NUMERIC) {
}
}
if (!function_exists('array_combine')) {
+
/**
* Combines given identical arrays by using the first array's values as keys,
* and the second one's values as values. (Implemented for backwards compatibility with PHP4)
@@ -188,6 +197,7 @@ function array_combine($a1, $a2) {
return $output;
}
}
+
/**
* Convenience method for htmlspecialchars.
*
@@ -208,6 +218,7 @@ function h($text, $charset = null) {
}
return htmlspecialchars($text, ENT_QUOTES, $charset);
}
+
/**
* Returns an array of all the given parameters.
*
@@ -228,6 +239,7 @@ function a() {
$args = func_get_args();
return $args;
}
+
/**
* Constructs associative array from pairs of arguments.
*
@@ -257,6 +269,7 @@ function aa() {
}
return $a;
}
+
/**
* Convenience method for echo().
*
@@ -266,6 +279,7 @@ function aa() {
function e($text) {
echo $text;
}
+
/**
* Convenience method for strtolower().
*
@@ -276,6 +290,7 @@ function e($text) {
function low($str) {
return strtolower($str);
}
+
/**
* Convenience method for strtoupper().
*
@@ -286,6 +301,7 @@ function low($str) {
function up($str) {
return strtoupper($str);
}
+
/**
* Convenience method for str_replace().
*
@@ -298,6 +314,7 @@ function up($str) {
function r($search, $replace, $subject) {
return str_replace($search, $replace, $subject);
}
+
/**
* Print_r convenience function, which prints out <PRE> tags around
* the output of given array. Similar to debug().
@@ -314,6 +331,7 @@ function pr($var) {
echo '</pre>';
}
}
+
/**
* Display parameters.
*
@@ -329,6 +347,7 @@ function params($p) {
}
return $p;
}
+
/**
* Merge a group of arrays
*
@@ -350,6 +369,7 @@ function am() {
}
return $r;
}
+
/**
* Gets an environment variable from available sources, and provides emulation
* for unsupported or inconsistent environment variables (i.e. DOCUMENT_ROOT on
@@ -362,8 +382,8 @@ function am() {
*/
function env($key) {
if ($key == 'HTTPS') {
- if (isset($_SERVER) && !empty($_SERVER)) {
- return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on');
+ if (isset($_SERVER['HTTPS'])) {
+ return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off');
}
return (strpos(env('SCRIPT_URI'), 'https://') === 0);
}
@@ -426,6 +446,7 @@ function env($key) {
return null;
}
if (!function_exists('file_put_contents')) {
+
/**
* Writes data into file.
*
@@ -453,6 +474,7 @@ function file_put_contents($fileName, $data) {
return false;
}
}
+
/**
* Reads/writes temporary data to cache files or session.
*
@@ -504,6 +526,7 @@ function cache($path, $data = null, $expires = '+1 day', $target = 'cache') {
}
return $data;
}
+
/**
* Used to delete files in the cache directories, or clear contents of cache directories
*
@@ -566,6 +589,7 @@ function clearCache($params = null, $type = 'views', $ext = '.php') {
}
return false;
}
+
/**
* Recursively strips slashes from all values in an array
*
@@ -583,6 +607,7 @@ function stripslashes_deep($values) {
}
return $values;
}
+
/**
* Returns a translated string if one is found; Otherwise, the submitted message.
*
@@ -605,6 +630,7 @@ function __($singular, $return = false) {
return I18n::translate($singular);
}
}
+
/**
* Returns correct plural form of message identified by $singular and $plural for count $count.
* Some languages have more than one form for plural messages dependent on the count.
@@ -624,11 +650,12 @@ function __n($singular, $plural, $count, $return = false) {
}
if ($return === false) {
- echo I18n::translate($singular, $plural, null, 5, $count);
+ echo I18n::translate($singular, $plural, null, 6, $count);
} else {
- return I18n::translate($singular, $plural, null, 5, $count);
+ return I18n::translate($singular, $plural, null, 6, $count);
}
}
+
/**
* Allows you to override the current domain for a single message lookup.
*
@@ -651,6 +678,7 @@ function __d($domain, $msg, $return = false) {
return I18n::translate($msg, null, $domain);
}
}
+
/**
* Allows you to override the current domain for a single plural message lookup.
* Returns correct plural form of message identified by $singular and $plural for count $count
@@ -672,11 +700,12 @@ function __dn($domain, $singular, $plural, $count, $return = false) {
}
if ($return === false) {
- echo I18n::translate($singular, $plural, $domain, 5, $count);
+ echo I18n::translate($singular, $plural, $domain, 6, $count);
} else {
- return I18n::translate($singular, $plural, $domain, 5, $count);
+ return I18n::translate($singular, $plural, $domain, 6, $count);
}
}
+
/**
* Allows you to override the current domain for a single message lookup.
* It also allows you to specify a category.
@@ -713,6 +742,7 @@ function __dc($domain, $msg, $category, $return = false) {
return I18n::translate($msg, null, $domain, $category);
}
}
+
/**
* Allows you to override the current domain for a single plural message lookup.
* It also allows you to specify a category.
@@ -723,13 +753,13 @@ function __dc($domain, $msg, $category, $return = false) {
* Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.
*
* Note that the category must be specified with a numeric value, instead of the constant name. The values are:
- * LC_CTYPE 0
- * LC_NUMERIC 1
- * LC_TIME 2
- * LC_COLLATE 3
- * LC_MONETARY 4
- * LC_MESSAGES 5
- * LC_ALL 6
+ * LC_ALL 0
+ * LC_COLLATE 1
+ * LC_CTYPE 2
+ * LC_MONETARY 3
+ * LC_NUMERIC 4
+ * LC_TIME 5
+ * LC_MESSAGES 6
*
* @param string $domain Domain
* @param string $singular Singular string to translate
@@ -753,6 +783,7 @@ function __dcn($domain, $singular, $plural, $count, $category, $return = false)
return I18n::translate($singular, $plural, $domain, $category, $count);
}
}
+
/**
* The category argument allows a specific category of the locale settings to be used for fetching a message.
* Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.
@@ -785,6 +816,7 @@ function __c($msg, $category, $return = false) {
return I18n::translate($msg, null, null, $category);
}
}
+
/**
* Computes the difference of arrays using keys for comparison.
*
@@ -819,6 +851,7 @@ function array_diff_key() {
return $valuesDiff;
}
}
+
/**
* Computes the intersection of arrays using keys for comparison
*
@@ -837,6 +870,7 @@ function array_intersect_key($arr1, $arr2) {
return $res;
}
}
+
/**
* Shortcut to Log::write.
*
@@ -850,6 +884,7 @@ function LogError($message) {
$good = ' ';
CakeLog::write('error', str_replace($bad, $good, $message));
}
+
/**
* Searches include path for files.
*
@@ -870,6 +905,7 @@ function fileExistsInPath($file) {
}
return false;
}
+
/**
* Convert forward slashes to underscores and removes first and last underscores in a string
*
@@ -883,6 +919,7 @@ function convertSlash($string) {
$string = str_replace('/', '_', $string);
return $string;
}
+
/**
* Implements http_build_query for PHP4.
*
@@ -922,6 +959,7 @@ function http_build_query($data, $prefix = null, $argSep = null, $baseKey = null
return implode($argSep, $out);
}
}
+
/**
* Wraps ternary operations. If $condition is a non-empty value, $val1 is returned, otherwise $val2.
* Don't use for isset() conditions, or wrap your variable with @ operator:
View
35 cake/config/paths.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Short description for file.
*
@@ -24,6 +25,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* If the index.php file is used instead of an .htaccess file
* or if the user can not set the web root to use the public
@@ -36,92 +38,112 @@
if (!defined('WEBROOT_DIR')) {
define('WEBROOT_DIR', 'webroot');
}
+
/**
* Path to the cake directory.
*/
define('CAKE', CORE_PATH.'cake'.DS);
+
/**
* Path to the application's directory.
*/
if (!defined('APP')) {
define('APP', ROOT.DS.APP_DIR.DS);
}
+
/**
* Path to the application's models directory.
*/
define('MODELS', APP.'models'.DS);
+
/**
* Path to model behaviors directory.
*/
define('BEHAVIORS', MODELS.'behaviors'.DS);
+
/**
* Path to the application's controllers directory.
*/
define('CONTROLLERS', APP.'controllers'.DS);
+
/**
* Path to the application's components directory.
*/
define('COMPONENTS', CONTROLLERS.'components'.DS);
+
/**
* Path to the application's views directory.
*/
define('VIEWS', APP.'views'.DS);
+
/**
* Path to the application's helpers directory.
*/
define('HELPERS', VIEWS.'helpers'.DS);
+
/**
* Path to the application's view's layouts directory.
*/
define('LAYOUTS', VIEWS.'layouts'.DS);
+
/**
* Path to the application's view's elements directory.
* It's supposed to hold pieces of PHP/HTML that are used on multiple pages
* and are not linked to a particular layout (like polls, footers and so on).
*/
define('ELEMENTS', VIEWS.'elements'.DS);
+
/**
* Path to the configuration files directory.
*/
if (!defined('CONFIGS')) {
define('CONFIGS', APP.'config'.DS);
}
+
/**
* Path to the libs directory.
*/
define('INFLECTIONS', CAKE.'config'.DS.'inflections'.DS);
+
/**
* Path to the libs directory.
*/
define('LIBS', CAKE.'libs'.DS);
+
/**
* Path to the public CSS directory.
*/
define('CSS', WWW_ROOT.'css'.DS);
+
/**
* Path to the public JavaScript directory.
*/
define('JS', WWW_ROOT.'js'.DS);
+
/**
* Path to the public images directory.
*/
define('IMAGES', WWW_ROOT.'img'.DS);
+
/**
* Path to the console libs direcotry.
*/
define('CONSOLE_LIBS', CAKE.'console'.DS.'libs'.DS);
+
/**
* Path to the tests directory.
*/
if (!defined('TESTS')) {
define('TESTS', APP.'tests'.DS);
}
+
/**
* Path to the core tests directory.
*/
if (!defined('CAKE_TESTS')) {
define('CAKE_TESTS', CAKE.'tests'.DS);
}
+
/**
* Path to the test suite.
*/
@@ -131,48 +153,58 @@
* Path to the controller test directory.
*/
define('CONTROLLER_TESTS', TESTS.'cases'.DS.'controllers'.DS);
+
/**
* Path to the components test directory.
*/
define('COMPONENT_TESTS', TESTS.'cases'.DS.'components'.DS);
+
/**
* Path to the helpers test directory.
*/
define('HELPER_TESTS', TESTS.'cases'.DS.'views'.DS.'helpers'.DS);
+
/**
* Path to the models' test directory.
*/
define('MODEL_TESTS', TESTS.'cases'.DS.'models'.DS);
+
/**
* Path to the lib test directory.
*/
define('LIB_TESTS', CAKE_TESTS.'cases'.DS.'lib'.DS);
+
/**
* Path to the temporary files directory.
*/
if (!defined('TMP')) {
define('TMP', APP.'tmp'.DS);
}
+
/**
* Path to the logs directory.
*/
define('LOGS', TMP.'logs'.DS);
+
/**
* Path to the cache files directory. It can be shared between hosts in a multi-server setup.
*/
define('CACHE', TMP.'cache'.DS);
+
/**
* Path to the vendors directory.
*/
if (!defined('VENDORS')) {
define('VENDORS', CAKE_CORE_INCLUDE_PATH.DS.'vendors'.DS);
}
+
/**
* Path to the Pear directory
* The purporse is to make it easy porting Pear libs into Cake
* without setting the include_path PHP variable.
*/
define('PEAR', VENDORS.'Pear'.DS);
+
/**
* Full url prefix
*/
@@ -189,18 +221,21 @@
}
unset($httpHost, $s);
}
+
/**
* Web path to the public images directory.
*/
if (!defined('IMAGES_URL')) {
define('IMAGES_URL', 'img/');
}
+
/**
* Web path to the CSS files directory.
*/
if (!defined('CSS_URL')) {
define('CSS_URL', 'css/');
}
+
/**
* Web path to the js files directory.
*/
View
2 cake/config/unicode/casefolding/0080_00ff.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/0100_017f.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/0180_024F.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/0250_02af.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/0370_03ff.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/0400_04ff.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/0500_052f.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/0530_058f.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/1e00_1eff.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/1f00_1fff.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/2100_214f.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/2150_218f.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/2460_24ff.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/2c00_2c5f.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/2c60_2c7f.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/2c80_2cff.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/config/unicode/casefolding/ff00_ffef.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Case Folding Properties.
*
@@ -28,6 +29,7 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* The upper field is the decimal value of the upper case character
*
View
2 cake/console/cake
@@ -22,8 +22,6 @@
# @license http://www.opensource.org/licenses/mit-license.php The MIT License
#
################################################################################
-clear
-
LIB=${0/%cake/}
APP=`pwd`
View
49 cake/console/cake.php
@@ -1,6 +1,7 @@
#!/usr/bin/php -q
<?php
/* SVN FILE: $Id$ */
+
/**
* Command-line code generation utility to automate programmer chores.
*
@@ -25,90 +26,103 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* Shell dispatcher
*
* @package cake
* @subpackage cake.cake.console
*/
class ShellDispatcher {
+
/**
* Standard input stream.
*
* @var filehandle
* @access public
*/
var $stdin;
+
/**
* Standard output stream.
*
* @var filehandle
* @access public
*/
var $stdout;
+
/**
* Standard error stream.
*
* @var filehandle
* @access public
*/
var $stderr;
+
/**
* Contains command switches parsed from the command line.
*
* @var array
* @access public
*/
var $params = array();
+
/**
* Contains arguments parsed from the command line.
*
* @var array
* @access public
*/
var $args = array();
+
/**
* The file name of the shell that was invoked.
*
* @var string
* @access public
*/
var $shell = null;
+
/**
* The class name of the shell that was invoked.
*
* @var string
* @access public
*/
var $shellClass = null;
+
/**
* The command called if public methods are available.
*
* @var string
* @access public
*/
var $shellCommand = null;
+
/**
* The path locations of shells.
*
* @var array
* @access public
*/
var $shellPaths = array();
+
/**
* The path to the current shell location.
*
* @var string
* @access public
*/
var $shellPath = null;
+
/**
* The name of the shell in camelized.
*
* @var string
* @access public
*/
var $shellName = null;
+
/**
* Constructs this ShellDispatcher instance.
*
@@ -117,6 +131,7 @@ class ShellDispatcher {
function ShellDispatcher($args = array()) {
$this->__construct($args);
}
+
/**
* Constructor
*
@@ -130,6 +145,7 @@ function __construct($args = array()) {
$this->__buildPaths();
$this->_stop($this->dispatch());
}
+
/**
* Defines core configuration.
*
@@ -154,6 +170,7 @@ function __initConstants() {
}
require_once(CORE_PATH . 'cake' . DS . 'basics.php');
}
+
/**
* Defines current working environment.
*
@@ -190,6 +207,7 @@ function _initEnvironment() {
$this->shiftArgs();
}
+
/**
* Builds the shell paths.
*
@@ -224,6 +242,7 @@ function __buildPaths() {
$this->shellPaths = array_values(array_unique(array_merge($paths, App::path('shells'))));
}
+
/**
* Initializes the environment and loads the Cake core.
*
@@ -259,13 +278,30 @@ function __bootstrap() {
Configure::getInstance(file_exists(CONFIGS . 'bootstrap.php'));
if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) {
- include_once CORE_PATH . 'cake' . DS . 'console' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php';
- Configure::buildPaths(array());
+ include_once CORE_PATH . 'cake' . DS . 'console' . DS . 'libs' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php';
+ App::build();
}
Configure::write('debug', 1);
return true;
}
+
+/**
+ * Clear the console
+ *
+ * @return void
+ * @access public
+ */
+ function clear() {
+ if (empty($this->params['noclear'])) {
+ if ( DS === '/') {
+ passthru('clear');
+ } else {
+ passthru('cls');
+ }
+ }
+ }
+
/**
* Dispatches a CLI request
*
@@ -382,6 +418,7 @@ function dispatch() {
$this->help();
}
}
+
/**
* Prompts the user for input, and returns it.
*
@@ -415,6 +452,7 @@ function getInput($prompt, $options = null, $default = null) {
}
return $result;
}
+
/**
* Outputs to the stdout filehandle.
*
@@ -429,6 +467,7 @@ function stdout($string, $newline = true) {
fwrite($this->stdout, $string);
}
}
+
/**
* Outputs to the stderr filehandle.
*
@@ -438,6 +477,7 @@ function stdout($string, $newline = true) {
function stderr($string) {
fwrite($this->stderr, 'Error: '. $string);
}
+
/**
* Parses command line options
*
@@ -479,6 +519,7 @@ function parseParams($params) {
$this->params = array_merge($this->params, $params);
}
+
/**
* Helper for recursively paraing params
*
@@ -510,6 +551,7 @@ function __parseParams($params) {
}
}
}
+
/**
* Removes first argument and shifts other arguments up
*
@@ -524,12 +566,14 @@ function shiftArgs() {
$this->args = array_values($this->args);
return true;
}
+
/**
* Shows console help
*
* @access public
*/
function help() {
+ $this->clear();
$this->stdout("\nWelcome to CakePHP v" . Configure::version() . " Console");
$this->stdout("---------------------------------------------------------------");
$this->stdout("Current Paths:");
@@ -570,6 +614,7 @@ function help() {
$this->stdout("To get help on a specific command, type 'cake shell_name help'");
$this->_stop();
}
+
/**
* Stop execution of the current script
*
View
22 cake/console/error.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* ErrorHandler for Console Shells
*
@@ -24,27 +25,31 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**
* Error Handler for Cake console.
*
* @package cake
* @subpackage cake.cake.console
*/
class ErrorHandler extends Object {
+
/**
* Standard output stream.
*
* @var filehandle
* @access public
*/
var $stdout;
+
/**
* Standard error stream.
*
* @var filehandle
* @access public
*/
var $stderr;
+
/**
* Class constructor.
*
@@ -60,6 +65,7 @@ function __construct($method, $messages) {
call_user_func_array(array(&$this, 'error404'), $messages);
}
}
+
/**
* Displays an error page (e.g. 404 Not found).
*
@@ -71,6 +77,7 @@ function error($params) {
$this->stderr($code . $name . $message."\n");
$this->_stop();
}
+
/**
* Convenience method to display a 404 page.
*
@@ -84,6 +91,7 @@ function error404($params) {
'message' => sprintf(__("The requested address %s was not found on this server.", true), $url, $message)));
$this->_stop();
}
+
/**
* Renders the Missing Controller web page.
*
@@ -96,6 +104,7 @@ function missingController($params) {
$this->stderr(sprintf(__("Missing Controller '%s'", true), $controllerName));
$this->_stop();
}
+
/**
* Renders the Missing Action web page.
*
@@ -107,6 +116,7 @@ function missingAction($params) {
$this->stderr(sprintf(__("Missing Method '%s' in '%s'", true), $action, $className));
$this->_stop();
}
+
/**
* Renders the Private Action web page.
*
@@ -118,6 +128,7 @@ function privateAction($params) {
$this->stderr(sprintf(__("Trying to access private method '%s' in '%s'", true), $action, $className));
$this->_stop();
}
+
/**
* Renders the Missing Table web page.
*
@@ -129,6 +140,7 @@ function missingTable($params) {
$this->stderr(sprintf(__("Missing database table '%s' for model '%s'", true), $table, $className));
$this->_stop();
}
+
/**
* Renders the Missing Database web page.
*
@@ -139,6 +151,7 @@ function missingDatabase($params = array()) {
$this->stderr(__("Missing Database", true));
$this->_stop();
}
+
/**
* Renders the Missing View web page.
*
@@ -150,6 +163,7 @@ function missingView($params) {
$this->stderr(sprintf(__("Missing View '%s' for '%s' in '%s'", true), $file, $action, $className));
$this->_stop();
}
+
/**
* Renders the Missing Layout web page.
*
@@ -161,6 +175,7 @@ function missingLayout($params) {
$this->stderr(sprintf(__("Missing Layout '%s'", true), $file));
$this->_stop();
}
+
/**
* Renders the Database Connection web page.
*
@@ -172,6 +187,7 @@ function missingConnection($params) {
$this->stderr(__("Missing Database Connection. Try 'cake bake'", true));
$this->_stop();
}
+
/**
* Renders the Missing Helper file web page.
*
@@ -183,6 +199,7 @@ function missingHelperFile($params) {
$this->stderr(sprintf(__("Missing Helper file '%s' for '%s'", true), $file, Inflector::camelize($helper)));
$this->_stop();
}
+
/**
* Renders the Missing Helper class web page.
*
@@ -194,6 +211,7 @@ function missingHelperClass($params) {
$this->stderr(sprintf(__("Missing Helper class '%s' in '%s'", true), Inflector::camelize($helper), $file));
$this->_stop();
}
+
/**
* Renders the Missing Component file web page.
*
@@ -205,6 +223,7 @@ function missingComponentFile($params) {
$this->stderr(sprintf(__("Missing Component file '%s' for '%s'", true), $file, Inflector::camelize($component)));
$this->_stop();
}
+
/**
* Renders the Missing Component class web page.
*
@@ -216,6 +235,7 @@ function missingComponentClass($params) {
$this->stderr(sprintf(__("Missing Component class '%s' in '%s'", true), Inflector::camelize($component), $file));
$this->_stop();
}
+
/**
* Renders the Missing Model class web page.
*
@@ -227,6 +247,7 @@ function missingModel($params) {
$this->stderr(sprintf(__("Missing model '%s'", true), $className));
$this->_stop();
}
+
/**
* Outputs to the stdout filehandle.
*
@@ -241,6 +262,7 @@ function stdout($string, $newline = true) {
fwrite($this->stdout, $string);
}
}
+
/**
* Outputs to the stderr filehandle.
*
View
21 cake/console/libs/acl.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* Short description for file.
*
@@ -26,41 +27,47 @@
*/
App::import('Component', 'Acl');
App::import('Model', 'DbAcl');
+
/**
* Shell for ACL management.
*
* @package cake
* @subpackage cake.cake.console.libs
*/
class AclShell extends Shell {
+
/**
* Contains instance of AclComponent
*
* @var AclComponent
* @access public
*/
var $Acl;
+
/**
* Contains arguments parsed from the command line.
*
* @var array
* @access public
*/
var $args;
+
/**
* Contains database source to use
*
* @var string
* @access public
*/
var $dataSource = 'default';
+
/**
* Contains tasks to load and instantiate
*
* @var array
* @access public
*/
var $tasks = array('DbConfig');
+
/**
* Override startup of the Shell
*
@@ -101,6 +108,7 @@ function startup() {
}
}
}
+
/**
* Override main() for help message hook
*
@@ -122,6 +130,7 @@ function main() {
$out .= __("For help, run the 'help' command. For help on a specific command, run 'help <command>'", true);
$this->out($out);
}
+
/**
* Creates an ARO/ACO node
*
@@ -179,6 +188,7 @@ function create() {
$this->err(sprintf(__("There was a problem creating a new %s '%s'.", true), $class, $this->args[2]));
}
}
+
/**
* Delete an ARO/ACO node.
*
@@ -216,6 +226,7 @@ function setParent() {
$this->out(sprintf(__("Node parent set to %s", true), $this->args[2]) . "\n", true);
}
}
+
/**
* Get path to specified ARO/ACO node.
*
@@ -234,6 +245,7 @@ function getPath() {
$this->out(str_repeat(' ', $i) . "[" . $nodes[$i][$class]['id'] . "]" . $nodes[$i][$class]['alias'] . "\n");
}
}
+
/**
* Check permission for a given ARO to a given ACO.
*
@@ -249,6 +261,7 @@ function check() {
$this->out(sprintf(__("%s is not allowed.", true), $aro), true);
}
}
+
/**
* Grant permission for a given ARO to a given ACO.
*
@@ -264,6 +277,7 @@ function grant() {
$this->out(__("Permission was not granted.", true), true);
}
}
+
/**
* Deny access for an ARO to an ACO.
*
@@ -279,6 +293,7 @@ function deny() {
$this->out(__("Permission was not denied.", true), true);
}
}
+
/**
* Set an ARO to inhermit permission to an ACO.
*
@@ -294,6 +309,7 @@ function inherit() {
$this->out(__("Permission was not inherited.", true), true);
}
}
+
/**
* Show a specific ARO/ACO node.
*
@@ -345,6 +361,7 @@ function view() {
}
$this->hr();
}
+
/**
* Initialize ACL database.
*
@@ -354,6 +371,7 @@ function initdb() {
$this->Dispatch->args = array('schema', 'run', 'create', 'DbAcl');
$this->Dispatch->dispatch();
}
+
/**
* Show help screen.
*
@@ -431,6 +449,7 @@ function help() {
$this->out(sprintf(__("Command '%s' not found", true), $this->args[0]));
}
}
+
/**
* Check that first argument specifies a valid Node type (ARO/ACO)
*
@@ -444,6 +463,7 @@ function checkNodeType() {
$this->error(sprintf(__("Missing/Unknown node type: '%s'", true), $this->args[1]), __('Please specify which ACL object type you wish to create.', true));
}
}
+
/**
* Checks that given node exists
*
@@ -465,6 +485,7 @@ function nodeExists() {
}
return $possibility;
}
+
/**
* get params for standard Acl methods
*
View
8 cake/console/libs/api.php
@@ -1,5 +1,6 @@
<?php
/* SVN FILE: $Id$ */
+
/**
* API shell to get CakePHP core method signatures.
*
@@ -32,13 +33,15 @@
* @subpackage cake.cake.console.libs
*/
class ApiShell extends Shell {
+
/**
* Map between short name for paths and real paths.
*
* @var array
* @access public
*/
var $paths = array();
+
/**
* Override intialize of the Shell
*
@@ -56,6 +59,7 @@ function initialize () {
'core' => LIBS
));
}
+
/**
* Override main() to handle action
*
@@ -66,7 +70,7 @@ function main() {
return $this->help();
}
- $type = low($this->args[0]);
+ $type = strtolower($this->args[0]);
if (isset($this->paths[$type])) {
$path = $this->paths[$type];
@@ -202,7 +206,7 @@ function __parseClass($path) {
if (strpos($method, '__') === false && $method[0] != '_') {
$parsed[$method] = array(
- 'comment' => r(array('/*', '*/', '*'), '', trim($result[1][$key])),
+ 'comment' => str_replace(array('/*', '*/', '*'), '', trim($result[1][$key])),
'method' => $method,
'parameters' => trim($result[3][$key])
);
View
5 cake/console/libs/bake.php
@@ -22,6 +22,7 @@
* @since CakePHP(tm) v 1.2.0.5012
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
+
/**